summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-06-25 22:21:08 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-29 07:35:54 +0000
commit50bf96d31ab2eb546f6c71cc93c1fa5dd4bf3044 (patch)
tree6fa465f41eb719352e2c9d730cd452fd5bf41d17
parent1294013bf5d373ded1d050370569acdc2b68c5f5 (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>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docxbin0 -> 42783 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx17
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx4
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
new file mode 100644
index 000000000000..b5e7ef02341a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index a6282d6e3f64..9abeccc8927b 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 b31dbb02c513..37f9646fe663 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())