fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / slideshow / source / engine / effectrewinder.hxx
blobe44a63faa58ba7ca66ad8c4b137f24a9e4aa36e6
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"
29 #include <com/sun/star/presentation/XSlideShow.hpp>
30 #include <boost/scoped_ptr.hpp>
31 #include <boost/function.hpp>
32 #include <vector>
34 namespace slideshow { namespace internal {
36 class EventMultiplexer;
37 class EventQueue;
38 class UserEventQueue;
40 /** Rewind single effects of the main effect sequence. A rewind is
41 initiated by calling the Rewind() method. Part of the processing is
42 done asynchronously. Multiple EventQueue::update() calls may be
43 necessary to finish a rewind.
45 Remember to call SetRootAnimationNode() when switching to a different
46 slide so that the EffectRewinder can determine the number of main
47 sequence effects.
49 class EffectRewinder
51 public:
52 EffectRewinder (
53 EventMultiplexer& rEventMultiplexer,
54 EventQueue& rEventQueue,
55 UserEventQueue& rUserEventQueue);
56 ~EffectRewinder();
58 /** Call Dispose() before the ownder of an EffectRewinder object dies so
59 that the EffectRewinder can release all references to the owner.
62 void dispose();
64 /** Store the root node of the animation tree. It is used in
65 CountMainSequenceEffects() to count the number of main sequence
66 effects (or effect groups.)
68 void setRootAnimationNode (
69 const css::uno::Reference<css::animations::XAnimationNode>& xRootNode);
71 /** Rewind one effect of the main effect sequence. When the current
72 slide has not effects or no main sequence effect has yet been played
73 then switch to the previous slide and replay all of its main
74 sequence effects.
75 The caller has to pass two functors that redisplay the current slide
76 or switch to the previous slide so that it does not have to expose
77 its internals to us. Only one of the two functors is called.
78 @param rpPaintLock
79 This paint lock is released after the whole asynchronous
80 procoess of rewinding the current effect is completed. It
81 prevents intermediate repaints that would show partial replay
82 of effects.
83 @param rSlideRewindFunctor
84 This functor is called when the current slide is to be
85 redisplayed. When it is called then the other functor is not
86 called.
87 @param rPreviousSlideFunctor
88 This functor is called to switch to the previous slide. When it
89 is called then the other functor is not called.
91 bool rewind (
92 const ::boost::shared_ptr<ScreenUpdater::UpdateLock>& rpPaintLock,
93 const ::boost::function<void()>& rSlideRewindFunctor,
94 const ::boost::function<void()>& rPreviousSlideFunctor);
96 /** Call this method after gotoPreviousEffect() triggered a slide change
97 to the previous slide.
99 void skipAllMainSequenceEffects();
101 private:
102 EventMultiplexer& mrEventMultiplexer;
103 EventQueue& mrEventQueue;
104 UserEventQueue& mrUserEventQueue;
106 EventHandlerSharedPtr mpSlideStartHandler;
107 EventHandlerSharedPtr mpSlideEndHandler;
108 AnimationEventHandlerSharedPtr mpAnimationStartHandler;
110 /** The number off main sequence effects so far.
112 sal_Int32 mnMainSequenceEffectCount;
114 /** This is the currently scheduled event that executes the asynchronous
115 part of the effect rewinding. It is also used as flag that prevents
116 nested rewinds.
118 EventSharedPtr mpAsynchronousRewindEvent;
120 css::uno::Reference<css::animations::XAnimationNode> mxCurrentAnimationRootNode;
121 ::boost::shared_ptr<ScreenUpdater::UpdateLock> mpPaintLock;
123 bool mbNonUserTriggeredMainSequenceEffectSeen;
125 void initialize();
127 bool resetEffectCount();
128 /** Called by listeners when an animation (not necessarily of a main
129 sequence effect) starts.
131 bool notifyAnimationStart (const AnimationNodeSharedPtr& rpNode);
133 /** Count the number of effects (or effect groups) in the main effect
134 sequence.
136 sal_Int32 countMainSequenceEffects();
138 /** Skip the next main sequence effect.
140 void skipSingleMainSequenceEffects();
142 /** Rewind the last effect of the main effect sequence by replaying all
143 previous effects.
144 @param nEffectCount
145 The number of main sequence effects to replay.
146 @param bRedisplayCurrentSlide
147 When <TRUE/> then the current slide is redisplayed before the
148 effects are replayed.
149 @param rSlideRewindFunctor
150 This functor is used to redisplay the current slide.
152 void asynchronousRewind (
153 sal_Int32 nEffectCount,
154 const bool bRedisplayCurrentSlide,
155 const boost::function<void()>& rSlideRewindFunctor);
157 /** Go to the previous slide and replay all of its main sequence effects
158 (or effect groups).
159 @param rPreviousSlideFunctor
160 This functor is used to go to the previous slide.
162 void asynchronousRewindToPreviousSlide (
163 const ::boost::function<void()>& rPreviousSlideFunctor);
166 } } // end of namespace ::slideshow::internal
168 #endif
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */