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

Miklos Vajna vmiklos at collabora.co.uk
Wed Sep 11 07:15:02 PDT 2013


 sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                   |   17 +++++++++++++
 writerfilter/source/dmapper/PropertyMap.cxx                |    4 ++-
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 4e653d15eff26aa5283d8ba20611893f4c573f57
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Sep 11 15:18:26 2013 +0200

    DOCX import: fix default section break type inside multiple columns
    
    Change-Id: I7c44a2bdb69563953d3257b435aeed5bae50f7b2

diff --git a/sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx b/sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx
new file mode 100755
index 0000000..b66b844
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 06a3ae2..6076d77 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/text/XDependentTextField.hpp>
 #include <com/sun/star/text/XFormField.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
@@ -134,6 +135,7 @@ public:
     void testFdo68607();
     void testVmlTextVerticalAdjust();
     void testGroupshapeSdt();
+    void testDefaultSectBreakCols();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -233,6 +235,7 @@ void Test::run()
         {"fdo68607.docx", &Test::testFdo68607},
         {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust},
         {"groupshape-sdt.docx", &Test::testGroupshapeSdt},
+        {"default-sect-break-cols.docx", &Test::testDefaultSectBreakCols},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1614,6 +1617,20 @@ void Test::testGroupshapeSdt()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning"));
 }
 
+void Test::testDefaultSectBreakCols()
+{
+    // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns.
+    uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First."), "TextSection");
+    CPPUNIT_ASSERT(xTextSection.is());
+    uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+    // Second problem: the page style had two columns, while it shouldn't have any.
+    uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index c3a6523..86382bb 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -907,7 +907,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
     }
 
     //depending on the break type no page styles should be created
-    if(m_nBreakType == 0)
+    // If the section type is missing, but we have columns, then this should be
+    // handled as a continuous section break.
+    if(m_nBreakType == 0 || (m_nBreakType == -1 && m_nColumnCount > 0))
     {
         //todo: insert a section or access the already inserted section
         uno::Reference< beans::XPropertySet > xSection =


More information about the Libreoffice-commits mailing list