summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-09-11 15:18:26 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-11 16:14:16 +0200
commit4e653d15eff26aa5283d8ba20611893f4c573f57 (patch)
treeedb4a54114aed8579e73c347ecadb2e22df98fa0
parent066e0fe1a230eac2531a53e1ec5fa58347e9e31e (diff)
DOCX import: fix default section break type inside multiple columns
Change-Id: I7c44a2bdb69563953d3257b435aeed5bae50f7b2
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/default-sect-break-cols.docxbin0 -> 9993 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx17
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx4
3 files changed, 20 insertions, 1 deletions
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 000000000000..b66b844f16ee
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 06a3ae242739..6076d77e619a 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 c3a6523d711c..86382bbf7fb2 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 =