diff options
author | Michael Stahl <mst@openoffice.org> | 2012-07-24 11:40:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-07-24 18:05:23 +0200 |
commit | e991df706d4a1af4a17cacd473ec6107a9d934d1 (patch) | |
tree | 8f8722af59f5f7a0893998211ea1825e14b5912e /sw | |
parent | 60ebdce4735f8ecf51a6ddd94786d465f112f334 (diff) |
better page descriptor handling in RTF
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
(cherry picked from commit dd1bc101f93107c021fa180f23bda7ace0c5e6a3)
Change-Id: I9f80d5be700c94cf5993243903a70295d2545868
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 396de09a7fb4..94569405d4d8 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -3239,6 +3239,7 @@ void SwRTFParser::ReadPageDescTbl() sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0; std::vector<sal_uInt16> aColumns; + ::std::map< const SwPageDesc*, sal_uInt16 > aFollowMap; //store index of following page descriptors while( nNumOpenBrakets && IsParserWorking() ) { @@ -3301,10 +3302,9 @@ void SwRTFParser::ReadPageDescTbl() break; case RTF_PGDSCNXT: - // setze erstmal nur die Nummer als Follow. Am Ende der - // Tabelle wird diese entsprechend korrigiert !! + // store index of follow in map; will be fixed up later if( nTokenValue ) - pPg->SetFollow( (const SwPageDesc*)nTokenValue ); + aFollowMap.insert( ::std::pair<const SwPageDesc*, sal_uInt16>( pPg, nTokenValue )); else pPg->SetFollow( & const_cast<const SwDoc *>(pDoc) ->GetPageDesc( 0 ) ); @@ -3473,10 +3473,13 @@ void SwRTFParser::ReadPageDescTbl() for( nPos = 0; nPos < pDoc->GetPageDescCnt(); ++nPos ) { SwPageDesc* pPgDsc = &pDoc->_GetPageDesc( nPos ); - if( (sal_uInt16)(long)pPgDsc->GetFollow() < pDoc->GetPageDescCnt() ) - pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc) - ->GetPageDesc((sal_uInt16)(long) - pPgDsc->GetFollow())); + std::map< const SwPageDesc*, sal_uInt16 >::const_iterator aIter = + aFollowMap.find( pPgDsc ); + if (aIter != aFollowMap.end()) + { + if ((*aIter).second < pDoc->GetPageDescCnt()) + pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc)->GetPageDesc((*aIter).second)); + } } SetChkStyleAttr( bSaveChkStyleAttr ); |