* Fixed style reading for OOffice documents

git-svn-id: trunk@11268 -
This commit is contained in:
michael 2008-06-23 19:38:40 +00:00
parent 91116c2e21
commit 96edd65a89

View File

@ -803,6 +803,7 @@ var
sp : PRTFStyle; sp : PRTFStyle;
sep,sepLast : PRTFStyleElt; sep,sepLast : PRTFStyleElt;
bp : string[rtfBufSiz]; bp : string[rtfBufSiz];
I : Integer;
Begin Begin
While true do While true do
@ -823,40 +824,40 @@ While true do
FstyleList := sp; FstyleList := sp;
if not CheckCM (rtfGroup, rtfBeginGroup) then if not CheckCM (rtfGroup, rtfBeginGroup) then
Error ('SSErr - missing {'); Error ('SSErr - missing {');
while (GetToken=rtfControl) or (FTokenClass=rtfControl) do I:=0;
GetToken;
while (fRTFClass=rtfControl) or (FTokenClass=rtfControl) or (FRTFClass=rtfGroup) do
Begin Begin
if rtfClass=rtfUnknown then If CheckCM(rtfGroup, rtfBeginGroup) then
continue; SkipGroup
if (CheckMM (rtfParAttr, rtfStyleNum)) then else if rtfClass<>rtfUnknown then
Begin begin
sp^.rtfSNum:=rtfParam; if (CheckMM (rtfParAttr, rtfStyleNum)) then
continue; sp^.rtfSNum:=rtfParam
End; else if (CheckMM (rtfStyleAttr, rtfBasedOn)) then
if (CheckMM (rtfStyleAttr, rtfBasedOn)) then sp^.rtfSBasedOn:=rtfParam
Begin else if (CheckMM (rtfStyleAttr, rtfNext)) then
sp^.rtfSBasedOn:=rtfParam; sp^.rtfSNextPar:=rtfParam
continue; else
End; begin
if (CheckMM (rtfStyleAttr, rtfNext)) then new(sep);
Begin if sep=nil then
sp^.rtfSNextPar:=rtfParam; Error ('SSErr - cannot allocate style element');
Continue; sep^.rtfSEClass:=rtfClass;
End; sep^.rtfSEMajor:=rtfMajor;
new(sep); sep^.rtfSEMinor:=rtfMinor;
if sep=nil then sep^.rtfSEParam:=rtfParam;
Error ('SSErr - cannot allocate style element'); sep^.rtfSEText:=rtfTextBuf;
sep^.rtfSEClass:=rtfClass; if sepLast=nil then
sep^.rtfSEMajor:=rtfMajor; sp^.rtfSSEList:=sep { first element }
sep^.rtfSEMinor:=rtfMinor; else { add to end }
sep^.rtfSEParam:=rtfParam; sepLast^.rtfNextSE:=sep;
sep^.rtfSEText:=rtfTextBuf; sep^.rtfNextSE:=nil;
if sepLast=nil then sepLast:=sep;
sp^.rtfSSEList:=sep { first element } end;
else { add to end } end;
sepLast^.rtfNextSE:=sep; GetToken;
sep^.rtfNextSE:=nil; End;
sepLast:=sep;
End;
if sp^.rtfSNextPar=-1 then { \snext not given } if sp^.rtfSNextPar=-1 then { \snext not given }
sp^.rtfSNextPar:=sp^.rtfSNum; { next is itself } sp^.rtfSNextPar:=sp^.rtfSNum; { next is itself }
if rtfClass<>rtfText then if rtfClass<>rtfText then