Class RtfElement
java.lang.Object
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
- Direct Known Subclasses:
RtfBookmark,RtfContainer,RtfExternalGraphic,RtfGenerator,RtfLineBreak,RtfPageBreak,RtfParagraphBreak,RtfString,RtfText
Base class for all elements of an RTF file.
This work was authored by Bertrand Delacretaz (bdelacretaz@codeconsult.ch) and Andreas Putz (a.putz@skynamics.com).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final RtfAttributesattributes of the elementprotected final RtfContainerparent elementprotected final WriterWriter to be used -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yetfind the first parent where c.isAssignableFrom(parent.getClass()) is trueAdded by Normand Masse Used for attribute inheritanceabstract booleanisEmpty()voidnewLine()Starts a new line in the RTF file being written.protected booleancan be overridden to suppress all RTF outputtoString()minimal debugging displayprotected voidwriteAttributes(RtfAttributes attr, String[] nameList) Write given attribute values to our Writerprotected final voidwriteControlWord(String word) Write an RTF control word to our Writerprotected final voidwriteControlWordNS(String word) Write rtf control word without the space behind itprotected voidMake a visible entry in the RTF for an exceptionprotected final voidwriteGroupMark(boolean isStart) Write a start or end group markprotected voidwriteOneAttribute(String name, Object value) Write one attribute to our Writerprotected voidwriteOneAttributeNS(String name, Object value) Write one attribute to our Writer without a spacefinal voidwriteRtf()Write the RTF code of this element to our Writerprotected abstract voidMust be implemented to write RTF content to m_writerprotected voidCalled before writeRtfContent()protected voidCalled after writeRtfContent()protected final voidwriteStarControlWord(String word) Write an RTF control word to our Writer, preceeded by a star '*' meaning "ignore this if you don't know what it means"protected final voidwriteStarControlWordNS(String word) Same as writeStarControlWord(String word), except with no space behind it
-
Field Details
-
writer
Writer to be used -
parent
parent element -
attrib
attributes of the element
-
-
Method Details
-
close
Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet- Throws:
IOException- for I/O problems
-
writeRtf
Write the RTF code of this element to our Writer- Throws:
IOException- for I/O problems
-
newLine
Starts a new line in the RTF file being written. This is only to format the RTF file itself (for easier debugging), not its content.- Throws:
IOException- in case of an I/O problem
-
writeControlWord
Write an RTF control word to our Writer- Parameters:
word- RTF control word to write- Throws:
IOException- for I/O problems
-
writeStarControlWord
Write an RTF control word to our Writer, preceeded by a star '*' meaning "ignore this if you don't know what it means"- Parameters:
word- RTF control word to write- Throws:
IOException- for I/O problems
-
writeStarControlWordNS
Same as writeStarControlWord(String word), except with no space behind it- Parameters:
word- RTF control word to write- Throws:
IOException- for I/O problems
-
writeControlWordNS
Write rtf control word without the space behind it- Parameters:
word- RTF control word to write- Throws:
IOException- for I/O problems
-
writeRtfPrefix
Called before writeRtfContent()- Throws:
IOException- for I/O problems
-
writeRtfContent
Must be implemented to write RTF content to m_writer- Throws:
IOException- for I/O problems
-
writeRtfSuffix
Called after writeRtfContent()- Throws:
IOException- for I/O problems
-
writeGroupMark
Write a start or end group mark- Parameters:
isStart- set to true if this is a start mark- Throws:
IOException- for I/O problems
-
writeAttributes
Write given attribute values to our Writer- Parameters:
attr- RtfAttributes to be writtennameList- if given, only attribute names from this list are considered- Throws:
IOException- for I/O problems
-
writeOneAttribute
Write one attribute to our Writer- Parameters:
name- name of attribute to writevalue- value of attribute to be written- Throws:
IOException- for I/O problems
-
writeOneAttributeNS
Write one attribute to our Writer without a space- Parameters:
name- name of attribute to writevalue- value of attribute to be written- Throws:
IOException- for I/O problems
-
okToWriteRtf
protected boolean okToWriteRtf()can be overridden to suppress all RTF output- Returns:
- true if this object can be written into the RTF
-
toString
minimal debugging display -
getParentOfClass
find the first parent where c.isAssignableFrom(parent.getClass()) is true- Returns:
- null if not found
-
isEmpty
public abstract boolean isEmpty()- Returns:
- true if this element would generate no "useful" RTF content
-
writeExceptionInRtf
Make a visible entry in the RTF for an exception- Parameters:
ie- Exception to flag- Throws:
IOException- for I/O problems
-
getRtfAttributes
Added by Normand Masse Used for attribute inheritance- Returns:
- RtfAttributes
-