fop 1.0

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

java.lang.Object
  extended by org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement
Direct Known 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.

Author:
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  java.io.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
 java.lang.String toString()
          minimal debugging display
protected  void writeAttributes(RtfAttributes attr, java.lang.String[] nameList)
          Write given attribute values to our Writer
protected  void writeControlWord(java.lang.String word)
          Write an RTF control word to our Writer
protected  void writeControlWordNS(java.lang.String word)
          Write rtf control word without the space behind it
protected  void writeExceptionInRtf(java.lang.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(java.lang.String name, java.lang.Object value)
          Write one attribute to our Writer
protected  void writeOneAttributeNS(java.lang.String name, java.lang.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(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  void writeStarControlWordNS(java.lang.String word)
          Same as writeStarControlWord(String word), except with no space behind it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.IOException
Does 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.IOException
Write the RTF code of this element to our Writer

Throws:
java.io.IOException - for I/O problems

newLine

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

Throws:
java.io.IOException - in case of an I/O problem

writeControlWord

protected final void writeControlWord(java.lang.String word)
                               throws java.io.IOException
Write 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.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
Throws:
java.io.IOException - for I/O problems

writeStarControlWordNS

protected final void writeStarControlWordNS(java.lang.String word)
                                     throws java.io.IOException
Same 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.IOException
Write 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.IOException
Called before writeRtfContent()

Throws:
java.io.IOException - for I/O problems

writeRtfContent

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

Throws:
java.io.IOException - for I/O problems

writeRtfSuffix

protected void writeRtfSuffix()
                       throws java.io.IOException
Called after writeRtfContent()

Throws:
java.io.IOException - for I/O problems

writeGroupMark

protected final void writeGroupMark(boolean isStart)
                             throws java.io.IOException
Write 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 written
nameList - 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.IOException
Write one attribute to our Writer

Parameters:
name - name of attribute to write
value - 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.IOException
Write one attribute to our Writer without a space

Parameters:
name - name of attribute to write
value - 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:
toString in class java.lang.Object
Returns:
String representation of object

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.IOException
Make 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

fop 1.0

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