[Libreoffice-commits] core.git: sd/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 31 01:56:30 UTC 2018
sd/source/filter/eppt/epptooxml.hxx | 12 ---
sd/source/filter/eppt/pptx-animations.cxx | 106 ++++++++++++++++++++++--------
sd/source/filter/eppt/pptx-animations.hxx | 23 ++++++
sd/source/filter/eppt/pptx-epptooxml.cxx | 13 +++
4 files changed, 115 insertions(+), 39 deletions(-)
New commits:
commit 76be5c31b97a37d15a3009995f4e60e4cee011ee
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Wed Aug 29 01:21:28 2018 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Fri Aug 31 03:56:04 2018 +0200
sd/pptx export: new PPTXAnimationExport class.
Create a new PPTXAnimationExport and move animation
related member functions from PowerPointExport.
Change-Id: Iaeb9ff032c248d9b540680a4937365004d0c921e
Reviewed-on: https://gerrit.libreoffice.org/59735
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index 97f7cf903d3f..4f1a1540da20 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -83,6 +83,8 @@ public:
static const char* Get8Direction( sal_uInt8 nDirection );
static int GetPPTXLayoutId( int nOffset );
+ sal_Int32 GetShapeID(const css::uno::Reference<css::drawing::XShape>& rXShape);
+ sal_Int32 GetNextAnimationNodeID();
private:
virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
@@ -99,16 +101,6 @@ private:
virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
void WriteNotesMaster();
- void WriteAnimations( const ::sax_fastparser::FSHelperPtr& pFS );
- void WriteAnimationNode( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild );
- void WriteAnimationNodeAnimate( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
- void WriteAnimationNodeAnimateInside( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple, bool bWriteTo = true );
- 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 );
-
- void WriteAnimationTarget( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rTarget );
bool WriteComments( sal_uInt32 nPageNum );
void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
void WriteTransition( const ::sax_fastparser::FSHelperPtr& pFS );
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index d9c98db90415..17d16dedc591 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -54,11 +54,13 @@
#include <com/sun/star/presentation/TextAnimationType.hpp>
#include <com/sun/star/text/XSimpleText.hpp>
#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
#include <oox/export/utils.hxx>
#include <oox/ppt/pptfilterhelpers.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include "pptexanimations.hxx"
+#include "pptx-animations.hxx"
#include "../ppt/pptanimations.hxx"
using namespace ::com::sun::star::animations;
@@ -71,6 +73,7 @@ using namespace oox::core;
using namespace oox;
using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::drawing::XDrawPage;
using ::com::sun::star::drawing::XShape;
using ::com::sun::star::text::XSimpleText;
using ::sax_fastparser::FSHelperPtr;
@@ -447,9 +450,54 @@ sal_Int32 convertNodeType(sal_Int16 nType)
}
return xmlNodeType;
}
+
+class PPTXAnimationExport
+{
+ void WriteAnimationNode(const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode,
+ bool bMainSeqChild);
+ void WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode,
+ sal_Int32 nXmlNodeType, bool bMainSeqChild);
+ void WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode,
+ bool bMainSeqChild, bool bSimple, bool bWriteTo = true);
+ void WriteAnimationNodeSeq(const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode,
+ sal_Int32 nXmlNodeType, bool bMainSeqChild);
+ void WriteAnimationNodeEffect(const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode,
+ sal_Int32 nXmlNodeType, bool bMainSeqChild);
+ void WriteAnimationNodeCommand(const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode,
+ sal_Int32 nXmlNodeType, bool bMainSeqChild);
+ void WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode, bool bSingle,
+ bool bMainSeqChild);
+ void WriteAnimationTarget(const FSHelperPtr& pFS, const Any& rTarget);
+
+ PowerPointExport& mrPowerPointExport;
+
+public:
+ PPTXAnimationExport(PowerPointExport& rExport);
+ void WriteAnimations(const FSHelperPtr& pFS, const Reference<XDrawPage>& rXDrawPage);
+};
}
-void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& rTarget)
+namespace oox
+{
+namespace core
+{
+void WriteAnimations(const FSHelperPtr& pFS, const Reference<XDrawPage>& rXDrawPage,
+ PowerPointExport& rExport)
+{
+ PPTXAnimationExport aAnimationExport(rExport);
+ aAnimationExport.WriteAnimations(pFS, rXDrawPage);
+}
+}
+}
+
+PPTXAnimationExport::PPTXAnimationExport(PowerPointExport& rExport)
+ : mrPowerPointExport(rExport)
+{
+}
+
+void PPTXAnimationExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& rTarget)
{
sal_Int32 nParagraph = -1;
bool bParagraphTarget = false;
@@ -475,9 +523,10 @@ void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& r
if (rXShape.is())
{
+ sal_Int32 nShapeID = mrPowerPointExport.GetShapeID(rXShape);
+
pFS->startElementNS(XML_p, XML_tgtEl, FSEND);
- pFS->startElementNS(XML_p, XML_spTgt, XML_spid,
- I32S(ShapeExport::GetShapeID(rXShape, &maShapeMap)), FSEND);
+ pFS->startElementNS(XML_p, XML_spTgt, XML_spid, I32S(nShapeID), FSEND);
if (bParagraphTarget)
{
pFS->startElementNS(XML_p, XML_txEl, FSEND);
@@ -490,9 +539,9 @@ void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& r
}
}
-void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode,
- sal_Int32 nXmlNodeType, bool bMainSeqChild)
+void PPTXAnimationExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode,
+ sal_Int32 nXmlNodeType, bool bMainSeqChild)
{
Reference<XAnimate> rXAnimate(rXNode, UNO_QUERY);
if (!rXAnimate.is())
@@ -617,10 +666,10 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS,
pFS->endElementNS(XML_p, nXmlNodeType);
}
-void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode,
- bool bMainSeqChild, bool bSimple,
- bool bWriteTo)
+void PPTXAnimationExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode,
+ bool bMainSeqChild, bool bSimple,
+ bool bWriteTo)
{
Reference<XAnimate> rXAnimate(rXNode, UNO_QUERY);
if (!rXAnimate.is())
@@ -686,9 +735,9 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName());
}
-void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode,
- bool bSingle, bool bMainSeqChild)
+void PPTXAnimationExport::WriteAnimationNodeCommonPropsStart(
+ const FSHelperPtr& pFS, const Reference<XAnimationNode>& rXNode, bool bSingle,
+ bool bMainSeqChild)
{
const char* pDuration = nullptr;
const char* pRestart = nullptr;
@@ -835,7 +884,7 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
bool bAutoReverse = rXNode->getAutoReverse();
pFS->startElementNS(
- XML_p, XML_cTn, XML_id, I64S(mnAnimationNodeIdMax++), XML_dur,
+ XML_p, XML_cTn, XML_id, I64S(mrPowerPointExport.GetNextAnimationNodeID()), XML_dur,
fDuration != 0 ? I32S(static_cast<sal_Int32>(fDuration * 1000.0)) : pDuration, XML_autoRev,
bAutoReverse ? "1" : nullptr, XML_restart, pRestart, XML_nodeType, pNodeType, XML_fill,
pFill, XML_presetClass, pPresetClass, XML_presetID, bPresetId ? I64S(nPresetId) : nullptr,
@@ -924,9 +973,9 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
pFS->endElementNS(XML_p, XML_cTn);
}
-void PowerPointExport::WriteAnimationNodeSeq(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode, sal_Int32,
- bool bMainSeqChild)
+void PPTXAnimationExport::WriteAnimationNodeSeq(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode, sal_Int32,
+ bool bMainSeqChild)
{
SAL_INFO("sd.eppt", "write animation node SEQ");
@@ -940,9 +989,9 @@ void PowerPointExport::WriteAnimationNodeSeq(const FSHelperPtr& pFS,
pFS->endElementNS(XML_p, XML_seq);
}
-void PowerPointExport::WriteAnimationNodeEffect(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode, sal_Int32,
- bool bMainSeqChild)
+void PPTXAnimationExport::WriteAnimationNodeEffect(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode,
+ sal_Int32, bool bMainSeqChild)
{
SAL_INFO("sd.eppt", "write animation node FILTER");
Reference<XTransitionFilter> xFilter(rXNode, UNO_QUERY);
@@ -960,9 +1009,9 @@ void PowerPointExport::WriteAnimationNodeEffect(const FSHelperPtr& pFS,
}
}
-void PowerPointExport::WriteAnimationNodeCommand(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode, sal_Int32,
- bool bMainSeqChild)
+void PPTXAnimationExport::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);
@@ -1002,9 +1051,9 @@ void PowerPointExport::WriteAnimationNodeCommand(const FSHelperPtr& pFS,
}
}
-void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS,
- const Reference<XAnimationNode>& rXNode,
- bool bMainSeqChild)
+void PPTXAnimationExport::WriteAnimationNode(const FSHelperPtr& pFS,
+ const Reference<XAnimationNode>& rXNode,
+ bool bMainSeqChild)
{
SAL_INFO("sd.eppt", "export node type: " << rXNode->getType());
sal_Int32 xmlNodeType = convertNodeType(rXNode->getType());
@@ -1055,9 +1104,10 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS,
}
}
-void PowerPointExport::WriteAnimations(const FSHelperPtr& pFS)
+void PPTXAnimationExport::WriteAnimations(const FSHelperPtr& pFS,
+ const Reference<XDrawPage>& rXDrawPage)
{
- Reference<XAnimationNodeSupplier> xNodeSupplier(mXDrawPage, UNO_QUERY);
+ Reference<XAnimationNodeSupplier> xNodeSupplier(rXDrawPage, UNO_QUERY);
if (xNodeSupplier.is())
{
const Reference<XAnimationNode> xNode(xNodeSupplier->getAnimationNode());
diff --git a/sd/source/filter/eppt/pptx-animations.hxx b/sd/source/filter/eppt/pptx-animations.hxx
new file mode 100644
index 000000000000..738100befee0
--- /dev/null
+++ b/sd/source/filter/eppt/pptx-animations.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_SD_SOURCE_FILTER_EPPT_EPPTANIMATIONS_HXX
+#define INCLUDED_SD_SOURCE_FILTER_EPPT_EPPTANIMATIONS_HXX
+
+namespace oox
+{
+namespace core
+{
+void WriteAnimations(const ::sax_fastparser::FSHelperPtr& pFS,
+ const css::uno::Reference<css::drawing::XDrawPage>& rXDrawPage,
+ PowerPointExport& rExport);
+}
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 6142e15a66cb..e625a98da656 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -61,6 +61,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include "pptexanimations.hxx"
+#include "pptx-animations.hxx"
#include "../ppt/pptanimations.hxx"
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -1108,7 +1109,7 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum
pFS->endElementNS(XML_p, XML_cSld);
WriteTransition(pFS);
- WriteAnimations(pFS);
+ WriteAnimations(pFS, mXDrawPage, *this);
pFS->endElementNS(XML_p, XML_sld);
@@ -1929,6 +1930,16 @@ void PowerPointExport::WriteNotesMaster()
SAL_INFO("sd.eppt", "----------------");
}
+sal_Int32 PowerPointExport::GetShapeID(const Reference<XShape>& rXShape)
+{
+ return ShapeExport::GetShapeID(rXShape, &maShapeMap);
+}
+
+sal_Int32 PowerPointExport::GetNextAnimationNodeID()
+{
+ return mnAnimationNodeIdMax++;
+}
+
bool PowerPointExport::ImplCreateMainNotes()
{
if (mbCreateNotes)
More information about the Libreoffice-commits
mailing list