Kaydet (Commit) 146a64bb authored tarafından Szymon Kłos's avatar Szymon Kłos

tdf#112333 PPTX export animClr

Change-Id: Ibf230a6c4ddac4806dab235c3394778db26da38c
Reviewed-on: https://gerrit.libreoffice.org/42476Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 6978f506
......@@ -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()
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment