sd/source/filter/eppt/pptx-animations.cxx | 38 +++++++++++++----------------- 1 file changed, 17 insertions(+), 21 deletions(-)
New commits: commit 9a9b81c7212fa6a6762246593acf3f1950677a22 Author: Mark Hung <mark...@gmail.com> AuthorDate: Thu Sep 6 05:56:46 2018 +0800 Commit: Mark Hung <mark...@gmail.com> CommitDate: Fri Sep 7 23:57:02 2018 +0200 sd/ pptx export: resolves unhandled node type causing crashes. found in http://dev-builds.libreoffice.org/crashtest/1103bddab3f695b61484960523c4c2c0de4f0f91/ https://bz.apache.org/ooo/attachment.cgi?id=49270 https://bz.apache.org/ooo/attachment.cgi?id=44458 https://bz.apache.org/ooo/attachment.cgi?id=54593 Change-Id: If9e19140f2fcffc0b261c1d91a40597684a51917 Reviewed-on: https://gerrit.libreoffice.org/60060 Tested-by: Jenkins Reviewed-by: Mark Hung <mark...@gmail.com> diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index b02ccdcc4cb7..42cec71e09e1 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -425,9 +425,10 @@ bool isValidTarget(const Any& rTarget) return false; } -/// convert animation node type to corresponding ooxml element. -sal_Int32 convertNodeType(sal_Int16 nType) +/// extract ooxml node type from a XAnimationNode. +sal_Int32 extractNodeType(const Reference<XAnimationNode>& rXNode) { + sal_Int16 nType = rXNode->getType(); sal_Int32 xmlNodeType = -1; switch (nType) { @@ -445,9 +446,17 @@ sal_Int32 convertNodeType(sal_Int16 nType) xmlNodeType = XML_animMotion; break; case AnimationNodeType::ANIMATETRANSFORM: - // could be XML_animScale or XML_animRot based on xTransform->getTransformType() - xmlNodeType = -1; + { + Reference<XAnimateTransform> xTransform(rXNode, UNO_QUERY); + if (xTransform.is()) + { + if (xTransform->getTransformType() == AnimationTransformType::SCALE) + xmlNodeType = XML_animScale; + else if (xTransform->getTransformType() == AnimationTransformType::ROTATE) + xmlNodeType = XML_animRot; + } break; + } case AnimationNodeType::ANIMATECOLOR: xmlNodeType = XML_animClr; break; @@ -1136,7 +1145,10 @@ void PPTXAnimationExport::WriteAnimationNode(const NodeContextPtr& pContext) const Reference<XAnimationNode>& rXNode = getCurrentNode(); SAL_INFO("sd.eppt", "export node type: " << rXNode->getType()); - sal_Int32 xmlNodeType = convertNodeType(rXNode->getType()); + sal_Int32 xmlNodeType = extractNodeType(rXNode); + + if (xmlNodeType == -1) + return; switch (rXNode->getType()) { @@ -1150,22 +1162,6 @@ void PPTXAnimationExport::WriteAnimationNode(const NodeContextPtr& pContext) WriteAnimationNodeSeq(); break; case AnimationNodeType::ANIMATETRANSFORM: - { - Reference<XAnimateTransform> xTransform(rXNode, UNO_QUERY); - if (xTransform.is()) - { - if (xTransform->getTransformType() == AnimationTransformType::SCALE) - xmlNodeType = XML_animScale; - else if (xTransform->getTransformType() == AnimationTransformType::ROTATE) - xmlNodeType = XML_animRot; - - WriteAnimationNodeAnimate(xmlNodeType); - } - else - SAL_WARN("sd.eppt", - "XAnimateTransform not handled: " << xTransform->getTransformType()); - } - break; case AnimationNodeType::ANIMATE: case AnimationNodeType::ANIMATEMOTION: case AnimationNodeType::ANIMATECOLOR: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits