diff options
author | Justin Luth <justin_luth@sil.org> | 2016-06-25 22:21:08 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-07-04 17:08:10 +0200 |
commit | e6e962a2db0b82efe1054bb85e56406ada4f4c69 (patch) | |
tree | 71a6a921edf7912e428abb62e67da6c7bb1bd252 | |
parent | 3ca7bf489d3df36b4e23bc3c5b515bd93e235e27 (diff) |
tdf#90697 docx - don't change continuous break into page break
As soon as you set PROP_PAGE_DESC_NAME, you are inserting that
style as a page break. Setting a pagebreak via a continous break
was first introduced in commit 50cb1667020494906afaacb68d4163d1eda527cf
but the unittest for that commit no longer uses this code.
I'm suggesting it be reverted. It really messes up round-tripping
when continuous breaks are removed/replaced with hard page breaks.
There are a few odd cases where the very first section needs to set the
page break via the continuous break, so it hasn't been eliminated
completely.
Reviewed-on: https://gerrit.libreoffice.org/26662
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 50bf96d31ab2eb546f6c71cc93c1fa5dd4bf3044)
Change-Id: I5b0e4bb7612ee9df47e5c49b8c2316dc001b5238
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx | bin | 0 -> 42783 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 4 |
3 files changed, 20 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx Binary files differnew file mode 100644 index 000000000000..b5e7ef02341a --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 1a16cbaece1e..0174e70a1da5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/text/XTextFramesSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextSection.hpp> +#include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/style/CaseMap.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/LineSpacing.hpp> @@ -367,6 +368,22 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column"); } +DECLARE_OOXMLEXPORT_TEST(testTdf90697_complexBreaksHeaders,"tdf90697_complexBreaksHeaders.docx") +{ +// This is a complex document using many types of section breaks and re-defined headers. +// Paragraphs 44-47 were in two columns + uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(45), "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()); + +// after that, the section break should switch things back to one column. + xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(50), "TextSection"); + CPPUNIT_ASSERT(xTextSection.is()); + xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount()); +} + DECLARE_OOXMLEXPORT_TEST(testIndentation, "test_indentation.docx") { // fdo#74141 :There was a problem that in style.xml and document.xml in <w:ind> tag "right" & "left" margin diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index d2e1b41801e8..afa08150088b 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1140,7 +1140,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { try { - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(aName)); + if( m_bIsFirstSection ) + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(aName)); + uno::Reference<beans::XPropertySet> xPageStyle (rDM_Impl.GetPageStyles()->getByName(aName), uno::UNO_QUERY_THROW); HandleMarginsHeaderFooter(rDM_Impl); if (rDM_Impl.IsNewDoc()) |