mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 23:30:29 +02:00
* Fixed style reading for OOffice documents
git-svn-id: trunk@11268 -
This commit is contained in:
parent
91116c2e21
commit
96edd65a89
@ -803,6 +803,7 @@ var
|
||||
sp : PRTFStyle;
|
||||
sep,sepLast : PRTFStyleElt;
|
||||
bp : string[rtfBufSiz];
|
||||
I : Integer;
|
||||
|
||||
Begin
|
||||
While true do
|
||||
@ -823,40 +824,40 @@ While true do
|
||||
FstyleList := sp;
|
||||
if not CheckCM (rtfGroup, rtfBeginGroup) then
|
||||
Error ('SSErr - missing {');
|
||||
while (GetToken=rtfControl) or (FTokenClass=rtfControl) do
|
||||
I:=0;
|
||||
GetToken;
|
||||
while (fRTFClass=rtfControl) or (FTokenClass=rtfControl) or (FRTFClass=rtfGroup) do
|
||||
Begin
|
||||
if rtfClass=rtfUnknown then
|
||||
continue;
|
||||
if (CheckMM (rtfParAttr, rtfStyleNum)) then
|
||||
Begin
|
||||
sp^.rtfSNum:=rtfParam;
|
||||
continue;
|
||||
End;
|
||||
if (CheckMM (rtfStyleAttr, rtfBasedOn)) then
|
||||
Begin
|
||||
sp^.rtfSBasedOn:=rtfParam;
|
||||
continue;
|
||||
End;
|
||||
if (CheckMM (rtfStyleAttr, rtfNext)) then
|
||||
Begin
|
||||
sp^.rtfSNextPar:=rtfParam;
|
||||
Continue;
|
||||
End;
|
||||
new(sep);
|
||||
if sep=nil then
|
||||
Error ('SSErr - cannot allocate style element');
|
||||
sep^.rtfSEClass:=rtfClass;
|
||||
sep^.rtfSEMajor:=rtfMajor;
|
||||
sep^.rtfSEMinor:=rtfMinor;
|
||||
sep^.rtfSEParam:=rtfParam;
|
||||
sep^.rtfSEText:=rtfTextBuf;
|
||||
if sepLast=nil then
|
||||
sp^.rtfSSEList:=sep { first element }
|
||||
else { add to end }
|
||||
sepLast^.rtfNextSE:=sep;
|
||||
sep^.rtfNextSE:=nil;
|
||||
sepLast:=sep;
|
||||
End;
|
||||
If CheckCM(rtfGroup, rtfBeginGroup) then
|
||||
SkipGroup
|
||||
else if rtfClass<>rtfUnknown then
|
||||
begin
|
||||
if (CheckMM (rtfParAttr, rtfStyleNum)) then
|
||||
sp^.rtfSNum:=rtfParam
|
||||
else if (CheckMM (rtfStyleAttr, rtfBasedOn)) then
|
||||
sp^.rtfSBasedOn:=rtfParam
|
||||
else if (CheckMM (rtfStyleAttr, rtfNext)) then
|
||||
sp^.rtfSNextPar:=rtfParam
|
||||
else
|
||||
begin
|
||||
new(sep);
|
||||
if sep=nil then
|
||||
Error ('SSErr - cannot allocate style element');
|
||||
sep^.rtfSEClass:=rtfClass;
|
||||
sep^.rtfSEMajor:=rtfMajor;
|
||||
sep^.rtfSEMinor:=rtfMinor;
|
||||
sep^.rtfSEParam:=rtfParam;
|
||||
sep^.rtfSEText:=rtfTextBuf;
|
||||
if sepLast=nil then
|
||||
sp^.rtfSSEList:=sep { first element }
|
||||
else { add to end }
|
||||
sepLast^.rtfNextSE:=sep;
|
||||
sep^.rtfNextSE:=nil;
|
||||
sepLast:=sep;
|
||||
end;
|
||||
end;
|
||||
GetToken;
|
||||
End;
|
||||
if sp^.rtfSNextPar=-1 then { \snext not given }
|
||||
sp^.rtfSNextPar:=sp^.rtfSNum; { next is itself }
|
||||
if rtfClass<>rtfText then
|
||||
|
Loading…
Reference in New Issue
Block a user