summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-19 16:10:52 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-22 17:46:31 +0200
commit26f4a898aaaf123ec12407412dd7b27fa5e18f07 (patch)
tree10d3e7e6b96f399d0ad6d84d7b89fe91b603cad9 /writerfilter
parent7a9c9567b2431b6b1c4c8cf0aa0565ae2def63da (diff)
n#758883 dmapper: take care of border width when setting margins
Word handles the "border to page" distance as a subset of the page margin. Writer handles these values separately, and the real margin is the sum of the border width, the margin and the border width itself. The problem was that the width of the border itself wasn't counted, so the real margin was a bit larger than necessary. Change-Id: Id38153308f1e321b6556762b30f3377f2360edf6
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx13
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx2
2 files changed, 9 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 58dd2b4266f6..913eaac432b0 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -501,17 +501,20 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
}
if( m_nBorderDistances[nBorder] >= 0 )
{
+ sal_uInt32 nLineWidth = 0;
+ if (m_pBorderLines[nBorder])
+ nLineWidth = m_pBorderLines[nBorder]->LineWidth;
SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
- m_nBorderDistances[nBorder], nOffsetFrom );
+ m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
if(xSecond.is())
SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
- m_nBorderDistances[nBorder], nOffsetFrom );
+ m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
}
}
}
void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
- PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom )
+ PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth )
{
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
@@ -523,8 +526,8 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet
sal_Int32 nMargin = 0;
aMargin >>= nMargin;
- // Change the margins with the border distance
- xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) );
+ // Change the margins with the ( border distance - line width )
+ xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance - nLineWidth ) );
// Set the distance to ( Margin - distance )
nDist = nMargin - nDistance;
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index ba5e1ab90c42..b9a3d5d0ebb5 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -207,7 +207,7 @@ class SectionPropertyMap : public PropertyMap
bool HasFooter( bool bFirstPage ) const;
void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle,
- PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom );
+ PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth );
public:
explicit SectionPropertyMap(bool bIsFirstSection);