Class 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 Detail

      • os

        private final java.io.OutputStream os
      • log

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

        private boolean bDefer
      • bPrevHeaderSpecified

        private boolean bPrevHeaderSpecified
      • bPrevFooterSpecified

        private boolean bPrevFooterSpecified
      • bHeaderSpecified

        private boolean bHeaderSpecified
      • bFooterSpecified

        private boolean bFooterSpecified
      • nestedTableDepth

        private int nestedTableDepth
      • FLAVORS

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

      • RTFHandler

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

      • handleIOTrouble

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

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

        public void endDocument()
                         throws org.xml.sax.SAXException
        This method is called to indicate the end of a document run.
        Overrides:
        endDocument in class FOEventHandler
        Throws:
        org.xml.sax.SAXException - In case of a problem
      • 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.
      • toRtfBreakValue

        private int toRtfBreakValue​(int foBreakValue)
      • startPart

        private void startPart​(TablePart part)
      • endPart

        private void endPart​(TablePart tb)
      • 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
      • 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
      • putGraphic

        private void putGraphic​(AbstractGraphics abstractGraphic,
                                org.apache.xmlgraphics.image.loader.ImageInfo info)
                         throws java.io.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:
        java.io.IOException - In case of an I/O error
      • putGraphic

        private void putGraphic​(AbstractGraphics abstractGraphic,
                                org.apache.xmlgraphics.image.loader.Image image)
                         throws java.io.IOException
        Puts a graphic/image into the generated RTF file.
        Parameters:
        abstractGraphic - the graphic (external-graphic or instream-foreign-object)
        image - the image
        Throws:
        java.io.IOException - In case of an I/O error
      • 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,
                         java.lang.CharSequence characters)
        Parameters:
        text - FOText object
        characters - CharSequence of the characters to process.
      • 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​(java.lang.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