[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 17 02:28:21 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 870e1d6e74e9d8eea13dec0cab52755980cf2a93
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
    
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Conflicts:
    	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
    
    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 2076c8c..bbf1d3e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -25,6 +25,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>
@@ -135,6 +136,7 @@ public:
     void testVmlTextVerticalAdjust();
     void testGroupshapeSdt();
     void testBnc779620();
+    void testDefaultSectBreakCols();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -235,6 +237,7 @@ void Test::run()
         {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust},
         {"groupshape-sdt.docx", &Test::testGroupshapeSdt},
         {"bnc779620.docx", &Test::testBnc779620},
+        {"default-sect-break-cols.docx", &Test::testDefaultSectBreakCols},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1652,6 +1655,20 @@ void Test::testBnc779620()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+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 3c4a470..2de47e9 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -890,7 +890,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