@@ -234,7 +234,7 @@ procedure TRTFBuilder.AddText(const Text: string);
234
234
fInControls := False;
235
235
end ;
236
236
// Add text, escaping disallowed characters
237
- AppendBody(RTFMakeSafeText (Text, fCodePage));
237
+ AppendBody(TRTF.MakeSafeText (Text, fCodePage));
238
238
end ;
239
239
240
240
procedure TRTFBuilder.AppendBody (const S: ASCIIString);
@@ -269,7 +269,7 @@ procedure TRTFBuilder.BeginGroup;
269
269
270
270
procedure TRTFBuilder.ClearParaFormatting ;
271
271
begin
272
- AddControl(RTFControl (rcPard));
272
+ AddControl(TRTF.ControlWord (rcPard));
273
273
end ;
274
274
275
275
constructor TRTFBuilder.Create(const CodePage: Integer);
@@ -296,11 +296,11 @@ destructor TRTFBuilder.Destroy;
296
296
297
297
function TRTFBuilder.DocHeader : ASCIIString;
298
298
begin
299
- Result := RTFControl (rcRTF, cRTFVersion)
300
- + RTFControl (rcAnsi)
301
- + RTFControl (rcAnsiCodePage, fCodePage)
302
- + RTFControl (rcDefFontNum, DefaultFontIdx)
303
- + RTFControl (rcDefLanguage, DefaultLanguageID)
299
+ Result := TRTF.ControlWord (rcRTF, cRTFVersion)
300
+ + TRTF.ControlWord (rcAnsi)
301
+ + TRTF.ControlWord (rcAnsiCodePage, fCodePage)
302
+ + TRTF.ControlWord (rcDefFontNum, DefaultFontIdx)
303
+ + TRTF.ControlWord (rcDefLanguage, DefaultLanguageID)
304
304
+ fFontTable.AsString
305
305
+ fColourTable.AsString
306
306
+ fDocProperties.AsString
@@ -315,7 +315,7 @@ procedure TRTFBuilder.EndGroup;
315
315
316
316
procedure TRTFBuilder.EndPara ;
317
317
begin
318
- AddControl(RTFControl (rcPar));
318
+ AddControl(TRTF.ControlWord (rcPar));
319
319
AppendBody(EOL);
320
320
fInControls := False;
321
321
end ;
@@ -327,12 +327,12 @@ function TRTFBuilder.Render: TRTFMarkup;
327
327
328
328
procedure TRTFBuilder.ResetCharStyle ;
329
329
begin
330
- AddControl(RTFControl (rcPlain));
330
+ AddControl(TRTF.ControlWord (rcPlain));
331
331
end ;
332
332
333
333
procedure TRTFBuilder.SetColour (const Colour: TColor);
334
334
begin
335
- AddControl(RTFControl (rcForeColorNum, fColourTable.ColourRef(Colour)));
335
+ AddControl(TRTF.ControlWord (rcForeColorNum, fColourTable.ColourRef(Colour)));
336
336
end ;
337
337
338
338
procedure TRTFBuilder.SetFont (const FontName: string);
@@ -342,39 +342,39 @@ procedure TRTFBuilder.SetFont(const FontName: string);
342
342
// We don't emit control if this is default font
343
343
FontIdx := fFontTable.FontRef(FontName);
344
344
if FontIdx <> DefaultFontIdx then
345
- AddControl(RTFControl (rcFontNum, FontIdx));
345
+ AddControl(TRTF.ControlWord (rcFontNum, FontIdx));
346
346
end ;
347
347
348
348
procedure TRTFBuilder.SetFontSize (const Points: Double);
349
349
begin
350
- AddControl(RTFControl (rcFontSize, FloatToInt(2 * Points)));
350
+ AddControl(TRTF.ControlWord (rcFontSize, FloatToInt(2 * Points)));
351
351
end ;
352
352
353
353
procedure TRTFBuilder.SetFontStyle (const Style: TFontStyles);
354
354
begin
355
355
if fsBold in Style then
356
- AddControl(RTFControl (rcBold));
356
+ AddControl(TRTF.ControlWord (rcBold));
357
357
if fsItalic in Style then
358
- AddControl(RTFControl (rcItalic));
358
+ AddControl(TRTF.ControlWord (rcItalic));
359
359
if fsUnderline in Style then
360
- AddControl(RTFControl (rcUnderline));
360
+ AddControl(TRTF.ControlWord (rcUnderline));
361
361
end ;
362
362
363
363
procedure TRTFBuilder.SetIndents (const LeftIndent, FirstLineOffset: SmallInt);
364
364
begin
365
- AddControl(RTFControl (rcLeftIndent, LeftIndent));
366
- AddControl(RTFControl (rcFirstLineOffset, FirstLineOffset));
365
+ AddControl(TRTF.ControlWord (rcLeftIndent, LeftIndent));
366
+ AddControl(TRTF.ControlWord (rcFirstLineOffset, FirstLineOffset));
367
367
end ;
368
368
369
369
procedure TRTFBuilder.SetParaSpacing (const Spacing: TRTFParaSpacing);
370
370
const
371
371
TwipsPerPoint = 20 ; // Note: 20 Twips in a point
372
372
begin
373
373
AddControl(
374
- RTFControl (rcSpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before))
374
+ TRTF.ControlWord (rcSpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before))
375
375
);
376
376
AddControl(
377
- RTFControl (rcSpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After))
377
+ TRTF.ControlWord (rcSpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After))
378
378
);
379
379
end ;
380
380
@@ -383,7 +383,7 @@ procedure TRTFBuilder.SetTabStops(const TabStops: array of SmallInt);
383
383
Tab: SmallInt;
384
384
begin
385
385
for Tab in TabStops do
386
- AddControl(RTFControl (rcTabStop, Tab));
386
+ AddControl(TRTF.ControlWord (rcTabStop, Tab));
387
387
end ;
388
388
389
389
{ TRTFFontTable }
@@ -420,15 +420,15 @@ function TRTFFontTable.AsString: ASCIIString;
420
420
Idx: Integer; // loops thru fonts in table
421
421
Font: TRTFFont; // reference to a font in table
422
422
begin
423
- Result := ' {' + RTFControl (rcFontTable);
423
+ Result := ' {' + TRTF.ControlWord (rcFontTable);
424
424
for Idx := 0 to Pred(fFonts.Count) do
425
425
begin
426
426
Font := fFonts[Idx];
427
427
Result := Result + ' {'
428
- + RTFControl (rcFontNum, Idx)
429
- + RTFControl (rcFontPitch, 1 )
430
- + RTFControl (cGenericFonts[Font.Generic ])
431
- + RTFControl (rcFontCharset, Font.Charset)
428
+ + TRTF.ControlWord (rcFontNum, Idx)
429
+ + TRTF.ControlWord (rcFontPitch, 1 )
430
+ + TRTF.ControlWord (cGenericFonts[Font.Generic ])
431
+ + TRTF.ControlWord (rcFontCharset, Font.Charset)
432
432
+ ' '
433
433
+ StringToASCIIString(Font.Name )
434
434
+ ' }' ;
@@ -488,7 +488,7 @@ function TRTFColourTable.AsString: ASCIIString;
488
488
begin
489
489
// Begin table
490
490
Result := ' {'
491
- + RTFControl (rcColorTable)
491
+ + TRTF.ControlWord (rcColorTable)
492
492
+ ' ' ;
493
493
// Add entry for each colour
494
494
for Colour in fColours do
@@ -497,9 +497,9 @@ function TRTFColourTable.AsString: ASCIIString;
497
497
begin
498
498
RGB := ColorToRGB(Colour);
499
499
Result := Result
500
- + RTFControl (rcRed, GetRValue(RGB))
501
- + RTFControl (rcGreen, GetGValue(RGB))
502
- + RTFControl (rcBlue, GetBValue(RGB))
500
+ + TRTF.ControlWord (rcRed, GetRValue(RGB))
501
+ + TRTF.ControlWord (rcGreen, GetGValue(RGB))
502
+ + TRTF.ControlWord (rcBlue, GetBValue(RGB))
503
503
+ ' ;'
504
504
end
505
505
else
@@ -540,9 +540,9 @@ function TRTFDocProperties.AsString: ASCIIString;
540
540
Exit;
541
541
end ;
542
542
// Start with \info control word in group
543
- Result := ' {' + RTFControl (rcInfo);
543
+ Result := ' {' + TRTF.ControlWord (rcInfo);
544
544
if fTitle <> ' ' then
545
- Result := Result + RTFUnicodeSafeDestination (rcTitle, fTitle, fCodePage);
545
+ Result := Result + TRTF.UnicodeSafeDestination (rcTitle, fTitle, fCodePage);
546
546
// Close \info group
547
547
Result := Result + ' }' ;
548
548
end ;
0 commit comments