Class RtfCtrlWordHandler
- java.lang.Object
-
- com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordHandler
-
- All Implemented Interfaces:
java.lang.Cloneable
public class RtfCtrlWordHandler extends java.lang.Object implements java.lang.CloneableRtfCtrlWordBaseis the base class for all control word handlers to extend from.- Since:
- 2.0.8
- Author:
- Howard Shank (hgshank@yahoo.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringctrlWordThe control word for this class.protected RtfCtrlWordDatactrlWordDataThe control word as parsed by the parser.protected java.lang.StringctrlWordPrefixThe prefix for all control words.protected java.lang.StringctrlWordSuffixThe prefix for all control words.protected intctrlWordTypeControl Word type.protected intdefaultParameterValueThe default value for this control word.protected java.lang.StringgroupPrefixString containing the value of "{" or "" (blank) depending on if this is the first control word in a group.protected booleanpassDefaultParameterValueDoes this control word use the default value?protected RtfParserrtfParserLocal variable referencing the parser object.protected floatrtfVersionSupportedWhat version of the RTF spec the control word was introduced.protected java.lang.StringspecialHandlerClass, property, etc.
-
Constructor Summary
Constructors Constructor Description RtfCtrlWordHandler(RtfParser rtfParser, java.lang.String ctrlWord, int defaultParameterValue, boolean passDefaultParameterValue, int ctrlWordType, java.lang.String prefix, java.lang.String suffix, java.lang.String specialHandler)Constructor:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanafterControlWord()Post-processing after the control word.protected booleanbeforeControlWord()Pre-processing before the control word.booleanhandleControlword(RtfCtrlWordData ctrlWordDataIn)The primary control word handler method.protected booleanonControlWord()Handle the control word.
-
-
-
Field Detail
-
rtfParser
protected RtfParser rtfParser
Local variable referencing the parser object.- Since:
- 2.0.8
-
ctrlWord
protected java.lang.String ctrlWord
The control word for this class.- Since:
- 2.0.8
-
defaultParameterValue
protected int defaultParameterValue
The default value for this control word. Not all control words use a default parameter value.- Since:
- 2.0.8
-
passDefaultParameterValue
protected boolean passDefaultParameterValue
Does this control word use the default value?- Since:
- 2.0.8
-
ctrlWordType
protected int ctrlWordType
Control Word type. Destination, toggle, value, etc.- Since:
- 2.0.8
-
specialHandler
protected java.lang.String specialHandler
Class, property, etc.- Since:
- 2.0.8
-
rtfVersionSupported
protected float rtfVersionSupported
What version of the RTF spec the control word was introduced.- Since:
- 2.0.8
-
ctrlWordData
protected RtfCtrlWordData ctrlWordData
The control word as parsed by the parser.- Since:
- 2.0.8
-
groupPrefix
protected java.lang.String groupPrefix
String containing the value of "{" or "" (blank) depending on if this is the first control word in a group.- Since:
- 2.0.8
-
ctrlWordPrefix
protected java.lang.String ctrlWordPrefix
The prefix for all control words.- Since:
- 2.0.8
-
ctrlWordSuffix
protected java.lang.String ctrlWordSuffix
The prefix for all control words.- Since:
- 2.0.8
-
-
Constructor Detail
-
RtfCtrlWordHandler
public RtfCtrlWordHandler(RtfParser rtfParser, java.lang.String ctrlWord, int defaultParameterValue, boolean passDefaultParameterValue, int ctrlWordType, java.lang.String prefix, java.lang.String suffix, java.lang.String specialHandler)
Constructor:- Parameters:
rtfParser- The parser for this control word.ctrlWord- The string value of this control word.defaultParameterValue- The default value of this control word. Not all control words have values.passDefaultParameterValue- Flag indicating if this control word should use the default value.ctrlWordType- Indicator of the type of control word this is. DESTINATION|DESTINATION_EX|VALUE|FLAG|TOGGLE|SYMBOLprefix- String to prefix the ctrl word with. "\" or "\*\" are the 2 used values.suffix- String to add as suffix to the ctrl word. " " and "" are the 2 used values.specialHandler- If TOGGLE then the property name as String (propertyGroup.propertyName format ex. "character.bold") If FLAG then the property name as String (propertyGroup.propertyName format ex. "character.bold") If VALUE then the property name as String (propertyGroup.propertyName format ex. "character.bold") If SYMBOL then the character to use for substitution as String If DESTINATION|DESTINATION_EX then the RtfDestination class name as String- Since:
- 2.0.8
-
-
Method Detail
-
handleControlword
public final boolean handleControlword(RtfCtrlWordData ctrlWordDataIn)
The primary control word handler method. Called by the parser once it has a control word and parameter if applicable.- Parameters:
ctrlWordDataIn- The control word and associated parameter if applicable.- Returns:
trueorfalseif the control word was handled.- Since:
- 2.0.8
-
beforeControlWord
protected boolean beforeControlWord()
Pre-processing before the control word. If return value is true, no further processing will be performed on this control word.- Returns:
false= stop processing,true= continue processing- Since:
- 2.0.8
-
onControlWord
protected boolean onControlWord()
Handle the control word.- Returns:
trueif control word was handled,falseif it was not handled.- Since:
- 2.0.8
-
afterControlWord
protected boolean afterControlWord()
Post-processing after the control word.- Returns:
false= stop processing,true= continue processing- Since:
- 2.0.8
-
-