[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source

Justin Luth justin_luth at sil.org
Tue Aug 23 19:59:33 UTC 2016


 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 6f9cbfad8744646b5b1f79d5fbf1c1f9eb03519d
Author: Justin Luth <justin_luth at 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 <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/28252
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>

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 20ee525..21e288b 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 31001c1..5bc56b8 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())


More information about the Libreoffice-commits mailing list