sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 17 ++++++++++ writerfilter/source/dmapper/PropertyMap.cxx | 4 +- 3 files changed, 20 insertions(+), 1 deletion(-)
New commits: commit 50bf96d31ab2eb546f6c71cc93c1fa5dd4bf3044 Author: Justin Luth <justin_l...@sil.org> Date: Sat Jun 25 22:21:08 2016 +0300 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 <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx new file mode 100644 index 0000000..b5e7ef0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index a6282d6..9abeccc 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> @@ -373,6 +374,22 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage()); } +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 b31dbb0..37f9646 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1148,7 +1148,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()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits