diff options
author | Mark Hung <marklh9@gmail.com> | 2018-09-06 05:56:46 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-09-07 23:57:02 +0200 |
commit | 9a9b81c7212fa6a6762246593acf3f1950677a22 (patch) | |
tree | 508bc398d36ad0fe0ebcd33bed38d4362c92a794 /sd | |
parent | [tr][autocorr] Consistent capitalizations for Turkish (diff) | |
download | core-9a9b81c7212fa6a6762246593acf3f1950677a22.tar.gz core-9a9b81c7212fa6a6762246593acf3f1950677a22.zip |
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 <marklh9@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/pptx-animations.cxx | 38 |
1 files changed, 17 insertions, 21 deletions
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: |