From dea74f31d2a0062547e279bb934c60731f5e560d Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 25 Jun 2018 13:43:11 +0300 Subject: tdf#114845 sd: only shift rotated group items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes 6.0 commit 9ae1e094d5a8a5b4432c88ebea0ca9fc1c79f602 > PPTX export: correct position of rotated groups However, there was nothing excluding the re-positioning to only group items. Change-Id: I62e36b46c0d2ac3e41f8d7d4ed82df11e6eb1ee5 Reviewed-on: https://gerrit.libreoffice.org/56386 Tested-by: Jenkins Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/56535 Reviewed-by: Justin Luth --- oox/source/export/drawingml.cxx | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'oox') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 1c0be28fdaf9..8992ff3ba0ba 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1369,7 +1369,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2; } - else if(nRotation == 18000) + else if ( nRotation == 18000 && IsGroupShape( rXShape, /*bOrChildShape=*/true ) ) { if (!bFlipV && bPositiveX) { @@ -1392,11 +1392,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa if(bFlipH != bFlipV) nRotation = nRotation * -1 + 36000; - uno::Reference xServiceInfo(rXShape, uno::UNO_QUERY_THROW); - bool bIsGroupShape = (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.GroupShape")); - WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace, - bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), bIsGroupShape); + bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape )); } void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect, @@ -2079,6 +2076,28 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS } } +bool DrawingML::IsInGroupShape () const +{ + bool bRet = m_xParent.is(); + if ( bRet ) + { + uno::Reference xServiceInfo(m_xParent, uno::UNO_QUERY_THROW); + bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"); + } + return bRet; +} + +bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape, bool bOrChildShape ) const +{ + bool bRet = bOrChildShape && IsInGroupShape(); + if ( !bRet ) + { + uno::Reference xServiceInfo(rXShape, uno::UNO_QUERY_THROW); + bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"); + } + return bRet; +} + sal_Int32 DrawingML::getBulletMarginIndentation (const Reference< XPropertySet >& rXPropSet,sal_Int16 nLevel, const OUString& propName) { if( nLevel < 0 || !GETA( NumberingRules ) ) -- cgit v1.2.3