RTFWriter class is used to write styled content as rich text.
The implementation complies with the RTF specification version 1.5.
toString() is guaranteed to return a valid formatted string only after
close() has been called.
Whole and partial lines and line breaks can be written. Lines will be
formatted using the styles queried from the LineStyleListener,
if set, or those set directly in the widget. All styles are applied to
the stream like they are rendered by the widget. In addition, the
widget font name and size is used for the whole text.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv List | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv String | escapeText(String
the text to escape string)Implements abstract org. |
| private int | Returns: the index of the specified color in the RTF color table or "defaultIndex" if "color" is null.the color color, int return value if color is null defaultIndex)Returns the index of the specified color in the RTF color table. |
| private int | Returns: the index of the specified color in the RTF color table or "defaultIndex" if "color" is null.the color font)Returns the index of the specified color in the RTF color table. |
| pack-priv void | writeEmptyLine()
Implements abstract org. |
| pack-priv void | writeHeader()
Implements abstract org. |
| public void | writeLineDelimiter(String
line delimiter to write lineDelimiter)Overrides org. |
| pack-priv String | writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify)
Implements abstract org. |
| pack-priv String | writeSpanStart(StyleRange style)
Implements abstract org. |
| colorTable | back to summary |
|---|---|
| pack-priv List<Color> colorTable | |
| DEFAULT_BACKGROUND | back to summary |
|---|---|
| pack-priv static final int DEFAULT_BACKGROUND | |
| DEFAULT_FOREGROUND | back to summary |
|---|---|
| pack-priv static final int DEFAULT_FOREGROUND | |
| fontTable | back to summary |
|---|---|
| pack-priv List<Font> fontTable | |
| RTFWriter | back to summary |
|---|---|
| public RTFWriter(StyledText styledText, int start, int length) | |
| close | back to summary |
|---|---|
| public void close() Overrides org. Doc from org. Closes the writer. Once closed no more content can be written Note
| |
| escapeText | back to summary |
|---|---|
| pack-priv String escapeText(String string) Implements abstract org. Doc from org. Takes plain text and returns the same text escaped using the rules of the output format. | |
| getColorIndex | back to summary |
|---|---|
| private int getColorIndex(Color color, int defaultIndex) Returns the index of the specified color in the RTF color table.
| |
| getFontIndex | back to summary |
|---|---|
| private int getFontIndex(Font font) Returns the index of the specified color in the RTF color table.
| |
| writeEmptyLine | back to summary |
|---|---|
| pack-priv void writeEmptyLine() Implements abstract org. Doc from org. Invoked at the end of each line, writeLineEnd, if there was no text output. This is needed for HTML, which does not render empty paragraphs.
| |
| writeHeader | back to summary |
|---|---|
| pack-priv void writeHeader() Implements abstract org. Writes the RTF header including font table and color table.
| |
| writeLineDelimiter | back to summary |
|---|---|
| public void writeLineDelimiter(String lineDelimiter) Overrides org. Doc from org. Appends the specified line delimiter to the data. | |
| writeLineStart | back to summary |
|---|---|
| pack-priv String writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify) Implements abstract org. Doc from org. Invoked at the beginning of each line in the original widget. It should output whatever tags are appropriate to start a new line in the output format. | |
| writeSpanStart | back to summary |
|---|---|
| pack-priv String writeSpanStart(StyleRange style) Implements abstract org. Doc from org. Invoked at the beginning of each styled span fragment in the original widget. It should output whatever tags are appropriate to start a formatted span in the output format. | |