summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2019-12-16 11:31:49 +0300
committerAndras Timar <andras.timar@collabora.com>2019-12-18 09:01:14 +0100
commit070c587adeb0953a52c1508c87ef6a803b58c8c5 (patch)
treeedf2025090b4fcadcc07d870ce48d2ac15a99845
parent181a1463280c26ace1fbd8a5e3158b56bcfcb2dc (diff)
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@collabora.com> (cherry picked from commit 8eb2d2972583b909a249f5b0f22a9b1fbf533d24) Reviewed-on: https://gerrit.libreoffice.org/85253 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--slideshow/source/engine/effectrewinder.cxx58
-rw-r--r--slideshow/source/engine/effectrewinder.hxx3
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 <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;