Top Method Summary
Options Name Purpose
AddHorizontalRule () Adds the horizontal rule an empty bordered paragraph stands for
AddListItemBlock () Adds the list item block the paragraph properties in effect describe
LONGCHAR AnsiChar (integer) Returns the character a byte of the ansicpg code page stands for
AppendChar (character) Appends a single character to the text of the current run, or to the entry of the destination being read
AppendDecoded (longchar) Appends a decoded character to the text of the current run
AppendHexChar (character) Appends the character of a hex escape to the current run
AppendPictureHex (character) Decodes a run of hex picture data into the picture MEMPTR
AppendUnicode (integer) Appends the character of a unicode escape to the current run
BeginListDefinition () Begins the definition of a list of the list table
BeginListLevel () Begins the definition of a level of the list that is being defined
BeginParagraphNumbering () Begins the pn destination of the WordPad list construct
BeginTableRow () Begins the definition of a table row
LOGICAL BytesBeginWith (memptr, integer, character) Returns if the bytes begin with the given ASCII text
ClearEntry () Clears the entry accumulator and its ASCII stage
ClearParagraphBorder () Clears the border the brdrnone control word switches off
INTEGER CountListItem (integer, integer, integer) Counts the item of the given list override and level and returns its number
EndParagraph () Ends the paragraph being read
EndTableCell () Ends the cell being read
EndTableRow () Ends the row being read
EnsureBlock () Opens the block the pending text belongs to when none is open
FinishColorEntry () Stores the color table entry that was collected
FinishDestination () Completes the destination that the group being closed carried
FinishFieldInstruction () Picks the hyperlink target out of the field instruction
FinishFontEntry () Stores the font table entry that was collected
FinishPicture () Adds the picture that was collected as an image run
FinishStyleEntry () Stores the stylesheet entry that was collected when it names a style the model can express
FlushText () Writes the text collected so far into the document
HandleControlWord (character, integer, logical) Applies the given control word to the reader state
INTEGER HexToInteger (character) Returns the integer value of a hex string
INTEGER IndentLevelOf (integer) Returns the indentation level the given left indentation names
INTEGER IndexOfByte (memptr, integer, integer, integer) Returns the position of the next occurrence of the given byte
LOGICAL IsAsciiLetter (character) Returns if the given character is an ASCII letter
LOGICAL IsInParagraphNumbering () Returns if the pn destination of the WordPad list construct is being read
LOGICAL IsRtf (longchar) Returns if the given value is an RTF document
LOGICAL IsTrimByte (integer, character) Returns if the given byte is whitespace or one of the given trim characters
INTEGER LastCompleteTokenEnd (character) Returns the position of the last character of the window that is guaranteed to end a complete token
MarkHeaderRow () Marks the row being defined as a header row
MarkParagraphInTable () Marks the paragraph being read as one that sits in a table cell
Consultingwerk.Util.DocumentConverter.ListNumberingEnum NumberingOf (integer) Returns the numbering type the given levelnfc value names
PopGroup () Restores the state saved by the matching opening brace
PushGroup () Saves the current state on the group stack
Consultingwerk.Util.DocumentConverter.TextDocument Read (longchar) Reads the given RTF document into a new TextDocument
INTEGER ReadControl (character, integer, integer) Reads the control word or control symbol at the given position
LONGCHAR ReadFontName () Returns the font name of the ttFont row the buffer is positioned on
INTEGER ReadPictureRun (character, integer, integer) Reads the run of picture data at the given position
ReleasePicture () Releases the memory of the picture being read
ResetParagraphProperties () Resets the paragraph properties to the default
ResetState () Resets the reader state so that an instance could be reused
ScanWindow (character, integer) Scans one window of the source and dispatches its tokens
SetBold (logical) Applies a change of the bold state to the current run
SetFont (integer) Applies a font change to the current run, or remembers the font number while the font table is read
SetFontSize (integer) Applies a font size change to the current run
SetForeColor (integer) Applies a foreground color change to the current run
SetItalic (logical) Applies a change of the italic state to the current run
SetListId (integer) Applies the listid control word
SetListLevelFormat (integer) Applies the number format a levelnfc control word names to the list level that is being defined
SetListLevelStart (integer) Applies the start number a levelstartat control word names to the list level that is being defined
SetListOverride (integer) Applies the ls control word
SetParagraphAlignment (BlockAlignmentEnum) Applies the alignment an alignment control word names to the paragraph being read
SetParagraphBorder (logical) Notes the border side a border control word selects
SetParagraphIndent (integer) Applies the left indentation the li control word names to the paragraph being read
SetParagraphNumbering (ListNumberingEnum) Applies the numbering type a control word of the pn destination names
SetStrikethrough (logical) Applies a change of the strikethrough state to the current run
SetSubscript (logical) Applies a change of the subscript state to the current run
SetSuperscript (logical) Applies a change of the superscript state to the current run
SetUnderline (logical, UnderlineStyleEnum) Applies a change of the underline state to the current run
INTEGER SignatureByte (integer) Returns the byte the RTF signature carries at the given position
LONGCHAR SliceUtf8 (memptr, integer, integer) Returns the given byte range of a MEMPTR as a UTF-8 longchar
StageToEntry () Moves the ASCII stage of the entry into its UTF-8 accumulator
StageToPending () Moves the ASCII stage into the UTF-8 accumulator
SyncTableContext () Opens or closes the table, the row and the cell of the block that is about to be created
LONGCHAR TakeEntry () Returns the entry text collected so far and clears it
LONGCHAR TrimEntry (longchar, character) Returns the given value without leading and trailing whitespace and without the given trim characters
LONGCHAR Utf8Char (integer) Returns the given Unicode code point as a UTF-8 longchar

