com.lowagie.text.rtf.parser.destinations

## Class RtfDestination

- java.lang.Object
- - com.lowagie.text.rtf.parser.destinations.RtfDestination

Direct Known Subclasses:
  RtfDestinationColorTable, RtfDestinationDocument, RtfDestinationFontTable, RtfDestinationInfo, RtfDestinationListTable, RtfDestinationNull, RtfDestinationShppict, RtfDestinationStylesheetTable

    public abstract class RtfDestination
    extends java.lang.Object

`RtfDestination` is the base class for destinations according to the RTF Specification. All destinations must extend from this class.

Since:
  2.0.8
Author:
  Howard Shank (hgshank@yahoo.com

### Field Summary

Fields
`protected RtfCtrlWordData` `lastCtrlWord` The last control word handled by this destination
`private static java.util.ArrayList` `listeners` The `RtfDestinationListener`.
`protected boolean` `modified` Is data in destination modified?
`protected RtfParser` `rtfParser` Parser object

### Constructor Summary

Constructors
Constructor and Description
`RtfDestination()` Constructor.
`RtfDestination(RtfParser parser)` Constructor

### Method Summary

Methods
`boolean` `addListener(RtfDestinationListener listener)` Adds a `RtfDestinationListener` to the `RtfDestinationMgr`.
`protected int` `afterCharacter(int ch)`
`protected RtfCtrlWordData` `afterCtrlWord(RtfCtrlWordData ctrlWordData)`
`protected int` `beforeCharacter(int ch)`
`protected RtfCtrlWordData` `beforeCtrlWord(RtfCtrlWordData ctrlWordData)`
`abstract boolean` `closeDestination()` Clean up when destination is closed.
`int` `getNewTokeniserState()`
`abstract boolean` `handleCharacter(int ch)` Handle text for this destination
`abstract boolean` `handleCloseGroup()` Clean up when group is closed.
`abstract boolean` `handleControlWord(RtfCtrlWordData ctrlWordData)` Handle control word for this destination
`abstract boolean` `handleOpenGroup()` Setup when group is opened.
`abstract boolean` `handleOpeningSubGroup()` Handle a new subgroup contained within this group
`boolean` `isModified()` Method to indicate if data in this destination has changed.
`protected int` `onCharacter(int ch)`
`protected boolean` `onCloseGroup()`
`protected RtfCtrlWordData` `onCtrlWord(RtfCtrlWordData ctrlWordData)`
`protected boolean` `onOpenGroup()`
`boolean` `removeListener(RtfDestinationListener listener)` Removes a `RtfDestinationListener` from the `RtfDestinationMgr`.
`void` `setParser(RtfParser parser)` Set the parser to use with the RtfDestination object.
`abstract void` `setToDefaults()` Method to set this object to the default values.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### rtfParser

    protected RtfParser rtfParser

Parser object

#### modified

    protected boolean modified

Is data in destination modified?

#### lastCtrlWord

    protected RtfCtrlWordData lastCtrlWord

The last control word handled by this destination

#### listeners

    private static java.util.ArrayList listeners

The `RtfDestinationListener`.

### Constructor Detail

#### RtfDestination

    public RtfDestination()

Constructor.

#### RtfDestination

    public RtfDestination(RtfParser parser)

Constructor

Parameters:
  `parser` - `RtfParser` object.

### Method Detail

#### setParser

    public void setParser(RtfParser parser)

Set the parser to use with the RtfDestination object.

Parameters:
  `parser` - The RtfParser object.

#### closeDestination

    public abstract boolean closeDestination()

Clean up when destination is closed.

Returns:
  true if handled, false if not handled

#### handleOpeningSubGroup

    public abstract boolean handleOpeningSubGroup()

Handle a new subgroup contained within this group

Returns:
  true if handled, false if not handled

#### handleCloseGroup

    public abstract boolean handleCloseGroup()

Clean up when group is closed.

Returns:
  true if handled, false if not handled

#### handleOpenGroup

    public abstract boolean handleOpenGroup()

Setup when group is opened.

Returns:
  true if handled, false if not handled

#### handleCharacter

    public abstract boolean handleCharacter(int ch)

Handle text for this destination

Returns:
  true if handled, false if not handled

#### handleControlWord

    public abstract boolean handleControlWord(RtfCtrlWordData ctrlWordData)

Handle control word for this destination

Parameters:
  `ctrlWordData` - The control word and parameter information object
Returns:
  true if handled, false if not handled

#### setToDefaults

    public abstract void setToDefaults()

Method to set this object to the default values. Must be implemented in child class.

#### isModified

    public boolean isModified()

Method to indicate if data in this destination has changed.

Returns:
  true if modified, false if not modified.

#### addListener

    public boolean addListener(RtfDestinationListener listener)

Adds a `RtfDestinationListener` to the `RtfDestinationMgr`.

Parameters:
  `listener` - the new RtfDestinationListener.

#### removeListener

    public boolean removeListener(RtfDestinationListener listener)

Removes a `RtfDestinationListener` from the `RtfDestinationMgr`.

Parameters:
  `listener` - the RtfCtrlWordListener that has to be removed.

#### beforeCtrlWord

    protected RtfCtrlWordData beforeCtrlWord(RtfCtrlWordData ctrlWordData)

#### onCtrlWord

    protected RtfCtrlWordData onCtrlWord(RtfCtrlWordData ctrlWordData)

#### afterCtrlWord

    protected RtfCtrlWordData afterCtrlWord(RtfCtrlWordData ctrlWordData)

#### beforeCharacter

    protected int beforeCharacter(int ch)

#### onCharacter

    protected int onCharacter(int ch)

#### afterCharacter

    protected int afterCharacter(int ch)

#### onOpenGroup

    protected boolean onOpenGroup()

Returns:
  true if all goes well

#### onCloseGroup

    protected boolean onCloseGroup()

Returns:
  true if all goes well

#### getNewTokeniserState

    public int getNewTokeniserState()