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>
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index b02ccdc..42cec71 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: