@@ -234,7 +234,7 @@ procedure TRTFBuilder.AddText(const Text: string);
234234 fInControls := False;
235235 end ;
236236 // Add text, escaping disallowed characters
237- AppendBody(RTFMakeSafeText (Text, fCodePage));
237+ AppendBody(TRTF.MakeSafeText (Text, fCodePage));
238238end ;
239239
240240procedure TRTFBuilder.AppendBody (const S: ASCIIString);
@@ -269,7 +269,7 @@ procedure TRTFBuilder.BeginGroup;
269269
270270procedure TRTFBuilder.ClearParaFormatting ;
271271begin
272- AddControl(RTFControl (rcPard));
272+ AddControl(TRTF.ControlWord (rcPard));
273273end ;
274274
275275constructor TRTFBuilder.Create(const CodePage: Integer);
@@ -296,11 +296,11 @@ destructor TRTFBuilder.Destroy;
296296
297297function TRTFBuilder.DocHeader : ASCIIString;
298298begin
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)
304304 + fFontTable.AsString
305305 + fColourTable.AsString
306306 + fDocProperties.AsString
@@ -315,7 +315,7 @@ procedure TRTFBuilder.EndGroup;
315315
316316procedure TRTFBuilder.EndPara ;
317317begin
318- AddControl(RTFControl (rcPar));
318+ AddControl(TRTF.ControlWord (rcPar));
319319 AppendBody(EOL);
320320 fInControls := False;
321321end ;
@@ -327,12 +327,12 @@ function TRTFBuilder.Render: TRTFMarkup;
327327
328328procedure TRTFBuilder.ResetCharStyle ;
329329begin
330- AddControl(RTFControl (rcPlain));
330+ AddControl(TRTF.ControlWord (rcPlain));
331331end ;
332332
333333procedure TRTFBuilder.SetColour (const Colour: TColor);
334334begin
335- AddControl(RTFControl (rcForeColorNum, fColourTable.ColourRef(Colour)));
335+ AddControl(TRTF.ControlWord (rcForeColorNum, fColourTable.ColourRef(Colour)));
336336end ;
337337
338338procedure TRTFBuilder.SetFont (const FontName: string);
@@ -342,39 +342,39 @@ procedure TRTFBuilder.SetFont(const FontName: string);
342342 // We don't emit control if this is default font
343343 FontIdx := fFontTable.FontRef(FontName);
344344 if FontIdx <> DefaultFontIdx then
345- AddControl(RTFControl (rcFontNum, FontIdx));
345+ AddControl(TRTF.ControlWord (rcFontNum, FontIdx));
346346end ;
347347
348348procedure TRTFBuilder.SetFontSize (const Points: Double);
349349begin
350- AddControl(RTFControl (rcFontSize, FloatToInt(2 * Points)));
350+ AddControl(TRTF.ControlWord (rcFontSize, FloatToInt(2 * Points)));
351351end ;
352352
353353procedure TRTFBuilder.SetFontStyle (const Style: TFontStyles);
354354begin
355355 if fsBold in Style then
356- AddControl(RTFControl (rcBold));
356+ AddControl(TRTF.ControlWord (rcBold));
357357 if fsItalic in Style then
358- AddControl(RTFControl (rcItalic));
358+ AddControl(TRTF.ControlWord (rcItalic));
359359 if fsUnderline in Style then
360- AddControl(RTFControl (rcUnderline));
360+ AddControl(TRTF.ControlWord (rcUnderline));
361361end ;
362362
363363procedure TRTFBuilder.SetIndents (const LeftIndent, FirstLineOffset: SmallInt);
364364begin
365- AddControl(RTFControl (rcLeftIndent, LeftIndent));
366- AddControl(RTFControl (rcFirstLineOffset, FirstLineOffset));
365+ AddControl(TRTF.ControlWord (rcLeftIndent, LeftIndent));
366+ AddControl(TRTF.ControlWord (rcFirstLineOffset, FirstLineOffset));
367367end ;
368368
369369procedure TRTFBuilder.SetParaSpacing (const Spacing: TRTFParaSpacing);
370370const
371371 TwipsPerPoint = 20 ; // Note: 20 Twips in a point
372372begin
373373 AddControl(
374- RTFControl (rcSpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before))
374+ TRTF.ControlWord (rcSpaceBefore, FloatToInt(TwipsPerPoint * Spacing.Before))
375375 );
376376 AddControl(
377- RTFControl (rcSpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After))
377+ TRTF.ControlWord (rcSpaceAfter, FloatToInt(TwipsPerPoint * Spacing.After))
378378 );
379379end ;
380380
@@ -383,7 +383,7 @@ procedure TRTFBuilder.SetTabStops(const TabStops: array of SmallInt);
383383 Tab: SmallInt;
384384begin
385385 for Tab in TabStops do
386- AddControl(RTFControl (rcTabStop, Tab));
386+ AddControl(TRTF.ControlWord (rcTabStop, Tab));
387387end ;
388388
389389{ TRTFFontTable }
@@ -420,15 +420,15 @@ function TRTFFontTable.AsString: ASCIIString;
420420 Idx: Integer; // loops thru fonts in table
421421 Font: TRTFFont; // reference to a font in table
422422begin
423- Result := ' {' + RTFControl (rcFontTable);
423+ Result := ' {' + TRTF.ControlWord (rcFontTable);
424424 for Idx := 0 to Pred(fFonts.Count) do
425425 begin
426426 Font := fFonts[Idx];
427427 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)
432432 + ' '
433433 + StringToASCIIString(Font.Name )
434434 + ' }' ;
@@ -488,7 +488,7 @@ function TRTFColourTable.AsString: ASCIIString;
488488begin
489489 // Begin table
490490 Result := ' {'
491- + RTFControl (rcColorTable)
491+ + TRTF.ControlWord (rcColorTable)
492492 + ' ' ;
493493 // Add entry for each colour
494494 for Colour in fColours do
@@ -497,9 +497,9 @@ function TRTFColourTable.AsString: ASCIIString;
497497 begin
498498 RGB := ColorToRGB(Colour);
499499 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))
503503 + ' ;'
504504 end
505505 else
@@ -540,9 +540,9 @@ function TRTFDocProperties.AsString: ASCIIString;
540540 Exit;
541541 end ;
542542 // Start with \info control word in group
543- Result := ' {' + RTFControl (rcInfo);
543+ Result := ' {' + TRTF.ControlWord (rcInfo);
544544 if fTitle <> ' ' then
545- Result := Result + RTFUnicodeSafeDestination (rcTitle, fTitle, fCodePage);
545+ Result := Result + TRTF.UnicodeSafeDestination (rcTitle, fTitle, fCodePage);
546546 // Close \info group
547547 Result := Result + ' }' ;
548548end ;
0 commit comments