[Libreoffice-commits] core.git: sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 30 23:26:06 UTC 2018


 sd/source/filter/eppt/epptooxml.hxx       |    7 
 sd/source/filter/eppt/pptx-animations.cxx |  367 ++++++++++++++----------------
 2 files changed, 182 insertions(+), 192 deletions(-)

New commits:
commit 7496a0c8141c05c5f2b7e39ea9d4582f261b9e13
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Tue Aug 28 23:24:11 2018 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Fri Aug 31 01:25:34 2018 +0200

    sd/pptx export: move animation related static member functions
    
    of PowerPointExport to anonymous namespace. This allows cleaning
    up PowerPointExport and later moving other non-static member
    functions caller outside PowerPointExport to become a new class.
    
    Change-Id: I174337896db68307d7859dc9cf8bb9a9648f90eb
    Reviewed-on: https://gerrit.libreoffice.org/59732
    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 29ffca5604d9..97f7cf903d3f 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -99,12 +99,7 @@ private:
     virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
     void WriteNotesMaster();
 
-    static void WriteAnimateTo( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rValue, const OUString& rAttributeName );
-    static void WriteAnimateValues( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimate >& rXAnimate );
-    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, css::uno::Any const & rAny, bool bWriteEvent, bool bMainSeqChild, sal_Int32 nToken );
-    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay, sal_Int32 nToken );
     void WriteAnimations( const ::sax_fastparser::FSHelperPtr& pFS );
-    static void WriteAnimationAttributeName( const ::sax_fastparser::FSHelperPtr& pFS, const OUString& rAttributeName );
     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 );
@@ -113,8 +108,6 @@ private:
     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 WriteAnimateColorColor(const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny, sal_Int32 nToken);
-    static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny, sal_Int32 nToken = 0 );
     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 );
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index 82dbb8eb59ab..c2fa67f36673 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -73,9 +73,11 @@ using namespace ::ppt;
 using ::sax_fastparser::FSHelperPtr;
 using namespace oox::drawingml;
 using namespace oox::core;
+using namespace oox;
 
-void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny,
-                                              sal_Int32 nToken)
+namespace
+{
+void WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 nToken = 0)
 {
     if (!rAny.hasValue())
         return;
@@ -132,8 +134,64 @@ void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const Any&
         pFS->endElementNS(XML_p, nToken);
 }
 
-void PowerPointExport::WriteAnimateValues(const FSHelperPtr& pFS,
-                                          const Reference<XAnimate>& rXAnimate)
+void WriteAnimateColorColor(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 nToken)
+{
+    if (!rAny.hasValue())
+        return;
+
+    sal_Int32 nColor = 0;
+    if (rAny >>= nColor)
+    {
+        pFS->startElementNS(XML_p, nToken, FSEND);
+
+        if (nToken == XML_by)
+        {
+            // CT_TLByRgbColorTransform
+            SAL_WARN("sd.eppt", "Export p:rgb in p:by of animClr isn't implemented yet.");
+        }
+        else
+        {
+            // CT_Color
+            pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor), FSEND);
+        }
+
+        pFS->endElementNS(XML_p, nToken);
+    }
+
+    Sequence<double> aHSL(3);
+    if (rAny >>= aHSL)
+    {
+        pFS->startElementNS(XML_p, nToken, FSEND);
+
+        if (nToken == XML_by)
+        {
+            // CT_TLByHslColorTransform
+            pFS->singleElementNS(XML_p, XML_hsl, XML_h, I32S(aHSL[0] * 60000), // ST_Angel
+                                 XML_s, I32S(aHSL[1] * 100000), XML_l, I32S(aHSL[2] * 100000),
+                                 FSEND);
+        }
+        else
+        {
+            // CT_Color
+            SAL_WARN("sd.eppt", "Export p:hsl in p:from or p:to of animClr isn't implemented yet.");
+        }
+
+        pFS->endElementNS(XML_p, nToken);
+    }
+}
+
+void WriteAnimateTo(const FSHelperPtr& pFS, const Any& rValue, const OUString& rAttributeName)
+{
+    if (!rValue.hasValue())
+        return;
+
+    SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
+
+    WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName),
+                           XML_to);
+}
+
+void WriteAnimateValues(const FSHelperPtr& pFS, const Reference<XAnimate>& rXAnimate)
 {
     const Sequence<double> aKeyTimes = rXAnimate->getKeyTimes();
     if (aKeyTimes.getLength() <= 0)
@@ -175,20 +233,130 @@ void PowerPointExport::WriteAnimateValues(const FSHelperPtr& pFS,
     pFS->endElementNS(XML_p, XML_tavLst);
 }
 
-void PowerPointExport::WriteAnimateTo(const FSHelperPtr& pFS, const Any& rValue,
-                                      const OUString& rAttributeName)
+void WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay, const char* pEvent,
+                             double fDelay, bool bHasFDelay, sal_Int32 nToken)
 {
-    if (!rValue.hasValue())
-        return;
+    if (bHasFDelay || pDelay || pEvent)
+    {
+        pFS->startElementNS(XML_p, nToken, FSEND);
 
-    SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
+        if (!pEvent)
+            pFS->singleElementNS(
+                XML_p, XML_cond, XML_delay,
+                bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay * 1000.0)) : pDelay, FSEND);
+        else
+        {
+            pFS->startElementNS(XML_p, XML_cond, XML_delay,
+                                bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay * 1000.0))
+                                           : pDelay,
+                                XML_evt, pEvent, FSEND);
 
-    WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName),
-                           XML_to);
+            pFS->startElementNS(XML_p, XML_tgtEl, FSEND);
+            pFS->singleElementNS(XML_p, XML_sldTgt, FSEND);
+            pFS->endElementNS(XML_p, XML_tgtEl);
+
+            pFS->endElementNS(XML_p, XML_cond);
+        }
+
+        pFS->endElementNS(XML_p, nToken);
+    }
+}
+
+void WriteAnimationCondition(const FSHelperPtr& pFS, Any const& rAny, bool bWriteEvent,
+                             bool bMainSeqChild, sal_Int32 nToken)
+{
+    bool bHasFDelay = false;
+    double fDelay = 0;
+    Timing eTiming;
+    Event aEvent;
+    Reference<XShape> xShape;
+    const char* pDelay = nullptr;
+    const char* pEvent = nullptr;
+
+    if (rAny >>= fDelay)
+        bHasFDelay = true;
+    else if (rAny >>= eTiming)
+    {
+        if (eTiming == Timing_INDEFINITE)
+            pDelay = "indefinite";
+    }
+    else if (rAny >>= aEvent)
+    {
+        // TODO
+
+        SAL_INFO("sd.eppt", "animation condition event: TODO");
+        SAL_INFO("sd.eppt", "event offset has value: "
+                                << aEvent.Offset.hasValue() << " trigger: " << aEvent.Trigger
+                                << " source has value: " << aEvent.Source.hasValue());
+        if (!bWriteEvent && aEvent.Trigger == EventTrigger::ON_NEXT && bMainSeqChild)
+            pDelay = "indefinite";
+        else if (bWriteEvent)
+        {
+            switch (aEvent.Trigger)
+            {
+                case EventTrigger::ON_NEXT:
+                    pEvent = "onNext";
+                    break;
+                case EventTrigger::ON_PREV:
+                    pEvent = "onPrev";
+                    break;
+                case EventTrigger::BEGIN_EVENT:
+                    pEvent = "begin";
+                    break;
+                case EventTrigger::END_EVENT:
+                    pEvent = "end";
+                    break;
+                case EventTrigger::ON_BEGIN:
+                    pEvent = "onBegin";
+                    break;
+                case EventTrigger::ON_END:
+                    pEvent = "onEnd";
+                    break;
+                case EventTrigger::ON_CLICK:
+                    pEvent = "onClick";
+                    break;
+                case EventTrigger::ON_DBL_CLICK:
+                    pEvent = "onDblClick";
+                    break;
+                case EventTrigger::ON_STOP_AUDIO:
+                    pEvent = "onStopAudio";
+                    break;
+                case EventTrigger::ON_MOUSE_ENTER:
+                    pEvent = "onMouseOver"; // not exact?
+                    break;
+                case EventTrigger::ON_MOUSE_LEAVE:
+                    pEvent = "onMouseOut";
+                    break;
+            }
+        }
+
+        if (aEvent.Offset >>= fDelay)
+        {
+            bHasFDelay = true;
+            SAL_INFO("sd.eppt", "event offset: " << fDelay);
+        }
+        else if (aEvent.Offset >>= eTiming)
+        {
+            if (eTiming == Timing_INDEFINITE)
+                pDelay = "indefinite";
+            SAL_INFO("sd.eppt", "event offset timing: " << static_cast<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, nToken);
 }
 
-void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS,
-                                                   const OUString& rAttributeName)
+void WriteAnimationAttributeName(const FSHelperPtr& pFS, const OUString& rAttributeName)
 {
     if (rAttributeName.isEmpty())
         return;
@@ -237,6 +405,7 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS,
 
     pFS->endElementNS(XML_p, XML_attrNameLst);
 }
+}
 
 void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& rTarget)
 {
@@ -406,53 +575,6 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS,
     pFS->endElementNS(XML_p, nXmlNodeType);
 }
 