Top Constructor Summary
Options Name Purpose
RtfReader () Creates a new RtfReader instance


Method Detail
Top

AddHorizontalRule ()

Purpose: Adds the horizontal rule an empty bordered paragraph stands for
Notes: The block is opened the way EnsureBlock opens one, so that a
rule inside a table cell belongs to that cell. It takes
neither the alignment nor the indentation of the paragraph:
the model holds neither for a rule, and the RtfWriter writes
neither, so a ql or an li the source put in front of the
border would come back as a property the document never
carried (SCL-5857).

Top

AddListItemBlock ()

Purpose: Adds the list item block the paragraph properties in effect
describe
Notes: The Word construct first: a paragraph that names a list with ls
is numbered when its level carries a number format other than
the bullet or the one that shows nothing, it takes the numbering
type of that format, and it is counted per list and level from
the levelstartat of its level on. Neither Word nor the Telerik
editor writes the pn destination alongside it, so without the
list table every numbered list of theirs would read as a
bulleted one.
The WordPad construct, and a list the list table does not
resolve, fall back to the pn destination: the pnstart of the
paragraph is the number of the item, and a paragraph that
carried none leaves the counting to the model, which continues
the list in front of it (SCL-5858).

Top

LONGCHAR AnsiChar (integer)

Purpose: Returns the character a byte of the ansicpg code page stands for
Notes: The byte is handed to the AVM as a one byte MEMPTR that is read
back through a LONGCHAR fixed to the code page, which is the
conversion the AVM performs reliably. The three argument CHR
function is not used - it does not convert from an arbitrary
code page into the internal one and silently yields nothing.

Parameters:
piByte INTEGER
The byte value of the hex escape
Returns LONGCHAR
The character, or the unknown value when the byte cannot be decoded
Top

AppendChar (character)

Purpose: Appends a single character to the text of the current run, or
to the entry of the destination being read
Notes:

Parameters:
pcChar CHARACTER
The character to append
Top

AppendDecoded (longchar)

Purpose: Appends a decoded character to the text of the current run
Notes: Used for everything that came out of an escape - it may be a
character the session code page cannot represent, so it never
passes through the CHARACTER stage

Parameters:
plcChar LONGCHAR
The decoded character
Top

AppendHexChar (character)

Purpose: Appends the character of a hex escape to the current run
Notes: The byte is decoded with the code page named by ansicpg

Parameters:
pcHex CHARACTER
The two hex digits of the escape
Top

AppendPictureHex (character)

