Kaydet (Commit) e64ebbb7 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

tdf#106867: Implement pptx export of AnimationNodeType::COMMAND.

This is still not enough to make PowerPoint happy with the test file.

Change-Id: Icadcb640b44100ffb3482de57723576e4d843e7a
Reviewed-on: https://gerrit.libreoffice.org/41977Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 6ac9d6d2
......@@ -108,6 +108,7 @@ protected:
void WriteAnimationNodeAnimateInside( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple );
void WriteAnimationNodeSeq( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
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 WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny );
void WriteAnimationTarget( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rTarget );
......
......@@ -53,6 +53,7 @@
#include <com/sun/star/animations/XAnimateMotion.hpp>
#include <com/sun/star/animations/XAnimationNode.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/animations/XCommand.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
......@@ -64,6 +65,7 @@
#include <com/sun/star/office/XAnnotationEnumeration.hpp>
#include <com/sun/star/office/XAnnotationAccess.hpp>
#include <com/sun/star/presentation/AnimationSpeed.hpp>
#include <com/sun/star/presentation/EffectCommands.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp>
#include <com/sun/star/presentation/EffectPresetClass.hpp>
#include <com/sun/star/presentation/ParagraphTarget.hpp>
......@@ -1104,6 +1106,7 @@ void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const
double fDelay = 0;
Timing eTiming;
Event aEvent;
Reference<XShape> xShape;
const char* pDelay = nullptr;
const char* pEvent = nullptr;
......@@ -1175,6 +1178,15 @@ void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const
SAL_INFO("sd.eppt", "event offset timing: " << (int)eTiming);
}
}
else if (rAny >>= xShape)
{
SAL_INFO("sd.eppt", "Got the xShape: " << xShape->getShapeType());
if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape" || xShape->getShapeType() == "com.sun.star.presentation.MediaShape")
{
// write the default
bHasFDelay = true;
}
}
WriteAnimationCondition(pFS, pDelay, pEvent, fDelay, bHasFDelay);
}
......@@ -1433,6 +1445,41 @@ void PowerPointExport::WriteAnimationNodeEffect(const FSHelperPtr& pFS, const Re
}
}
void PowerPointExport::WriteAnimationNodeCommand(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, bool bMainSeqChild)
{
SAL_INFO("sd.eppt", "write animation node COMMAND");
Reference<XCommand> xCommand(rXNode, UNO_QUERY);
if (xCommand.is())
{
const char* pType = "call";
const char* pCommand = nullptr;
switch (xCommand->getCommand())
{
case EffectCommands::VERB: pType = "verb"; pCommand = "1"; /* FIXME hardcoded viewing */ break;
case EffectCommands::PLAY: pCommand = "play"; break;
case EffectCommands::TOGGLEPAUSE: pCommand = "togglePause"; break;
case EffectCommands::STOP: pCommand = "stop"; break;
default:
SAL_WARN("sd.eppt", "unknown command: " << xCommand->getCommand());
break;
}
pFS->startElementNS(XML_p, XML_cmd,
XML_type, pType,
XML_cmd, pCommand,
FSEND);
WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, false);
pFS->startElementNS(XML_p, XML_cBhvr,
FSEND);
WriteAnimationNodeCommonPropsStart(pFS, rXNode, true, bMainSeqChild);
WriteAnimationTarget(pFS, xCommand->getTarget());
pFS->endElementNS(XML_p, XML_cBhvr);
pFS->endElementNS(XML_p, XML_cmd);
}
}
void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bMainSeqChild)
{
SAL_INFO("sd.eppt", "export node type: " << rXNode->getType());
......@@ -1464,6 +1511,13 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc
xmlNodeType = XML_animEffect;
pMethod = &PowerPointExport::WriteAnimationNodeEffect;
break;
case AnimationNodeType::COMMAND:
xmlNodeType = XML_cmd;
pMethod = &PowerPointExport::WriteAnimationNodeCommand;
break;
default:
SAL_WARN("sd.eppt", "unhandled: " << rXNode->getType());
break;
}
if (pMethod)
......
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