summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-09-01 18:22:43 +0200
committerJan Holesovsky <kendy@collabora.com>2017-09-06 14:46:19 +0200
commite64ebbb7ac530f82bf26a67fed0e1d22b254ff93 (patch)
tree592c3362b93ce15530a75f22f613410664e69e84
parent6ac9d6d2a0def5ccc7d8b0d8893c8462f87cb9e5 (diff)
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/41977 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sd/source/filter/eppt/epptooxml.hxx1
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx54
2 files changed, 55 insertions, 0 deletions
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index 41f7b393bf53..2780767230d6 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -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 );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index e8c3e851b413..28c1d2870ed4 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -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)