[Libreoffice-commits] .: Branch 'libreoffice-3-3' - sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Nov 26 08:03:31 PST 2010


 sw/source/filter/ww8/wrtw8sty.cxx |   19 ++++++++++++++-----
 sw/source/filter/ww8/wrtww8.hxx   |    1 +
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 56a6681b4292702677a9bfc3ee0b8903a4bbc99e
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Nov 26 17:02:07 2010 +0100

    Fix n#653526: Some section was added after having written the SEPX
    
    The real problem is probably more on the docx import side, but it can't
    hurt to have some guards on the export as well.

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index c82f2b1..38e9d25 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -966,7 +966,8 @@ WW8_WrPlcSepx::WW8_WrPlcSepx( MSWordExportBase& rExport )
     : MSWordSections( rExport ),
       aCps( 4, 4 ),
       pAttrs( 0 ),
-      pTxtPos( 0 )
+      pTxtPos( 0 ),
+      bNoMoreSections( false )
 {
     // to be in sync with the AppendSection() call in the MSWordSections
     // constructor
@@ -1042,9 +1043,12 @@ void MSWordSections::AppendSection( const SwPageDesc* pPd,
 void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
     const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
 {
-    aCps.Insert( nStartCp, aCps.Count() );
+    if ( !bNoMoreSections )
+    {
+        aCps.Insert( nStartCp, aCps.Count() );
 
-    AppendSection( pPd, pSectionFmt, nLnNumRestartNo );
+        AppendSection( pPd, pSectionFmt, nLnNumRestartNo );
+    }
 }
 
 void MSWordSections::AppendSection( const SwFmtPageDesc& rPD,
@@ -1059,9 +1063,12 @@ void MSWordSections::AppendSection( const SwFmtPageDesc& rPD,
 void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD,
     const SwNode& rNd, const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
 {
-    aCps.Insert(nStartCp, aCps.Count());
+    if ( !bNoMoreSections )
+    {
+        aCps.Insert(nStartCp, aCps.Count());
 
-    AppendSection( rPD, rNd, pSectionFmt, nLnNumRestartNo );
+        AppendSection( rPD, rNd, pSectionFmt, nLnNumRestartNo );
+    }
 }
 
 // MSWordSections::SetNum() setzt in jeder Section beim 1. Aufruf den
@@ -1746,6 +1753,8 @@ bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt )
 
         WW8_SepInfo& rSepInfo = aSects[i];
         rWrt.SectionProperties( rSepInfo, pA );
+
+        bNoMoreSections = true;
     }
     rWrt.SetHdFtIndex( nOldIndex ); //0
 
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index a1529b4..081609d 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -228,6 +228,7 @@ class WW8_WrPlcSepx : public MSWordSections
     SvULongs aCps;              // PTRARR von CPs
     WW8_PdAttrDesc* pAttrs;
     WW8_WrPlc0* pTxtPos;        // Pos der einzelnen Header / Footer
+    bool bNoMoreSections;
 
     // No copy, no assign
     WW8_WrPlcSepx( const WW8_WrPlcSepx& );


More information about the Libreoffice-commits mailing list