This topic covers the implementation details of TRuleAboveBelow.
Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.
Direct rule serializer using the same million-fold numeric encoding as TXtagsRule and including Overprint. This is not identical to the selective TParagraphAttributesRec parent path, which stores only selected options.
Use the actual containing serializer to determine which fields survive a round trip. The selective parent currently omits the Overprint payload despite having option IDs for it.
Notation and shared helper rules: Reading this reference.
Literal rec_type values emitted within these routines: TRuleAboveBelow. Nested values may belong to child wrappers rather than this owner itself; the attribute entries below give their exact locations.
Structures used directly by this XML implementation:
Exact XML fields and attributes
The paths below start at this record or property node. A slash identifies a child element; @ identifies an attribute. Curly braces mark a variable index or expression, not literal XML text. Initial values describe initialization; they do not establish what an omitted individual element does. The Implementation toggle below contains the supplied routines for exact branch order and conversions.
Enabled
XML representation: The text of the Enabled element.
Initial value: false (TRuleAboveBelow.Initialize).
Reading: Reads the element into Enabled when the record node exists.
Writing: Stores true or false according to Enabled when Enabled is true.
Length
XML representation: The text of the Length element.
Reading: Reads the element into Length when the record node exists.
Writing: Stores the numeric value of Length (see the value table below) when Enabled is true.
FromLeft
XML representation: The text of the FromLeft element.
Initial value: 0.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to FromLeft when the record node exists. The temporary numeric value starts at 0 before reading.
Writing: Stores FromLeft multiplied by 1000000, then rounded to an integer when Enabled is true.
FromRight
XML representation: The text of the FromRight element.
Initial value: 0.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to FromRight when the record node exists. The temporary numeric value starts at 0 before reading.
Writing: Stores FromRight multiplied by 1000000, then rounded to an integer when Enabled is true.
Offset
XML representation: The text of the Offset element.
Initial value: 0.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to Offset when the record node exists. The temporary numeric value starts at 0 before reading.
Writing: Stores Offset multiplied by 1000000, then rounded to an integer when Enabled is true.
OffsetInPercent
XML representation: The text of the OffsetInPercent element.
Initial value: false (TRuleAboveBelow.Initialize).
Reading: Reads the element into OffsetInPercent when the record node exists.
Writing: Stores true or false according to OffsetInPercent when Enabled is true.
Style.ID
XML representation: The text of the Style.ID element.
Reading: Reads the element into Style.ID when the record node exists.
Writing: Stores the numeric value of Style.ID when Enabled is true.
Style.Name
XML representation: The text of the Style.Name element.
Reading: Reads the element into Style.Name when the record node exists.
Writing: Stores Style.Name when Enabled is true.
Width
XML representation: The text of the Width element.
Initial value: 0.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to Width when the record node exists. The temporary numeric value starts at 0 before reading.
Writing: Stores Width multiplied by 1000000, then rounded to an integer when Enabled is true.
Color
XML representation: The text of the Color element.
Initial value: “BLACK” (TRuleAboveBelow.Initialize).
Reading: Reads the element into Color when the record node exists.
Writing: Stores Color when Enabled is true.
Shade
XML representation: The text of the Shade element.
Initial value: 100.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to Shade when the record node exists. The temporary numeric value starts at 100 * 1000000 before reading.
Writing: Stores Shade multiplied by 1000000, then rounded to an integer when Enabled is true.
Opacity
XML representation: The text of the Opacity element.
Initial value: 100.0 (TRuleAboveBelow.Initialize).
Reading: Reads the stored number, divides it by 1000000.0, and assigns the result to Opacity when the record node exists. The temporary numeric value starts at 100 * 1000000 before reading.
Writing: Stores Opacity multiplied by 1000000, then rounded to an integer when Enabled is true.
Overprint
XML representation: The text of the Overprint element.
Initial value: false (TRuleAboveBelow.Initialize).
Reading: Reads the element into Overprint when the record node exists.
Writing: Stores true or false according to Overprint when Enabled is true.
@rec_type
XML representation: The rec_type attribute.
Writing: Stores the literal text “TRuleAboveBelow” whenever the writer reaches this field.
Initialization and reset values
TRuleAboveBelow.Initialize
Setting or temporary variable |
Initial value |
When it is assigned |
self |
Default (TRuleAboveBelow) |
Always |
Enabled |
false |
Always |
Length |
TRulesLength (0) |
Always |
FromLeft |
0.0 |
Always |
FromRight |
0.0 |
Always |
Offset |
0.0 |
Always |
OffsetInPercent |
false |
Always |
Width |
0.0 |
Always |
Color |
“BLACK” |
Always |
Shade |
100.0 |
Always |
Opacity |
100.0 |
Always |
Overprint |
false |
Always |
This routine also calls Style.Initialize. See Implementation for their order and any conditional calls.
Value namespaces used by this implementation
These are declared Pascal ordinal values. Use the ordinal only where the field serializer actually writes ord(...), an integer cast or an equivalent value. Set-marker strings and local option lists have their own representation; sentinel members in an enum are not automatically legal XML choices.
TRulesLength
Ordinal |
Declared member |
0 |
qrlIndents |
1 |
qrlText |
2 |
qrlColumn |
Built-in numeric style names and their separate namespaces: Values and encodings.
Storage declarations relevant to interpretation
These are in-memory member and property types, not a list of mandatory XML children. They retain array bounds, fixed buffers and selector types. The field reference above defines what is actually serialized.
Name |
Declared type / bounds |
Kind |
Enabled |
boolean |
member |
Length |
TRulesLength |
member |
FromLeft |
double |
member |
FromRight |
double |
member |
Offset |
double |
member |
OffsetInPercent |
Boolean |
member |
Style |
TRuleStyle |
member |
Width |
double |
member |
Color |
string |
member |
Shade |
double |
member |
Opacity |
double |
member |
Overprint |
boolean |
member |
The Implementation toggle contains only TRuleAboveBelow methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.
Declaration reproduces this record’s complete declaration from the supplied source, including its fields, properties and method signatures.