Purpose: Decodes a run of hex picture data into the picture MEMPTR
Notes: HEX-DECODE converts the whole run in one statement. It raises
an error on a run holding anything but hex digits; such a run
is decoded byte by byte instead, with a pair that is not hex
read as a zero byte, so that the reader stays tolerant of
broken input as its contract requires. A run is never longer
than a window, so the RAW value stays well below 32 KB.

Parameters:
pcHex CHARACTER
The run of hex digits, CR and LF are dropped
Top

AppendUnicode (integer)

Purpose: Appends the character of a unicode escape to the current run
Notes: A negative parameter is the signed 16-bit representation of a
code point above 32767. The uc fallback characters that follow
the escape are not emitted, because the escape carries the
same character already.

Parameters:
piCodePoint INTEGER
The code point as written by the unicode escape
Top

BeginListDefinition ()

Purpose: Begins the definition of a list of the list table
Notes: Corresponds to the RTF list control word. The levels that follow
belong to this list; its listid is written behind them, which is
why the list is numbered by its position until then (SCL-5858).

Top

BeginListLevel ()

Purpose: Begins the definition of a level of the list that is being
defined
Notes: Corresponds to the RTF listlevel control word. The levels of a
list are written in the order of their nesting, the first one
is the outermost; a level that names no number format is a
decimal one, which is the default of the specification.

Top

BeginParagraphNumbering ()

Purpose: Begins the pn destination of the WordPad list construct
Notes: The destination is read only where it stands in the body - a pn
group inside a skipped group is skipped with it. The numbering
type starts out decimal, which is what a pn destination that
names no type means (SCL-5858).

Top

BeginTableRow ()

Purpose: Begins the definition of a table row
Notes: Corresponds to the RTF trowd control word. The row is not
opened in the document yet: the row definition is repeated in
front of the row terminator by our own writer and by Word, and
a definition that is followed by no cell content must not
produce a row of its own. SyncTableContext opens it once a
block of the row arrives.

Top

LOGICAL BytesBeginWith (memptr, integer, character)

Purpose: Returns if the bytes begin with the given ASCII text
Notes: Compares case insensitively, which is what the RTF style names
and the HYPERLINK keyword need

Parameters:
pmData MEMPTR
The bytes to test
piBytes INTEGER
The number of bytes available
pcAscii CHARACTER
The ASCII text to look for
Returns LOGICAL
TRUE when the bytes begin with that text
Top

ClearEntry ()

Purpose: Clears the entry accumulator and its ASCII stage
Notes:

Top

ClearParagraphBorder ()

Purpose: Clears the border the brdrnone control word switches off
Notes: Only the bottom border matters here, so the control word is
only of interest while the bottom border is the one being
described. A paragraph whose bottom border was switched off
again is not a horizontal rule (SCL-5857).

Top

INTEGER CountListItem (integer, integer, integer)

Purpose: Counts the item of the given list override and level and
returns its number
Notes: The deeper levels of the list are restarted, and a level that
has not been counted yet starts at the given start number
(SCL-5858)

Parameters:
piOverride INTEGER
The ls number the item names
piLevel INTEGER
The ilvl of the item
piStartAt INTEGER
The levelstartat of the level
Returns INTEGER
The number of the item
Top

EndParagraph ()

Purpose: Ends the paragraph being read
Notes: An empty paragraph is kept, so that the blank lines of the
source survive the conversion
A paragraph that carries a bottom border and never received
content is the horizontal rule (SCL-5857), and that is the
one construct RTF has for one. The condition is the border
AND the absence of content, not the border alone: a Word
paragraph that has a bottom border and text in it is a
bordered paragraph, and its border is a paragraph property
the model does not hold and drops like every other one.
lNeedBlock is what says the paragraph has no content: it is
cleared by EnsureBlock, which every run of a paragraph goes
through, and set again here.

Top

EndTableCell ()

Purpose: Ends the cell being read
Notes: Corresponds to the RTF cell control word

Top

EndTableRow ()

Purpose: Ends the row being read
Notes: Corresponds to the RTF row control word. The table itself
stays open - the next row definition continues it, and only a
block outside the table or the end of the input closes it.

