Class RTFHandler

java.lang.Object
org.apache.fop.fo.FOEventHandler
org.apache.fop.render.rtf.RTFHandler

public class RTFHandler extends FOEventHandler
RTF Handler: generates RTF output using the structure events from the FO Tree sent to this structure handler.
  • Field Details

    • rtfFile

      private RtfFile rtfFile
    • os

      private final OutputStream os
    • log

      private static org.apache.commons.logging.Log log
    • sect

      private RtfSection sect
    • docArea

      private RtfDocumentArea docArea
    • bDefer

      private boolean bDefer
    • bPrevHeaderSpecified

      private boolean bPrevHeaderSpecified
    • bPrevFooterSpecified

      private boolean bPrevFooterSpecified
    • bHeaderSpecified

      private boolean bHeaderSpecified
    • bFooterSpecified

      private boolean bFooterSpecified
    • builderContext

      private BuilderContext builderContext
    • pagemaster

      private SimplePageMaster pagemaster
    • nestedTableDepth

      private int nestedTableDepth
    • percentManager

      private PercentContext percentManager
    • FLAVORS

      private static final org.apache.xmlgraphics.image.loader.ImageFlavor[] FLAVORS
  • Constructor Details

    • RTFHandler

      public RTFHandler(FOUserAgent userAgent, OutputStream os)
      Creates a new RTF structure handler.
      Parameters:
      userAgent - the FOUserAgent for this process
      os - OutputStream to write to
  • Method Details

    • handleIOTrouble

      protected void handleIOTrouble(IOException ioe)
      Central exception handler for I/O exceptions.
      Parameters:
      ioe - IOException to handle
    • startDocument

      public void startDocument() throws SAXException
      This method is called to indicate the start of a new document run.
      Overrides:
      startDocument in class FOEventHandler
      Throws:
      SAXException - In case of a problem
    • endDocument

      public void endDocument() throws SAXException
      This method is called to indicate the end of a document run.
      Overrides:
      endDocument in class FOEventHandler
      Throws:
      SAXException - In case of a problem
    • startPageSequence

      public void startPageSequence(PageSequence pageSeq)
      Overrides:
      startPageSequence in class FOEventHandler
      Parameters:
      pageSeq - PageSequence that is starting.
    • endPageSequence

      public void endPageSequence(PageSequence pageSeq)
      Overrides:
      endPageSequence in class FOEventHandler
      Parameters:
      pageSeq - PageSequence that is ending.
    • startFlow

      public void startFlow(Flow fl)
      This method is called to indicate the start of a new fo:flow or fo:static-content. This method also handles fo:static-content tags, because the StaticContent class is derived from the Flow class.
      Overrides:
      startFlow in class FOEventHandler
      Parameters:
      fl - Flow that is starting.
    • endFlow

      public void endFlow(Flow fl)
      Overrides:
      endFlow in class FOEventHandler
      Parameters:
      fl - Flow that is ending.
    • startBlock

      public void startBlock(Block bl)
      Overrides:
      startBlock in class FOEventHandler
      Parameters:
      bl - Block that is starting.
    • endBlock

      public void endBlock(Block bl)
      Overrides:
      endBlock in class FOEventHandler
      Parameters:
      bl - Block that is ending.
    • startBlockContainer

      public void startBlockContainer(BlockContainer blc)
      Overrides:
      startBlockContainer in class FOEventHandler
      Parameters:
      blc - BlockContainer that is starting.
    • endBlockContainer

      public void endBlockContainer(BlockContainer bl)
      Overrides:
      endBlockContainer in class FOEventHandler
      Parameters:
      bl - BlockContainer that is ending.
    • toRtfBreakValue

      private int toRtfBreakValue(int foBreakValue)
    • startTable

      public void startTable(Table tbl)
      Overrides:
      startTable in class FOEventHandler
      Parameters:
      tbl - Table that is starting.
    • endTable

      public void endTable(Table tbl)
      Overrides:
      endTable in class FOEventHandler
      Parameters:
      tbl - Table that is ending.
    • startColumn

      public void startColumn(TableColumn tc)
      Overrides:
      startColumn in class FOEventHandler
      Parameters:
      tc - TableColumn that is starting;
    • endColumn

      public void endColumn(TableColumn tc)
      Overrides:
      endColumn in class FOEventHandler
      Parameters:
      tc - TableColumn that is ending;
    • startHeader

      public void startHeader(TableHeader header)
      Overrides:
      startHeader in class FOEventHandler
      Parameters:
      header - TableHeader that is starting;
    • endHeader

      public void endHeader(TableHeader header)
      Overrides:
      endHeader in class FOEventHandler
      Parameters:
      header - TableHeader that is ending.
    • startFooter

      public void startFooter(TableFooter footer)
      Overrides:
      startFooter in class FOEventHandler
      Parameters:
      footer - TableFooter that is starting.
    • endFooter

      public void endFooter(TableFooter footer)
      Overrides:
      endFooter in class FOEventHandler
      Parameters:
      footer - TableFooter that is ending.
    • startInline

      public void startInline(Inline inl)
      Overrides:
      startInline in class FOEventHandler
      Parameters:
      inl - Inline that is starting.
    • endInline

      public void endInline(Inline inl)
      Overrides:
      endInline in class FOEventHandler
      Parameters:
      inl - Inline that is ending.
    • startPart

      private void startPart(TablePart part)
    • endPart

      private void endPart(TablePart tb)
    • startBody

      public void startBody(TableBody body)
      Overrides:
      startBody in class FOEventHandler
      Parameters:
      body - TableBody that is starting.
    • endBody

      public void endBody(TableBody body)
      Overrides:
      endBody in class FOEventHandler
      Parameters:
      body - TableBody that is ending.
    • startRow

      public void startRow(TableRow tr)
      Overrides:
      startRow in class FOEventHandler
      Parameters:
      tr - TableRow that is starting.
    • endRow

      public void endRow(TableRow tr)
      Overrides:
      endRow in class FOEventHandler
      Parameters:
      tr - TableRow that is ending.
    • startCell

      public void startCell(TableCell tc)
      Overrides:
      startCell in class FOEventHandler
      Parameters:
      tc - TableCell that is starting.
    • endCell

      public void endCell(TableCell tc)
      Overrides:
      endCell in class FOEventHandler
      Parameters:
      tc - TableCell that is ending.
    • startList

      public void startList(ListBlock lb)
      Overrides:
      startList in class FOEventHandler
      Parameters:
      lb - ListBlock that is starting.
    • endList

      public void endList(ListBlock lb)
      Overrides:
      endList in class FOEventHandler
      Parameters:
      lb - ListBlock that is ending.
    • startListItem

      public void startListItem(ListItem li)
      Overrides:
      startListItem in class FOEventHandler
      Parameters:
      li - ListItem that is starting.
    • endListItem

      public void endListItem(ListItem li)
      Overrides:
      endListItem in class FOEventHandler
      Parameters:
      li - ListItem that is ending.
    • startListLabel

      public void startListLabel(ListItemLabel listItemLabel)
      Process start of a ListLabel.
      Overrides:
      startListLabel in class FOEventHandler
      Parameters:
      listItemLabel - ListItemLabel that is starting
    • endListLabel

      public void endListLabel(ListItemLabel listItemLabel)
      Process end of a ListLabel.
      Overrides:
      endListLabel in class FOEventHandler
      Parameters:
      listItemLabel - ListItemLabel that is ending
    • startListBody

      public void startListBody(ListItemBody listItemBody)
      Process start of a ListBody.
      Overrides:
      startListBody in class FOEventHandler
      Parameters:
      listItemBody - ListItemBody that is starting
    • endListBody

      public void endListBody(ListItemBody listItemBody)
      Process end of a ListBody.
      Overrides:
      endListBody in class FOEventHandler
      Parameters:
      listItemBody - ListItemBody that is ending
    • startStatic

      public void startStatic(StaticContent staticContent)
      Process start of a Static.
      Overrides:
      startStatic in class FOEventHandler
      Parameters:
      staticContent - StaticContent that is starting
    • endStatic

      public void endStatic(StaticContent statisContent)
      Process end of a Static.
      Overrides:
      endStatic in class FOEventHandler
      Parameters:
      statisContent - StaticContent that is ending
    • startMarkup

      public void startMarkup()
      Process start of a Markup.
      Overrides:
      startMarkup in class FOEventHandler
    • endMarkup

      public void endMarkup()
      Process end of a Markup.
      Overrides:
      endMarkup in class FOEventHandler
    • startLink

      public void startLink(BasicLink basicLink)
      Process start of a Link.
      Overrides:
      startLink in class FOEventHandler
      Parameters:
      basicLink - BasicLink that is starting
    • endLink

      public void endLink(BasicLink basicLink)
      Process end of a Link.
      Overrides:
      endLink in class FOEventHandler
      Parameters:
      basicLink - BasicLink that is ending
    • image

      public void image(ExternalGraphic eg)
      Process an ExternalGraphic.
      Overrides:
      image in class FOEventHandler
      Parameters:
      eg - ExternalGraphic to process.
    • endInstreamForeignObject

      public void endInstreamForeignObject(InstreamForeignObject ifo)
      Process the end of an InstreamForeignObject.
      Overrides:
      endInstreamForeignObject in class FOEventHandler
      Parameters:
      ifo - InstreamForeignObject that is ending
    • putGraphic

      private void putGraphic(AbstractGraphics abstractGraphic, org.apache.xmlgraphics.image.loader.ImageInfo info) throws IOException
      Puts a graphic/image into the generated RTF file.
      Parameters:
      abstractGraphic - the graphic (external-graphic or instream-foreign-object)
      info - the image info object
      Throws:
      IOException - In case of an I/O error
    • putGraphic

      private void putGraphic(AbstractGraphics abstractGraphic, org.apache.xmlgraphics.image.loader.Image image) throws IOException
      Puts a graphic/image into the generated RTF file.
      Parameters:
      abstractGraphic - the graphic (external-graphic or instream-foreign-object)
      image - the image
      Throws:
      IOException - In case of an I/O error
    • pageRef

      public void pageRef()
      Process a pageRef.
      Overrides:
      pageRef in class FOEventHandler
    • startFootnote

      public void startFootnote(Footnote footnote)
      Process the start of a footnote.
      Overrides:
      startFootnote in class FOEventHandler
      Parameters:
      footnote - Footnote that is starting
    • endFootnote

      public void endFootnote(Footnote footnote)
      Process the ending of a footnote.
      Overrides:
      endFootnote in class FOEventHandler
      Parameters:
      footnote - Footnote that is ending
    • startFootnoteBody

      public void startFootnoteBody(FootnoteBody body)
      Process the start of a footnote body.
      Overrides:
      startFootnoteBody in class FOEventHandler
      Parameters:
      body - FootnoteBody that is starting
    • endFootnoteBody

      public void endFootnoteBody(FootnoteBody body)
      Process the ending of a footnote body.
      Overrides:
      endFootnoteBody in class FOEventHandler
      Parameters:
      body - FootnoteBody that is ending
    • startLeader

      public void startLeader(Leader l)
      Process the start of a Leader.
      Overrides:
      startLeader in class FOEventHandler
      Parameters:
      l - Leader that is starting
    • text

      public void text(FOText text, CharSequence characters)
      Parameters:
      text - FOText object
      characters - CharSequence of the characters to process.
    • startPageNumber

      public void startPageNumber(PageNumber pagenum)
      Overrides:
      startPageNumber in class FOEventHandler
      Parameters:
      pagenum - PageNumber that is starting.
    • endPageNumber

      public void endPageNumber(PageNumber pagenum)
      Overrides:
      endPageNumber in class FOEventHandler
      Parameters:
      pagenum - PageNumber that is ending.
    • startPageNumberCitation

      public void startPageNumberCitation(PageNumberCitation l)
      Overrides:
      startPageNumberCitation in class FOEventHandler
      Parameters:
      l - PageNumberCitation that is starting.
    • startPageNumberCitationLast

      public void startPageNumberCitationLast(PageNumberCitationLast l)
      Overrides:
      startPageNumberCitationLast in class FOEventHandler
      Parameters:
      l - PageNumberCitationLast that is starting.
    • prepareTable

      private void prepareTable(Table tab)
    • invokeDeferredEvent

      private void invokeDeferredEvent(FONode foNode, boolean bStart)
      Calls the appropriate event handler for the passed FObj.
      Parameters:
      foNode - FO node whose event is to be called
      bStart - TRUE calls the start handler, FALSE the end handler
    • endContainer

      public boolean endContainer(Class containerClass)
      Closes any mismatched tags that are detected in the RTF structure.
      Parameters:
      containerClass - The class representing the tag to close.
      Returns:
      Determines whether the tag mismatch has been handled.
    • recurseFONode

      private void recurseFONode(FONode foNode)
      Calls the event handlers for the passed FONode and all its elements.
      Parameters:
      foNode - FONode object which shall be recursed