org.apache.fop.render.rtf.rtflib.rtfdoc

Class RtfElement

Known Direct Subclasses:
RtfBookmark, RtfContainer, RtfExternalGraphic, RtfGenerator, RtfLineBreak, RtfPageBreak, RtfString, RtfText

public abstract class RtfElement
extends java.lang.Object

Base class for all elements of an RTF file.
Authors:
Bertrand Delacretaz bdelacretaz@codeconsult.ch
Andreas Putz a.putz@skynamics.com

Field Summary

protected RtfAttributes
attrib
attributes of the element
protected RtfContainer
parent
parent element
protected Writer
writer
Writer to be used

Method Summary

void
close()
Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet
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

Field Details

attrib

protected final RtfAttributes attrib
attributes of the element

parent

protected final RtfContainer parent
parent element

writer

protected final Writer writer
Writer to be used

Method Details

close

public final void close()
            throws IOException
Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet

getRtfAttributes

public RtfAttributes getRtfAttributes()
Added by Normand Masse Used for attribute inheritance
Returns:
RtfAttributes

isEmpty

public abstract boolean isEmpty()
Returns:
true if this element would generate no "useful" RTF content

newLine

public void newLine()
            throws IOException
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.

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 String toString()
minimal debugging display
Returns:
String representation of object

writeAttributes

protected void writeAttributes(RtfAttributes attr,
                               String[] nameList)
            throws IOException
Write given attribute values to our Writer
Parameters:
attr - RtfAttributes to be written
nameList - if given, only attribute names from this list are considered

writeControlWord

protected final void writeControlWord(String word)
            throws IOException
Write an RTF control word to our Writer
Parameters:
word - RTF control word to write

writeControlWordNS

protected final void writeControlWordNS(String word)
            throws IOException
Write rtf control word without the space behind it
Parameters:
word - RTF control word to write

writeExceptionInRtf

protected void writeExceptionInRtf(Exception ie)
            throws IOException
Make a visible entry in the RTF for an exception
Parameters:
ie - Exception to flag

writeGroupMark

protected final void writeGroupMark(boolean isStart)
            throws IOException
Write a start or end group mark
Parameters:
isStart - set to true if this is a start mark

writeOneAttribute

protected void writeOneAttribute(String name,
                                 Object value)
            throws IOException
Write one attribute to our Writer
Parameters:
name - name of attribute to write
value - value of attribute to be written

writeOneAttributeNS

protected void writeOneAttributeNS(String name,
                                   Object value)
            throws IOException
Write one attribute to our Writer without a space
Parameters:
name - name of attribute to write
value - value of attribute to be written

writeRtf

public final void writeRtf()
            throws IOException
Write the RTF code of this element to our Writer

writeRtfContent

protected abstract void writeRtfContent()
            throws IOException
Must be implemented to write RTF content to m_writer

writeRtfPrefix

protected void writeRtfPrefix()
            throws IOException
Called before writeRtfContent()

writeRtfSuffix

protected void writeRtfSuffix()
            throws IOException
Called after writeRtfContent()

writeStarControlWord

protected final void writeStarControlWord(String word)
            throws IOException
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

writeStarControlWordNS

protected final void writeStarControlWordNS(String word)
            throws IOException
Same as writeStarControlWord(String word), except with no space behind it
Parameters:
word - RTF control word to write

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.