Kaydet (Commit) 74977861 authored tarafından Paul Trojahn's avatar Paul Trojahn Kaydeden (comit) Tamás Zolnai

tdf#100065 Refactoring

Change-Id: I842f90b655ccf195185bf8bae2d93b5b187954aa
Reviewed-on: https://gerrit.libreoffice.org/43137Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 4aa3a0b2
...@@ -507,7 +507,6 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -507,7 +507,6 @@ Reference< XShape > const & Shape::createAndInsert(
if( bUseRotationTransform ) if( bUseRotationTransform )
{ {
// OOXML flips shapes before rotating them. // OOXML flips shapes before rotating them.
double fRotation = F_PI180 * ( (double)mnRotation / 60000.0 );
if( bIsCustomShape ) if( bIsCustomShape )
{ {
basegfx::B2DVector aScale, aTranslate; basegfx::B2DVector aScale, aTranslate;
...@@ -526,7 +525,7 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -526,7 +525,7 @@ Reference< XShape > const & Shape::createAndInsert(
} }
} }
// rotate around object's center // rotate around object's center
aTransformation.rotate( fRotation ); aTransformation.rotate( F_PI180 * ( (double)mnRotation / 60000.0 ) );
} }
// move object back from center // move object back from center
...@@ -546,20 +545,19 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -546,20 +545,19 @@ Reference< XShape > const & Shape::createAndInsert(
aParentTransformation = aTransformation; aParentTransformation = aTransformation;
aTransformation.scale(1/double(EMU_PER_HMM), 1/double(EMU_PER_HMM)); aTransformation.scale(1/double(EMU_PER_HMM), 1/double(EMU_PER_HMM));
if( bIsCustomShape ) if( bIsCustomShape && mbFlipH != mbFlipV )
{ {
basegfx::B2DVector aScale, aTranslate; basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX; double fRotate, fShearX;
aTransformation.decompose(aScale, aTranslate, fRotate, fShearX); aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
// OOXML rotates shapes before flipping them, so the rotation needs to be inverted. if(fRotate != 0)
if( mbFlipH != mbFlipV)
{ {
// calculate object's center // calculate object's center
basegfx::B2DPoint aCenter(0.5, 0.5); basegfx::B2DPoint aCenter(0.5, 0.5);
aCenter *= aTransformation; aCenter *= aTransformation;
aTransformation.translate( -aCenter.getX(), -aCenter.getY() ); aTransformation.translate( -aCenter.getX(), -aCenter.getY() );
// OOXML flips shapes before rotating them, so the rotation needs to be inverted
aTransformation.rotate( fRotate * -2.0 ); aTransformation.rotate( fRotate * -2.0 );
aTransformation.translate( aCenter.getX(), aCenter.getY() ); aTransformation.translate( aCenter.getX(), aCenter.getY() );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment