File bsc1095601.patch of Package libreoffice.openSUSE_Leap_42.3_Update

From 3fdff39af3b793f68f9c72d940590948dbb840e2 Mon Sep 17 00:00:00 2001
From: Justin Luth <justin.luth@collabora.com>
Date: Mon, 25 Jun 2018 13:43:11 +0300
Subject: [PATCH] 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 <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/56542
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
---
 include/oox/export/drawingml.hxx                |   2 ++
 oox/source/export/drawingml.cxx                 |  29 ++++++++++++++++++++----
 sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx | Bin 0 -> 45018 bytes
 sd/qa/unit/export-tests-ooxml2.cxx              |  16 +++++++++++++
 4 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 627bcc983706..f281d7f7ccc4 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -226,6 +226,8 @@ public:
     void WriteShape3DEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
     void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
     OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData );
+    bool IsInGroupShape() const;
+    bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape, bool bOrChildShape = false ) const;
     sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, const OUString& propName);

     static void ResetCounters();
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d243a4f99d13..d83f9165656f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1322,7 +1322,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)
             {
@@ -1348,11 +1348,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
     if(bSuppressFlipping)
         bFlipH = bFlipV = false;

-    uno::Reference<lang::XServiceInfo> 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,
-            bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), bIsGroupShape);
+            bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape ));
 }

 void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect,
@@ -2024,6 +2021,28 @@ void DrawingML::WriteParagraphNumbering( const Reference< XPropertySet >& rXProp
     }
 }

+bool DrawingML::IsInGroupShape () const
+{
+    bool bRet = m_xParent.is();
+    if ( bRet )
+    {
+        uno::Reference<lang::XServiceInfo> 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 && rXShape.is() )
+    {
+        uno::Reference<lang::XServiceInfo> 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 ) )

openSUSE Build Service is sponsored by