Top

EnsureBlock ()

Purpose: Opens the block the pending text belongs to when none is open
Notes: The block kind follows the paragraph properties in effect

Top

FinishColorEntry ()

Purpose: Stores the color table entry that was collected
Notes: The entries of the color table are separated by semicolons,
the first one is usually the empty auto color

Top

FinishDestination ()

Purpose: Completes the destination that the group being closed carried
Notes: A font table entry, a color table entry, a stylesheet entry, a
picture and the field instruction of a hyperlink are only
complete when their group ends

Top

FinishFieldInstruction ()

Purpose: Picks the hyperlink target out of the field instruction
Notes: The result text of the field carries the display text and is
read as ordinary body text with the URL applied

Top

FinishFontEntry ()

Purpose: Stores the font table entry that was collected
Notes:

Top

FinishPicture ()

Purpose: Adds the picture that was collected as an image run
Notes: Only PNG and JPEG are kept, every other picture type is dropped

Top

FinishStyleEntry ()

Purpose: Stores the stylesheet entry that was collected when it names a
style the model can express
Notes: RTF has no heading and no code block concept - a paragraph
becomes either only by referencing a style named "heading N"
or "HTML Preformatted", which is the name Word gives the style
of an HTML pre element and the name the RtfWriter writes

Top

FlushText ()

Purpose: Writes the text collected so far into the document
Notes: Called before every change of the character formatting and at
every block boundary

Top

HandleControlWord (character, integer, logical)

Purpose: Applies the given control word to the reader state
Notes: Unknown control words are ignored, as the RTF specification
requires

Parameters:
pcWord CHARACTER
The control word without the leading backslash
piParameter INTEGER
The numeric parameter, 0 when the word carries none
plHasParameter LOGICAL
TRUE when the control word carried a numeric parameter
Top

INTEGER HexToInteger (character)

Purpose: Returns the integer value of a hex string
Notes: Returns the unknown value for a string that is not hex

Parameters:
pcHex CHARACTER
The hex digits
Returns INTEGER
The integer value, or the unknown value
Top

INTEGER IndentLevelOf (integer)

Purpose: Returns the indentation level the given left indentation names
Notes: 720 twips - half an inch - is one level. That is the step our
own writer emits, the step Word and WordPad use for the list
levels and for the indent button, and the step the Telerik
editor uses as well. A value in between is truncated down to
the level it has reached, and a negative one names no
indentation at all.

Parameters:
piTwips INTEGER
The left indentation in twips
Returns INTEGER
The indentation level, 0 when the paragraph is not indented
Top

INTEGER IndexOfByte (memptr, integer, integer, integer)

Purpose: Returns the position of the next occurrence of the given byte
Notes:

Parameters:
pmData MEMPTR
The bytes to search
piBytes INTEGER
The number of bytes available
piByte INTEGER
The byte to look for
piFrom INTEGER
The position to start at
Returns INTEGER
The position, or 0 when the byte does not occur
Top

LOGICAL IsAsciiLetter (character)

Purpose: Returns if the given character is an ASCII letter
Notes: Control words consist of ASCII letters only

Parameters:
pcChar CHARACTER
The character to test
Returns LOGICAL
TRUE when the character is a letter between a and z
Top

LOGICAL IsInParagraphNumbering ()

Purpose: Returns if the pn destination of the WordPad list construct is
being read
Notes: SCL-5858

Returns LOGICAL
TRUE inside the pn destination of a paragraph of the body
Top

LOGICAL IsRtf (longchar)

Purpose: Returns if the given value is an RTF document
Notes: Tests the RTF signature on the left trimmed value. The reader
itself does not depend on the answer being TRUE - it reads a
value that is not RTF as a single plain text paragraph rather
than failing. Consultingwerk.Util.StringHelper:IsRtf forwards
to this method, so that the knowledge of what RTF looks like
stays in the RTF class.

Parameters:
plcText LONGCHAR
The value to test
Returns LOGICAL
TRUE when the value begins with the RTF signature
Top

LOGICAL IsTrimByte (integer, character)

