[Libreoffice-commits] core.git: oox/source sd/qa

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 15 09:50:35 UTC 2021


 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 7337e7e74d8bde77a56552bcb7b40bf1668c87b7
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Jan 6 13:24:10 2021 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jan 15 10:49:54 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 <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c63e7d4181f1..8e8acb50cc92 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3589,7 +3589,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 ba04f02911be..6b782c3067a6 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -105,6 +105,7 @@ public:
     void testTdf128345GradientAxial();
     void testTdf134969TransparencyOnColorGradient();
     void testTdf136911();
+    void testArcTo();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
@@ -154,6 +155,7 @@ public:
     CPPUNIT_TEST(testTdf128345GradientAxial);
     CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient);
     CPPUNIT_TEST(testTdf136911);
+    CPPUNIT_TEST(testArcTo);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1279,6 +1281,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();


More information about the Libreoffice-commits mailing list