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

Pallavi Jadhav pallavi.jadhav at synerzip.com
Wed May 7 00:35:02 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo77812.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx    |   17 +++++++++++++++++
 sw/source/filter/ww8/wrtww8.cxx             |   15 +++++++++++++++
 3 files changed, 32 insertions(+)

New commits:
commit f6eb92406bd366c557bc07810649e7ab3d1db614
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Tue Apr 29 18:44:16 2014 +0530

    fdo#77812 :FILESAVE :DOCX : Extra Section Break gets added in file
    
    	Issue :
    	LO was exporting DOCX containing MultiColumns with additional
    	Section break Continuos.
    
    	Implementation :
    	1] Added check for Column_count in MSWordExportBase::WriteText()
    	   If Column_count > 1 and Text node is empty then do not
    	   export Section Break.
    	2] Written Export unit test case.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/9200
    
    Change-Id: Ibf3e6bd2d4827aa77a659b1600939cc56d65a63b

diff --git a/sw/qa/extras/ooxmlexport/data/fdo77812.docx b/sw/qa/extras/ooxmlexport/data/fdo77812.docx
new file mode 100644
index 0000000..48fb498
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77812.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8c99382..acd3d06 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3215,7 +3215,24 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0);
     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0);
     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx")
+{
+    /* Additional sectPr was getting inserted and hence Column properties
+     * were getting added into this additional sectPr instead of Default setPr.
+     */
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+
+    // Check no additional section break is inserted.
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0);
 
+    // Check w:cols comes under Default sectPr
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols", "num", "2");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", 1);
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 718761a..916d33f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -114,6 +114,7 @@
 #include <editeng/charrotateitem.hxx>
 #include "WW8FibData.hxx"
 #include "numrule.hxx"
+#include "fmtclds.hxx"
 
 using namespace css;
 using namespace sw::util;
@@ -2597,6 +2598,20 @@ void MSWordExportBase::WriteText()
                         }
                     }
                 }
+                else
+                {
+                    /* Do not export Section Break in case DOCX containing MultiColumn and
+                     * aIdx.GetNode().IsTxtNode() is False i.e. Text node is NULL.
+                     */
+                    const SwFrmFmt* pPgFmt = rSect.GetFmt();
+                    const SwFmtCol& rCol = pPgFmt->GetCol();
+                    sal_uInt16 nColumnCount = rCol.GetNumCols();
+                    if(nColumnCount > 1)
+                    {
+                        bNeedExportBreakHere = sal_False;
+                    }
+                }
+
                 if (bNeedExportBreakHere)  //#120140# End of check
                 {
                     ReplaceCr( (char)0xc ); // indicator for Page/Section-Break


More information about the Libreoffice-commits mailing list