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.
|
boolean |
isHeading()
Returns the paragraph type, heading or body text paragraph.
|
static Paragraph |
newParagraph(ParagraphContainer container)
Create an instance of paragraph
The paragrah will be added at the end of this container.
|
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, unregisterComponent
public 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 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 Component
public void remove()
public ParagraphStyleHandler getStyleHandler()
The style handler is an instance of ParagraphStyleHandler
ParagraphStyleHandler
public 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 Component
TextParagraphElementBase
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()
TextboxContainer
addTextbox
in interface TextboxContainer
public Iterator<Textbox> getTextboxIterator()
TextboxContainer
getTextboxIterator
in interface TextboxContainer
public boolean removeTextbox(Textbox box)
TextboxContainer
removeTextbox
in interface TextboxContainer
box
- - the instance of text boxpublic OdfElement getFrameContainerElement()
FrameContainer
getFrameContainerElement
in interface FrameContainer
public Textbox addTextbox(FrameRectangle position)
TextboxContainer
addTextbox
in interface TextboxContainer
position
- - the rectangle (position and size) of this text boxpublic Textbox getTextboxByName(String name)
TextboxContainer
getTextboxByName
in interface TextboxContainer
name
- - the name of the text boxpublic List<Textbox> getTextboxByUsage(PresentationDocument.PresentationClass usage)
TextboxContainer
This method will return a list of text boxs by the usage in presentation slides.
getTextboxByUsage
in interface TextboxContainer
usage
- - the usage descriptionpublic TextHyperlink applyHyperlink(URI linkto)
applyHyperlink
in interface TextHyperlinkContainer
linkto
- the hyperlinkpublic Iterator<TextHyperlink> getHyperlinkIterator()
TextHyperlinkContainer
getHyperlinkIterator
in interface TextHyperlinkContainer
public void removeHyperlinks()
TextHyperlinkContainer
removeHyperlinks
in interface TextHyperlinkContainer
public TextHyperlink appendHyperlink(String text, URI linkto)
TextHyperlinkContainer
appendHyperlink
in interface TextHyperlinkContainer
text
- - the text contentlinkto
- - the URI of this hyperlinkpublic Control createDrawControl()
createDrawControl
in interface ControlContainer
public OdfElement getDrawControlContainerElement()
ControlContainer
getDrawControlContainerElement
in interface ControlContainer
Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.