Package net.sf.okapi.filters.rtf
Class RTFFilter
- java.lang.Object
-
- net.sf.okapi.filters.rtf.RTFFilter
-
-
Field Summary
Fields Modifier and Type Field Description static intCW_AFTNSEPstatic intCW_AFTNSEPCstatic intCW_ANNOTATIONstatic intCW_ANSIstatic intCW_ANSICPGstatic intCW_BKMKENDstatic intCW_BKMKSTARTstatic intCW_BULLETstatic intCW_CCHSstatic intCW_CELLstatic intCW_COLORTBLstatic intCW_CPGstatic intCW_CSstatic intCW_DELETEDstatic intCW_EMDASHstatic intCW_ENDASHstatic intCW_Fstatic intCW_FCHARSETstatic intCW_FLDINSTstatic intCW_FONTTBLstatic intCW_FOOTNOTEstatic intCW_FTNSEPstatic intCW_FTNSEPCstatic intCW_INDEXSEPstatic intCW_INFOstatic intCW_LDBLQUOTEstatic intCW_LINEstatic intCW_LQUOTEstatic intCW_LTRMARKstatic intCW_MACstatic intCW_NONSHPPICTstatic intCW_PAGEstatic intCW_PARstatic intCW_PARDstatic intCW_PCstatic intCW_PCAstatic intCW_PICTstatic intCW_PLAINstatic intCW_RDBLQUOTEstatic intCW_ROWstatic intCW_RQUOTEstatic intCW_RTFstatic intCW_RTLMARKstatic intCW_SHPTXTstatic intCW_SPECIALstatic intCW_STYLESHEETstatic intCW_TABstatic intCW_TITLEstatic intCW_TROWDstatic intCW_Ustatic intCW_UCstatic intCW_ULstatic intCW_ULDBstatic intCW_Vstatic intCW_XEstatic intCW_XMLOPENstatic intCW_ZWJstatic intCW_ZWNJstatic StringPROP_HASHIDDENTEXTstatic intTOKEN_CHARstatic intTOKEN_CTRLWORDstatic intTOKEN_ENDGROUPstatic intTOKEN_ENDINPUTstatic intTOKEN_STARTGROUP-
Fields inherited from interface net.sf.okapi.common.filters.IFilter
SUB_FILTER
-
-
Constructor Summary
Constructors Constructor Description RTFFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the current process.voidclose()Closes the input document.IFilterWritercreateFilterWriter()Creates a new IFilterWriter object from the most appropriate class to use with this filter.ISkeletonWritercreateSkeletonWriter()Creates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.List<FilterConfiguration>getConfigurations()Gets the list of all predefined configurations for this filter.StringgetDisplayName()Gets the localizable display name of this filter.EncoderManagergetEncoderManager()Gets the EncoderManager object for this filter.StringgetMimeType()Gets the MIME type of the format supported by this filter.StringgetName()Gets the name/identifier of this filter.IParametersgetParameters()Gets the current parameters for this filter.booleangetSegment(ITextUnit tu)intgetTextUntil(StringBuilder text, int cwCode, int errorCwCode)Gets the text content until a specified condition is reached.booleanhasNext()Indicates if there is an event to process.Eventnext()Gets the next event available.voidopen(RawDocument input)Opens the input document described in a give RawDocument object.voidopen(RawDocument input, boolean generateSkeleton)Opens the input document described in a give RawDocument object, and optionally creates skeleton information.voidparseNext()voidsetFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)Sets the filter configuration mapper for this filter.voidsetParameters(IParameters params)Sets new parameters for this filter.voidsetStripWSBeforeTextStart(boolean value)Set this option (for each input) to stripp any white spaces before any text (e.g.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.filters.IFilter
isMultilingual, stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Field Detail
-
PROP_HASHIDDENTEXT
public static final String PROP_HASHIDDENTEXT
- See Also:
- Constant Field Values
-
TOKEN_CHAR
public static final int TOKEN_CHAR
- See Also:
- Constant Field Values
-
TOKEN_STARTGROUP
public static final int TOKEN_STARTGROUP
- See Also:
- Constant Field Values
-
TOKEN_ENDGROUP
public static final int TOKEN_ENDGROUP
- See Also:
- Constant Field Values
-
TOKEN_ENDINPUT
public static final int TOKEN_ENDINPUT
- See Also:
- Constant Field Values
-
TOKEN_CTRLWORD
public static final int TOKEN_CTRLWORD
- See Also:
- Constant Field Values
-
CW_ANSI
public static final int CW_ANSI
- See Also:
- Constant Field Values
-
CW_F
public static final int CW_F
- See Also:
- Constant Field Values
-
CW_U
public static final int CW_U
- See Also:
- Constant Field Values
-
CW_ANSICPG
public static final int CW_ANSICPG
- See Also:
- Constant Field Values
-
CW_LQUOTE
public static final int CW_LQUOTE
- See Also:
- Constant Field Values
-
CW_RQUOTE
public static final int CW_RQUOTE
- See Also:
- Constant Field Values
-
CW_LDBLQUOTE
public static final int CW_LDBLQUOTE
- See Also:
- Constant Field Values
-
CW_RDBLQUOTE
public static final int CW_RDBLQUOTE
- See Also:
- Constant Field Values
-
CW_BULLET
public static final int CW_BULLET
- See Also:
- Constant Field Values
-
CW_ENDASH
public static final int CW_ENDASH
- See Also:
- Constant Field Values
-
CW_EMDASH
public static final int CW_EMDASH
- See Also:
- Constant Field Values
-
CW_ZWJ
public static final int CW_ZWJ
- See Also:
- Constant Field Values
-
CW_ZWNJ
public static final int CW_ZWNJ
- See Also:
- Constant Field Values
-
CW_LTRMARK
public static final int CW_LTRMARK
- See Also:
- Constant Field Values
-
CW_RTLMARK
public static final int CW_RTLMARK
- See Also:
- Constant Field Values
-
CW_UC
public static final int CW_UC
- See Also:
- Constant Field Values
-
CW_CPG
public static final int CW_CPG
- See Also:
- Constant Field Values
-
CW_FONTTBL
public static final int CW_FONTTBL
- See Also:
- Constant Field Values
-
CW_FCHARSET
public static final int CW_FCHARSET
- See Also:
- Constant Field Values
-
CW_PAR
public static final int CW_PAR
- See Also:
- Constant Field Values
-
CW_PAGE
public static final int CW_PAGE
- See Also:
- Constant Field Values
-
CW_STYLESHEET
public static final int CW_STYLESHEET
- See Also:
- Constant Field Values
-
CW_COLORTBL
public static final int CW_COLORTBL
- See Also:
- Constant Field Values
-
CW_SPECIAL
public static final int CW_SPECIAL
- See Also:
- Constant Field Values
-
CW_FOOTNOTE
public static final int CW_FOOTNOTE
- See Also:
- Constant Field Values
-
CW_TAB
public static final int CW_TAB
- See Also:
- Constant Field Values
-
CW_V
public static final int CW_V
- See Also:
- Constant Field Values
-
CW_XE
public static final int CW_XE
- See Also:
- Constant Field Values
-
CW_CCHS
public static final int CW_CCHS
- See Also:
- Constant Field Values
-
CW_PICT
public static final int CW_PICT
- See Also:
- Constant Field Values
-
CW_SHPTXT
public static final int CW_SHPTXT
- See Also:
- Constant Field Values
-
CW_LINE
public static final int CW_LINE
- See Also:
- Constant Field Values
-
CW_INDEXSEP
public static final int CW_INDEXSEP
- See Also:
- Constant Field Values
-
CW_ULDB
public static final int CW_ULDB
- See Also:
- Constant Field Values
-
CW_TITLE
public static final int CW_TITLE
- See Also:
- Constant Field Values
-
CW_TROWD
public static final int CW_TROWD
- See Also:
- Constant Field Values
-
CW_CELL
public static final int CW_CELL
- See Also:
- Constant Field Values
-
CW_BKMKSTART
public static final int CW_BKMKSTART
- See Also:
- Constant Field Values
-
CW_ROW
public static final int CW_ROW
- See Also:
- Constant Field Values
-
CW_UL
public static final int CW_UL
- See Also:
- Constant Field Values
-
CW_PARD
public static final int CW_PARD
- See Also:
- Constant Field Values
-
CW_NONSHPPICT
public static final int CW_NONSHPPICT
- See Also:
- Constant Field Values
-
CW_INFO
public static final int CW_INFO
- See Also:
- Constant Field Values
-
CW_CS
public static final int CW_CS
- See Also:
- Constant Field Values
-
CW_DELETED
public static final int CW_DELETED
- See Also:
- Constant Field Values
-
CW_PLAIN
public static final int CW_PLAIN
- See Also:
- Constant Field Values
-
CW_BKMKEND
public static final int CW_BKMKEND
- See Also:
- Constant Field Values
-
CW_ANNOTATION
public static final int CW_ANNOTATION
- See Also:
- Constant Field Values
-
CW_MAC
public static final int CW_MAC
- See Also:
- Constant Field Values
-
CW_PC
public static final int CW_PC
- See Also:
- Constant Field Values
-
CW_PCA
public static final int CW_PCA
- See Also:
- Constant Field Values
-
CW_FTNSEP
public static final int CW_FTNSEP
- See Also:
- Constant Field Values
-
CW_FTNSEPC
public static final int CW_FTNSEPC
- See Also:
- Constant Field Values
-
CW_AFTNSEP
public static final int CW_AFTNSEP
- See Also:
- Constant Field Values
-
CW_AFTNSEPC
public static final int CW_AFTNSEPC
- See Also:
- Constant Field Values
-
CW_RTF
public static final int CW_RTF
- See Also:
- Constant Field Values
-
CW_FLDINST
public static final int CW_FLDINST
- See Also:
- Constant Field Values
-
CW_XMLOPEN
public static final int CW_XMLOPEN
- See Also:
- Constant Field Values
-
-
Method Detail
-
cancel
public void cancel()
Description copied from interface:IFilterCancels the current process.
-
close
public void close()
Description copied from interface:IFilterCloses the input document. Developers should call this method from within their code before sending the last event: This can allow writer objects to overwrite the input file when they receive the last event. This method must also be safe to call even if the input document is not opened.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIFilter
-
getName
public String getName()
Description copied from interface:IFilterGets the name/identifier of this filter.
-
getDisplayName
public String getDisplayName()
Description copied from interface:IFilterGets the localizable display name of this filter.- Specified by:
getDisplayNamein interfaceIFilter- Returns:
- the localizable display name of this filter.
-
getMimeType
public String getMimeType()
Description copied from interface:IFilterGets the MIME type of the format supported by this filter.- Specified by:
getMimeTypein interfaceIFilter- Returns:
- The MIME type of the format supported by this filter.
-
getConfigurations
public List<FilterConfiguration> getConfigurations()
Description copied from interface:IFilterGets the list of all predefined configurations for this filter.- Specified by:
getConfigurationsin interfaceIFilter- Returns:
- a list of the all predefined configurations for this filter.
-
setStripWSBeforeTextStart
public void setStripWSBeforeTextStart(boolean value)
Set this option (for each input) to stripp any white spaces before any text (e.g. the XML declaration).- Parameters:
value- true to strip, false to behave normally.
-
getEncoderManager
public EncoderManager getEncoderManager()
Description copied from interface:IFilterGets the EncoderManager object for this filter. This encoder manager should provided the mappings to the different MIME types used by the filter.- Specified by:
getEncoderManagerin interfaceIFilter- Returns:
- the EncoderManager for this filter.
-
getParameters
public IParameters getParameters()
Description copied from interface:IFilterGets the current parameters for this filter.- Specified by:
getParametersin interfaceIFilter- Returns:
- The current parameters for this filter, or
DefaultParametersif this filter has no parameters.
-
hasNext
public boolean hasNext()
Description copied from interface:IFilterIndicates if there is an event to process.Implementer Note: The caller must be able to call this method several times without changing state.
-
next
public Event next()
Description copied from interface:IFilterGets the next event available. Calling this method can be done only once on each event.
-
parseNext
public void parseNext()
-
open
public void open(RawDocument input)
Description copied from interface:IFilterOpens the input document described in a give RawDocument object. Skeleton information is always created when you use this method.
-
open
public void open(RawDocument input, boolean generateSkeleton)
Description copied from interface:IFilterOpens the input document described in a give RawDocument object, and optionally creates skeleton information.
-
setFilterConfigurationMapper
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
Description copied from interface:IFilterSets the filter configuration mapper for this filter. This object is used by this filter if it needs to instantiate sub-filters. The implementations of IFilter that do not use sub-filters can use an empty stub for this method.- Specified by:
setFilterConfigurationMapperin interfaceIFilter- Parameters:
fcMapper- the mapper to set.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilterSets new parameters for this filter.- Specified by:
setParametersin interfaceIFilter- Parameters:
params- The new parameters to use.
-
createSkeletonWriter
public ISkeletonWriter createSkeletonWriter()
Description copied from interface:IFilterCreates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.- Specified by:
createSkeletonWriterin interfaceIFilter- Returns:
- A new instance of ISkeletonWriter for the type of skeleton this filter uses.
-
createFilterWriter
public IFilterWriter createFilterWriter()
Description copied from interface:IFilterCreates a new IFilterWriter object from the most appropriate class to use with this filter.- Specified by:
createFilterWriterin interfaceIFilter- Returns:
- A new instance of IFilterWriter for the preferred implementation for this filter.
-
getSegment
public boolean getSegment(ITextUnit tu)
-
getTextUntil
public int getTextUntil(StringBuilder text, int cwCode, int errorCwCode)
Gets the text content until a specified condition is reached.- Parameters:
cwCode- the control word to stop on. Use -1 for either CW_PAR or CW_LINE.errorCwCode- the control word to stop on and return an error. Use 0 for none.- Returns:
- 0: OK, 1: error, 2: stop was due to no more text
-
-