Kaydet (Commit) a472d335 authored tarafından Mark Hung's avatar Mark Hung

tdf#113822 handle letter-by-letter animations in pptx documents.

Unlike odp that has anim:iterate (IterateContainer) node,
both parallel time container and interate container appear
as p:par in ooxml so that we have to alter the node type
in the end. We also have to set the target of the iterate
container to make animation work.

Change-Id: Ic50b5f1d85716a67712ed1e812bcb0e7f25fb5a8
Reviewed-on: https://gerrit.libreoffice.org/58576
Tested-by: Jenkins
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst df1d4bd5
......@@ -75,7 +75,8 @@ namespace oox { namespace ppt {
void setNode(
const ::oox::core::XmlFilterBase& rFilter,
const css::uno::Reference< css::animations::XAnimationNode >& xNode,
const SlidePersistPtr & pSlide );
const SlidePersistPtr & pSlide,
const css::uno::Reference< css::animations::XAnimationNode >& xParent);
AnimTargetElementPtr const & getTarget()
{
......
......@@ -157,7 +157,8 @@ void SlidePersist::createXShapes( XmlFilterBase& rFilterBase )
TimeNodePtr pNode(maTimeNodeList.front());
OSL_ENSURE( pNode, "pNode" );
pNode->setNode( rFilterBase, xNode, pSlidePtr );
Reference<XAnimationNode> xDummy;
pNode->setNode(rFilterBase, xNode, pSlidePtr, xDummy);
}
}
}
......
......@@ -66,6 +66,9 @@ namespace oox { namespace ppt {
case AnimationNodeType::ANIMATE:
sServiceName = "com.sun.star.animations.Animate";
break;
case AnimationNodeType::ITERATE:
sServiceName = "com.sun.star.animations.IterateContainer";
break;
case AnimationNodeType::ANIMATECOLOR:
sServiceName = "com.sun.star.animations.AnimateColor";
break;
......@@ -194,9 +197,15 @@ namespace oox { namespace ppt {
void TimeNode::addNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& rxNode, const SlidePersistPtr & pSlide )
{
try {
OUString sServiceName = getServiceName( mnNodeType );
sal_Int16 nNodeType = mnNodeType;
if (mnNodeType == AnimationNodeType::PAR && maNodeProperties[NP_ITERATETYPE].hasValue())
nNodeType = AnimationNodeType::ITERATE;
OUString sServiceName = getServiceName(nNodeType);
Reference< XAnimationNode > xNode = createAndInsert( rFilter, sServiceName, rxNode );
setNode( rFilter, xNode, pSlide );
setNode(rFilter, xNode, pSlide, rxNode);
}
catch( const Exception& e )
{
......@@ -204,7 +213,7 @@ namespace oox { namespace ppt {
}
}
void TimeNode::setNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide )
void TimeNode::setNode(const XmlFilterBase& rFilter, const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide, const Reference<XAnimationNode>& xParent)
{
SAL_WARN_IF( !xNode.is(), "oox.ppt", "null node passed" );
......@@ -310,10 +319,20 @@ namespace oox { namespace ppt {
xAnimate->setBy( aValue );
break;
case NP_TARGET:
if (xAnimate.is())
xAnimate->setTarget(aValue);
if (xCommand.is())
xCommand->setTarget(aValue);
if (xParent.is() && xParent->getType() == AnimationNodeType::ITERATE)
{
Reference<XIterateContainer> xParentContainer(xParent, UNO_QUERY);
if (xParentContainer.is())
xParentContainer->setTarget(aValue);
}
else
{
if (xAnimate.is())
xAnimate->setTarget(aValue);
if (xCommand.is())
xCommand->setTarget(aValue);
}
break;
case NP_SUBITEM:
if( xAnimate.is() )
......
......@@ -1108,7 +1108,14 @@ void SdExportTest::testTdf113822()
xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile);
xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml");
assertXPath(pXmlDoc, "//anim:set[1]", "to", "solid");
// IterateContainer was created as ParallelTimeContainer before, so
// the iterate type is not set too.
assertXPath(pXmlDoc, "//anim:iterate", "iterate-type", "by-letter");
// The target of the child animation nodes need to be in the iterate container.
assertXPath(pXmlDoc, "//anim:iterate", "targetElement", "id1");
assertXPath(pXmlDoc, "//anim:iterate/anim:set", "attributeName", "text-underline");
assertXPath(pXmlDoc, "//anim:iterate/anim:set", "to", "solid");
xDocShRef->DoClose();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment