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

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 17 06:14:07 UTC 2019


 slideshow/source/engine/effectrewinder.cxx |   58 ++++++++++++++++++++++++++++-
 slideshow/source/engine/effectrewinder.hxx |    3 +
 2 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit 8eb2d2972583b909a249f5b0f22a9b1fbf533d24
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon Dec 16 11:31:49 2019 +0300
Commit:     Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Tue Dec 17 07:13:09 2019 +0100

    tdf#125949 Allow the slide to continue with freezing animation.
    
    Entrance (Zoom in, Spiral in, Sviwel, Stretchy) animations with
    shapes freezes the presentation when OpenGL is enabled. As a
    workaround, avoid playing these animations.
    
    Change-Id: I054d87c4d3774339a9fe6fba42dea20bccd31bb1
    Reviewed-on: https://gerrit.libreoffice.org/85201
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>

diff --git a/slideshow/source/engine/effectrewinder.cxx b/slideshow/source/engine/effectrewinder.cxx
index d920bdd4ad06..5db91ff9a621 100644
--- a/slideshow/source/engine/effectrewinder.cxx
+++ b/slideshow/source/engine/effectrewinder.cxx
@@ -29,7 +29,7 @@
 #include <com/sun/star/animations/Event.hpp>
 #include <com/sun/star/animations/EventTrigger.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
-
+#include <com/sun/star/animations/XAnimate.hpp>
 using ::com::sun::star::uno::Reference;
 using namespace ::com::sun::star;
 
@@ -291,9 +291,64 @@ bool EffectRewinder::resetEffectCount()
     return false;
 }
 
+bool EffectRewinder::hasBlockedAnimation( const css::uno::Reference<css::animations::XAnimationNode>& xNode)
+{
+    bool isShapeTarget = false;;
+    OUString preset_id;
+    OUString preset_sub_type;
+    OUString preset_property;
+
+    if (xNode->getUserData().getLength())
+    {
+        for(int i = 0; i < xNode->getUserData().getLength(); i++)
+        {
+            if(xNode->getUserData()[i].Name == "preset-id")
+                xNode->getUserData()[i].Value >>= preset_id;
+            if(xNode->getUserData()[i].Name == "preset-sub-type")
+                xNode->getUserData()[i].Value >>= preset_sub_type;
+            if(xNode->getUserData()[i].Name == "preset-property")
+                xNode->getUserData()[i].Value >>= preset_property;
+        }
+    }
+
+    uno::Reference<container::XEnumerationAccess> xEnumerationAccess (xNode, uno::UNO_QUERY);
+    if (xEnumerationAccess.is())
+    {
+        uno::Reference<container::XEnumeration> xEnumeration (
+            xEnumerationAccess->createEnumeration());
+        if (xEnumeration.is())
+            while (xEnumeration->hasMoreElements())
+            {
+                uno::Reference<animations::XAnimationNode> xNext (xEnumeration->nextElement(), uno::UNO_QUERY);
+                uno::Reference<animations::XAnimate> xAnimate( xNext, uno::UNO_QUERY );
+
+                if(xAnimate.is())
+                {
+                    uno::Reference< drawing::XShape > xShape( xAnimate->getTarget(), uno::UNO_QUERY );
+
+                    if (xShape.is() || xAnimate->getTarget().getValueType() == cppu::UnoType<void>::get())
+                        isShapeTarget=true;
+                }
+            }
+    }
+
+    if(isShapeTarget &&
+       ((preset_id == "ooo-entrance-zoom" && preset_sub_type == "in") || // Entrance Zoom In
+        (preset_id == "ooo-entrance-swivel" )                         || // Entrance Swivel
+        (preset_id == "ooo-entrance-spiral-in")                       || // Entrance Spiral-In
+        (preset_id == "ooo-entrance-stretchy")))                         // Entrance Stretchy
+        return true;
+
+    return false;
+}
 
 bool EffectRewinder::notifyAnimationStart (const AnimationNodeSharedPtr& rpNode)
 {
+    Reference<animations::XAnimationNode> xNode (rpNode->getXAnimationNode());
+
+    if(xNode.is() && hasBlockedAnimation(xNode) )
+        skipSingleMainSequenceEffects();
+
     // This notification is only relevant for us when the rpNode belongs to
     // the main sequence.
     BaseNodeSharedPtr pBaseNode (::std::dynamic_pointer_cast<BaseNode>(rpNode));
@@ -308,7 +363,6 @@ bool EffectRewinder::notifyAnimationStart (const AnimationNodeSharedPtr& rpNode)
     // triggered.
     bool bIsUserTriggered (false);
 
-    Reference<animations::XAnimationNode> xNode (rpNode->getXAnimationNode());
     if (xNode.is())
     {
         animations::Event aEvent;
diff --git a/slideshow/source/engine/effectrewinder.hxx b/slideshow/source/engine/effectrewinder.hxx
index 0a88409498ec..f71f8425e840 100644
--- a/slideshow/source/engine/effectrewinder.hxx
+++ b/slideshow/source/engine/effectrewinder.hxx
@@ -97,6 +97,9 @@ public:
     */
     void skipAllMainSequenceEffects();
 
+    //FIXME: That is an opengl issue(it doesn't allow to animate somea animations), remove that function when opengl fixed.
+    static bool hasBlockedAnimation( const css::uno::Reference<css::animations::XAnimationNode>& xNode);
+
 private:
     EventMultiplexer& mrEventMultiplexer;
     EventQueue& mrEventQueue;


More information about the Libreoffice-commits mailing list