summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-20 14:43:42 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-20 15:23:50 +0200
commit382bab9412b87f82da82276332496eb28b28d4f3 (patch)
tree211144226393525768444b53d53e0eaf5d64ed2b
parentf24c60870531689d95c056037e48cd29ad1d17bb (diff)
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
-rw-r--r--sw/qa/extras/ooxmlexport/data/page-break-before.docxbin0 -> 12943 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
3 files changed, 9 insertions, 5 deletions
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 000000000000..99d8c3a5d4eb
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/page-break-before.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b35f97b4bc8a..3d7628720eab 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 45fb28f41468..12763b9bd91f 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