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"
29 #include <com/sun/star/presentation/XSlideShow.hpp>
35 namespace slideshow
{ namespace internal
{
37 class EventMultiplexer
;
41 /** Rewind single effects of the main effect sequence. A rewind is
42 initiated by calling the Rewind() method. Part of the processing is
43 done asynchronously. Multiple EventQueue::update() calls may be
44 necessary to finish a rewind.
46 Remember to call SetRootAnimationNode() when switching to a different
47 slide so that the EffectRewinder can determine the number of main
54 EventMultiplexer
& rEventMultiplexer
,
55 EventQueue
& rEventQueue
,
56 UserEventQueue
& rUserEventQueue
);
59 /** Call Dispose() before the owner of an EffectRewinder object dies so
60 that the EffectRewinder can release all references to the owner.
65 /** Store the root node of the animation tree. It is used in
66 CountMainSequenceEffects() to count the number of main sequence
67 effects (or effect groups.)
69 void setRootAnimationNode (
70 const css::uno::Reference
<css::animations::XAnimationNode
>& xRootNode
);
72 /** Rewind one effect of the main effect sequence. When the current
73 slide has not effects or no main sequence effect has yet been played
74 then switch to the previous slide and replay all of its main
76 The caller has to pass two functors that redisplay the current slide
77 or switch to the previous slide so that it does not have to expose
78 its internals to us. Only one of the two functors is called.
80 This paint lock is released after the whole asynchronous
81 process of rewinding the current effect is completed. It
82 prevents intermediate repaints that would show partial replay
84 @param rSlideRewindFunctor
85 This functor is called when the current slide is to be
86 redisplayed. When it is called then the other functor is not
88 @param rPreviousSlideFunctor
89 This functor is called to switch to the previous slide. When it
90 is called then the other functor is not called.
93 const ::std::shared_ptr
<ScreenUpdater::UpdateLock
>& rpPaintLock
,
94 const ::std::function
<void ()>& rSlideRewindFunctor
,
95 const ::std::function
<void ()>& rPreviousSlideFunctor
);
97 /** Call this method after gotoPreviousEffect() triggered a slide change
98 to the previous slide.
100 void skipAllMainSequenceEffects();
103 EventMultiplexer
& mrEventMultiplexer
;
104 EventQueue
& mrEventQueue
;
105 UserEventQueue
& mrUserEventQueue
;
107 EventHandlerSharedPtr mpSlideStartHandler
;
108 EventHandlerSharedPtr mpSlideEndHandler
;
109 AnimationEventHandlerSharedPtr mpAnimationStartHandler
;
111 /** The number off main sequence effects so far.
113 sal_Int32 mnMainSequenceEffectCount
;
115 /** This is the currently scheduled event that executes the asynchronous
116 part of the effect rewinding. It is also used as flag that prevents
119 EventSharedPtr mpAsynchronousRewindEvent
;
121 css::uno::Reference
<css::animations::XAnimationNode
> mxCurrentAnimationRootNode
;
122 ::std::shared_ptr
<ScreenUpdater::UpdateLock
> mpPaintLock
;
124 bool mbNonUserTriggeredMainSequenceEffectSeen
;
128 bool resetEffectCount();
129 /** Called by listeners when an animation (not necessarily of a main
130 sequence effect) starts.
132 bool notifyAnimationStart (const AnimationNodeSharedPtr
& rpNode
);
134 /** Count the number of effects (or effect groups) in the main effect
137 sal_Int32
countMainSequenceEffects();
139 /** Skip the next main sequence effect.
141 void skipSingleMainSequenceEffects();
143 /** Rewind the last effect of the main effect sequence by replaying all
146 The number of main sequence effects to replay.
147 @param bRedisplayCurrentSlide
148 When <TRUE/> then the current slide is redisplayed before the
149 effects are replayed.
150 @param rSlideRewindFunctor
151 This functor is used to redisplay the current slide.
153 void asynchronousRewind (
154 sal_Int32 nEffectCount
,
155 const bool bRedisplayCurrentSlide
,
156 const ::std::function
<void ()>& rSlideRewindFunctor
);
158 /** Go to the previous slide and replay all of its main sequence effects
160 @param rPreviousSlideFunctor
161 This functor is used to go to the previous slide.
163 void asynchronousRewindToPreviousSlide (
164 const ::std::function
<void ()>& rPreviousSlideFunctor
);
167 } } // end of namespace ::slideshow::internal
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */