net.sourceforge.rtf.handler
Class RTFDocumentHandler

java.lang.Object
  extended by net.sourceforge.rtf.parser.AbstractCoreRTFParser
      extended by net.sourceforge.rtf.parser.AbstractDefaultRTFParser
          extended by net.sourceforge.rtf.handler.RTFDocumentHandler
All Implemented Interfaces:
IRTFDocumentParser

public class RTFDocumentHandler
extends AbstractDefaultRTFParser
implements IRTFDocumentParser

RTF handler which implement AbstractDefaultRTFParser to create RTFDocument element RTF of RTF stream source.

Version:
1.0.0
Author:
Angelo ZERR
See Also:
RTFDocument

Constructor Summary
RTFDocumentHandler()
           
 
Method Summary
protected  void endBookmark(java.lang.String content)
          Implement endBookmark to end RTF bookmark element
protected  void endField()
          End field, compute name of field and update current RTF element to parent of field/
protected  void endGroup(char endGroupCharacter, int level)
          Implement endGroup event to add end group character to last row, last bookmark... parsed otherwise into current RTF element.
protected  void endRow(java.lang.String content)
          Implement endRow to end RTF row element into current RTF element parsed.
protected  void endUserProperty(java.lang.String content)
          Event end user property.
 RTFDocument getRTFDocument()
          Return RTFDocument populated by RTF handler.
protected  void handleText(java.lang.String content)
          Implement handleText to add RTF content (different of RTF keyword) into current RTF element.
protected  void inTable(java.lang.String content)
          Implement inTable - if currentElement is not row, then put it and the preceeding text from the last element to a new row, and set it as current element.
protected  void startBookmark(java.lang.String content)
          Implement startBookmark to start and add RTF bookmark element into current RTF element parsed.
protected  void startField(java.lang.String content)
          Implement startField to start and add RTF field element into current RTF element parsed.
protected  void startGroup(char startGroupCharacter, int level)
          Implement startGroup event to create RTF root element RTFDocument on first level and store start group character.
protected  void startPage(java.lang.String content)
          Implement startPage to start and add RTF page break element into current RTF element parsed.
protected  void startRow(java.lang.String content)
          Implement startRow to start and add RTF row element into current RTF element parsed.
protected  void startUserProperty(java.lang.String content)
          Event start user property.
 
Methods inherited from class net.sourceforge.rtf.parser.AbstractDefaultRTFParser
handleKeyword
 
Methods inherited from class net.sourceforge.rtf.parser.AbstractCoreRTFParser
getLevel, parse, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.rtf.IRTFDocumentParser
parse, parse
 

Constructor Detail

RTFDocumentHandler

public RTFDocumentHandler()
Method Detail

startGroup

protected void startGroup(char startGroupCharacter,
                          int level)
                   throws java.io.IOException
Implement startGroup event to create RTF root element RTFDocument on first level and store start group character.

Specified by:
startGroup in class AbstractCoreRTFParser
Parameters:
startGroupCharacter - start group character {.
level - of current group.
Throws:
java.io.IOException

endGroup

protected void endGroup(char endGroupCharacter,
                        int level)
                 throws java.io.IOException
Implement endGroup event to add end group character to last row, last bookmark... parsed otherwise into current RTF element.

Specified by:
endGroup in class AbstractCoreRTFParser
Parameters:
endGroupCharacter - end group character }.
level - of current group.
Throws:
java.io.IOException

startRow

protected void startRow(java.lang.String content)
                 throws java.io.IOException
Implement startRow to start and add RTF row element into current RTF element parsed.

Specified by:
startRow in class AbstractDefaultRTFParser
Parameters:
content - RTF start row keyword \trowd.
Throws:
java.io.IOException

endRow

protected void endRow(java.lang.String content)
               throws java.io.IOException
Implement endRow to end RTF row element into current RTF element parsed.

Specified by:
endRow in class AbstractDefaultRTFParser
Parameters:
content - RTF end row keyword \row.
Throws:
java.io.IOException

inTable

protected void inTable(java.lang.String content)
                throws java.io.IOException
Implement inTable - if currentElement is not row, then put it and the preceeding text from the last element to a new row, and set it as current element.

Specified by:
inTable in class AbstractDefaultRTFParser
Parameters:
content - RTF in table keyword \intbl
Throws:
java.io.IOException

startField

protected void startField(java.lang.String content)
                   throws java.io.IOException
Implement startField to start and add RTF field element into current RTF element parsed.

Specified by:
startField in class AbstractDefaultRTFParser
Parameters:
content - RTF start field keyword \field.
Throws:
java.io.IOException

endField

protected void endField()
                 throws java.io.IOException
End field, compute name of field and update current RTF element to parent of field/

Throws:
java.io.IOException

startBookmark

protected void startBookmark(java.lang.String content)
                      throws java.io.IOException
Implement startBookmark to start and add RTF bookmark element into current RTF element parsed.

Specified by:
startBookmark in class AbstractDefaultRTFParser
Parameters:
content - RTF start bookmark keyword \bkmstart.
Throws:
java.io.IOException

endBookmark

protected void endBookmark(java.lang.String content)
                    throws java.io.IOException
Implement endBookmark to end RTF bookmark element

Specified by:
endBookmark in class AbstractDefaultRTFParser
Parameters:
content - RTF end bookmark keyword \bkmend.
Throws:
java.io.IOException

startPage

protected void startPage(java.lang.String content)
                  throws java.io.IOException
Implement startPage to start and add RTF page break element into current RTF element parsed.

Specified by:
startPage in class AbstractDefaultRTFParser
Parameters:
content - RTF start page keyword \page.
Throws:
java.io.IOException

startUserProperty

protected void startUserProperty(java.lang.String content)
                          throws java.io.IOException
Description copied from class: AbstractDefaultRTFParser
Event start user property. This event is launched when RTF keyword \propname is found.

Specified by:
startUserProperty in class AbstractDefaultRTFParser
Parameters:
content - RTF start user property keyword \propname.
Throws:
java.io.IOException

endUserProperty

protected void endUserProperty(java.lang.String content)
                        throws java.io.IOException
Description copied from class: AbstractDefaultRTFParser
Event end user property. This event is launched when RTF keyword \staticval is found.

Specified by:
endUserProperty in class AbstractDefaultRTFParser
Parameters:
content - RTF end user property keyword \staticval.
Throws:
java.io.IOException

handleText

protected void handleText(java.lang.String content)
                   throws java.io.IOException
Implement handleText to add RTF content (different of RTF keyword) into current RTF element.

Specified by:
handleText in class AbstractDefaultRTFParser
Parameters:
content - RTF code.
Throws:
java.io.IOException

getRTFDocument

public RTFDocument getRTFDocument()
Return RTFDocument populated by RTF handler.

Specified by:
getRTFDocument in interface IRTFDocumentParser
Returns:


Copyright 2007 null. All Rights Reserved.