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
public abstract class RtfElement extends java.lang.ObjectBase 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
Fields Modifier and Type Field Description protected RtfAttributesattribattributes of the elementprotected RtfContainerparentparent elementprotected java.io.WriterwriterWriter to be used
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yetRtfElementgetParentOfClass(java.lang.Class c)find the first parent where c.isAssignableFrom(parent.getClass()) is trueRtfAttributesgetRtfAttributes()Added by Normand Masse Used for attribute inheritanceabstract booleanisEmpty()voidnewLine()Starts a new line in the RTF file being written.protected booleanokToWriteRtf()can be overridden to suppress all RTF outputjava.lang.StringtoString()minimal debugging displayprotected voidwriteAttributes(RtfAttributes attr, java.lang.String[] nameList)Write given attribute values to our Writerprotected voidwriteControlWord(java.lang.String word)Write an RTF control word to our Writerprotected voidwriteControlWordNS(java.lang.String word)Write rtf control word without the space behind itprotected voidwriteExceptionInRtf(java.lang.Exception ie)Make a visible entry in the RTF for an exceptionprotected voidwriteGroupMark(boolean isStart)Write a start or end group markprotected voidwriteOneAttribute(java.lang.String name, java.lang.Object value)Write one attribute to our Writerprotected voidwriteOneAttributeNS(java.lang.String name, java.lang.Object value)Write one attribute to our Writer without a spacevoidwriteRtf()Write the RTF code of this element to our Writerprotected abstract voidwriteRtfContent()Must be implemented to write RTF content to m_writerprotected voidwriteRtfPrefix()Called before writeRtfContent()protected voidwriteRtfSuffix()Called after writeRtfContent()protected voidwriteStarControlWord(java.lang.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 voidwriteStarControlWordNS(java.lang.String word)Same as writeStarControlWord(String word), except with no space behind it
-
-
-
Field Detail
-
writer
protected final java.io.Writer writer
Writer to be used
-
parent
protected final RtfContainer parent
parent element
-
attrib
protected final RtfAttributes attrib
attributes of the element
-
-
Method Detail
-
close
public final void close() throws java.io.IOExceptionDoes nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet- Throws:
java.io.IOException- for I/O problems
-
writeRtf
public final void writeRtf() throws java.io.IOExceptionWrite the RTF code of this element to our Writer- Throws:
java.io.IOException- for I/O problems
-
newLine
public void newLine() throws java.io.IOExceptionStarts 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:
java.io.IOException- in case of an I/O problem
-
writeControlWord
protected final void writeControlWord(java.lang.String word) throws java.io.IOExceptionWrite an RTF control word to our Writer- Parameters:
word- RTF control word to write- Throws:
java.io.IOException- for I/O problems
-
writeStarControlWord
protected final void writeStarControlWord(java.lang.String word) throws java.io.IOExceptionWrite 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:
java.io.IOException- for I/O problems
-
writeStarControlWordNS
protected final void writeStarControlWordNS(java.lang.String word) throws java.io.IOExceptionSame as writeStarControlWord(String word), except with no space behind it- Parameters:
word- RTF control word to write- Throws:
java.io.IOException- for I/O problems
-
writeControlWordNS
protected final void writeControlWordNS(java.lang.String word) throws java.io.IOExceptionWrite rtf control word without the space behind it- Parameters:
word- RTF control word to write- Throws:
java.io.IOException- for I/O problems
-
writeRtfPrefix
protected void writeRtfPrefix() throws java.io.IOExceptionCalled before writeRtfContent()- Throws:
java.io.IOException- for I/O problems
-
writeRtfContent
protected abstract void writeRtfContent() throws java.io.IOExceptionMust be implemented to write RTF content to m_writer- Throws:
java.io.IOException- for I/O problems
-
writeRtfSuffix
protected void writeRtfSuffix() throws java.io.IOExceptionCalled after writeRtfContent()- Throws:
java.io.IOException- for I/O problems
-
writeGroupMark
protected final void writeGroupMark(boolean isStart) throws java.io.IOExceptionWrite a start or end group mark- Parameters:
isStart- set to true if this is a start mark- Throws:
java.io.IOException- for I/O problems
-
writeAttributes
protected void writeAttributes(RtfAttributes attr, java.lang.String[] nameList) throws java.io.IOException
Write given attribute values to our Writer- Parameters:
attr- RtfAttributes to be writtennameList- if given, only attribute names from this list are considered- Throws:
java.io.IOException- for I/O problems
-
writeOneAttribute
protected void writeOneAttribute(java.lang.String name, java.lang.Object value) throws java.io.IOExceptionWrite one attribute to our Writer- Parameters:
name- name of attribute to writevalue- value of attribute to be written- Throws:
java.io.IOException- for I/O problems
-
writeOneAttributeNS
protected void writeOneAttributeNS(java.lang.String name, java.lang.Object value) throws java.io.IOExceptionWrite one attribute to our Writer without a space- Parameters:
name- name of attribute to writevalue- value of attribute to be written- Throws:
java.io.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
public java.lang.String toString()
minimal debugging display- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation of object
-
getParentOfClass
public RtfElement getParentOfClass(java.lang.Class c)
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
protected void writeExceptionInRtf(java.lang.Exception ie) throws java.io.IOExceptionMake a visible entry in the RTF for an exception- Parameters:
ie- Exception to flag- Throws:
java.io.IOException- for I/O problems
-
getRtfAttributes
public RtfAttributes getRtfAttributes()
Added by Normand Masse Used for attribute inheritance- Returns:
- RtfAttributes
-
-