From 0741ab9d642f63f8c19720cc14335bf72f366b38 Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Mon, 16 Dec 2019 11:31:49 +0300 Subject: tdf#125949 Allow the slide to continue with freezing animation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 8eb2d2972583b909a249f5b0f22a9b1fbf533d24) Reviewed-on: https://gerrit.libreoffice.org/85252 --- slideshow/source/engine/effectrewinder.cxx | 58 ++++++++++++++++++++++++++++-- slideshow/source/engine/effectrewinder.hxx | 3 ++ 2 files changed, 59 insertions(+), 2 deletions(-) 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 #include #include - +#include 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& 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 xEnumerationAccess (xNode, uno::UNO_QUERY); + if (xEnumerationAccess.is()) + { + uno::Reference xEnumeration ( + xEnumerationAccess->createEnumeration()); + if (xEnumeration.is()) + while (xEnumeration->hasMoreElements()) + { + uno::Reference xNext (xEnumeration->nextElement(), uno::UNO_QUERY); + uno::Reference 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::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 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(rpNode)); @@ -308,7 +363,6 @@ bool EffectRewinder::notifyAnimationStart (const AnimationNodeSharedPtr& rpNode) // triggered. bool bIsUserTriggered (false); - Reference 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& xNode); + private: EventMultiplexer& mrEventMultiplexer; EventQueue& mrEventQueue; -- cgit