Kaydet (Commit) 3e0fc218 authored tarafından Armin Le Grand's avatar Armin Le Grand

RTF import filter review: the page descriptor fiasco

Patch by: Michael Stahl
üst 59e19330
...@@ -3250,6 +3250,7 @@ void SwRTFParser::ReadPageDescTbl() ...@@ -3250,6 +3250,7 @@ void SwRTFParser::ReadPageDescTbl()
sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0; sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0;
SvUShorts aColumns; SvUShorts aColumns;
::std::map< const SwPageDesc*, sal_uInt16 > aFollowMap; //store index of following page descriptors
while( nNumOpenBrakets && IsParserWorking() ) while( nNumOpenBrakets && IsParserWorking() )
{ {
...@@ -3323,10 +3324,9 @@ void SwRTFParser::ReadPageDescTbl() ...@@ -3323,10 +3324,9 @@ void SwRTFParser::ReadPageDescTbl()
break; break;
case RTF_PGDSCNXT: case RTF_PGDSCNXT:
// setze erstmal nur die Nummer als Follow. Am Ende der // store index of follow in map; will be fixed up later
// Tabelle wird diese entsprechend korrigiert !!
if( nTokenValue ) if( nTokenValue )
pPg->SetFollow( (const SwPageDesc*)nTokenValue ); aFollowMap.insert( ::std::pair<const SwPageDesc*, sal_uInt16>( pPg, nTokenValue ));
else else
pPg->SetFollow( & const_cast<const SwDoc *>(pDoc) pPg->SetFollow( & const_cast<const SwDoc *>(pDoc)
->GetPageDesc( 0 ) ); ->GetPageDesc( 0 ) );
...@@ -3507,10 +3507,13 @@ void SwRTFParser::ReadPageDescTbl() ...@@ -3507,10 +3507,13 @@ void SwRTFParser::ReadPageDescTbl()
for( nPos = 0; nPos < pDoc->GetPageDescCnt(); ++nPos ) for( nPos = 0; nPos < pDoc->GetPageDescCnt(); ++nPos )
{ {
SwPageDesc* pPgDsc = &pDoc->_GetPageDesc( nPos ); SwPageDesc* pPgDsc = &pDoc->_GetPageDesc( nPos );
if( (sal_uInt16)(long)pPgDsc->GetFollow() < pDoc->GetPageDescCnt() ) std::map< const SwPageDesc*, sal_uInt16 >::const_iterator aIter =
pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc) aFollowMap.find( pPgDsc );
->GetPageDesc((sal_uInt16)(long) if (aIter != aFollowMap.end())
pPgDsc->GetFollow())); {
if ((*aIter).second < pDoc->GetPageDescCnt())
pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc)->GetPageDesc((*aIter).second));
}
} }
SetChkStyleAttr( bSaveChkStyleAttr ); SetChkStyleAttr( bSaveChkStyleAttr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment