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 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).

  • Field Details

    • writer

      protected final Writer writer
      Writer to be used
    • parent

      protected final RtfContainer parent
      parent element
    • attrib

      protected final RtfAttributes attrib
      attributes of the element
  • 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
      Throws:
      IOException - for I/O problems
    • writeRtf

      public final void writeRtf() throws IOException
      Write the RTF code of this element to our Writer
      Throws:
      IOException - for I/O problems
    • 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.
      Throws:
      IOException - in case of an I/O problem
    • writeControlWord

      protected final void writeControlWord(String word) throws IOException
      Write an RTF control word to our Writer
      Parameters:
      word - RTF control word to write
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • writeRtfPrefix

      protected void writeRtfPrefix() throws IOException
      Called before writeRtfContent()
      Throws:
      IOException - for I/O problems
    • writeRtfContent

      protected abstract void writeRtfContent() throws IOException
      Must be implemented to write RTF content to m_writer
      Throws:
      IOException - for I/O problems
    • writeRtfSuffix

      protected void writeRtfSuffix() throws IOException
      Called after writeRtfContent()
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • 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
      Throws:
      IOException - for I/O problems
    • 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
      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

      public String toString()
      minimal debugging display
      Overrides:
      toString in class Object
      Returns:
      String representation of object
    • getParentOfClass

      public RtfElement getParentOfClass(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(Exception ie) throws IOException
      Make a visible entry in the RTF for an exception
      Parameters:
      ie - Exception to flag
      Throws:
      IOException - for I/O problems
    • getRtfAttributes

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