diff options
author | Mark Hung <marklh9@gmail.com> | 2018-07-21 10:20:51 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-07-24 12:12:01 +0200 |
commit | 6a79db85be2520de3ca5d2c52eacdb58bc17fec8 (patch) | |
tree | d72a7e30bf46d018d83a508048295172baacc049 /sd/source/filter | |
parent | 0bc245ede6ec5831561e950299071f57b0329da8 (diff) |
tdf#118835 export animClr element. ( handle AnimateColor ).
Implement PowerPointExport::WriteAnimateColorColor to export
to, from, by elements of the animClr element.
Change-Id: I0fb81f8838656c127610a9a10654e3e51106bea8
Reviewed-on: https://gerrit.libreoffice.org/57820
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd/source/filter')
-rw-r--r-- | sd/source/filter/eppt/epptooxml.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 73 |
2 files changed, 73 insertions, 2 deletions
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index ee5520f590b5..8784ae49c18a 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -112,6 +112,8 @@ private: void WriteAnimationNodeEffect( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild ); void WriteAnimationNodeCommand(const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild ); void WriteAnimationNodeCommonPropsStart( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild ); + + static void WriteAnimateColorColor(const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny, sal_Int32 nToken); static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny, sal_Int32 nToken = 0 ); void WriteAnimationTarget( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rTarget ); bool WriteComments( sal_uInt32 nPageNum ); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 5811334ddff7..80e87fa1db0c 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/animations/AnimationRestart.hpp> #include <com/sun/star/animations/AnimationTransformType.hpp> #include <com/sun/star/animations/AnimationValueType.hpp> +#include <com/sun/star/animations/AnimationColorSpace.hpp> #include <com/sun/star/animations/Event.hpp> #include <com/sun/star/animations/EventTrigger.hpp> #include <com/sun/star/animations/Timing.hpp> @@ -55,6 +56,7 @@ #include <com/sun/star/animations/XAnimateTransform.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> +#include <com/sun/star/animations/XAnimateColor.hpp> #include <com/sun/star/animations/XCommand.hpp> #include <com/sun/star/animations/XTransitionFilter.hpp> #include <com/sun/star/beans/Property.hpp> @@ -1195,8 +1197,18 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R } else if (nXmlNodeType == XML_animClr) { + Reference<XAnimateColor> xColor(rXNode, UNO_QUERY); + const char *pColorSpace = "rgb"; + const char *pDirection = nullptr; + if (xColor.is() && xColor->getColorInterpolation() == AnimationColorSpace::HSL) + { + // Note: from, to, by can still be specified in any supported format. + pColorSpace = "hsl"; + pDirection = xColor->getDirection() ? "cw" : "ccw"; + } pFS->startElementNS(XML_p, nXmlNodeType, - XML_clrSpc, "rgb", + XML_clrSpc, pColorSpace, + XML_dir, pDirection, XML_calcmode, pCalcMode, XML_valueType, pValueType, FSEND); @@ -1229,6 +1241,54 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R pFS->endElementNS(XML_p, nXmlNodeType); } +void PowerPointExport::WriteAnimateColorColor(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 nToken) +{ + if (!rAny.hasValue()) + return; + + sal_Int32 nColor = 0; + if (rAny >>= nColor) + { + pFS->startElementNS(XML_p, nToken, FSEND); + + if (nToken == XML_by) + { + // CT_TLByRgbColorTransform + SAL_WARN("sd.eppt", "Export p:rgb in p:by of animClr isn't implemented yet."); + } + else + { + // CT_Color + pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor), FSEND); + } + + pFS->endElementNS(XML_p, nToken); + } + + Sequence< double > aHSL(3); + if (rAny >>= aHSL) + { + pFS->startElementNS(XML_p, nToken, FSEND); + + if (nToken == XML_by) + { + // CT_TLByHslColorTransform + pFS->singleElementNS(XML_p, XML_hsl, + XML_h, I32S(aHSL[0] * 60000), // ST_Angel + XML_s, I32S(aHSL[1] * 100000), + XML_l, I32S(aHSL[2] * 100000), + FSEND); + } + else + { + // CT_Color + SAL_WARN("sd.eppt", "Export p:hsl in p:from or p:to of animClr isn't implemented yet."); + } + + pFS->endElementNS(XML_p, nToken); + } +} + void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple, bool bWriteTo) { Reference< XAnimate > rXAnimate(rXNode, UNO_QUERY); @@ -1276,7 +1336,16 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, c pFS->endElementNS(XML_p, XML_cBhvr); WriteAnimateValues(pFS, rXAnimate); - if (bWriteTo) + + Reference<XAnimateColor> xColor(rXNode, UNO_QUERY); + + if (xColor.is()) + { + WriteAnimateColorColor(pFS, xColor->getBy(), XML_by); + WriteAnimateColorColor(pFS, xColor->getFrom(), XML_from); + WriteAnimateColorColor(pFS, xColor->getTo(), XML_to); + } + else if (bWriteTo) WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName()); } |