diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-10-26 17:52:42 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-10-27 14:37:58 +0100 |
commit | bf1772c9fe7206c2594b2db5f6da3ca97003ba98 (patch) | |
tree | 2fbd21c9b2a610f13de5fd76cd9488486bb21e4f /writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | |
parent | 5e07e42556e1399e37ad3ccf02b75f3b1d03551a (diff) |
DOCX import, altChunk: fix missing page break
Somewhat similar to copy&paste, the altChunk mechanism drops styles from
the inner document by default. A surprising consequence of that is
sections in the inner document have the default page size. This leads to
a page break when the content of the outer document ends and the content
of the inner document starts.
Fix the importer to support this:
1) Ignore the page size and number in DomainMapper::lcl_attribute().
2) Pass the start of the current section to the sub-importer, so that it
can insert the starting page break at the right place.
(cherry picked from commit 32c322e9d037b29ded2297b400a2c596c042f1fa)
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.hxx
Change-Id: Id3955f2b35a139692254c4ac1233e96eef2620e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104870
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx')
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx index 8aa53fcee3ec..d09a476dce4a 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx @@ -120,16 +120,28 @@ CPPUNIT_TEST_FIXTURE(Test, testAltChunk) uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara; + uno::Reference<beans::XPropertySet> xParaProps; xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Outer para 1"), xPara->getString()); + xParaProps.set(xPara, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("outer, before sect break"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("Standard"), + xParaProps->getPropertyValue("PageStyleName").get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Outer para 2"), xPara->getString()); + xParaProps.set(xPara, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("outer, after sect break"), xPara->getString()); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Converted1 + // - Actual : Standard + // i.e. the page break between the first and the second paragraph was missing. + CPPUNIT_ASSERT_EQUAL(OUString("Converted1"), + xParaProps->getPropertyValue("PageStyleName").get<OUString>()); // Without the accompanying fix in place, this test would have failed with a // container.NoSuchElementException, as the document had only 2 paragraphs, all the "inner" // content was lost. xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Inner para 1"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("inner doc, first para"), xPara->getString()); } } |