oox/source/export/drawingml.cxx | 28 +++++++++++++++++++++++++++- sd/qa/unit/data/pptx/arc-validiert.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-)
New commits: commit 6492679040db6415543119ada9d1124bd532ec6a Author: Tünde Tóth <[email protected]> AuthorDate: Wed Jan 6 13:24:10 2021 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Jan 18 10:58:30 2021 +0100 tdf#61028 OOXML export: fix lost arcTo shape a:custGeom was exported without the a:arcTo element and its attributes. Note: see customshapegeometry.cxx for import of a:arcTo attributes. Change-Id: I611ea9fb6a81d45cfd52a16abbb37071ea0ce7d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108874 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109446 Tested-by: Jenkins diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 9eeacf4d2b19..559b35b9023f 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3576,7 +3576,33 @@ bool DrawingML::WriteCustomGeometry( } case drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO : { - nPairIndex += 2; + if (nPairIndex + 1 >= aPairs.getLength()) + bOK = false; + else + { + const EnhancedCustomShape2d aCustoShape2d( + const_cast<SdrObjCustomShape&>(rSdrObjCustomShape)); + double fWR = 0.0; + aCustoShape2d.GetParameter(fWR, aPairs[nPairIndex].First, false, + false); + double fHR = 0.0; + aCustoShape2d.GetParameter(fHR, aPairs[nPairIndex].Second, + false, false); + double fStartAngle = 0.0; + aCustoShape2d.GetParameter( + fStartAngle, aPairs[nPairIndex + 1].First, false, false); + sal_Int32 nStartAng(std::lround(fStartAngle * 60000)); + double fSwingAng = 0.0; + aCustoShape2d.GetParameter( + fSwingAng, aPairs[nPairIndex + 1].Second, false, false); + sal_Int32 nSwingAng(std::lround(fSwingAng * 60000)); + mpFS->singleElement(FSNS(XML_a, XML_arcTo), + XML_wR, OString::number(fWR), + XML_hR, OString::number(fHR), + XML_stAng, OString::number(nStartAng), + XML_swAng, OString::number(nSwingAng)); + nPairIndex += 2; + } break; } default: diff --git a/sd/qa/unit/data/pptx/arc-validiert.pptx b/sd/qa/unit/data/pptx/arc-validiert.pptx new file mode 100644 index 000000000000..163f187b0bcc Binary files /dev/null and b/sd/qa/unit/data/pptx/arc-validiert.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 75222f267a58..b1d3eb57f8f2 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -100,6 +100,7 @@ public: void testTdf128345GradientAxial(); void testTdf134969TransparencyOnColorGradient(); void testTdf136911(); + void testArcTo(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -149,6 +150,7 @@ public: CPPUNIT_TEST(testTdf128345GradientAxial); CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient); CPPUNIT_TEST(testTdf136911); + CPPUNIT_TEST(testArcTo); CPPUNIT_TEST_SUITE_END(); @@ -1274,6 +1276,22 @@ void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient() assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "60000"); } +void SdOOXMLExportTest1::testArcTo() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/arc-validiert.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + const OString sPath("//a:custGeom/a:pathLst/a:path/a:arcTo"); + assertXPath(pXmlDoc, sPath, "wR", "3"); + assertXPath(pXmlDoc, sPath, "hR", "3"); + assertXPath(pXmlDoc, sPath, "stAng", "1800000"); + assertXPath(pXmlDoc, sPath, "swAng", "2700000"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
