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

Justin Luth justin_luth at sil.org
Fri Feb 24 05:29:41 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                    |    6 ++++++
 writerfilter/source/dmapper/PropertyMap.cxx                  |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 1dadd312e5cb3c95f1e3cd5a1776830b7056bc6b
Author: Justin Luth <justin_luth at sil.org>
Date:   Fri Feb 24 07:16:00 2017 +0300

    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 at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx b/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx
new file mode 100644
index 0000000..6acb9f3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf105490_negativeMargins.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 6f31ba0..0ffd692 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 7cba5a1..354be34 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,


More information about the Libreoffice-commits mailing list