Class RtfTextrun
- java.lang.Object
-
- org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
-
- org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer
-
- org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun
-
- Direct Known Subclasses:
RtfListItem.RtfListItemLabel
public class RtfTextrun extends RtfContainer
Class which contains a linear text run. It has methods to add attributes, text, paragraph breaks....
This work was authored by Peter Herweg (pherweg@web.de).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRtfTextrun.RtfCloseGroupMarkClass which represents the closing of a RTF group mark.private classRtfTextrun.RtfOpenGroupMarkClass which represents the opening of a RTF group mark.
-
Field Summary
Fields Modifier and Type Field Description static intBREAK_COLUMNConstant for a column breakstatic intBREAK_EVEN_PAGEConstant for a even page breakstatic intBREAK_NONEConstant for no page breakstatic intBREAK_ODD_PAGEConstant for a odd page breakstatic intBREAK_PAGEConstant for a normal page breakprivate booleanbSuppressLastParprotected static org.apache.commons.logging.Logloglogging instanceprivate RtfListItemrtfListItemprivate RtfSpaceManagerrtfSpaceManagerManager for handling space-* property.-
Fields inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
attrib, parent, writer
-
-
Constructor Summary
Constructors Constructor Description RtfTextrun(RtfContainer parent, java.io.Writer w, RtfAttributes attrs)Create an RTF container as a child of given container
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBookmark(java.lang.String id)Inserts a bookmark.private voidaddCloseGroupMark()Adds instance ofCloseGroupMarkas a child, but without a break option.private voidaddCloseGroupMark(int breakType)Adds instance ofCloseGroupMarkas a child.RtfFootnoteaddFootnote()Inserts a footnote.RtfHyperLinkaddHyperlink(RtfAttributes attr)Inserts a hyperlink.voidaddLeader(RtfAttributes attrs)Inserts a leader.private voidaddOpenGroupMark(RtfAttributes attrs)Adds instance ofOpenGroupMarkas a child with attributes.voidaddPageNumber(RtfAttributes attr)Inserts a page number.voidaddPageNumberCitation(java.lang.String refId)Inserts a page number citation.RtfParagraphBreakaddParagraphBreak()Inserts paragraph break before all close group marks.voidaddString(java.lang.String s)Add string to children list.RtfListItemgetRtfListItem()Gets the parent list-item of the textrun.static RtfTextrungetTextrun(RtfContainer container, java.io.Writer writer, RtfAttributes attrs)Adds a new RtfTextrun to the given container if necessary, and returns it.RtfExternalGraphicnewImage()Inserts an image.voidpopBlockAttributes(int breakType)Pops block attributes, notifies all opened blocks about pushing block attributes, addsCloseGroupMarkas a child.voidpopInlineAttributes()Pop inline attributes.voidpushBlockAttributes(RtfAttributes attrs)Pushes block attributes, notifies all opened blocks about pushing block attributes, addsOpenGroupMarkas a child.voidpushInlineAttributes(RtfAttributes attrs)Pushes inline attributes.voidsetRtfListItem(RtfListItem listItem)Set the parent list-item of the textrun.voidsetSuppressLastPar(boolean bSuppress)specify, if the last paragraph control word (\par) should be suppressed.protected voidwriteRtfContent()write RTF code of all our children-
Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer
addChild, containsText, dump, findChildren, getChildCount, getChildren, getOptions, isEmpty, okToWriteRtf, setChildren, setOptions, toString
-
Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
close, getParentOfClass, getRtfAttributes, getRtfFile, isClosed, newLine, writeAttributes, writeControlWord, writeControlWordNS, writeExceptionInRtf, writeGroupMark, writeOneAttribute, writeOneAttributeNS, writeRtf, writeRtfPrefix, writeRtfSuffix, writeStarControlWord, writeStarControlWordNS
-
-
-
-
Field Detail
-
BREAK_NONE
public static final int BREAK_NONE
Constant for no page break- See Also:
- Constant Field Values
-
BREAK_PAGE
public static final int BREAK_PAGE
Constant for a normal page break- See Also:
- Constant Field Values
-
BREAK_COLUMN
public static final int BREAK_COLUMN
Constant for a column break- See Also:
- Constant Field Values
-
BREAK_EVEN_PAGE
public static final int BREAK_EVEN_PAGE
Constant for a even page break- See Also:
- Constant Field Values
-
BREAK_ODD_PAGE
public static final int BREAK_ODD_PAGE
Constant for a odd page break- See Also:
- Constant Field Values
-
bSuppressLastPar
private boolean bSuppressLastPar
-
rtfListItem
private RtfListItem rtfListItem
-
log
protected static final org.apache.commons.logging.Log log
logging instance
-
rtfSpaceManager
private RtfSpaceManager rtfSpaceManager
Manager for handling space-* property.
-
-
Constructor Detail
-
RtfTextrun
RtfTextrun(RtfContainer parent, java.io.Writer w, RtfAttributes attrs) throws java.io.IOException
Create an RTF container as a child of given container- Throws:
java.io.IOException
-
-
Method Detail
-
addOpenGroupMark
private void addOpenGroupMark(RtfAttributes attrs) throws java.io.IOException
Adds instance ofOpenGroupMarkas a child with attributes.- Parameters:
attrs- attributes to add- Throws:
java.io.IOException- for I/O problems
-
addCloseGroupMark
private void addCloseGroupMark(int breakType) throws java.io.IOExceptionAdds instance ofCloseGroupMarkas a child.- Throws:
java.io.IOException- for I/O problems
-
addCloseGroupMark
private void addCloseGroupMark() throws java.io.IOExceptionAdds instance ofCloseGroupMarkas a child, but without a break option. Inline attributes do not need that for example- Throws:
java.io.IOException- for I/O problems
-
pushBlockAttributes
public void pushBlockAttributes(RtfAttributes attrs) throws java.io.IOException
Pushes block attributes, notifies all opened blocks about pushing block attributes, addsOpenGroupMarkas a child.- Parameters:
attrs- the block attributes to push- Throws:
java.io.IOException- for I/O problems
-
popBlockAttributes
public void popBlockAttributes(int breakType) throws java.io.IOExceptionPops block attributes, notifies all opened blocks about pushing block attributes, addsCloseGroupMarkas a child.- Parameters:
breakType- the break type- Throws:
java.io.IOException- for I/O problems
-
pushInlineAttributes
public void pushInlineAttributes(RtfAttributes attrs) throws java.io.IOException
Pushes inline attributes.- Parameters:
attrs- the inline attributes to push- Throws:
java.io.IOException- for I/O problems
-
addPageNumberCitation
public void addPageNumberCitation(java.lang.String refId) throws java.io.IOExceptionInserts a page number citation.- Parameters:
refId- the identifier being referenced- Throws:
java.io.IOException- for I/O problems
-
popInlineAttributes
public void popInlineAttributes() throws java.io.IOExceptionPop inline attributes.- Throws:
java.io.IOException- for I/O problems
-
addString
public void addString(java.lang.String s) throws java.io.IOExceptionAdd string to children list.- Parameters:
s- string to add- Throws:
java.io.IOException- for I/O problems
-
addFootnote
public RtfFootnote addFootnote() throws java.io.IOException
Inserts a footnote.- Returns:
- inserted footnote
- Throws:
java.io.IOException- for I/O problems
-
addParagraphBreak
public RtfParagraphBreak addParagraphBreak() throws java.io.IOException
Inserts paragraph break before all close group marks.- Returns:
- The paragraph break element
- Throws:
java.io.IOException- for I/O problems
-
addLeader
public void addLeader(RtfAttributes attrs) throws java.io.IOException
Inserts a leader.- Parameters:
attrs- Attributes for the leader- Throws:
java.io.IOException- for I/O problems
-
addPageNumber
public void addPageNumber(RtfAttributes attr) throws java.io.IOException
Inserts a page number.- Parameters:
attr- Attributes for the page number to insert.- Throws:
java.io.IOException- for I/O problems
-
addHyperlink
public RtfHyperLink addHyperlink(RtfAttributes attr) throws java.io.IOException
Inserts a hyperlink.- Parameters:
attr- Attributes for the hyperlink to insert.- Returns:
- inserted hyperlink
- Throws:
java.io.IOException- for I/O problems
-
addBookmark
public void addBookmark(java.lang.String id) throws java.io.IOExceptionInserts a bookmark.- Parameters:
id- Id for the inserted bookmark- Throws:
java.io.IOException- for I/O problems
-
newImage
public RtfExternalGraphic newImage() throws java.io.IOException
Inserts an image.- Returns:
- inserted image
- Throws:
java.io.IOException- for I/O problems
-
getTextrun
public static RtfTextrun getTextrun(RtfContainer container, java.io.Writer writer, RtfAttributes attrs) throws java.io.IOException
Adds a new RtfTextrun to the given container if necessary, and returns it.- Parameters:
container- RtfContainer, which is the parent of the returned RtfTextrunwriter- Writer of the given RtfContainerattrs- RtfAttributes which are to write at the beginning of the RtfTextrun- Returns:
- new or existing RtfTextrun object.
- Throws:
java.io.IOException- for I/O problems
-
setSuppressLastPar
public void setSuppressLastPar(boolean bSuppress)
specify, if the last paragraph control word (\par) should be suppressed.- Parameters:
bSuppress- true, if the last \par should be suppressed
-
writeRtfContent
protected void writeRtfContent() throws java.io.IOExceptionwrite RTF code of all our children- Overrides:
writeRtfContentin classRtfContainer- Throws:
java.io.IOException- for I/O problems
-
setRtfListItem
public void setRtfListItem(RtfListItem listItem)
Set the parent list-item of the textrun.- Parameters:
listItem- parent list-item of the textrun
-
getRtfListItem
public RtfListItem getRtfListItem()
Gets the parent list-item of the textrun.- Returns:
- parent list-item of the textrun
-
-