Purpose: Returns if the given byte is whitespace or one of the given
trim characters
Notes:

Parameters:
piByte INTEGER
The byte to test
pcTrimChars CHARACTER
The ASCII characters that count as trimmable
Returns LOGICAL
TRUE when the byte should be trimmed
Top

INTEGER LastCompleteTokenEnd (character)

Purpose: Returns the position of the last character of the window that
is guaranteed to end a complete token
Notes: A control word, a hex escape or a unicode escape that the
window boundary would split has to be carried into the next
window instead of being tokenized in halves

Parameters:
pcWindow CHARACTER
The window to inspect
Returns INTEGER
The position of the last character that may still be scanned
Top

MarkHeaderRow ()

Purpose: Marks the row being defined as a header row
Notes: Corresponds to the RTF trhdr control word, which marks a row
that is repeated at the top of every page - the closest RTF
has to the header cells of an HTML table

Top

MarkParagraphInTable ()

Purpose: Marks the paragraph being read as one that sits in a table cell
Notes: Corresponds to the RTF intbl control word. It is a paragraph
property, so pard resets it.

Top

Consultingwerk.Util.DocumentConverter.ListNumberingEnum NumberingOf (integer)

Purpose: Returns the numbering type the given levelnfc value names
Notes: 0 decimal, 1 upper case roman, 2 lower case roman, 3 upper case
letters, 4 lower case letters. Every other numbered format -
the ordinals, the cardinal text, the numbers of the Asian
scripts - is one the model cannot hold and is read as decimal
numbers, which keeps the number and drops the spelling
(SCL-5858).

Parameters:
piFormat INTEGER
The levelnfc value
Returns Consultingwerk.Util.DocumentConverter.ListNumberingEnum
The ListNumberingEnum member
Top

PopGroup ()

Purpose: Restores the state saved by the matching opening brace
Notes: Called for a closing brace. A closing brace without a matching
opening one is ignored.

Top

PushGroup ()

Purpose: Saves the current state on the group stack
Notes: Called for an opening brace

Top

Consultingwerk.Util.DocumentConverter.TextDocument Read (longchar)

Purpose: Reads the given RTF document into a new TextDocument
Notes: A value that does not start with the RTF signature is read as
a single plain text paragraph, so that a field holding legacy
plain text survives the same call

Parameters:
plcSource LONGCHAR
The longchar with the RTF document
Returns Consultingwerk.Util.DocumentConverter.TextDocument
The TextDocument with the content of the RTF document
Top

INTEGER ReadControl (character, integer, integer)

Purpose: Reads the control word or control symbol at the given position
Notes:

Parameters:
pcWindow CHARACTER
The window being scanned
piScan INTEGER
The position of the backslash
piLength INTEGER
The length of the window
Returns INTEGER
The position of the first character behind the control
Top

LONGCHAR ReadFontName ()

Purpose: Returns the font name of the ttFont row the buffer is
positioned on
Notes:

Returns LONGCHAR
The longchar with the font name, fixed to UTF-8
Top

INTEGER ReadPictureRun (character, integer, integer)

Purpose: Reads the run of picture data at the given position
Notes: The run ends in front of the next backslash or brace, or with
the window. CR and LF inside the run are dropped by
AppendPictureHex.

Parameters:
pcWindow CHARACTER
The window being scanned
piScan INTEGER
The position of the first character of the run
piLength INTEGER
The length of the window
Returns INTEGER
The position of the first character behind the run
Top

ReleasePicture ()

Purpose: Releases the memory of the picture being read
Notes:

Top

ResetParagraphProperties ()

Purpose: Resets the paragraph properties to the default
Notes: Corresponds to the RTF pard control word

Top

ResetState ()

Purpose: Resets the reader state so that an instance could be reused
Notes:

Top

ScanWindow (character, integer)

Purpose: Scans one window of the source and dispatches its tokens
Notes:

Parameters:
pcWindow CHARACTER
The window to scan
piScan INTEGER
The position in the window to start scanning at
Top

SetBold (logical)

Purpose: Applies a change of the bold state to the current run
Notes: Flushes the pending text first, so that it keeps the formatting
it was written with

