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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 24 10:10:54 UTC 2018


 oox/source/ppt/pptfilterhelpers.cxx      |    2 
 sd/source/filter/eppt/pptx-epptooxml.cxx |   82 +++++++++----------------------
 2 files changed, 25 insertions(+), 59 deletions(-)

New commits:
commit e65da112029bf7b6a3b5d94b72bcd5d6ca225195
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sat Jul 21 09:22:45 2018 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Tue Jul 24 12:10:29 2018 +0200

    tdf#118835 fix missing attribute name conversion.
    
    LineColor and LineStyle are missing from the switch-case.
    Just reuse the conversion list from
    oox::ppt::getAttributeConversionList(), also reoder the
    list so that fillcolor is prior than fillColor.
    
    Change-Id: Ia78553ad2fc908923da56bc58baf96dbb7d40863
    Reviewed-on: https://gerrit.libreoffice.org/57819
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/oox/source/ppt/pptfilterhelpers.cxx b/oox/source/ppt/pptfilterhelpers.cxx
index 3c1ab92fc06d..cc4ebfba1e4c 100644
--- a/oox/source/ppt/pptfilterhelpers.cxx
+++ b/oox/source/ppt/pptfilterhelpers.cxx
@@ -57,8 +57,8 @@ namespace oox { namespace ppt {
             { AnimationAttributeEnum::PPT_C,             "ppt_c",                        "DimColor" },
             { AnimationAttributeEnum::R,                 "r",                            "Rotate" },
             { AnimationAttributeEnum::XSHEAR,            "xshear",                       "SkewX" },
-            { AnimationAttributeEnum::FILLCOLOR,         "fillColor",                    "FillColor" },
             { AnimationAttributeEnum::FILLCOLOR,         "fillcolor",                    "FillColor" },
+            { AnimationAttributeEnum::FILLCOLOR,         "fillColor",                    "FillColor" },
             { AnimationAttributeEnum::FILLTYPE,          "fill.type",                    "FillStyle" },
             { AnimationAttributeEnum::FILLON,            "fill.on",                      "FillOn" },
             { AnimationAttributeEnum::STROKECOLOR,       "stroke.color",                 "LineColor" },
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 17d7c4f6835d..5811334ddff7 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -78,6 +78,7 @@
 #include <com/sun/star/frame/XModel.hpp>
 
 #include <oox/export/utils.hxx>
+#include <oox/ppt/pptfilterhelpers.hxx>
 
 #include "pptexanimations.hxx"
 #include "../ppt/pptanimations.hxx"
@@ -1020,21 +1021,7 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
 
     SAL_INFO("sd.eppt", "write attribute name: " << USS(rAttributeName));
 
-    const char* pAttribute = nullptr;
-
-    if (rAttributeName == "Visibility")
-    {
-        pAttribute = "style.visibility";
-    }
-    else if (rAttributeName == "X")
-    {
-        pAttribute = "ppt_x";
-    }
-    else if (rAttributeName == "Y")
-    {
-        pAttribute = "ppt_y";
-    }
-    else if (rAttributeName == "X;Y")
+    if (rAttributeName == "X;Y")
     {
         pFS->startElementNS(XML_p, XML_attrName, FSEND);
         pFS->writeEscaped("ppt_x");
@@ -1044,52 +1031,31 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
         pFS->writeEscaped("ppt_y");
         pFS->endElementNS(XML_p, XML_attrName);
     }
-    else if (rAttributeName == "Width")
-    {
-        pAttribute = "ppt_w";
-    }
-    else if (rAttributeName == "Height")
-    {
-        pAttribute = "ppt_h";
-    }
-    else if (rAttributeName == "Rotate")
-    {
-        pAttribute = "r";
-    }
-    else if (rAttributeName == "FillStyle")
-    {
-        pAttribute = "fill.type";
-    }
-    else if (rAttributeName == "FillOn")
-    {
-        pAttribute = "fill.on";
-    }
-    else if (rAttributeName == "FillColor")
-    {
-        pAttribute = "fillcolor";
-    }
-    else if (rAttributeName == "CharColor")
-    {
-        pAttribute = "style.color";
-    }
-    else if (rAttributeName == "Opacity")
-    {
-        pAttribute = "style.opacity";
-    }
-    else if (rAttributeName == "SkewX")
-    {
-        pAttribute = "xshear";
-    }
     else
     {
-        SAL_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
-    }
+        const oox::ppt::ImplAttributeNameConversion *attrConv = oox::ppt::getAttributeConversionList();
+        const char* pAttribute = nullptr;
 
-    if (pAttribute)
-    {
-        pFS->startElementNS(XML_p, XML_attrName, FSEND);
-        pFS->writeEscaped(pAttribute);
-        pFS->endElementNS(XML_p, XML_attrName);
+        while(attrConv->mpAPIName != nullptr)
+        {
+            if(rAttributeName.equalsAscii(attrConv->mpAPIName))
+            {
+                pAttribute = attrConv->mpMSName;
+                break;
+            }
+            attrConv++;
+        }
+
+        if (pAttribute)
+        {
+            pFS->startElementNS(XML_p, XML_attrName, FSEND);
+            pFS->writeEscaped(pAttribute);
+            pFS->endElementNS(XML_p, XML_attrName);
+        }
+        else
+        {
+            SAL_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
+        }
     }
 
     pFS->endElementNS(XML_p, XML_attrNameLst);


More information about the Libreoffice-commits mailing list