@@ -269,7 +269,7 @@ procedure TRTFBuilder.BeginGroup;
269269
270270procedure TRTFBuilder.ClearParaFormatting ;
271271begin
272- AddControl(TRTF.ControlWord(rcPard ));
272+ AddControl(TRTF.ControlWord(TRTFControl.Pard ));
273273end ;
274274
275275constructor TRTFBuilder.Create(const CodePage: Integer);
@@ -296,11 +296,11 @@ destructor TRTFBuilder.Destroy;
296296
297297function TRTFBuilder.DocHeader : ASCIIString;
298298begin
299- Result := TRTF.ControlWord(rcRTF , TRTF.Version)
300- + TRTF.ControlWord(rcAnsi )
301- + TRTF.ControlWord(rcAnsiCodePage , fCodePage)
302- + TRTF.ControlWord(rcDefFontNum , DefaultFontIdx)
303- + TRTF.ControlWord(rcDefLanguage , DefaultLanguageID)
299+ Result := TRTF.ControlWord(TRTFControl.RTF , TRTF.Version)
300+ + TRTF.ControlWord(TRTFControl.Ansi )
301+ + TRTF.ControlWord(TRTFControl.AnsiCodePage , fCodePage)
302+ + TRTF.ControlWord(TRTFControl.DefFontNum , DefaultFontIdx)
303+ + TRTF.ControlWord(TRTFControl.DefLanguage , DefaultLanguageID)
304304 + fFontTable.AsString
305305 + fColourTable.AsString
306306 + fDocProperties.AsString
@@ -315,7 +315,7 @@ procedure TRTFBuilder.EndGroup;
315315
316316procedure TRTFBuilder.EndPara ;
317317begin
318- AddControl(TRTF.ControlWord(rcPar ));
318+ AddControl(TRTF.ControlWord(TRTFControl.Par ));
319319 AppendBody(EOL);
320320 fInControls := False;
321321end ;
@@ -327,12 +327,14 @@ function TRTFBuilder.Render: TRTFMarkup;
327327
328328procedure TRTFBuilder.ResetCharStyle ;
329329begin
330- AddControl(TRTF.ControlWord(rcPlain ));
330+ AddControl(TRTF.ControlWord(TRTFControl.Plain ));
331331end ;
332332
333333procedure TRTFBuilder.SetColour (const Colour: TColor);
334334begin
335- AddControl(TRTF.ControlWord(rcForeColorNum, fColourTable.ColourRef(Colour)));
335+ AddControl(
336+ TRTF.ControlWord(TRTFControl.ForeColorNum, fColourTable.ColourRef(Colour))
337+ );
336338end ;
337339
338340procedure TRTFBuilder.SetFont (const FontName: string);
@@ -342,39 +344,43 @@ procedure TRTFBuilder.SetFont(const FontName: string);
342344 // We don't emit control if this is default font
343345 FontIdx := fFontTable.FontRef(FontName);
344346 if FontIdx <> DefaultFontIdx then
345- AddControl(TRTF.ControlWord(rcFontNum , FontIdx));
347+ AddControl(TRTF.ControlWord(TRTFControl.FontNum , FontIdx));
346348end ;
347349
348350procedure TRTFBuilder.SetFontSize (const Points: Double);
349351begin
350- AddControl(TRTF.ControlWord(rcFontSize , FloatToInt(2 * Points)));
352+ AddControl(TRTF.ControlWord(TRTFControl.FontSize , FloatToInt(2 * Points)));
351353end ;
352354
353355procedure TRTFBuilder.SetFontStyle (const Style: TFontStyles);
354356begin
355357 if fsBold in Style then
356- AddControl(TRTF.ControlWord(rcBold ));
358+ AddControl(TRTF.ControlWord(TRTFControl.Bold ));
357359 if fsItalic in Style then
358- AddControl(TRTF.ControlWord(rcItalic ));
360+ AddControl(TRTF.ControlWord(TRTFControl.Italic ));
359361 if fsUnderline in Style then
360- AddControl(TRTF.ControlWord(rcUnderline ));
362+ AddControl(TRTF.ControlWord(TRTFControl.Underline ));
361363end ;
362364
363365procedure TRTFBuilder.SetIndents (const LeftIndent, FirstLineOffset: SmallInt);
364366begin
365- AddControl(TRTF.ControlWord(rcLeftIndent , LeftIndent));
366- AddControl(TRTF.ControlWord(rcFirstLineOffset , FirstLineOffset));
367+ AddControl(TRTF.ControlWord(TRTFControl.LeftIndent , LeftIndent));
368+ AddControl(TRTF.ControlWord(TRTFControl.FirstLineOffset , FirstLineOffset));
367369end ;
368370
369371procedure TRTFBuilder.SetParaSpacing (const Spacing: TRTFParaSpacing);
370372const
371373 TwipsPerPoint = 20 ; // Note: 20 Twips in a point
372374begin
373375 AddControl(
374- TRTF.ControlWord(rcSpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before))
376+ TRTF.ControlWord(
377+ TRTFControl.SpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before)
378+ )
375379 );
376380 AddControl(
377- TRTF.ControlWord(rcSpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After))
381+ TRTF.ControlWord(
382+ TRTFControl.SpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After)
383+ )
378384 );
379385end ;
380386
@@ -383,7 +389,7 @@ procedure TRTFBuilder.SetTabStops(const TabStops: array of SmallInt);
383389 Tab: SmallInt;
384390begin
385391 for Tab in TabStops do
386- AddControl(TRTF.ControlWord(rcTabStop , Tab));
392+ AddControl(TRTF.ControlWord(TRTFControl.TabStop , Tab));
387393end ;
388394
389395{ TRTFFontTable }
@@ -413,22 +419,27 @@ function TRTFFontTable.AsString: ASCIIString;
413419const
414420 // Map of generic font families to RTF controls
415421 cGenericFonts: array [TRTFGenericFont] of TRTFControl = (
416- rcFontFamilyNil, rcFontFamilyRoman, rcFontFamilySwiss, rcFontFamilyModern,
417- rcFontFamilyScript, rcFontFamilyDecor, rcFontFamilyTech
422+ TRTFControl.FontFamilyNil, // rgfDontCare
423+ TRTFControl.FontFamilyRoman, // rgfRoman
424+ TRTFControl.FontFamilySwiss, // rgfSwiss
425+ TRTFControl.FontFamilyModern, // rgfModern
426+ TRTFControl.FontFamilyScript, // rgfScript
427+ TRTFControl.FontFamilyDecor, // rgfDecorative
428+ TRTFControl.FontFamilyTech // rgfTechnical
418429 );
419430var
420431 Idx: Integer; // loops thru fonts in table
421432 Font: TRTFFont; // reference to a font in table
422433begin
423- Result := ' {' + TRTF.ControlWord(rcFontTable );
434+ Result := ' {' + TRTF.ControlWord(TRTFControl.FontTable );
424435 for Idx := 0 to Pred(fFonts.Count) do
425436 begin
426437 Font := fFonts[Idx];
427438 Result := Result + ' {'
428- + TRTF.ControlWord(rcFontNum , Idx)
429- + TRTF.ControlWord(rcFontPitch , 1 )
439+ + TRTF.ControlWord(TRTFControl.FontNum , Idx)
440+ + TRTF.ControlWord(TRTFControl.FontPitch , 1 )
430441 + TRTF.ControlWord(cGenericFonts[Font.Generic ])
431- + TRTF.ControlWord(rcFontCharset , Font.Charset)
442+ + TRTF.ControlWord(TRTFControl.FontCharset , Font.Charset)
432443 + ' '
433444 + StringToASCIIString(Font.Name )
434445 + ' }' ;
@@ -488,7 +499,7 @@ function TRTFColourTable.AsString: ASCIIString;
488499begin
489500 // Begin table
490501 Result := ' {'
491- + TRTF.ControlWord(rcColorTable )
502+ + TRTF.ControlWord(TRTFControl.ColorTable )
492503 + ' ' ;
493504 // Add entry for each colour
494505 for Colour in fColours do
@@ -497,9 +508,9 @@ function TRTFColourTable.AsString: ASCIIString;
497508 begin
498509 RGB := ColorToRGB(Colour);
499510 Result := Result
500- + TRTF.ControlWord(rcRed , GetRValue(RGB))
501- + TRTF.ControlWord(rcGreen , GetGValue(RGB))
502- + TRTF.ControlWord(rcBlue , GetBValue(RGB))
511+ + TRTF.ControlWord(TRTFControl.Red , GetRValue(RGB))
512+ + TRTF.ControlWord(TRTFControl.Green , GetGValue(RGB))
513+ + TRTF.ControlWord(TRTFControl.Blue , GetBValue(RGB))
503514 + ' ;'
504515 end
505516 else
@@ -540,9 +551,10 @@ function TRTFDocProperties.AsString: ASCIIString;
540551 Exit;
541552 end ;
542553 // Start with \info control word in group
543- Result := ' {' + TRTF.ControlWord(rcInfo );
554+ Result := ' {' + TRTF.ControlWord(TRTFControl.Info );
544555 if fTitle <> ' ' then
545- Result := Result + TRTF.UnicodeSafeDestination(rcTitle, fTitle, fCodePage);
556+ Result := Result
557+ + TRTF.UnicodeSafeDestination(TRTFControl.Title, fTitle, fCodePage);
546558 // Close \info group
547559 Result := Result + ' }' ;
548560end ;
0 commit comments