Parameters:
plValue LOGICAL
The new value of the bold state
Top

SetFont (integer)

Purpose: Applies a font change to the current run, or remembers the font
number while the font table is read
Notes: The font number is resolved against the font table; an entry
declared as fmodern marks the run as monospace

Parameters:
piFontNum INTEGER
The font number of the RTF font table
Top

SetFontSize (integer)

Purpose: Applies a font size change to the current run
Notes: The RTF font size is given in half points

Parameters:
piHalfPoints INTEGER
The font size in half points
Top

SetForeColor (integer)

Purpose: Applies a foreground color change to the current run
Notes: The color number is resolved against the color table; color 0
is the automatic color and leaves the run without a color

Parameters:
piColorNum INTEGER
The color number of the RTF color table
Top

SetItalic (logical)

Purpose: Applies a change of the italic state to the current run
Notes:

Parameters:
plValue LOGICAL
The new value of the italic state
Top

SetListId (integer)

Purpose: Applies the listid control word
Notes: In the list table it names the list whose levels were just
defined, in the list override table the list the override
that is being read stands for

Parameters:
piListId INTEGER
The value of the control word
Top

SetListLevelFormat (integer)

Purpose: Applies the number format a levelnfc control word names to the
list level that is being defined
Notes: levelnfcn is the newer spelling of the same property, which Word
writes behind levelnfc with the same value

Parameters:
piFormat INTEGER
The value of the control word
Top

SetListLevelStart (integer)

Purpose: Applies the start number a levelstartat control word names to
the list level that is being defined
Notes: Read in the list table only. The levelstartat inside an lfolevel
group of the list override table - the restart of a level that
Word writes for "set numbering value" - is not read: the
override would have to be applied to the one item it restarts,
which the counting per list and level does not do, and it is
left to the first-pass loss (SCL-5858).

Parameters:
piStart INTEGER
The value of the control word
Top

SetListOverride (integer)

Purpose: Applies the ls control word
Notes: In the list override table it numbers the override that maps
to the list the listid in front of it named. In the body it
marks the paragraph as an item of that list - whether the item
is numbered, and its number, follow from the list table, see
AddListItemBlock.

Parameters:
piOverride INTEGER
The value of the control word
Top

SetParagraphAlignment (BlockAlignmentEnum)

Purpose: Applies the alignment an alignment control word names to the
paragraph being read
Notes: The value is kept as a paragraph property and handed to the
block when the block is opened, because the control words of
a paragraph come before its text. A block that is already open
is updated as well: the RTF specification lets a paragraph
property stand anywhere in the paragraph it applies to, and
the one in effect when the paragraph ends is the one that
counts (SCL-5855).

Parameters:
poAlignment Consultingwerk.Util.DocumentConverter.BlockAlignmentEnum
The alignment the control word names
Top

SetParagraphBorder (logical)

Purpose: Notes the border side a border control word selects
Notes: The control words that follow describe that border; only
whether the paragraph has a bottom border is kept, because
that is what tells an empty paragraph that is a horizontal
rule from one that is not (SCL-5857).

Parameters:
plBottom LOGICAL
TRUE when the control word selects the bottom border
Top

SetParagraphIndent (integer)

Purpose: Applies the left indentation the li control word names to the
paragraph being read
Notes: Kept as a paragraph property and handed to the block when the
block is opened, and applied to a block that is already open,
exactly the way the alignment is (SCL-5856).
A list item is not indented by this: the li of a list item is
the indentation of the list itself - our own writer emits
720 twips per nesting level for it, and so do Word and WordPad
- and reading it as an indentation on top of the list level
would give every list item of every document an indentation it
never had. TextDocument:SetBlockIndentLevel drops the level of
a list item, which is where that rule lives for all four
formats; the cost is that an indented list item from Word
arrives as a plain one.

Parameters:
piTwips INTEGER
The value of the li control word, in twips
Top

SetParagraphNumbering (ListNumberingEnum)

