oox/qa/unit/data/tdf164623.pptx          |binary
 oox/qa/unit/shape.cxx                    |   24 ++++++++++++++++++++++++
 oox/source/drawingml/connectorhelper.cxx |    7 ++++---
 3 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit d3bb134a0c817122537f3c2e178ba3685bdd4f54
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed May 21 14:32:38 2025 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri May 23 10:11:00 2025 +0200

    tdf#164623: handle negative rotations
    
    Change-Id: I35dd1ecda0754639b8e511532af24ef7e0d0935b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185610
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit bb08f8463bc00f8a6ef20cf21d29c985f64e8654)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185628
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/oox/qa/unit/data/tdf164623.pptx b/oox/qa/unit/data/tdf164623.pptx
new file mode 100644
index 000000000000..cbf72c4b1417
Binary files /dev/null and b/oox/qa/unit/data/tdf164623.pptx differ
diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx
index 929fecc64a7c..67ab647f6fe8 100644
--- a/oox/qa/unit/shape.cxx
+++ b/oox/qa/unit/shape.cxx
@@ -200,6 +200,30 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testStandardConnectors)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf164623)
+{
+    loadFromFile(u"tdf164623.pptx");
+
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                                 uno::UNO_QUERY);
+
+    sal_Int32 nEdgeLineDelta;
+    uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(2), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+    
CPPUNIT_ASSERT(xShapeProps->getPropertySetInfo()->hasPropertyByName(u"EdgeKind"_ustr));
+    xShapeProps->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta;
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: -662
+    // - Actual  : 3370
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-662), nEdgeLineDelta);
+    xShapeProps->getPropertyValue(UNO_NAME_EDGELINE2DELTA) >>= nEdgeLineDelta;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nEdgeLineDelta);
+    xShapeProps->getPropertyValue(UNO_NAME_EDGELINE3DELTA) >>= nEdgeLineDelta;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nEdgeLineDelta);
+}
+
 CPPUNIT_TEST_FIXTURE(OoxShapeTest, testGroupTransform)
 {
     loadFromFile(u"tdf141463_GroupTransform.pptx");
diff --git a/oox/source/drawingml/connectorhelper.cxx 
b/oox/source/drawingml/connectorhelper.cxx
index 0a529b56a03c..1d80540f727f 100644
--- a/oox/source/drawingml/connectorhelper.cxx
+++ b/oox/source/drawingml/connectorhelper.cxx
@@ -101,11 +101,12 @@ ConnectorHelper::getConnectorTransformMatrix(const 
oox::drawingml::ShapePtr& pCo
         aTransform.scale(1.0, -1.0);
     if (pConnector->getRotation() == 0)
         return aTransform;
-    if (pConnector->getRotation() == 5400000)
+
+    if (pConnector->getRotation() == 5400000 || pConnector->getRotation() == 
-16200000)
         aTransform *= basegfx::B2DHomMatrix(0, -1, 0, 1, 0, 0);
-    else if (pConnector->getRotation() == 10800000)
+    else if (pConnector->getRotation() == 10800000 || 
pConnector->getRotation() == -10800000)
         aTransform *= basegfx::B2DHomMatrix(-1, 0, 0, 0, -1, 0);
-    else if (pConnector->getRotation() == 16200000)
+    else if (pConnector->getRotation() == 16200000 || 
pConnector->getRotation() == -5400000)
         aTransform *= basegfx::B2DHomMatrix(0, 1, 0, -1, 0, 0);
     else
         SAL_WARN("oox", "tdf#157888 LibreOffice cannot handle such connector 
rotation");

Reply via email to