richmemo: loading tab offsets for a paragraph

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7314 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2020-01-22 20:08:26 +00:00
parent 019e5e3a8e
commit e8149045e9

View File

@ -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);