sw/qa/extras/ooxmlexport/data/plausable-border.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 +- writerfilter/source/dmapper/PropertyMap.cxx | 10 +++++----- 3 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit 78f90a6db00b5dd69bb14178a8b31fc0f845d59c Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Fri Oct 30 22:02:50 2015 +1000 tdf#95071: fix spacing calculations for border with page offset With commit ebf767eeb2a169ba533e1b2ffccf16f41d95df35, some previously hidden bugs manifested themselves, this is one of them. The margin size calculated incorrectly when border offset was from page. The border is drawn from the margin inwards, so the margin should be equal to OOXML w:space attribute, and border distance should be OOXML page margin - border distance - border width. Incorrect calculation gave negative margin, with IllegalArgumentException thrown in SfxItemPropertySet::setPropertyValue. Reviewed-on: https://gerrit.libreoffice.org/19586 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthieb...@gmail.com> Cherry-picked from 061d98ccc7fc95234514d5dee3d9e80e49b10dc7 Change-Id: Ifcf4a348e975df53410933aab3684d17f68b688c Reviewed-on: https://gerrit.libreoffice.org/19940 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mikekagan...@hotmail.com> Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/qa/extras/ooxmlexport/data/plausable-border.docx b/sw/qa/extras/ooxmlexport/data/plausable-border.docx index a1a9547..c6f049f 100644 Binary files a/sw/qa/extras/ooxmlexport/data/plausable-border.docx and b/sw/qa/extras/ooxmlexport/data/plausable-border.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 8a186ef..42dc736 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -567,7 +567,7 @@ DECLARE_OOXMLIMPORT_TEST(testN758883, "n758883.docx") uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); sal_Int32 nValue = 0; xPropertySet->getPropertyValue("LeftMargin") >>= nValue; - CPPUNIT_ASSERT_EQUAL(sal_Int32(794), nValue); + CPPUNIT_ASSERT_EQUAL(sal_Int32(847), nValue); // No assert for the 3rd problem: see the comment in the test doc. diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index b9f46ff..dab485f 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -700,18 +700,18 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); sal_Int32 nDist = nDistance; - if( nOffsetFrom == 1 ) + if( nOffsetFrom == 1 ) // From page { const OUString sMarginName = rPropNameSupplier.GetName( eMarginId ); uno::Any aMargin = xStyle->getPropertyValue( sMarginName ); sal_Int32 nMargin = 0; aMargin >>= nMargin; - // Change the margins with the ( border distance - line width ) - xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance - nLineWidth ) ); + // Change the margins with the border distance + xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) ); - // Set the distance to ( Margin - distance ) - nDist = nMargin - nDistance; + // Set the distance to ( Margin - distance - nLineWidth ) + nDist = nMargin - nDistance - nLineWidth; } const OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId ); if (xStyle.is()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits