android: Update app-specific/MIME type icons
[LibreOffice.git] / slideshow / source / engine / effectrewinder.hxx
blob093259785c938a7fcc8c6398a4deb9702c54303d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include <event.hxx>
27 #include <screenupdater.hxx>
28 #include <com/sun/star/drawing/XDrawPage.hpp>
30 #include <functional>
31 #include <memory>
33 namespace slideshow::internal {
35 class EventMultiplexer;
36 class EventQueue;
37 class UserEventQueue;
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
46 sequence effects.
48 class EffectRewinder
50 public:
51 EffectRewinder (
52 EventMultiplexer& rEventMultiplexer,
53 EventQueue& rEventQueue,
54 UserEventQueue& rUserEventQueue);
55 ~EffectRewinder();
57 /** Call Dispose() before the owner of an EffectRewinder object dies so
58 that the EffectRewinder can release all references to the owner.
61 void dispose();
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 /** Store the XDrawPage to reach specific slide properties.
72 void setCurrentSlide (
73 const css::uno::Reference<css::drawing::XDrawPage>& xSlide);
75 /** Rewind one effect of the main effect sequence. When the current
76 slide has not effects or no main sequence effect has yet been played
77 then switch to the previous slide and replay all of its main
78 sequence effects.
79 The caller has to pass two functors that redisplay the current slide
80 or switch to the previous slide so that it does not have to expose
81 its internals to us. Only one of the two functors is called.
82 @param rpPaintLock
83 This paint lock is released after the whole asynchronous
84 process of rewinding the current effect is completed. It
85 prevents intermediate repaints that would show partial replay
86 of effects.
87 @param rSlideRewindFunctor
88 This functor is called when the current slide is to be
89 redisplayed. When it is called then the other functor is not
90 called.
91 @param rPreviousSlideFunctor
92 This functor is called to switch to the previous slide. When it
93 is called then the other functor is not called.
95 bool rewind (
96 const ::std::shared_ptr<ScreenUpdater::UpdateLock>& rpPaintLock,
97 const ::std::function<void ()>& rSlideRewindFunctor,
98 const ::std::function<void ()>& rPreviousSlideFunctor);
100 /** Call this method after gotoPreviousEffect() triggered a slide change
101 to the previous slide.
103 void skipAllMainSequenceEffects();
105 private:
106 EventMultiplexer& mrEventMultiplexer;
107 EventQueue& mrEventQueue;
108 UserEventQueue& mrUserEventQueue;
110 EventHandlerSharedPtr mpSlideStartHandler;
111 EventHandlerSharedPtr mpSlideEndHandler;
112 AnimationEventHandlerSharedPtr mpAnimationStartHandler;
114 /** The number off main sequence effects so far.
116 sal_Int32 mnMainSequenceEffectCount;
118 /** This is the currently scheduled event that executes the asynchronous
119 part of the effect rewinding. It is also used as flag that prevents
120 nested rewinds.
122 EventSharedPtr mpAsynchronousRewindEvent;
124 css::uno::Reference<css::animations::XAnimationNode> mxCurrentAnimationRootNode;
125 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
126 ::std::shared_ptr<ScreenUpdater::UpdateLock> mpPaintLock;
128 bool mbNonUserTriggeredMainSequenceEffectSeen;
129 bool mbHasAdvancedTimeSetting; // Slide has advanced time setting or not.
131 void initialize();
133 bool resetEffectCount();
134 /** Called by listeners when an animation (not necessarily of a main
135 sequence effect) starts.
137 bool notifyAnimationStart (const AnimationNodeSharedPtr& rpNode);
139 /** Count the number of effects (or effect groups) in the main effect
140 sequence.
142 sal_Int32 countMainSequenceEffects();
144 /** Skip the next main sequence effect.
146 void skipSingleMainSequenceEffects();
148 /** Rewind the last effect of the main effect sequence by replaying all
149 previous effects.
150 @param nEffectCount
151 The number of main sequence effects to replay.
152 @param bRedisplayCurrentSlide
153 When <TRUE/> then the current slide is redisplayed before the
154 effects are replayed.
155 @param rSlideRewindFunctor
156 This functor is used to redisplay the current slide.
158 void asynchronousRewind (
159 sal_Int32 nEffectCount,
160 const bool bRedisplayCurrentSlide,
161 const ::std::function<void ()>& rSlideRewindFunctor);
163 /** Go to the previous slide and replay all of its main sequence effects
164 (or effect groups).
165 @param rPreviousSlideFunctor
166 This functor is used to go to the previous slide.
168 void asynchronousRewindToPreviousSlide (
169 const ::std::function<void ()>& rPreviousSlideFunctor);
172 } // end of namespace ::slideshow::internal
174 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */