File bnc1035589.patch of Package libreoffice.7249

From c49f2c00067cbe5de714525807290b71aec57ea3 Mon Sep 17 00:00:00 2001
From: Tamás Zolnai <tamas.zolnai@collabora.com>
Date: Sat, 29 Jul 2017 21:43:41 +0200
Subject: [PATCH] tdf#109223: PPTX: Vertical flip of child shape is not imported correctly

Group shape level vertical flip is not handled well. Recent handling
of group shape's transformation makes it hard to import this attribute,
but we can import the right text direction at least.

Reviewed-on: https://gerrit.libreoffice.org/40554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit d742c0019435d0bc90c9342492583636099a057f)

Change-Id: Ib9e39e3dcb28a95fabc61c13152a3f7296fbd4c3
Reviewed-on: https://gerrit.libreoffice.org/40556
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
---

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 67f9a9b..b7f1d16 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -138,6 +138,7 @@

     void                            setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
     void                            setFlip( bool bFlipH, bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
+    void                            applyParentTextFlipV(bool bTextFlipV) { mbInheritedTextFlipV = bTextFlipV; }
     void                            addChild( const ShapePtr& rChildPtr ) { maChildren.push_back( rChildPtr ); }
     std::vector< ShapePtr >&        getChildren() { return maChildren; }

@@ -315,6 +316,7 @@
     sal_Int32                       mnRotation;
     bool                            mbFlipH;
     bool                            mbFlipV;
+    bool                            mbInheritedTextFlipV; // Used by group shapes only
     bool                            mbHidden;
     bool                            mbHiddenMasterShape; // master shapes can be hidden in layout slides
                                                          // we need separate flag because we don't want
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index cd56496..2090057 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -116,6 +116,7 @@
 , mnRotation( 0 )
 , mbFlipH( false )
 , mbFlipV( false )
+, mbInheritedTextFlipV(false)
 , mbHidden( false )
 , mbHiddenMasterShape( false )
 , mbLockedCanvas( false )
@@ -157,6 +158,7 @@
 , mnRotation( pSourceShape->mnRotation )
 , mbFlipH( pSourceShape->mbFlipH )
 , mbFlipV( pSourceShape->mbFlipV )
+, mbInheritedTextFlipV(pSourceShape->mbInheritedTextFlipV)
 , mbHidden( pSourceShape->mbHidden )
 , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
 , mbLockedCanvas( pSourceShape->mbLockedCanvas )
@@ -314,6 +316,7 @@
     mnRotation = rReferencedShape.mnRotation;
     mbFlipH = rReferencedShape.mbFlipH;
     mbFlipV = rReferencedShape.mbFlipV;
+    mbInheritedTextFlipV = rReferencedShape.mbInheritedTextFlipV;
     mbHidden = rReferencedShape.mbHidden;
 }

@@ -393,6 +396,7 @@
     std::vector< ShapePtr >::iterator aIter( rMaster.maChildren.begin() );
     while( aIter != rMaster.maChildren.end() ) {
         (*aIter)->setMasterTextListStyle( mpMasterTextListStyle );
+        (*aIter)->applyParentTextFlipV(mbInheritedTextFlipV != mbFlipV);
         (*aIter++)->addShape( rFilterBase, pTheme, rxShapes, aChildTransformation, getFillProperties(), nullptr, pShapeMap );
     }
 }
@@ -1079,6 +1083,8 @@
             if( getTextBody() )
             {
                 sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
+                if(mbInheritedTextFlipV)
+                    nTextRotateAngle -= 180 * 60000;
                 /* OOX measures text rotation clockwise in 1/60000th degrees,
                    relative to the containing shape. setTextRotateAngle wants
                    degrees anticlockwise. */
openSUSE Build Service is sponsored by