public abstract class RtfElement extends Object
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).
| Modifier and Type | Field and Description |
|---|---|
protected RtfAttributes |
attrib
attributes of the element
|
protected RtfContainer |
parent
parent element
|
protected Writer |
writer
Writer to be used
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Does nothing, meant to allow elements to write themselves without waiting
for write(), but not implemented yet
|
RtfElement |
getParentOfClass(Class c)
find the first parent where c.isAssignableFrom(parent.getClass()) is true
|
RtfAttributes |
getRtfAttributes()
Added by Normand Masse
Used for attribute inheritance
|
abstract boolean |
isEmpty() |
void |
newLine()
Starts a new line in the RTF file being written.
|
protected boolean |
okToWriteRtf()
can be overridden to suppress all RTF output
|
String |
toString()
minimal debugging display
|
protected void |
writeAttributes(RtfAttributes attr,
String[] nameList)
Write given attribute values to our Writer
|
protected void |
writeControlWord(String word)
Write an RTF control word to our Writer
|
protected void |
writeControlWordNS(String word)
Write rtf control word without the space behind it
|
protected void |
writeExceptionInRtf(Exception ie)
Make a visible entry in the RTF for an exception
|
protected void |
writeGroupMark(boolean isStart)
Write a start or end group mark
|
protected void |
writeOneAttribute(String name,
Object value)
Write one attribute to our Writer
|
protected void |
writeOneAttributeNS(String name,
Object value)
Write one attribute to our Writer without a space
|
void |
writeRtf()
Write the RTF code of this element to our Writer
|
protected abstract void |
writeRtfContent()
Must be implemented to write RTF content to m_writer
|
protected void |
writeRtfPrefix()
Called before writeRtfContent()
|
protected void |
writeRtfSuffix()
Called after writeRtfContent()
|
protected void |
writeStarControlWord(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 void |
writeStarControlWordNS(String word)
Same as writeStarControlWord(String word), except with no space behind it
|
protected final Writer writer
protected final RtfContainer parent
protected final RtfAttributes attrib
public final void close()
throws IOException
IOException - for I/O problemspublic final void writeRtf()
throws IOException
IOException - for I/O problemspublic void newLine()
throws IOException
IOException - in case of an I/O problemprotected final void writeControlWord(String word) throws IOException
word - RTF control word to writeIOException - for I/O problemsprotected final void writeStarControlWord(String word) throws IOException
word - RTF control word to writeIOException - for I/O problemsprotected final void writeStarControlWordNS(String word) throws IOException
word - RTF control word to writeIOException - for I/O problemsprotected final void writeControlWordNS(String word) throws IOException
word - RTF control word to writeIOException - for I/O problemsprotected void writeRtfPrefix()
throws IOException
IOException - for I/O problemsprotected abstract void writeRtfContent()
throws IOException
IOException - for I/O problemsprotected void writeRtfSuffix()
throws IOException
IOException - for I/O problemsprotected final void writeGroupMark(boolean isStart)
throws IOException
isStart - set to true if this is a start markIOException - for I/O problemsprotected void writeAttributes(RtfAttributes attr, String[] nameList) throws IOException
attr - RtfAttributes to be writtennameList - if given, only attribute names from this list are consideredIOException - for I/O problemsprotected void writeOneAttribute(String name, Object value) throws IOException
name - name of attribute to writevalue - value of attribute to be writtenIOException - for I/O problemsprotected void writeOneAttributeNS(String name, Object value) throws IOException
name - name of attribute to writevalue - value of attribute to be writtenIOException - for I/O problemsprotected boolean okToWriteRtf()
public String toString()
public RtfElement getParentOfClass(Class c)
public abstract boolean isEmpty()
protected void writeExceptionInRtf(Exception ie) throws IOException
ie - Exception to flagIOException - for I/O problemspublic RtfAttributes getRtfAttributes()
Copyright © 2023 Apache Software Foundation. All rights reserved.