From 3e33a2551532806b99f6c8ca415136cd3f2f9256 Mon Sep 17 00:00:00 2001 From: Paul Trojahn Date: Tue, 1 Aug 2017 15:56:48 +0200 Subject: tdf#109317 Fix incorrect rotation of flipped custom OOXML shapes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shape wasn't imported correctly because IsPostRotateAngle wasn't set. As a result the shape was flipped after it was rotated instead of before. This commit removes 1c44b263 and converts the rotation to the internal format instead. This also fixes that ooxml preset shapes can't be exported to odf correctly and that ooxml preset shapes rotate in the wrong direction when rotated in LO. Change-Id: I9691902fdfb2cfecc8fe50d6eb66ac3880ddd4e8 Reviewed-on: https://gerrit.libreoffice.org/40789 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai --- svx/source/customshapes/EnhancedCustomShape2d.cxx | 5 ----- svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 9 +-------- svx/source/svdraw/svdoashp.cxx | 12 ------------ 3 files changed, 1 insertion(+), 25 deletions(-) (limited to 'svx/source') diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 90783f13089f..1180ffde845c 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2386,11 +2386,6 @@ void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj ) } } -bool EnhancedCustomShape2d::IsPostRotate() const -{ - return dynamic_cast( pCustomShapeObj) != nullptr && static_cast(pCustomShapeObj)->IsPostRotate(); -} - SdrObject* EnhancedCustomShape2d::CreateLineGeometry() { return CreateObject( true ); diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index a734d24c0c75..fc2f2dc7cb60 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -267,7 +267,6 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape ); sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle(); - bool bPostRotateAngle = aCustomShape2d.IsPostRotate(); bool bFlipV = aCustomShape2d.IsFlipVert(); bool bFlipH = aCustomShape2d.IsFlipHorz(); @@ -307,7 +306,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() } pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearAngle, nTan, false); } - if( !bPostRotateAngle && nRotateAngle ) + if(nRotateAngle ) { double a = nRotateAngle * F_PI18000; pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) ); @@ -324,12 +323,6 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() Point aBottom( aTop.X(), aTop.Y() + 1000 ); pRenderedShape->NbcMirror( aTop, aBottom ); } - // Specifically for pptx imports - if( bPostRotateAngle && nRotateAngle ) - { - double a = nRotateAngle * F_PI18000; - pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) ); - } pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), true ); pRenderedShape->RecalcSnapRect(); } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 2c2bd016378b..e4a945e80361 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -536,18 +536,6 @@ void SdrObjCustomShape::SetMirroredY( const bool bMirrorY ) SetMergedItem( aGeometryItem ); } - -bool SdrObjCustomShape::IsPostRotate() const -{ - const css::uno::Any* pAny; - bool bPostRotate = false; - const SdrCustomShapeGeometryItem& rGeometryItem = static_cast(GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); - pAny = rGeometryItem.GetPropertyValueByName( "IsPostRotateAngle" ); - if ( pAny ) - *pAny >>= bPostRotate; - return bPostRotate; -} - double SdrObjCustomShape::GetExtraTextRotation( const bool bPreRotation ) const { const css::uno::Any* pAny; -- cgit