Package com.scroogexhtml.converter
Class AbstractWriter
java.lang.Object
com.scroogexhtml.converter.AbstractWriter
- All Implemented Interfaces:
BorderPropertiesWriter
,CharacterPropertiesWriter
,DocumentWriter
,FieldWriter
,FootnoteWriter
,HeaderFooterWriter
,PageSetupWriter
,ParagraphPropertiesWriter
,TableStateWriter
,Writer
- Direct Known Subclasses:
XMLDOMWriter
The AbstractWriter class holds the Writer state.
It provides methods which are not DOM specific.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an anchor to the current document.void
void
Ends the current footnote.void
Starts a footnote.Retrieves the CharacterProperties object that represents the current state data of the Writer.Returns the default font name of the Writer.Retrieves the ParagraphProperties object that represents the current state data of the Writer.char
intToChar
(int value) boolean
Check if the writer is currently in a footnote.void
popCharacterProperties
(CharacterProperties newCharProps) void
Get last paragraph properties from stack.void
Will be called for \plain RTF token.void
Reset the paragraph attributes to default values.void
setAlignment
(Alignment newValue) Sets the alignment for the paragraph.void
setBGColor
(String newValue) Sets the background color for the character properties.void
setBold
(boolean newValue) Sets the bold attribute.void
setBorderColor
(String value) Sets the border color for the paragraph or table.void
setBorderStyle
(BorderStyle value) Sets the border style for the paragraph or table.void
setBorderWidth
(int value) Sets the width of the border.void
setDefaultFont
(FontDescriptor newValue) void
setFirstIndent
(int newValue) Sets the first-line indentation of the paragraph.void
setFontCharSet
(int newValue) Sets the font character set for the character properties.void
setFontColor
(String newValue) Sets the font color for the character properties.void
setFontName
(String newValue) Sets the font name for the character properties.void
setFontSize
(int newValue) Sets the font size in half-points for the character properties.void
setHidden
(boolean newValue) Sets the hidden attribute of the character properties.void
setHLColor
(String newValue) Sets the highlight color for the character properties.void
setItalic
(boolean newValue) Sets the italic attribute of the character properties.void
setItap
(byte newValue) Sets the value of the "Itap" property.void
setLanguage
(String newValue) Sets the language for the character properties.void
setLeftIndent
(int newValue) Set the left indent of the paragraph.void
setLeftMargin
(int paramValue) Sets the left margin of the page.void
setNodeCharset
(int paramValue) void
setPaperWidth
(int paramValue) Sets the width of the paper for page setup.void
setParagraphBackgroundColor
(String newValue) Sets the background color of the paragraph.void
Sets the border for the paragraph.void
setParagraphInTable
(boolean value) Sets the flag indicating whether the paragraph is inside a table or not.void
setRightIndent
(int newValue) Sets the right indent for the paragraph.void
setRightMargin
(int paramValue) Sets the right margin of the page.void
setRightToLeftChar
(boolean newValue) Sets the right-to-left character property.void
setRightToLeftPar
(boolean newValue) Sets the right-to-left paragraph property.void
setSpaceAfter
(int value) Sets the space after the paragraph.void
setSpaceBefore
(int newValue) Sets the space before the paragraph.void
setStrike
(boolean newValue) Sets the strike attribute of the character properties.void
Sets the subscript attribute of the character properties.void
setSubscript
(boolean newValue) Sets the subscript attribute of the character properties.void
Sets the superscript attribute of the character properties.void
setSuperscript
(boolean newValue) Sets the superscript attribute of the character properties.void
setUnderline
(boolean newValue) Sets the underline attribute of the character properties.void
writeChar
(char value) Append a character to the document.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.scroogexhtml.converter.DocumentWriter
add, add, addLinebreak, getResult, writeEof, writeTab
Methods inherited from interface com.scroogexhtml.converter.FieldWriter
finishField, finishFldInst, finishFldRslt, getCurrentFieldExpression, setFieldExpression
Methods inherited from interface com.scroogexhtml.converter.FootnoteWriter
addAutoFootnoteRef
Methods inherited from interface com.scroogexhtml.converter.HeaderFooterWriter
footerEnd, footerStart, headerEnd, headerStart
Methods inherited from interface com.scroogexhtml.converter.TableStateWriter
nestedTableCellEnds, nestedTableRowEnds, tableCellEnds
Methods inherited from interface com.scroogexhtml.converter.Writer
addPicture, applyParagraphProperties, applyTextProperties, getTableWriter, setListLevel, setListOverrideIndex, setNumberingLevel, setNumberingStyle
-
Method Details
-
setStrike
public void setStrike(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the strike attribute of the character properties.- Specified by:
setStrike
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- true to set the character properties as strike-through, false otherwise
-
setAlignment
Description copied from interface:ParagraphPropertiesWriter
Sets the alignment for the paragraph.The alignment can be one of the following values: ALIGN_LEFT - Aligns the paragraph to the left. ALIGN_CENTER - Centers the paragraph. ALIGN_RIGHT - Aligns the paragraph to the right. ALIGN_JUSTIFIED - Justifies the paragraph.
- Specified by:
setAlignment
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the Alignment value to set for the paragraph
-
setBGColor
Description copied from interface:CharacterPropertiesWriter
Sets the background color for the character properties.- Specified by:
setBGColor
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new background color value
-
setBold
public void setBold(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the bold attribute.- Specified by:
setBold
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new value for the bold attribute
-
setFirstIndent
public void setFirstIndent(int newValue) Description copied from interface:ParagraphPropertiesWriter
Sets the first-line indentation of the paragraph.- Specified by:
setFirstIndent
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the value of the first-line indentation
-
setFontColor
Description copied from interface:CharacterPropertiesWriter
Sets the font color for the character properties.- Specified by:
setFontColor
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new font color value
-
setUnderline
public void setUnderline(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the underline attribute of the character properties.- Specified by:
setUnderline
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- true to set the character properties as underline, false otherwise
-
setHLColor
Description copied from interface:CharacterPropertiesWriter
Sets the highlight color for the character properties.- Specified by:
setHLColor
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new highlight color value
-
setHidden
public void setHidden(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the hidden attribute of the character properties.- Specified by:
setHidden
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new hidden attribute value
-
setItalic
public void setItalic(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the italic attribute of the character properties.- Specified by:
setItalic
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- true to set the character properties as italic, false otherwise
-
setLeftIndent
public void setLeftIndent(int newValue) Description copied from interface:ParagraphPropertiesWriter
Set the left indent of the paragraph.- Specified by:
setLeftIndent
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the value of the left indent
-
setRightIndent
public void setRightIndent(int newValue) Description copied from interface:ParagraphPropertiesWriter
Sets the right indent for the paragraph.The right indent specifies the amount of indentation from the right margin of the paragraph.
- Specified by:
setRightIndent
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the value of the right indent for the paragraph
-
setSpaceBefore
public void setSpaceBefore(int newValue) Description copied from interface:ParagraphPropertiesWriter
Sets the space before the paragraph.- Specified by:
setSpaceBefore
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the value of the space before the paragraph
-
setSpaceAfter
public void setSpaceAfter(int value) Description copied from interface:ParagraphPropertiesWriter
Sets the space after the paragraph.- Specified by:
setSpaceAfter
in interfaceParagraphPropertiesWriter
- Parameters:
value
- the value of the space after the paragraph
-
setParagraphBorder
Description copied from interface:ParagraphPropertiesWriter
Sets the border for the paragraph.The border can be one of the following values:
- NONE - No border.
- BOX - Border around the entire paragraph.
- Specified by:
setParagraphBorder
in interfaceParagraphPropertiesWriter
- Parameters:
value
- the Border value to set for the paragraph
-
setBorderColor
Description copied from interface:BorderPropertiesWriter
Sets the border color for the paragraph or table.- Specified by:
setBorderColor
in interfaceBorderPropertiesWriter
- Parameters:
value
- the value to set as the border color
-
setBorderStyle
Description copied from interface:BorderPropertiesWriter
Sets the border style for the paragraph or table.Note: used for the paragraph border and the table border.
- Specified by:
setBorderStyle
in interfaceBorderPropertiesWriter
- Parameters:
value
- theBorderStyle
to set as the border style
-
setBorderWidth
public void setBorderWidth(int value) Description copied from interface:BorderPropertiesWriter
Sets the width of the border.- Specified by:
setBorderWidth
in interfaceBorderPropertiesWriter
- Parameters:
value
- the width of the border
-
setParagraphBackgroundColor
Description copied from interface:ParagraphPropertiesWriter
Sets the background color of the paragraph.This method sets the background color of the paragraph to the specified value. The value should be a valid hexadecimal color code representation.
- Specified by:
setParagraphBackgroundColor
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the background color value to set for the paragraph
-
setItap
public void setItap(byte newValue) Description copied from interface:TableStateWriter
Sets the value of the "Itap" property.- Specified by:
setItap
in interfaceTableStateWriter
- Parameters:
newValue
- The value to be set.
-
setRightToLeftChar
public void setRightToLeftChar(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the right-to-left character property.- Specified by:
setRightToLeftChar
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new value for the right-to-left character property
-
setRightToLeftPar
public void setRightToLeftPar(boolean newValue) Description copied from interface:ParagraphPropertiesWriter
Sets the right-to-left paragraph property.- Specified by:
setRightToLeftPar
in interfaceParagraphPropertiesWriter
- Parameters:
newValue
- the value of the right-to-left paragraph property
-
setSubscript
public void setSubscript(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the subscript attribute of the character properties.- Specified by:
setSubscript
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- true to set the character properties as subscript, false otherwise
-
setSubscript
public void setSubscript()Description copied from interface:CharacterPropertiesWriter
Sets the subscript attribute of the character properties.- Specified by:
setSubscript
in interfaceCharacterPropertiesWriter
-
setSuperscript
public void setSuperscript(boolean newValue) Description copied from interface:CharacterPropertiesWriter
Sets the superscript attribute of the character properties.- Specified by:
setSuperscript
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- true to set the character properties as superscript, false otherwise
-
setSuperscript
public void setSuperscript()Description copied from interface:CharacterPropertiesWriter
Sets the superscript attribute of the character properties.- Specified by:
setSuperscript
in interfaceCharacterPropertiesWriter
-
setFontName
Description copied from interface:CharacterPropertiesWriter
Sets the font name for the character properties.- Specified by:
setFontName
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new font name
-
setFontSize
public void setFontSize(int newValue) Description copied from interface:CharacterPropertiesWriter
Sets the font size in half-points for the character properties.- Specified by:
setFontSize
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new font size value to set
-
getCharacterProperties
Description copied from interface:Writer
Retrieves the CharacterProperties object that represents the current state data of the Writer.- Specified by:
getCharacterProperties
in interfaceWriter
- Returns:
- The character properties.
-
getParagraphProperties
Description copied from interface:Writer
Retrieves the ParagraphProperties object that represents the current state data of the Writer.- Specified by:
getParagraphProperties
in interfaceWriter
- Returns:
- The paragraph properties.
-
getDefaultFontName
Description copied from interface:Writer
Returns the default font name of the Writer.- Specified by:
getDefaultFontName
in interfaceWriter
- Returns:
- The default font name.
-
setDefaultFont
- Specified by:
setDefaultFont
in interfaceWriter
-
setParagraphInTable
public void setParagraphInTable(boolean value) Description copied from interface:ParagraphPropertiesWriter
Sets the flag indicating whether the paragraph is inside a table or not.- Specified by:
setParagraphInTable
in interfaceParagraphPropertiesWriter
- Parameters:
value
- the flag value indicating whether the paragraph is inside a table
-
resetCharacterAttributes
public void resetCharacterAttributes()Will be called for \plain RTF token.- Specified by:
resetCharacterAttributes
in interfaceWriter
-
resetParagraphAttributes
public void resetParagraphAttributes()Reset the paragraph attributes to default values. Invoked when the RTF token \pard appears.- Specified by:
resetParagraphAttributes
in interfaceWriter
- See Also:
-
addAnchor
Description copied from interface:FieldWriter
Adds an anchor to the current document.- Specified by:
addAnchor
in interfaceFieldWriter
- Parameters:
value
- The anchor value to add.
-
popCharacterProperties
- Specified by:
popCharacterProperties
in interfaceWriter
-
popParagraphProperties
Get last paragraph properties from stack.- Specified by:
popParagraphProperties
in interfaceWriter
- Parameters:
source
- the value on the stack.- See Also:
-
setFontCharSet
public void setFontCharSet(int newValue) Description copied from interface:CharacterPropertiesWriter
Sets the font character set for the character properties.- Specified by:
setFontCharSet
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new font character set
-
intToChar
public char intToChar(int value) -
setNodeCharset
public void setNodeCharset(int paramValue) - Specified by:
setNodeCharset
in interfaceWriter
-
setLanguage
Description copied from interface:CharacterPropertiesWriter
Sets the language for the character properties.- Specified by:
setLanguage
in interfaceCharacterPropertiesWriter
- Parameters:
newValue
- the new language value
-
writeChar
public void writeChar(char value) Append a character to the document.If it is a "new line" character, a new paragraph object will be created. The new paragraph inherits the properties of the previous paragraph.
- Specified by:
writeChar
in interfaceDocumentWriter
- Parameters:
value
- a character
-
footnoteStart
public void footnoteStart()Description copied from interface:FootnoteWriter
Starts a footnote.- Specified by:
footnoteStart
in interfaceFootnoteWriter
-
footnoteEnd
public void footnoteEnd()Description copied from interface:FootnoteWriter
Ends the current footnote.- Specified by:
footnoteEnd
in interfaceFootnoteWriter
-
isInFootnote
public boolean isInFootnote()Description copied from interface:FootnoteWriter
Check if the writer is currently in a footnote.- Specified by:
isInFootnote
in interfaceFootnoteWriter
- Returns:
- true if the writer is in a footnote, false otherwise
-
getListHeaderInfo
- Specified by:
getListHeaderInfo
in interfaceWriter
-
getCharProps
-
getParProps
-
setPaperWidth
public void setPaperWidth(int paramValue) Description copied from interface:PageSetupWriter
Sets the width of the paper for page setup.- Specified by:
setPaperWidth
in interfacePageSetupWriter
- Parameters:
paramValue
- the new width of the paper in pixels.
-
setLeftMargin
public void setLeftMargin(int paramValue) Description copied from interface:PageSetupWriter
Sets the left margin of the page.- Specified by:
setLeftMargin
in interfacePageSetupWriter
- Parameters:
paramValue
- the value of the left margin in pixels
-
setRightMargin
public void setRightMargin(int paramValue) Description copied from interface:PageSetupWriter
Sets the right margin of the page.- Specified by:
setRightMargin
in interfacePageSetupWriter
- Parameters:
paramValue
- The value of the right margin in pixels.
-
calculateCurrentPageWidth
public void calculateCurrentPageWidth()- Specified by:
calculateCurrentPageWidth
in interfacePageSetupWriter
-