Kaydet (Commit) 4e653d15 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: fix default section break type inside multiple columns

Change-Id: I7c44a2bdb69563953d3257b435aeed5bae50f7b2
üst 066e0fe1
......@@ -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();
......
......@@ -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 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment