[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Oct 20 06:24:51 PDT 2014


 sw/qa/extras/ooxmlexport/data/page-break-before.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx             |    9 ++++++++-
 writerfilter/source/dmapper/DomainMapper.cxx         |    5 +----
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 382bab9412b87f82da82276332496eb28b28d4f3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 20 14:43:42 2014 +0200

    DOCX import: fix <w:pageBreakBefore> wrt. inherited styles
    
    We used to ignore this element with a "false" logical attribute, but
    that causes a problem when an inherited style wants to explicitly
    disable this element from a parent style.
    
    Change-Id: I2fc4c5b2002987d44679d863ea3f19114b9ab7a4

diff --git a/sw/qa/extras/ooxmlexport/data/page-break-before.docx b/sw/qa/extras/ooxmlexport/data/page-break-before.docx
new file mode 100644
index 0000000..99d8c3a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/page-break-before.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b35f97b..3d76287 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -11,9 +11,10 @@
 
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/text/FontEmphasis.hpp>
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/XTextRangeCompare.hpp>
-#include <com/sun/star/text/FontEmphasis.hpp>
 
 #include <string>
 
@@ -493,6 +494,12 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphMark, "paragraph-mark.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharStyleName"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testPageBreakBefore, "page-break-before.docx")
+{
+    // This was style::BreakType_PAGE_BEFORE, i.e. page break wasn't ignored, as it should have been.
+    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 45fb28f..12763b9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1135,10 +1135,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
         rContext->Insert(PROP_PARA_KEEP_TOGETHER, uno::makeAny( nIntValue ? true : false) );
         break;
     case NS_ooxml::LN_CT_PPrBase_pageBreakBefore:
-        if ( nIntValue == 1 )
-        {
-            rContext->Insert(PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE ) );
-        }
+        rContext->Insert(PROP_BREAK_TYPE, uno::makeAny(nIntValue ? style::BreakType_PAGE_BEFORE : style::BreakType_NONE));
     break;
     case NS_ooxml::LN_CT_NumPr_ilvl:
             if (nIntValue < 0 || 10 <= nIntValue) // Writer can't do everything


More information about the Libreoffice-commits mailing list