diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-09-19 13:27:09 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-09-26 12:17:30 +0200 |
commit | 7ec18dc333ef110c842f0b153c01cf18b864ba8c (patch) | |
tree | 16ba47b35748f00caa04b6fc425e31bbe0e5837d | |
parent | tdf#112333 PPTX export fill.type & fill.on (diff) | |
download | core-7ec18dc333ef110c842f0b153c01cf18b864ba8c.tar.gz core-7ec18dc333ef110c842f0b153c01cf18b864ba8c.zip |
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>
Reviewed-on: https://gerrit.libreoffice.org/42584
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | include/oox/export/utils.hxx | 10 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 6 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 35 |
3 files changed, 50 insertions, 1 deletions
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx index 599e45ee55f8..0e0dae1bce83 100644 --- a/include/oox/export/utils.hxx +++ b/include/oox/export/utils.hxx @@ -26,6 +26,16 @@ #define I32S(x) OString::number( (sal_Int32) x ).getStr() #define I64S(x) OString::number( (sal_Int64) x ).getStr() + +inline OString I32SHEX_(sal_Int32 x) +{ + OString aStr = OString::number(x, 16); + if (aStr.getLength() % 2 != 0) + aStr = OString("0") + aStr; + return aStr.getStr(); +} +#define I32SHEX(x) I32SHEX_(x).getStr() + #define IS(x) OString::number( x ).getStr() #define BS(x) (x ? "1":"0") #define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 9fda601f4bbf..dd723a68c3fb 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -922,6 +922,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 d76b524119c9..f0e1b27f46b0 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -819,7 +819,15 @@ 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) ), @@ -875,7 +883,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 ); } @@ -935,6 +950,12 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons 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_INFO("sd.eppt", "unhandled animation attribute name: " << rAttributeName); @@ -1048,6 +1069,14 @@ void PowerPointExport::WriteAnimationNodeAnimate( const FSHelperPtr& pFS, const 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, @@ -1508,6 +1537,10 @@ void PowerPointExport::WriteAnimationNode( const FSHelperPtr& pFS, const Referen } } break; + case AnimationNodeType::ANIMATECOLOR: + xmlNodeType = XML_animClr; + pMethod = &PowerPointExport::WriteAnimationNodeAnimate; + break; case AnimationNodeType::SET: xmlNodeType = XML_set; pMethod = &PowerPointExport::WriteAnimationNodeAnimate; |