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 <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 9eeacf4..559b35b 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 0000000..163f187
--- /dev/null
+++ b/sd/qa/unit/data/pptx/arc-validiert.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 75222f2..b1d3eb5 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();