Purpose: Applies the numbering type a control word of the pn destination
names
Notes: pndec, pnlcltr, pnucltr, pnlcrm and pnucrm. Any of them marks
the paragraph as a numbered one, the way pndec did on its own
before the type was modelled (SCL-5858).

Parameters:
poNumbering Consultingwerk.Util.DocumentConverter.ListNumberingEnum
The numbering type the control word names
Top

SetStrikethrough (logical)

Purpose: Applies a change of the strikethrough state to the current run
Notes:

Parameters:
plValue LOGICAL
The new value of the strikethrough state
Top

SetSubscript (logical)

Purpose: Applies a change of the subscript state to the current run
Notes: Setting it clears the superscript state

Parameters:
plValue LOGICAL
The new value of the subscript state
Top

SetSuperscript (logical)

Purpose: Applies a change of the superscript state to the current run
Notes: Setting it clears the subscript state, so a document that
turns one on while the other is active flushes the text and
starts a run with the state the control word selected

Parameters:
plValue LOGICAL
The new value of the superscript state
Top

SetUnderline (logical, UnderlineStyleEnum)

Purpose: Applies a change of the underline state to the current run
Notes: A style word names the style as well, so a change of the style
alone starts a new run too. Switching the underline off resets
the style (SCL-5859), which is why a later plain ul does not
bring a double underline back.

Parameters:
plValue LOGICAL
The new value of the underline state
poStyle Consultingwerk.Util.DocumentConverter.UnderlineStyleEnum
The underline style the control word names
Top

INTEGER SignatureByte (integer)

Purpose: Returns the byte the RTF signature carries at the given position
Notes: The signature is the five characters of "{~\rtf"

Parameters:
piIndex INTEGER
The position within the signature, 1 to 5
Returns INTEGER
The byte value at that position
Top

LONGCHAR SliceUtf8 (memptr, integer, integer)

Purpose: Returns the given byte range of a MEMPTR as a UTF-8 longchar
Notes:

Parameters:
pmData MEMPTR
The bytes to read from
piFrom INTEGER
The position of the first byte
piLength INTEGER
The number of bytes
Returns LONGCHAR
The longchar with those bytes read as UTF-8
Top

StageToEntry ()

Purpose: Moves the ASCII stage of the entry into its UTF-8 accumulator
Notes:

Top

StageToPending ()

Purpose: Moves the ASCII stage into the UTF-8 accumulator
Notes: Keeps the number of LONGCHAR concatenations proportional to the
number of escapes rather than to the number of characters

Top

SyncTableContext ()

Purpose: Opens or closes the table, the row and the cell of the block
that is about to be created
Notes: Called from EnsureBlock for every block the reader adds, which
is the one place that knows a block is really coming. A
paragraph that carries neither intbl nor an open row
definition ends the table.

Top

LONGCHAR TakeEntry ()

Purpose: Returns the entry text collected so far and clears it
Notes:

Returns LONGCHAR
The longchar with the entry text, fixed to UTF-8
Top

LONGCHAR TrimEntry (longchar, character)

Purpose: Returns the given value without leading and trailing whitespace
and without the given trim characters
Notes: Works on the UTF-8 bytes, because TRIM would collate the value
through -cpinternal and raise for a character the session code
page does not know

Parameters:
plcValue LONGCHAR
The value to trim
pcTrimChars CHARACTER
The ASCII characters to trim besides whitespace
Returns LONGCHAR
The trimmed value, fixed to UTF-8
Top

LONGCHAR Utf8Char (integer)

Purpose: Returns the given Unicode code point as a UTF-8 longchar
Notes: The code point is encoded into its UTF-8 bytes by hand and read
back with an explicit source code page. CHR cannot be used - in
a session whose code page is not UTF-8 it returns nothing at
all for a code point the session code page does not know.

Parameters:
piCodePoint INTEGER
The Unicode code point
Returns LONGCHAR
The longchar holding that one character


Constructor Detail
Top

RtfReader ()

Purpose: Creates a new RtfReader instance
Notes: FIX-CODEPAGE is applied here rather than in ResetState, because
it can only be applied to a LONGCHAR that has no value yet -
and a reader instance is created per conversion anyway



©2006-2026 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       19.09.2026 10:19:21