diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-11 08:57:31 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-11 08:57:53 +0100 |
commit | 11129d89b152db54c86bb2bda58c24b8abb6c5a8 (patch) | |
tree | 54b65fad83cd1b018bf691055216b48d26b0df5f /oox | |
parent | fdeaa040059647f7bd1d103f2971e945bbe18659 (diff) |
tdf#85232 WPG import: fix handling of line shapes
The missing convertMm100ToTwip() calls mispositioned the line shapes
inside the groupshape in case of using drawingML inside DOCX files.
Change-Id: I0c9d652de43d779f9073a8bfe22866ce4f31d0fa
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7d329b23ecd1..6f8475978a2b 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -480,10 +480,11 @@ Reference< XShape > Shape::createAndInsert( aTransformation.translate( aCenter.getX(), aCenter.getY() ); } + bool bInGroup = !aParentTransformation.isIdentity(); if( maPosition.X != 0 || maPosition.Y != 0) { // if global position is used, add it to transformation - if (mbWps && aParentTransformation.isIdentity()) + if (mbWps && !bInGroup) aTransformation.translate( maPosition.X * EMU_PER_HMM, maPosition.Y * EMU_PER_HMM); else aTransformation.translate( maPosition.X, maPosition.Y ); @@ -505,10 +506,18 @@ Reference< XShape > Shape::createAndInsert( sal_Int32 i, nNumPoints = aPoly.count(); uno::Sequence< awt::Point > aPointSequence( nNumPoints ); awt::Point* pPoints = aPointSequence.getArray(); + uno::Reference<lang::XServiceInfo> xModelInfo(rFilterBase.getModel(), uno::UNO_QUERY); + bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument"); for( i = 0; i < nNumPoints; ++i ) { const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); - pPoints[ i ] = awt::Point( static_cast< sal_Int32 >( aPoint.getX() ), static_cast< sal_Int32 >( aPoint.getY() ) ); + if (bIsWriter && bInGroup) + // Writer's draw page is in twips, and these points get passed + // to core without any unit conversion when Writer + // postprocesses only the group shape itself. + pPoints[i] = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY()))); + else + pPoints[i] = awt::Point(static_cast<sal_Int32>(aPoint.getX()), static_cast<sal_Int32>(aPoint.getY())); } uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 ); aPolyPolySequence.getArray()[ 0 ] = aPointSequence; |