Blob Blame History Raw
From 3475d300ef29866542007e295569075e592bde66 Mon Sep 17 00:00:00 2001
From: Ivan Timofeev <timofeev.i.s@gmail.com>
Date: Wed, 25 Jan 2012 20:54:27 +0100
Subject: [PATCH] fdo#43193: fix rotation of shapes in imported MS documents

Signed-off-by: Petr Mladek <pmladek@suse.cz>
---
 filter/source/msfilter/msdffimp.cxx |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 5764c66..784b5a0 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4643,6 +4643,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
     rSt >> aRecHd;
     if ( aRecHd.nRecType == DFF_msofbtSpContainer )
     {
+        sal_Int32 nGroupRotateAngle = 0;
+        sal_Int32 nSpFlags = 0;
         mnFix16Angle = 0;
 
         aRecHd.SeekToBegOfRecord(rSt);
@@ -4650,15 +4652,19 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
         pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId );
         if ( pRet )
         {
+            nSpFlags = nGroupShapeFlags;
+            nGroupRotateAngle = mnFix16Angle;
+
             Rectangle aClientRect( rClientRect );
+
             Rectangle aGlobalChildRect;
             if ( !nCalledByGroup || rGlobalChildRect.IsEmpty() )
                 aGlobalChildRect = GetGlobalChildAnchor( rHd, rSt, aClientRect );
             else
                 aGlobalChildRect = rGlobalChildRect;
 
-            if ( ( mnFix16Angle > 4500 && mnFix16Angle <= 13500 )
-                || ( mnFix16Angle > 22500 && mnFix16Angle <= 31500 ) )
+            if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 )
+                || ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) )
             {
                 sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1;
                 sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
@@ -4704,18 +4710,18 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                 aRecHd2.SeekToEndOfRecord( rSt );
             }
 
-            if ( mnFix16Angle )
+            if ( nGroupRotateAngle )
             {
-                double a = mnFix16Angle * nPi180;
-                pRet->NbcRotate( aClientRect.Center(), mnFix16Angle, sin( a ), cos( a ) );
+                double a = nGroupRotateAngle * nPi180;
+                pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle, sin( a ), cos( a ) );
             }
-            if ( nGroupShapeFlags & SP_FFLIPV )		// Vertical flip?
+            if ( nSpFlags & SP_FFLIPV )     // Vertical flip?
             {	// BoundRect in aBoundRect
                 Point aLeft( aClientRect.Left(), ( aClientRect.Top() + aClientRect.Bottom() ) >> 1 );
                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
                 pRet->NbcMirror( aLeft, aRight );
             }
-            if ( nGroupShapeFlags & SP_FFLIPH )		// Horizontal flip?
+            if ( nSpFlags & SP_FFLIPH )     // Horizontal flip?
             {	// BoundRect in aBoundRect
                 Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, aClientRect.Top() );
                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
-- 
1.7.7.6