This topic covers the implementation details of TLineEndingOptionsRec.
Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.
Initializes before reading, including when the node is nil. TrueConditions starts with BoolType=All (1); FalseConditions starts with Any (0); the combiner starts at 0. All condition strings start empty. Default ending type is hard return.
Enabled=false with WasOnceEnabled=true preserves an inactive remembered case. Saving writes WasOnceEnabled as Enabled OR WasOnceEnabled. If both are false, the writer leaves only the rec_type attribute.
Slot zero can request rec_type=TDefaultLineEndingOptionsRec through the attrType parameter. It has the same field representation but its conditions are not used as an ordinary special case.
Notation and shared helper rules: Reading this reference.
Practical editing guide: Modifying GenTokens in an XML script.
Default slot and special-case activation in the editor
LineEndingOptions id=0 is the default. TGenTokensEditor.GetLineEndingOptions(0) explicitly sets Enabled=true. For ids 1–15 it reads the corresponding case checkbox. Checkbox changes update Enabled, while WasOnceEnabled is a separate serialized retention flag.
To disable an existing special case while retaining its settings on subsequent export, keep the payload and set Enabled=false and WasOnceEnabled=true. Deleting a slot is different: the reader initializes the missing slot. The parent GenTokens writer only emits slots whose Enabled or WasOnceEnabled is true.
Literal rec_type values emitted within these routines: TLineEndingOptionsRec. 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 (TLineEndingOptionsRec.Initialize).
Reading: Reads the element into Enabled when the record node exists.
Writing: Stores true or false according to Enabled when (Enabled is true or WasOnceEnabled is true).
WasOnceEnabled
XML representation: The text of the WasOnceEnabled element.
Initial value: false (TLineEndingOptionsRec.Initialize).
Reading: Reads the element into WasOnceEnabled when the record node exists.
Writing: Stores true or false according to Enabled or WasOnceEnabled when (Enabled is true or WasOnceEnabled is true).
TrueFalseLogicalOperator
XML representation: The text of the TrueFalseLogicalOperator element.
Initial value: 0 (TLineEndingOptionsRec.Initialize).
Reading: Reads the element into TrueFalseLogicalOperator when the record node exists.
Writing: Stores the numeric value of TrueFalseLogicalOperator when (Enabled is true or WasOnceEnabled is true).
@rec_type
XML representation: The rec_type attribute.
Writing: Stores attrType when attrType is not empty.
Writing: Stores the literal text “TLineEndingOptionsRec” when attrType is empty.
Nested records and repeated elements
Operation |
XML location |
When it is processed |
Read TrueConditions |
TrueConditions |
the record node exists; node2 exists |
Read FalseConditions |
FalseConditions |
the record node exists; node2 exists |
Read LineEnding |
LineEnding |
the record node exists; node2 exists |
Write TrueConditions |
TrueConditions |
(Enabled is true or WasOnceEnabled is true) |
Write FalseConditions |
FalseConditions |
(Enabled is true or WasOnceEnabled is true) |
Write LineEnding |
LineEnding |
(Enabled is true or WasOnceEnabled is true) |
Initialization and reset values
TLineEndingOptionsRec.Initialize
Setting or temporary variable |
Initial value |
When it is assigned |
self |
Default (TLineEndingOptionsRec) |
Always |
Enabled |
false |
Always |
TrueConditions.BoolType |
cbtAll (1) |
Always |
TrueConditions.Weekdays |
an empty string |
Always |
TrueConditions.Holidays |
an empty string |
Always |
TrueConditions.DaysOfMonth |
an empty string |
Always |
TrueConditions.MoonPhases |
an empty string |
Always |
TrueConditions.Miscellaneous |
an empty string |
Always |
FalseConditions.BoolType |
cbtAny (0) |
Always |
FalseConditions.Weekdays |
an empty string |
Always |
FalseConditions.Holidays |
an empty string |
Always |
FalseConditions.DaysOfMonth |
an empty string |
Always |
FalseConditions.MoonPhases |
an empty string |
Always |
FalseConditions.Miscellaneous |
an empty string |
Always |
TrueFalseLogicalOperator |
0 |
Always |
LineEnding.EndingType |
letHard (1) |
Always |
LineEnding.MacroToken |
an empty string |
Always |
LineEnding.Xtags |
an empty string |
Always |
LineEnding.XtagsDescription |
an empty string |
Always |
LineEnding.Overriding.Enabled |
false |
Always |
LineEnding.Overriding.TextTokens |
an empty string |
Always |
LineEnding.Formatting.Formats.Enabled |
false |
Always |
LineEnding.Formatting.Formats.LeftIndent |
0.0 |
Always |
LineEnding.Formatting.Formats.FirstLine |
0.0 |
Always |
LineEnding.Formatting.Formats.RightIndent |
0.0 |
Always |
LineEnding.Formatting.Formats.Leading |
0.0 |
Always |
LineEnding.Formatting.Formats.SpaceBefore |
0.0 |
Always |
LineEnding.Formatting.Formats.SpaceAfter |
0.0 |
Always |
LineEnding.Formatting.Formats.Alignment |
0 |
Always |
LineEnding.Formatting.Formats.DropCaps.Enabled |
false |
Always |
LineEnding.Formatting.Formats.DropCaps.CharCount |
1 |
Always |
LineEnding.Formatting.Formats.DropCaps.LineCount |
3 |
Always |
LineEnding.Formatting.Formats.KeepLinesTogether.Enabled |
false |
Always |
LineEnding.Formatting.Formats.KeepLinesTogether.AllLines |
true |
Always |
LineEnding.Formatting.Formats.KeepLinesTogether.Starting |
2 |
Always |
LineEnding.Formatting.Formats.KeepLinesTogether.Ending |
2 |
Always |
LineEnding.Formatting.Formats.KeepWithNext |
false |
Always |
LineEnding.Formatting.Formats.LockToBaselineGrid |
false |
Always |
LineEnding.Formatting.Tabs.Enabled |
false |
Always |
LineEnding.Formatting.Tabs.Xtags |
an empty string |
Always |
LineEnding.Formatting.Tabs.UseTabAsLineEnding |
false |
Always |
LineEnding.Formatting.RuleAbove.Enabled |
false |
Always |
LineEnding.Formatting.RuleAbove.Length |
qrlIndents (0) |
Always |
LineEnding.Formatting.RuleAbove.FromLeft |
0.0 |
Always |
LineEnding.Formatting.RuleAbove.FromRight |
0.0 |
Always |
LineEnding.Formatting.RuleAbove.Offset |
0.0 |
Always |
LineEnding.Formatting.RuleAbove.OffsetInPercent |
false |
Always |
LineEnding.Formatting.RuleAbove.Style.ID |
0 |
Always |
LineEnding.Formatting.RuleAbove.Style.Name |
“Solid” |
Always |
LineEnding.Formatting.RuleAbove.Width |
1.0 |
Always |
LineEnding.Formatting.RuleAbove.Color |
“K” |
Always |
LineEnding.Formatting.RuleAbove.Shade |
100.0 |
Always |
LineEnding.Formatting.RuleAbove.Opacity |
100.0 |
Always |
LineEnding.Formatting.RuleBelow.Enabled |
false |
Always |
LineEnding.Formatting.RuleBelow.Length |
qrlIndents (0) |
Always |
LineEnding.Formatting.RuleBelow.FromLeft |
0.0 |
Always |
LineEnding.Formatting.RuleBelow.FromRight |
0.0 |
Always |
LineEnding.Formatting.RuleBelow.Offset |
0.0 |
Always |
LineEnding.Formatting.RuleBelow.OffsetInPercent |
false |
Always |
LineEnding.Formatting.RuleBelow.Style.ID |
0 |
Always |
LineEnding.Formatting.RuleBelow.Style.Name |
“Solid” |
Always |
LineEnding.Formatting.RuleBelow.Width |
1.0 |
Always |
LineEnding.Formatting.RuleBelow.Color |
“K” |
Always |
LineEnding.Formatting.RuleBelow.Shade |
100.0 |
Always |
LineEnding.Formatting.RuleBelow.Opacity |
100.0 |
Always |
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 |
TConditionBoolType
Ordinal |
Declared member |
0 |
cbtAny |
1 |
cbtAll |
TLineEndingType
Ordinal |
Declared member |
0 |
letSoft |
1 |
letHard |
2 |
letTab |
3 |
letMacro |
4 |
letFormatting |
5 |
letXtags |
6 |
letNothing |
7 |
letNextBox |
8 |
letNextColumn |
9 |
letSkipLine |
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 |
WasOnceEnabled |
Boolean |
member |
TrueConditions |
TDateConditionsRec |
member |
FalseConditions |
TDateConditionsRec |
member |
TrueFalseLogicalOperator |
integer |
member |
LineEnding |
TLineEndingRec |
member |
The Implementation toggle contains only TLineEndingOptionsRec 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.