summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-10-30 22:02:50 +1000
committerAndras Timar <andras.timar@collabora.com>2015-11-10 22:31:15 +0100
commit258718a9a2084218a574c32db4d3e6bffc7c6849 (patch)
treed55a3dcb2fccf049c9ad202b8c7a34bc78da2c44 /writerfilter
parent02f452d67faf086c4ade874bcf588cf48b8a1ddb (diff)
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. Change-Id: Ifcf4a348e975df53410933aab3684d17f68b688c Reviewed-on: https://gerrit.libreoffice.org/19586 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> (cherry picked from commit 061d98ccc7fc95234514d5dee3d9e80e49b10dc7)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index b9f46ff8039b..dab485fbbdca 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())