diff --git a/components/richmemo/richmemortf.pas b/components/richmemo/richmemortf.pas index 7bac9f54d..a2c845f51 100644 --- a/components/richmemo/richmemortf.pas +++ b/components/richmemo/richmemortf.pas @@ -69,8 +69,10 @@ type fnum : Integer; // font index in the font table prev : TRTFParams; + tabs : TTabStopList; constructor Create(aprev: TRTFParams); procedure ResetDefault; + procedure AddTab(AOffset: double; ta: TTabAlignment); end; TRTFMemoParser = class(TRTFParser) @@ -283,6 +285,18 @@ begin pm.SpaceBefore:=0; pm.SpaceAfter:=0; pm.LineSpacing:=0; + tabs.Count:=0; +end; + +procedure TRTFParams.AddTab(AOffset: double; ta: TTabAlignment); +begin + if tabs.Count=length(tabs.Tabs) then begin + if tabs.Count=0 then SetLength(tabs.Tabs, 4) + else SetLength(tabs.Tabs, tabs.Count*2); + end; + tabs.Tabs[tabs.Count].Offset:=AOffset; + tabs.Tabs[tabs.Count].Align:=ta; + inc(tabs.Count); end; { TRTFMemoParserr } @@ -415,6 +429,9 @@ begin end; procedure TRTFMemoParser.doChangePara(aminor, aparam: Integer); +const + TabAl : array [rtfTabPos..rtfTabDecimal] of TTabAlignment = ( + tabLeft, tabRight, tabCenter, tabDecimal); begin case aminor of rtfParDef: prm.ResetDefault; // reset clear formatting @@ -437,6 +454,11 @@ begin rtfLanguage: begin SetLanguage(rtfParam); end; + rtfTabPos,//; rtfKstr : 'tx'; rtfkHash : 0), + rtfTabRight, // rtfKstr : 'tqr'; rtfkHash : 0), + rtfTabCenter, //; rtfKstr : 'tqc'; rtfkHash : 0), + rtfTabDecimal: //; rtfKstr : 'tqdec'; rtfkHash : 0), + prm.AddTab(aparam / 20, TabAl[aminor]); end; end; @@ -569,6 +591,9 @@ begin prm.pm.FirstLine:=prm.pm.FirstLine-prm.pm.HeadIndent; Memo.SetParaAlignment(selst, 1, prm.pa ); + + if prm.tabs.Count>0 then + Memo.SetParaTabs(selst, 1, prm.tabs); end; // Memo.GetTextAttributes(selst, font);