svx/qa/unit/classicshapes.cxx | 28 +++++++++++++++++++++++++++ svx/qa/unit/data/tdf139968_shear45_rot30.odg |binary svx/source/svdraw/svdocirc.cxx | 10 ++++----- 3 files changed, 33 insertions(+), 5 deletions(-)
New commits: commit fe00ea424ebda161badc3d7ff57957077e7a457a Author: Regina Henschel <[email protected]> AuthorDate: Wed Feb 4 00:36:04 2026 +0100 Commit: Regina Henschel <[email protected]> CommitDate: Wed Feb 4 15:03:57 2026 +0100 tdf#139968 first shear then rotate point of arc All internal calculation for transformation use the order resize, shear, rotate, translate. Thus the transformation of the points determining the angles of non-full SdrCircObj need to use that order too. Change-Id: If05310c64813bcffa410a328cf831b3f0b4c07e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198630 Reviewed-by: Regina Henschel <[email protected]> Tested-by: Jenkins 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 <test/unoapi_test.hxx> #include <rtl/ustring.hxx> #include <editeng/unoprnms.hxx> +#include <svx/svdocirc.hxx> +#include <sfx2/viewsh.hxx> +#include <svx/svdview.hxx> #include <cppunit/TestAssert.h> @@ -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<drawing::XShape> xShape(getShape(0, 0)); + SdrCircObj* pSdrCircObj(static_cast<SdrCircObj*>(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<beans::XPropertySet> 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
