public class Paragraph extends Component implements TextboxContainer, TextHyperlinkContainer, ControlContainer
| Modifier and Type | Method and Description |
|---|---|
void |
addComment(String content,
String creator)
Creates a comment in the front of this paragraph.
|
Textbox |
addTextbox()
Add a text box
|
Textbox |
addTextbox(FrameRectangle position)
Add a text box with a specific size at a specific position
|
TextHyperlink |
appendHyperlink(String text,
URI linkto)
Append a hyperlink at the end of the container
|
void |
appendTextContent(String content)
Append the text content at the end of this paragraph.
|
void |
appendTextContent(String content,
boolean isStyleInherited)
Append the text content at the end of this paragraph.
|
void |
appendTextContentNotCollapsed(String content)
Append the text content at the end of this paragraph.
|
void |
applyHeading()
Formats the paragraph as heading.
|
void |
applyHeading(boolean isHeading,
int level)
Sets the paragraph type, heading or body text paragraph.
|
TextHyperlink |
applyHyperlink(URI linkto)
Hyperlink support ***********
|
Control |
createDrawControl()
End of Hyperlink support ***********
|
OdfElement |
getDrawControlContainerElement()
Get the ODF element which can have DrawControlElement as child element directly.
|
Font |
getFont()
Returns the font definition for this paragraph.
|
OdfElement |
getFrameContainerElement()
Get the ODF element which can have
|
int |
getHeadingLevel()
Returns outline level of this paragraph.
|
StyleTypeDefinitions.HorizontalAlignmentType |
getHorizontalAlignment()
Return the horizontal alignment setting of this paragraph.
|
Iterator<TextHyperlink> |
getHyperlinkIterator()
Get the iterator of hyperlinks within this container element
|
static Paragraph |
getInstanceof(TextParagraphElementBase paragraphElement)
Gets a paragraph instance by an instance of
TextParagraphElementBase. |
TextParagraphElementBase |
getOdfElement()
Return the
TextParagraphElementBase of this paragraph. |
Document |
getOwnerDocument()
Get the owner document of this paragraph.
|
ParagraphStyleHandler |
getStyleHandler()
Get the style handler of this paragraph.
|
String |
getStyleName()
Get the style name of this paragraph
|
Textbox |
getTextboxByName(String name)
Return a text box whose name is a given value.
|
List<Textbox> |
getTextboxByUsage(PresentationDocument.PresentationClass usage)
This method is only useful in presentation slide.
|
Iterator<Textbox> |
getTextboxIterator()
Return an Iterator of the text objects in this container.
|
String |
getTextContent()
Return the text content of this paragraph.
|
static Paragraph |
insertNewParagraphBefore(ParagraphContainer container,
Node brother)
Create an instance of paragraph
|
boolean |
isHeading()
Returns the paragraph type, heading or body text paragraph.
|
static Paragraph |
newParagraph(ParagraphContainer container)
Create an instance of paragraph
|
void |
remove()
Remove this paragraph from its container.
|
void |
removeHyperlinks()
Remove all the hyperlinks in this container element.
|
boolean |
removeTextbox(Textbox box)
Remove the text box
|
void |
removeTextContent()
Remove the text content of this paragraph.
|
void |
setFont(Font font)
Sets font style for this paragraph.
|
void |
setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
Set the horizontal alignment setting of this paragraph.
|
void |
setStyleName(String styleName)
Set the style name of this paragraph
|
void |
setTextContent(String content)
Set the text content of this paragraph.
|
void |
setTextContentNotCollapsed(String content)
Set the text content of this paragraph.
|
getComponentByElement, registerComponent, unregisterComponentpublic static Paragraph getInstanceof(TextParagraphElementBase paragraphElement)
TextParagraphElementBase.paragraphElement - the instance of TextParagraphElementBase.public static Paragraph newParagraph(ParagraphContainer container)
The paragrah will be added at the end of this container.
container - the paragraph container that contains this paragraph.public static Paragraph insertNewParagraphBefore(ParagraphContainer container, Node brother)
The paragraph will be added before the odfelement 'brother'.
container - the paragraph container that contains this paragraph.brother - the the brother odfelement before that the new paragraph will be inserted.public void setTextContent(String content)
All the existing text content of this paragraph would be removed, and then new text content would be set. The style of the last character will be inherited.
The white space characters in the content would be collapsed by default. For example, tab
character would be replaced with
content - - the text contentsetTextContentNotCollapsed(String content)public void removeTextContent()
The other child elements except text content will not be removed.
public String getTextContent()
The other child elements except text content will not be returned.
public void setTextContentNotCollapsed(String content)
All the existing text content of this paragraph would be removed, and then new text content would be set.
The white space characters in the content would not be collapsed.
content - - the text contentsetTextContent(String content)public void appendTextContent(String content)
The white space characters in the content would be collapsed by default. For example, tab
character would be replaced with
content - - the text contentappendTextContentNotCollapsed(String content)public void appendTextContent(String content, boolean isStyleInherited)
The white space characters in the content would be collapsed by default. For example, tab
character would be replaced with
content - - the text contentisStyleInherited - - whether the style would be inherited by the appended textappendTextContentNotCollapsed(String content)public void appendTextContentNotCollapsed(String content)
The white space characters in the content would not be collapsed.
content - - the text contentappendTextContent(String content)public void setStyleName(String styleName)
styleName - - the style namepublic String getStyleName()
public Document getOwnerDocument()
getOwnerDocument in class Componentpublic void remove()
public ParagraphStyleHandler getStyleHandler()
The style handler is an instance of ParagraphStyleHandler
ParagraphStyleHandlerpublic TextParagraphElementBase getOdfElement()
TextParagraphElementBase of this paragraph. Headings and body text
paragraphs are collectively referred to as paragraph elements, so the
TextParagraphElementBase can be TextHElement element or TextPElement
element.getOdfElement in class ComponentTextParagraphElementBase of this paragraph.public void addComment(String content, String creator)
content - the content of this comment.creator - the creator of this comment, if creator is null, the value of
System.getProperty("user.name") will be used.public boolean isHeading()
true, otherwise
return false.public int getHeadingLevel()
public void applyHeading(boolean isHeading,
int level)
isHeading - if true, this paragraph would be formatted as heading, otherwise
as a body text paragraph.level - the heading outline level of this paragraph, if isHeading is
true.public void applyHeading()
public Font getFont()
null will be
returned.public void setFont(Font font)
font - the font definition of this paragraphpublic StyleTypeDefinitions.HorizontalAlignmentType getHorizontalAlignment()
Null will returned if there is no explicit style definition for this paragraph.
Default value will be returned if explicit style definition is found but no horizontal alignment is set.
public void setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
alignType - the horizontal alignment setting.public Textbox addTextbox()
TextboxContaineraddTextbox in interface TextboxContainerpublic Iterator<Textbox> getTextboxIterator()
TextboxContainergetTextboxIterator in interface TextboxContainerpublic boolean removeTextbox(Textbox box)
TextboxContainerremoveTextbox in interface TextboxContainerbox - - the instance of text boxpublic OdfElement getFrameContainerElement()
FrameContainergetFrameContainerElement in interface FrameContainerpublic Textbox addTextbox(FrameRectangle position)
TextboxContaineraddTextbox in interface TextboxContainerposition - - the rectangle (position and size) of this text boxpublic Textbox getTextboxByName(String name)
TextboxContainergetTextboxByName in interface TextboxContainername - - the name of the text boxpublic List<Textbox> getTextboxByUsage(PresentationDocument.PresentationClass usage)
TextboxContainerThis method will return a list of text boxs by the usage in presentation slides.
getTextboxByUsage in interface TextboxContainerusage - - the usage descriptionpublic TextHyperlink applyHyperlink(URI linkto)
applyHyperlink in interface TextHyperlinkContainerlinkto - the hyperlinkpublic Iterator<TextHyperlink> getHyperlinkIterator()
TextHyperlinkContainergetHyperlinkIterator in interface TextHyperlinkContainerpublic void removeHyperlinks()
TextHyperlinkContainerremoveHyperlinks in interface TextHyperlinkContainerpublic TextHyperlink appendHyperlink(String text, URI linkto)
TextHyperlinkContainerappendHyperlink in interface TextHyperlinkContainertext - - the text contentlinkto - - the URI of this hyperlinkpublic Control createDrawControl()
createDrawControl in interface ControlContainerpublic OdfElement getDrawControlContainerElement()
ControlContainergetDrawControlContainerElement in interface ControlContainerCopyright © 2010–2018 Apache Software Foundation; Copyright © 2018–2020 The Document Foundation. All rights reserved.