[Libreoffice-commits] core.git: sw/qa sw/source

umeshkadam umesh.kadam at synerzip.com
Thu May 8 23:35:11 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo77890.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx    |   13 +++++++++++++
 sw/source/filter/ww8/wrtww8.cxx             |    1 +
 sw/source/filter/ww8/wrtww8.hxx             |    1 +
 sw/source/filter/ww8/ww8atr.cxx             |   16 ++++++++++++----
 5 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit e9b2787c2ece4c8260fbac6359257e1829c917d4
Author: umeshkadam <umesh.kadam at synerzip.com>
Date:   Fri May 2 13:25:15 2014 +0530

    fdo#77890: page break exported as section break if different 1st page is set
    
    - Page break was getting exported as section break in case if the different
      first page was set.
    - Fixed this issue and added a UT.
    - For additional details regarding the issue please check the following
       https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2
    
    Reviewed on:
    	https://gerrit.libreoffice.org/9234
    
    Change-Id: I6799b204c0d1c80a7e07119e2e3aac337520cb08

diff --git a/sw/qa/extras/ooxmlexport/data/fdo77890.docx b/sw/qa/extras/ooxmlexport/data/fdo77890.docx
new file mode 100644
index 0000000..ac90174
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77890.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e1f8d95..42e25c7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3135,6 +3135,19 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76587 , "fdo76587.docx")
     assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "lineRule", "auto");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO77890 , "fdo77890.docx")
+{
+    /*
+    Ensure that the page break is preserved i.e it should not be converted to a section break, in case
+    if the different first page is set for the pages in the document.
+    For additional comments pls refer https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2
+    */
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:br", "type", "page");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testNumberedList,"NumberedList.docx")
 {
     //fdo74150:In document.xml, for pStyle = "NumberedList1", iLvl and numId was not preserved
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index bbf5af0..1fc1105 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3475,6 +3475,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
     , mnHdFtIndex(0)
     , mnRedlineMode(0)
     , pAktPageDesc(0)
+    , bPrevTextNodeIsEmpty(false)
     , pPapPlc(0)
     , pChpPlc(0)
     , pChpIter(0)
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index d607c8c..9229fa5 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -479,6 +479,7 @@ public:
     SwImplBookmarks maImplicitBookmarks;
     sw::Frames maFrames;             // The floating frames in this document
     const SwPageDesc *pAktPageDesc;
+    bool bPrevTextNodeIsEmpty;
     WW8_WrPlcPn* pPapPlc;
     WW8_WrPlcPn* pChpPlc;
     MSWordAttrIter* pChpIter;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index f2df0f1..de2ab6a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -422,11 +422,18 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
     // Even if pAktPageDesc != pPageDesc ,it might be because of the different header & footer types.
     if (pAktPageDesc != pPageDesc)
     {
-        if ( (isCellOpen && (pAktPageDesc->GetName() != pPageDesc->GetName())) || isTextNodeEmpty )
+        if ( ( isCellOpen && ( pAktPageDesc->GetName() != pPageDesc->GetName() )) ||
+             ( isTextNodeEmpty || bPrevTextNodeIsEmpty ))
         {
-           // Table cell is open and page header types are different,so do not output section break OR
-           // PageBreak is present but text node has no string - it is an empty node, do not prepare
-           // new page descriptor i.e. bNewPageDesc should be false.
+            /* Do not output a section break in the following scenarios.
+                1) Table cell is open and page header types are different
+                2) PageBreak is present but text node has no string - it is an empty node.
+                3) If the previous node was an empty text node and current node is a non empty text node or vice versa.
+                4) If previous node and current node both are empty text nodes.
+                Converting a page break to section break would cause serious issues while importing
+                the RT files with different first page being set.
+            */
+            bNewPageDesc = false;
         }
         else
         {
@@ -539,6 +546,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
         PrepareNewPageDesc( pSet, rNd, pPgDesc, pAktPageDesc );
     }
     bBreakBefore = false;
+    bPrevTextNodeIsEmpty = isTextNodeEmpty ;
 }
 
 // #i76300#


More information about the Libreoffice-commits mailing list