incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1362945 - /incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx
Date Wed, 18 Jul 2012 13:38:25 GMT
Author: alg
Date: Wed Jul 18 13:38:25 2012
New Revision: 1362945

URL: http://svn.apache.org/viewvc?rev=1362945&view=rev
Log:
RTF import filter review: the page descriptor fiasco
Patch by: Michael Stahl

Modified:
    incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx?rev=1362945&r1=1362944&r2=1362945&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/rtf/swparrtf.cxx Wed Jul 18 13:38:25 2012
@@ -3250,6 +3250,7 @@ void SwRTFParser::ReadPageDescTbl()
 
     sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0;
     SvUShorts aColumns;
+    ::std::map< const SwPageDesc*, sal_uInt16 > aFollowMap; //store index of following
page descriptors
 
     while( nNumOpenBrakets && IsParserWorking() )
     {
@@ -3323,10 +3324,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 ) );
@@ -3507,10 +3507,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 );



Mime
View raw message