-void PowerPointExport::WriteAnimateColorColor(const FSHelperPtr& pFS, const Any& rAny,
-                                              sal_Int32 nToken)
-{
-    if (!rAny.hasValue())
-        return;
-
-    sal_Int32 nColor = 0;
-    if (rAny >>= nColor)
-    {
-        pFS->startElementNS(XML_p, nToken, FSEND);
-
-        if (nToken == XML_by)
-        {
-            // CT_TLByRgbColorTransform
-            SAL_WARN("sd.eppt", "Export p:rgb in p:by of animClr isn't implemented yet.");
-        }
-        else
-        {
-            // CT_Color
-            pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor), FSEND);
-        }
-
-        pFS->endElementNS(XML_p, nToken);
-    }
-
-    Sequence<double> aHSL(3);
-    if (rAny >>= aHSL)
-    {
-        pFS->startElementNS(XML_p, nToken, FSEND);
-
-        if (nToken == XML_by)
-        {
-            // CT_TLByHslColorTransform
-            pFS->singleElementNS(XML_p, XML_hsl, XML_h, I32S(aHSL[0] * 60000), // ST_Angel
-                                 XML_s, I32S(aHSL[1] * 100000), XML_l, I32S(aHSL[2] * 100000),
-                                 FSEND);
-        }
-        else
-        {
-            // CT_Color
-            SAL_WARN("sd.eppt", "Export p:hsl in p:from or p:to of animClr isn't implemented yet.");
-        }
-
-        pFS->endElementNS(XML_p, nToken);
-    }
-}
-
 void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
                                                        const Reference<XAnimationNode>& rXNode,
                                                        bool bMainSeqChild, bool bSimple,
@@ -522,131 +644,6 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS,
         WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName());
 }
 
-void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay,
-                                               const char* pEvent, double fDelay, bool bHasFDelay,
-                                               sal_Int32 nToken)
-{
-    if (bHasFDelay || pDelay || pEvent)
-    {
-        pFS->startElementNS(XML_p, nToken, FSEND);
-
-        if (!pEvent)
-            pFS->singleElementNS(
-                XML_p, XML_cond, XML_delay,
-                bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay * 1000.0)) : pDelay, FSEND);
-        else
-        {
-            pFS->startElementNS(XML_p, XML_cond, XML_delay,
-                                bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay * 1000.0))
-                                           : pDelay,
-                                XML_evt, pEvent, FSEND);
-
-            pFS->startElementNS(XML_p, XML_tgtEl, FSEND);
-            pFS->singleElementNS(XML_p, XML_sldTgt, FSEND);
-            pFS->endElementNS(XML_p, XML_tgtEl);
-
-            pFS->endElementNS(XML_p, XML_cond);
-        }
-
-        pFS->endElementNS(XML_p, nToken);
-    }
-}
-
-void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const& rAny,
-                                               bool bWriteEvent, bool bMainSeqChild,
-                                               sal_Int32 nToken)
-{
-    bool bHasFDelay = false;
-    double fDelay = 0;
-    Timing eTiming;
-    Event aEvent;
-    Reference<XShape> xShape;
-    const char* pDelay = nullptr;
-    const char* pEvent = nullptr;
-
-    if (rAny >>= fDelay)
-        bHasFDelay = true;
-    else if (rAny >>= eTiming)
-    {
-        if (eTiming == Timing_INDEFINITE)
-            pDelay = "indefinite";
-    }
-    else if (rAny >>= aEvent)
-    {
-        // TODO
-
-        SAL_INFO("sd.eppt", "animation condition event: TODO");
-        SAL_INFO("sd.eppt", "event offset has value: "
-                                << aEvent.Offset.hasValue() << " trigger: " << aEvent.Trigger
-                                << " source has value: " << aEvent.Source.hasValue());
-        if (!bWriteEvent && aEvent.Trigger == EventTrigger::ON_NEXT && bMainSeqChild)
-            pDelay = "indefinite";
-        else if (bWriteEvent)
-        {
-            switch (aEvent.Trigger)
-            {
-                case EventTrigger::ON_NEXT:
-                    pEvent = "onNext";
-                    break;
-                case EventTrigger::ON_PREV:
-                    pEvent = "onPrev";
-                    break;
-                case EventTrigger::BEGIN_EVENT:
-                    pEvent = "begin";
-                    break;
-                case EventTrigger::END_EVENT:
-                    pEvent = "end";
-                    break;
-                case EventTrigger::ON_BEGIN:
-                    pEvent = "onBegin";
-                    break;
-                case EventTrigger::ON_END:
-                    pEvent = "onEnd";
-                    break;
-                case EventTrigger::ON_CLICK:
-                    pEvent = "onClick";
-                    break;
-                case EventTrigger::ON_DBL_CLICK:
-                    pEvent = "onDblClick";
-                    break;
-                case EventTrigger::ON_STOP_AUDIO:
-                    pEvent = "onStopAudio";
-                    break;
-                case EventTrigger::ON_MOUSE_ENTER:
-                    pEvent = "onMouseOver"; // not exact?
-                    break;
-                case EventTrigger::ON_MOUSE_LEAVE:
-                    pEvent = "onMouseOut";
-                    break;
-            }
-        }
-
-        if (aEvent.Offset >>= fDelay)
-        {
-            bHasFDelay = true;
-            SAL_INFO("sd.eppt", "event offset: " << fDelay);
-        }
-        else if (aEvent.Offset >>= eTiming)
-        {
-            if (eTiming == Timing_INDEFINITE)
-                pDelay = "indefinite";
-            SAL_INFO("sd.eppt", "event offset timing: " << static_cast<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, nToken);
-}
-
 void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS,
                                                           const Reference<XAnimationNode>& rXNode,
                                                           bool bSingle, bool bMainSeqChild)


More information about the Libreoffice-commits mailing list