Kaydet (Commit) 79fe1227 authored tarafından Armin Le Grand's avatar Armin Le Grand

#55394# Applied patch from Regina to solve mirror problem for CustomShapes

Patch by: Regina
Review by: alg
üst a2bbabbe
......@@ -1921,67 +1921,48 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, long nWink, double sn, dou
void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
{
// TTTT: Fix for old mirroring, can be removed again in aw080
// storing horizontal and vertical flipping without modifying the rotate angle
// decompose other flipping to rotation and MirrorX.
long ndx = rRef2.X()-rRef1.X();
long ndy = rRef2.Y()-rRef1.Y();
sal_Bool bHorz = sal_False;
sal_Bool bVert = sal_False;
if ( rRef1.X() == rRef2.X() )
bHorz = sal_True;
if ( rRef1.Y() == rRef2.Y() )
bVert = sal_True;
if ( !bHorz && !bVert )
bHorz = bVert = sal_True;
if ( bHorz || bVert )
if(!ndx) // MirroredX
{
SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
/////////////////
// "MirroredX" //
/////////////////
if ( bHorz )
SetMirroredX(!IsMirroredX());
SdrTextObj::NbcMirror( rRef1, rRef2 );
}
else
{
if(!ndy) // MirroredY
{
const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
if ( pAny )
{
sal_Bool bFlip = sal_Bool();
if ( *pAny >>= bFlip )
{
if ( bFlip )
bHorz = sal_False;
}
}
PropertyValue aPropVal;
aPropVal.Name = sMirroredX;
aPropVal.Value <<= bHorz;
aGeometryItem.SetPropertyValue( aPropVal );
SetMirroredY(!IsMirroredY());
SdrTextObj::NbcMirror( rRef1, rRef2 );
}
/////////////////
// "MirroredY" //
/////////////////
if ( bVert )
else // neither horizontal nor vertical
{
const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
if ( pAny )
SetMirroredX(!IsMirroredX());
// call parent
SdrTextObj::NbcMirror( rRef1, rRef2 );
// update fObjectRotation
long nTextObjRotation = aGeo.nDrehWink;
double fWink = nTextObjRotation;
fWink /= 100.0;
bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
fObjectRotation = fmod( bSingleFlip ? -fWink : fWink, 360.0 );
if ( fObjectRotation < 0 )
{
sal_Bool bFlip = sal_Bool();
if ( *pAny >>= bFlip )
{
if ( bFlip )
bVert = sal_False;
}
fObjectRotation = 360.0 + fObjectRotation;
}
PropertyValue aPropVal;
aPropVal.Name = sMirroredY;
aPropVal.Value <<= bVert;
aGeometryItem.SetPropertyValue( aPropVal );
}
SetMergedItem( aGeometryItem );
}
}
SdrTextObj::NbcMirror( rRef1, rRef2 );
InvalidateRenderGeometry();
}
......@@ -1992,20 +1973,24 @@ void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, FASTBOO
}
void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear )
{
long nDrehWink = aGeo.nDrehWink;
if ( nDrehWink )
{
aGeo.nDrehWink = -nDrehWink;
aGeo.RecalcSinCos();
NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
}
SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
if ( nDrehWink )
// TTTT: Fix for old mirroring, can be removed again in aw080
SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
// updating fObjectRotation
long nTextObjRotation = aGeo.nDrehWink;
double fWink = nTextObjRotation;
fWink /= 100.0;
bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
fObjectRotation = fmod( bSingleFlip ? -fWink : fWink, 360.0 );
if ( fObjectRotation < 0 )
{
aGeo.nDrehWink = nDrehWink;
aGeo.RecalcSinCos();
Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
fObjectRotation = 360.0 + fObjectRotation;
}
InvalidateRenderGeometry();
}
......
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