From cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8 Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Thu, 10 Mar 2022 08:42:12 +0100 Subject: tdf#89449 PPTX import: fix line connectors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Line connectors were imported as plain shapes, losing their functionality during editing, i.e. keeping connections of boxes and other shapes. Change-Id: I0f1562be2dbcce0e45eb209c6ca4e035731039e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131303 Tested-by: László Németh Reviewed-by: László Németh --- sd/qa/unit/data/pptx/tdf89449.pptx | Bin 0 -> 14939 bytes sd/qa/unit/data/xml/fdo47434_0.xml | 188 +--------------------- sd/qa/unit/data/xml/tdf100491_0.xml | 304 ++---------------------------------- sd/qa/unit/export-tests-ooxml2.cxx | 8 +- sd/qa/unit/import-tests.cxx | 39 +++++ 5 files changed, 63 insertions(+), 476 deletions(-) create mode 100644 sd/qa/unit/data/pptx/tdf89449.pptx (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/tdf89449.pptx b/sd/qa/unit/data/pptx/tdf89449.pptx new file mode 100644 index 000000000000..e55cbf21a927 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf89449.pptx differ diff --git a/sd/qa/unit/data/xml/fdo47434_0.xml b/sd/qa/unit/data/xml/fdo47434_0.xml index 512f422fd198..24dc47005623 100644 --- a/sd/qa/unit/data/xml/fdo47434_0.xml +++ b/sd/qa/unit/data/xml/fdo47434_0.xml @@ -1,10 +1,6 @@ - - - - - + @@ -21,53 +17,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -84,53 +35,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -147,53 +53,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -210,46 +71,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/qa/unit/data/xml/tdf100491_0.xml b/sd/qa/unit/data/xml/tdf100491_0.xml index 0c250e6fc840..e45eba130ebf 100644 --- a/sd/qa/unit/data/xml/tdf100491_0.xml +++ b/sd/qa/unit/data/xml/tdf100491_0.xml @@ -1,6 +1,6 @@ - + @@ -17,25 +17,8 @@ - - - - - - - - - - - - - - - - - - + @@ -52,25 +35,8 @@ - - - - - - - - - - - - - - - - - - + @@ -87,25 +53,8 @@ - - - - - - - - - - - - - - - - - - + @@ -122,25 +71,8 @@ - - - - - - - - - - - - - - - - - - + @@ -157,25 +89,8 @@ - - - - - - - - - - - - - - - - - - + @@ -192,25 +107,8 @@ - - - - - - - - - - - - - - - - - - + @@ -227,25 +125,8 @@ - - - - - - - - - - - - - - - - - - + @@ -262,25 +143,8 @@ - - - - - - - - - - - - - - - - - - + @@ -297,25 +161,8 @@ - - - - - - - - - - - - - - - - - - + @@ -332,25 +179,8 @@ - - - - - - - - - - - - - - - - - - + @@ -367,25 +197,8 @@ - - - - - - - - - - - - - - - - - - + @@ -402,25 +215,8 @@ - - - - - - - - - - - - - - - - - - + @@ -437,25 +233,8 @@ - - - - - - - - - - - - - - - - - - + @@ -472,25 +251,8 @@ - - - - - - - - - - - - - - - - - - + @@ -507,25 +269,8 @@ - - - - - - - - - - - - - - - - - - + @@ -542,22 +287,5 @@ - - - - - - - - - - - - - - - - - diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index e99ac6168dd5..6be1222b5c7d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1540,10 +1540,10 @@ void SdOOXMLExportTest2::testTdf114845_rotateShape() xDocShRef->DoClose(); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr", "name", "Straight Arrow Connector 9"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm", "flipV", "1"); - double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "x").toDouble(); - double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "y").toDouble(); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvPr", "name", "Straight Arrow Connector 9"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm", "flipV", "1"); + double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "x").toDouble(); + double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "y").toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 4059000.0, dX, dX * .001); CPPUNIT_ASSERT_DOUBLES_EQUAL( 3287520.0, dY, dY * .001); } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 215d668b2f3f..100c9e784875 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,7 @@ public: virtual void setUp() override; void testDocumentLayout(); + void testTdf89449(); void testTdf147459(); void testTdf146223(); void testTdf144918(); @@ -147,6 +149,7 @@ public: CPPUNIT_TEST_SUITE(SdImportTest); CPPUNIT_TEST(testDocumentLayout); + CPPUNIT_TEST(testTdf89449); CPPUNIT_TEST(testTdf147459); CPPUNIT_TEST(testTdf146223); CPPUNIT_TEST(testTdf144918); @@ -292,6 +295,42 @@ void SdImportTest::testDocumentLayout() } } +void SdImportTest::testTdf89449() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf89449.pptx"), PPTX); + + sal_Int32 nStartGlueId; + sal_Int32 nEndGlueId; + css::drawing::ConnectorType aConnectorType; + + uno::Reference xCurvedConnector(getShapeFromPage(3, 0, xDocShRef)); + xCurvedConnector->getPropertyValue("EdgeKind") >>= aConnectorType; + CPPUNIT_ASSERT_EQUAL(drawing::ConnectorType::ConnectorType_CURVE, aConnectorType); + nStartGlueId = xCurvedConnector->getPropertyValue("StartGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nStartGlueId); + nEndGlueId = xCurvedConnector->getPropertyValue("EndGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nEndGlueId); + + uno::Reference xStraightConnector(getShapeFromPage(4, 0, xDocShRef)); + xStraightConnector->getPropertyValue("EdgeKind") >>= aConnectorType; + CPPUNIT_ASSERT_EQUAL(drawing::ConnectorType::ConnectorType_LINE, aConnectorType); + nStartGlueId = xStraightConnector->getPropertyValue("StartGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nStartGlueId); + nEndGlueId = xStraightConnector->getPropertyValue("EndGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nEndGlueId); + + uno::Reference xStandardConnector(getShapeFromPage(5, 0, xDocShRef)); + xStandardConnector->getPropertyValue("EdgeKind") >>= aConnectorType; + CPPUNIT_ASSERT_EQUAL(drawing::ConnectorType::ConnectorType_STANDARD, aConnectorType); + nStartGlueId = xStandardConnector->getPropertyValue("StartGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nStartGlueId); + nEndGlueId = xStandardConnector->getPropertyValue("EndGluePointIndex").get(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nEndGlueId); + + xDocShRef->DoClose(); +} + void SdImportTest::testTdf147459() { sd::DrawDocShellRef xDocShRef -- cgit