1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_EFFECTREWINDER_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_EFFECTREWINDER_HXX
23 #include <animationnode.hxx>
24 #include <eventhandler.hxx>
25 #include <animationeventhandler.hxx>
27 #include <screenupdater.hxx>
33 namespace slideshow
{ namespace internal
{
35 class EventMultiplexer
;
39 /** Rewind single effects of the main effect sequence. A rewind is
40 initiated by calling the Rewind() method. Part of the processing is
41 done asynchronously. Multiple EventQueue::update() calls may be
42 necessary to finish a rewind.
44 Remember to call SetRootAnimationNode() when switching to a different
45 slide so that the EffectRewinder can determine the number of main
52 EventMultiplexer
& rEventMultiplexer
,
53 EventQueue
& rEventQueue
,
54 UserEventQueue
& rUserEventQueue
);
57 /** Call Dispose() before the owner of an EffectRewinder object dies so
58 that the EffectRewinder can release all references to the owner.
63 /** Store the root node of the animation tree. It is used in
64 CountMainSequenceEffects() to count the number of main sequence
65 effects (or effect groups.)
67 void setRootAnimationNode (
68 const css::uno::Reference
<css::animations::XAnimationNode
>& xRootNode
);
70 /** Rewind one effect of the main effect sequence. When the current
71 slide has not effects or no main sequence effect has yet been played
72 then switch to the previous slide and replay all of its main
74 The caller has to pass two functors that redisplay the current slide
75 or switch to the previous slide so that it does not have to expose
76 its internals to us. Only one of the two functors is called.
78 This paint lock is released after the whole asynchronous
79 process of rewinding the current effect is completed. It
80 prevents intermediate repaints that would show partial replay
82 @param rSlideRewindFunctor
83 This functor is called when the current slide is to be
84 redisplayed. When it is called then the other functor is not
86 @param rPreviousSlideFunctor
87 This functor is called to switch to the previous slide. When it
88 is called then the other functor is not called.
91 const ::std::shared_ptr
<ScreenUpdater::UpdateLock
>& rpPaintLock
,
92 const ::std::function
<void ()>& rSlideRewindFunctor
,
93 const ::std::function
<void ()>& rPreviousSlideFunctor
);
95 /** Call this method after gotoPreviousEffect() triggered a slide change
96 to the previous slide.
98 void skipAllMainSequenceEffects();
101 EventMultiplexer
& mrEventMultiplexer
;
102 EventQueue
& mrEventQueue
;
103 UserEventQueue
& mrUserEventQueue
;
105 EventHandlerSharedPtr mpSlideStartHandler
;
106 EventHandlerSharedPtr mpSlideEndHandler
;
107 AnimationEventHandlerSharedPtr mpAnimationStartHandler
;
109 /** The number off main sequence effects so far.
111 sal_Int32 mnMainSequenceEffectCount
;
113 /** This is the currently scheduled event that executes the asynchronous
114 part of the effect rewinding. It is also used as flag that prevents
117 EventSharedPtr mpAsynchronousRewindEvent
;
119 css::uno::Reference
<css::animations::XAnimationNode
> mxCurrentAnimationRootNode
;
120 ::std::shared_ptr
<ScreenUpdater::UpdateLock
> mpPaintLock
;
122 bool mbNonUserTriggeredMainSequenceEffectSeen
;
126 bool resetEffectCount();
127 /** Called by listeners when an animation (not necessarily of a main
128 sequence effect) starts.
130 bool notifyAnimationStart (const AnimationNodeSharedPtr
& rpNode
);
132 /** Count the number of effects (or effect groups) in the main effect
135 sal_Int32
countMainSequenceEffects();
137 /** Skip the next main sequence effect.
139 void skipSingleMainSequenceEffects();
141 /** Rewind the last effect of the main effect sequence by replaying all
144 The number of main sequence effects to replay.
145 @param bRedisplayCurrentSlide
146 When <TRUE/> then the current slide is redisplayed before the
147 effects are replayed.
148 @param rSlideRewindFunctor
149 This functor is used to redisplay the current slide.
151 void asynchronousRewind (
152 sal_Int32 nEffectCount
,
153 const bool bRedisplayCurrentSlide
,
154 const ::std::function
<void ()>& rSlideRewindFunctor
);
156 /** Go to the previous slide and replay all of its main sequence effects
158 @param rPreviousSlideFunctor
159 This functor is used to go to the previous slide.
161 void asynchronousRewindToPreviousSlide (
162 const ::std::function
<void ()>& rPreviousSlideFunctor
);
165 } } // end of namespace ::slideshow::internal
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */