diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx index 07a4b9f916ab..ea536ff3ec91 100644 --- a/svx/qa/unit/classicshapes.cxx +++ b/svx/qa/unit/classicshapes.cxx @@ -10,6 +10,9 @@ #include #include #include +#include +#include +#include #include @@ -187,5 +190,30 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip) 26000.0, nAngle2); } } + +CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf139968ShearRotateArcFlip) +{ + // The document contains an arc that is rotated and sheared. When horizonally flipped, start and + // end angles had got wrong values. + loadFromFile(u"tdf139968_shear45_rot30.odg"); + + // get shape and flip it + uno::Reference xShape(getShape(0, 0)); + SdrCircObj* pSdrCircObj(static_cast(SdrObject::getSdrObjectFromXShape(xShape))); + SfxViewShell* pViewShell = SfxViewShell::Current(); + CPPUNIT_ASSERT(pViewShell); + SdrView* pSdrView = pViewShell->GetDrawView(); + pSdrView->MarkObj(pSdrCircObj, pSdrView->GetSdrPageView()); + dispatchCommand(mxComponent, u".uno:FlipHorizontal"_ustr, {}); + + // make sure start and end angle are correct. + double fAngleS(0.0), fAngleE(0.0); + uno::Reference xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CircleStartAngle"_ustr) >>= fAngleS); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CircleEndAngle"_ustr) >>= fAngleE); + // without fix, start angle was 19419, end angle was 18176. Tolerance for to ignore round errors. + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("StartAngle wrong", 22500.0, fAngleS, 2.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("EndAngle wrong", 18000.0, fAngleE, 2.0); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/data/tdf139968_shear45_rot30.odg b/svx/qa/unit/data/tdf139968_shear45_rot30.odg new file mode 100644 index 000000000000..7898593c5200 Binary files /dev/null and b/svx/qa/unit/data/tdf139968_shear45_rot30.odg differ diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index eed36dbc71c1..ef4e8b5f04dc 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -901,16 +901,16 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2) if (nWdt==0) aTmpPt2.setX(0 ); if (nHgt==0) aTmpPt2.setY(0 ); aTmpPt2+=aCenter; - if (maGeo.m_nRotationAngle) - { - RotatePoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); - RotatePoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); - } if (maGeo.m_nShearAngle) { ShearPoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfTanShearAngle); ShearPoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfTanShearAngle); } + if (maGeo.m_nRotationAngle) + { + RotatePoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); + RotatePoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); + } } SdrTextObj::NbcMirror(rRef1,rRef2); if (meCircleKind!=SdrCircKind::Full) { // adapt starting and finishing angle