summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-09-19 13:27:09 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-09-20 08:50:17 +0200
commit146a64bb52a7d51cd27021311fb3ad9075e94d10 (patch)
tree60b2846804111425dd4bc45c52a89ec10b8d149e
parent6978f506a439cc8bf30393568ba496c266eafdb2 (diff)
tdf#112333 PPTX export animClr
Change-Id: Ibf230a6c4ddac4806dab235c3394778db26da38c Reviewed-on: https://gerrit.libreoffice.org/42476 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--include/oox/export/utils.hxx8
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx6
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx35
3 files changed, 48 insertions, 1 deletions
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
index 927987115a60..371cf6a956bf 100644
--- a/include/oox/export/utils.hxx
+++ b/include/oox/export/utils.hxx
@@ -25,8 +25,16 @@
#include <sal/types.h>
inline OString I32S_(sal_Int32 x) { return OString::number(x); }
+inline OString I32SHEX_(sal_Int32 x)
+{
+ OString aStr = OString::number(x, 16);
+ if (aStr.getLength() % 2 != 0)
+ aStr = OString("0") + aStr;
+ return aStr.getStr();
+}
inline OString I64S_(sal_Int64 x) { return OString::number(x); }
#define I32S(x) I32S_(x).getStr()
+#define I32SHEX(x) I32SHEX_(x).getStr()
#define I64S(x) I64S_(x).getStr()
#define IS(x) OString::number( x ).getStr()
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 44e335d65a2d..72d0cd04306c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1090,6 +1090,12 @@ void SdOOXMLExportTest2::testTdf112333()
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[2]/p:cBhvr/p:attrNameLst/p:attrName");
CPPUNIT_ASSERT_EQUAL(OUString("fill.on"), sAttributeName);
+
+ sTo = getXPath(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:animClr/p:to/a:srgbClr", "val");
+ CPPUNIT_ASSERT_EQUAL(OUString("0563c1"), sTo);
+
+ 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:animClr/p:cBhvr/p:attrNameLst/p:attrName");
+ CPPUNIT_ASSERT_EQUAL(OUString("fillcolor"), sAttributeName);
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 37ac57f83e40..4380048896c5 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -827,8 +827,16 @@ void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const Any&
if (!rAny.hasValue())
return;
+ sal_uInt32 nRgb;
+
switch (rAny.getValueType().getTypeClass())
{
+ case TypeClass_LONG:
+ rAny >>= nRgb;
+ pFS->singleElementNS(XML_a, XML_srgbClr,
+ XML_val, I32SHEX(nRgb),
+ FSEND);
+ break;
case TypeClass_STRING:
pFS->singleElementNS(XML_p, XML_strVal,
XML_val, USS(*o3tl::doAccess<OUString>(rAny)),
@@ -888,7 +896,14 @@ void PowerPointExport::WriteAnimateTo(const FSHelperPtr& pFS, const Any& rValue,
pFS->startElementNS(XML_p, XML_to, FSEND);
- WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName));
+ sal_uInt32 nColor;
+ if (rValue >>= nColor)
+ {
+ // RGB color
+ WriteAnimationProperty(pFS, rValue);
+ }
+ else
+ WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName));
pFS->endElementNS(XML_p, XML_to);
}
@@ -948,6 +963,12 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
pFS->writeEscaped("fill.on");
pFS->endElementNS(XML_p, XML_attrName);
}
+ else if (rAttributeName == "FillColor")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("fillcolor");
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
else
{
SAL_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
@@ -1084,6 +1105,14 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
XML_to, pTo,
FSEND);
}
+ else if (nXmlNodeType == XML_animClr)
+ {
+ pFS->startElementNS(XML_p, nXmlNodeType,
+ XML_clrSpc, "rgb",
+ XML_calcmode, pCalcMode,
+ XML_valueType, pValueType,
+ FSEND);
+ }
else
{
pFS->startElementNS(XML_p, nXmlNodeType,
@@ -1581,6 +1610,10 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc
}
}
break;
+ case AnimationNodeType::ANIMATECOLOR:
+ xmlNodeType = XML_animClr;
+ pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
+ break;
case AnimationNodeType::SET:
xmlNodeType = XML_set;
pMethod = &PowerPointExport::WriteAnimationNodeAnimate;