diff options
author | Justin Luth <justin_luth@sil.org> | 2017-02-24 07:16:00 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2017-02-24 05:29:16 +0000 |
commit | 1dadd312e5cb3c95f1e3cd5a1776830b7056bc6b (patch) | |
tree | 20e80ccd2615a073836302008d1762caf867c8cd | |
parent | fe7c8e4ec1990f33d325d3fcabdce30ef4f74465 (diff) |
tdf#105490: writerfilter exception - ULSpace must be >= 0
Instead of a minimal margin, default margins were being applied
because an exception was thrown when trying to set a negative
value to top and bottom margins in SvxULSpaceItem::PutValue
Change-Id: I0a9fc2c7cb996efbd26abfdbed27ea0bcb86d9a5
Reviewed-on: https://gerrit.libreoffice.org/34598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx | bin | 0 -> 12389 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx b/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx Binary files differnew file mode 100644 index 000000000000..6acb9f383de1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 6f31ba07911f..0ffd692e4f1a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -67,6 +67,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPad CPPUNIT_ASSERT_EQUAL( 3, getPages() ); } +DECLARE_OOXMLEXPORT_TEST(tdf105490_negativeMargins, "tdf105490_negativeMargins.docx") +{ + // negative margins should change to minimal margins, not default margins. + CPPUNIT_ASSERT_EQUAL( 1, getPages() ); +} + DECLARE_OOXMLEXPORT_TEST(testTdf104061_tableSectionColumns,"tdf104061_tableSectionColumns.docx") { CPPUNIT_ASSERT_MESSAGE("There should be two or three pages", getPages() <= 3 ); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 7cba5a1a3a8a..354be3488b04 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1005,8 +1005,8 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) } //now set the top/bottom margin for the follow page style - Insert(PROP_TOP_MARGIN, uno::makeAny( nTopMargin )); - Insert(PROP_BOTTOM_MARGIN, uno::makeAny( nBottomMargin )); + Insert(PROP_TOP_MARGIN, uno::makeAny( nTopMargin > 0 ? nTopMargin : 0 )); + Insert(PROP_BOTTOM_MARGIN, uno::makeAny( nBottomMargin > 0 ? nBottomMargin : 0 )); } uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, |