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

Szymon Kłos szymon.klos at collabora.com
Fri Mar 16 08:09:38 UTC 2018


 sd/qa/unit/data/pptx/tdf104789.pptx      |binary
 sd/qa/unit/export-tests-ooxml2.cxx       |   15 +++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx |   59 +++++++++++++------------------
 3 files changed, 40 insertions(+), 34 deletions(-)

New commits:
commit 064ad89c0e929cab771c6bda38bad5637db00575
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Thu Mar 15 19:23:20 2018 +0100

    tdf#104789 Export opacity attribute name
    
    Change-Id: Id47ab6b3cb20fbcebb2d7fa589f3b0d7552e2cce
    Reviewed-on: https://gerrit.libreoffice.org/51369
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sd/qa/unit/data/pptx/tdf104789.pptx b/sd/qa/unit/data/pptx/tdf104789.pptx
new file mode 100644
index 000000000000..d5ead6a931a7
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104789.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 27a09e86a856..4c564953aa47 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -137,6 +137,7 @@ public:
     void testTdf104792();
     void testTdf90627();
     void testTdf104786();
+    void testTdf104789();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -198,6 +199,7 @@ public:
     CPPUNIT_TEST(testTdf104792);
     CPPUNIT_TEST(testTdf90627);
     CPPUNIT_TEST(testTdf104786);
+    CPPUNIT_TEST(testTdf104789);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1584,6 +1586,19 @@ void SdOOXMLExportTest2::testTdf104786()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf104789()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104789.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+    OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName");
+    CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c41e4fb0e129..e4aced1ef9cf 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1004,23 +1004,19 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
 
     SAL_INFO("sd.eppt", "write attribute name: " << USS(rAttributeName));
 
+    const char* pAttribute = nullptr;
+
     if (rAttributeName == "Visibility")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("style.visibility");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "style.visibility";
     }
     else if (rAttributeName == "X")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("ppt_x");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "ppt_x";
     }
     else if (rAttributeName == "Y")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("ppt_y");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "ppt_y";
     }
     else if (rAttributeName == "X;Y")
     {
@@ -1034,57 +1030,52 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
     }
     else if (rAttributeName == "Width")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("ppt_w");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "ppt_w";
     }
     else if (rAttributeName == "Height")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("ppt_h");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "ppt_h";
     }
     else if (rAttributeName == "Rotate")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("r");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "r";
     }
     else if (rAttributeName == "FillStyle")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("fill.type");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "fill.type";
     }
     else if (rAttributeName == "FillOn")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("fill.on");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "fill.on";
     }
     else if (rAttributeName == "FillColor")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("fillcolor");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "fillcolor";
     }
     else if (rAttributeName == "CharColor")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("style.color");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "style.color";
     }
-    if (rAttributeName == "SkewX")
+    else if (rAttributeName == "Opacity")
     {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped("xshear");
-        pFS->endElementNS(XML_p, XML_attrName);
+        pAttribute = "style.opacity";
+    }
+    else if (rAttributeName == "SkewX")
+    {
+        pAttribute = "xshear";
     }
     else
     {
         SAL_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
     }
 
+    if (pAttribute)
+    {
+        pFS->startElementNS(XML_p, XML_attrName, FSEND);
+        pFS->writeEscaped(pAttribute);
+        pFS->endElementNS(XML_p, XML_attrName);
+    }
+
     pFS->endElementNS(XML_p, XML_attrNameLst);
 }
 


More information about the Libreoffice-commits mailing list