Class RtfParagraph
- 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.RtfBookmarkContainerImpl
-
- org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph
-
- All Implemented Interfaces:
IRtfBookmarkContainer
,IRtfExternalGraphicContainer
,IRtfHyperLinkContainer
,IRtfPageBreakContainer
,IRtfPageNumberCitationContainer
,IRtfPageNumberContainer
,IRtfTextContainer
- Direct Known Subclasses:
RtfListItem.RtfListItemParagraph
public class RtfParagraph extends RtfBookmarkContainerImpl implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, IRtfExternalGraphicContainer, IRtfPageNumberContainer, IRtfPageNumberCitationContainer
Model of an RTF paragraph, which can contain RTF text elements.
This work was authored by Bertrand Delacretaz (bdelacretaz@codeconsult.ch), Andreas Putz (a.putz@skynamics.com), and Boris Poudérous (boris.pouderous@free.fr).
-
-
Field Summary
Fields Modifier and Type Field Description private RtfExternalGraphic
externalGraphic
private RtfHyperLink
hyperlink
private boolean
keepn
private RtfPageNumber
pageNumber
private RtfPageNumberCitation
pageNumberCitation
private static java.lang.String[]
PARA_ATTRIBUTES
Set of attributes that must be copied at the start of a paragraphprivate boolean
resetProperties
private RtfText
text
private boolean
writeForBreak
-
Fields inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
attrib, parent, writer
-
-
Constructor Summary
Constructors Constructor Description RtfParagraph(IRtfParagraphContainer parent, java.io.Writer w)
Create an RTF paragraph as a child of given container with default attributesRtfParagraph(IRtfParagraphContainer parent, java.io.Writer w, RtfAttributes attr)
Create an RTF paragraph as a child of given container with given attributes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
closeAll()
private void
closeCurrentHyperLink()
private void
closeCurrentText()
java.lang.String
getText()
Accessor for the paragraph textRtfAttributes
getTextAttributes()
accessor for text attributesRtfAttributes
getTextContainerAttributes()
IRtfTextContainer requirement: return a copy of our attributesprivate boolean
mustWriteAttributes()
true if we must write our own (non-text) attributes in the RTFprivate boolean
mustWriteGroupMark()
true if we must write a group mark around this paragraph TODO is this correct, study interaction with mustWriteAttributes() <-- On implementation i have noticed if the groupmark set, the format attributes are only for this content, i think this implementation is okRtfHyperLink
newHyperLink(java.lang.String str, RtfAttributes attr)
Creates a new hyperlink.RtfExternalGraphic
newImage()
Start a new external graphic after closing all other elementsvoid
newLineBreak()
add a line breakvoid
newPageBreak()
add a page breakRtfPageNumber
newPageNumber()
Add a page numberRtfPageNumberCitation
newPageNumberCitation(java.lang.String id)
Added by Boris POUDEROUS on 2002/07/09RtfText
newText(java.lang.String str)
Close current text run if any and start a new one with default attributesRtfText
newText(java.lang.String str, RtfAttributes attr)
Close current text run if any and start a new oneprotected boolean
okToWriteRtf()
Depending on RtfOptions, do not emit any RTF for empty paragraphsvoid
setKeepn()
Set the keepn attribute for this paragraphvoid
setResetProperties()
Force reset propertiesprotected void
writeRtfPrefix()
Overridden to write our attributes before our contentprotected void
writeRtfSuffix()
Overridden to close paragraph-
Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfBookmarkContainerImpl
newBookmark
-
Methods inherited from class org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer
addChild, containsText, dump, findChildren, getChildCount, getChildren, getOptions, isEmpty, setChildren, setOptions, toString, writeRtfContent
-
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, writeStarControlWord, writeStarControlWordNS
-
-
-
-
Field Detail
-
text
private RtfText text
-
hyperlink
private RtfHyperLink hyperlink
-
externalGraphic
private RtfExternalGraphic externalGraphic
-
pageNumber
private RtfPageNumber pageNumber
-
pageNumberCitation
private RtfPageNumberCitation pageNumberCitation
-
keepn
private boolean keepn
-
resetProperties
private boolean resetProperties
-
writeForBreak
private boolean writeForBreak
-
PARA_ATTRIBUTES
private static final java.lang.String[] PARA_ATTRIBUTES
Set of attributes that must be copied at the start of a paragraph
-
-
Constructor Detail
-
RtfParagraph
RtfParagraph(IRtfParagraphContainer parent, java.io.Writer w) throws java.io.IOException
Create an RTF paragraph as a child of given container with default attributes- Throws:
java.io.IOException
-
RtfParagraph
RtfParagraph(IRtfParagraphContainer parent, java.io.Writer w, RtfAttributes attr) throws java.io.IOException
Create an RTF paragraph as a child of given container with given attributes- Throws:
java.io.IOException
-
-
Method Detail
-
getText
public java.lang.String getText()
Accessor for the paragraph text- Returns:
- the paragraph text
-
setKeepn
public void setKeepn()
Set the keepn attribute for this paragraph
-
setResetProperties
public void setResetProperties()
Force reset properties
-
getTextContainerAttributes
public RtfAttributes getTextContainerAttributes() throws FOPException
IRtfTextContainer requirement: return a copy of our attributes- Specified by:
getTextContainerAttributes
in interfaceIRtfTextContainer
- Returns:
- a copy of this paragraphs attributes
- Throws:
FOPException
- if attributes cannot be cloned
-
writeRtfPrefix
protected void writeRtfPrefix() throws java.io.IOException
Overridden to write our attributes before our content- Overrides:
writeRtfPrefix
in classRtfElement
- Throws:
java.io.IOException
- for I/O problems
-
writeRtfSuffix
protected void writeRtfSuffix() throws java.io.IOException
Overridden to close paragraph- Overrides:
writeRtfSuffix
in classRtfElement
- Throws:
java.io.IOException
- for I/O problems
-
newText
public RtfText newText(java.lang.String str) throws java.io.IOException
Close current text run if any and start a new one with default attributes- Specified by:
newText
in interfaceIRtfTextContainer
- Parameters:
str
- if not null, added to the RtfText created- Returns:
- the new RtfText object
- Throws:
java.io.IOException
- for I/O problems
-
newText
public RtfText newText(java.lang.String str, RtfAttributes attr) throws java.io.IOException
Close current text run if any and start a new one- Specified by:
newText
in interfaceIRtfTextContainer
- Parameters:
str
- if not null, added to the RtfText createdattr
- attributes of the text- Returns:
- the new RtfText object
- Throws:
java.io.IOException
- for I/O problems
-
newPageBreak
public void newPageBreak() throws java.io.IOException
add a page break- Specified by:
newPageBreak
in interfaceIRtfPageBreakContainer
- Throws:
java.io.IOException
- for I/O problems
-
newLineBreak
public void newLineBreak() throws java.io.IOException
add a line break- Specified by:
newLineBreak
in interfaceIRtfTextContainer
- Throws:
java.io.IOException
- for I/O problems
-
newPageNumber
public RtfPageNumber newPageNumber() throws java.io.IOException
Add a page number- Specified by:
newPageNumber
in interfaceIRtfPageNumberContainer
- Returns:
- new RtfPageNumber object
- Throws:
java.io.IOException
- for I/O problems
-
newPageNumberCitation
public RtfPageNumberCitation newPageNumberCitation(java.lang.String id) throws java.io.IOException
Added by Boris POUDEROUS on 2002/07/09- Specified by:
newPageNumberCitation
in interfaceIRtfPageNumberCitationContainer
- Parameters:
id
- string containing the citation text- Returns:
- the new RtfPageNumberCitation object
- Throws:
java.io.IOException
- for I/O problems
-
newHyperLink
public RtfHyperLink newHyperLink(java.lang.String str, RtfAttributes attr) throws java.io.IOException
Creates a new hyperlink.- Specified by:
newHyperLink
in interfaceIRtfHyperLinkContainer
- Parameters:
str
- string containing the hyperlink textattr
- attributes of new hyperlink- Returns:
- the new RtfHyperLink object
- Throws:
java.io.IOException
- for I/O problems
-
newImage
public RtfExternalGraphic newImage() throws java.io.IOException
Start a new external graphic after closing all other elements- Specified by:
newImage
in interfaceIRtfExternalGraphicContainer
- Returns:
- the new RtfExternalGraphic
- Throws:
java.io.IOException
- for I/O problems
-
closeCurrentText
private void closeCurrentText() throws java.io.IOException
- Throws:
java.io.IOException
-
closeCurrentHyperLink
private void closeCurrentHyperLink() throws java.io.IOException
- Throws:
java.io.IOException
-
closeAll
private void closeAll() throws java.io.IOException
- Throws:
java.io.IOException
-
okToWriteRtf
protected boolean okToWriteRtf()
Depending on RtfOptions, do not emit any RTF for empty paragraphs- Overrides:
okToWriteRtf
in classRtfContainer
- Returns:
- true if RTF should be written
-
mustWriteAttributes
private boolean mustWriteAttributes()
true if we must write our own (non-text) attributes in the RTF
-
mustWriteGroupMark
private boolean mustWriteGroupMark()
true if we must write a group mark around this paragraph TODO is this correct, study interaction with mustWriteAttributes() <-- On implementation i have noticed if the groupmark set, the format attributes are only for this content, i think this implementation is ok
-
getTextAttributes
public RtfAttributes getTextAttributes()
accessor for text attributes- Returns:
- attributes of the text
-
-