diff options
author | Justin Luth <justin_luth@sil.org> | 2016-06-25 22:21:08 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2016-08-23 19:59:06 +0000 |
commit | 6f9cbfad8744646b5b1f79d5fbf1c1f9eb03519d (patch) | |
tree | d49ea108067a8eda82e8973dbf4daf55b8b2d913 | |
parent | 15a504308d27dfcb605da320c9231227aca415e1 (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.
Change-Id: I5b0e4bb7612ee9df47e5c49b8c2316dc001b5238
Reviewed-on: https://gerrit.libreoffice.org/26662
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/28252
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
-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 20ee525f0e0c..21e288bc597d 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 31001c182bf4..5bc56b8710b8 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1154,7 +1154,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { try { - xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME), uno::makeAny(aName)); + if( m_bIsFirstSection ) + xRangeProperties->setPropertyValue(getPropertyName(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()) |