1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: slideshowimpl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_EFFECT_REWINDER_HXX
32 #define INCLUDED_SLIDESHOW_EFFECT_REWINDER_HXX
34 #include "animationnode.hxx"
35 #include "eventhandler.hxx"
36 #include "animationeventhandler.hxx"
38 #include "screenupdater.hxx"
40 #include <com/sun/star/presentation/XSlideShow.hpp>
41 #include <boost/scoped_ptr.hpp>
42 #include <boost/function.hpp>
45 namespace css
= ::com::sun::star
;
47 namespace slideshow
{ namespace internal
{
49 class EventMultiplexer
;
53 /** Rewind single effects of the main effect sequence. A rewind is
54 initiated by calling the Rewind() method. Part of the processing is
55 done asynchronously. Multiple EventQueue::update() calls may be
56 necessary to finish a rewind.
58 Remember to call SetRootAnimationNode() when switching to a different
59 slide so that the EffectRewinder can determine the number of main
66 EventMultiplexer
& rEventMultiplexer
,
67 EventQueue
& rEventQueue
,
68 UserEventQueue
& rUserEventQueue
);
69 ~EffectRewinder (void);
71 /** Call Dispose() before the ownder of an EffectRewinder object dies so
72 that the EffectRewinder can release all references to the owner.
77 /** Store the root node of the animation tree. It is used in
78 CountMainSequenceEffects() to count the number of main sequence
79 effects (or effect groups.)
81 void setRootAnimationNode (
82 const css::uno::Reference
<css::animations::XAnimationNode
>& xRootNode
);
84 /** Rewind one effect of the main effect sequence. When the current
85 slide has not effects or no main sequence effect has yet been played
86 then switch to the previous slide and replay all of its main
88 The caller has to pass two functors that redisplay the current slide
89 or switch to the previous slide so that it does not have to expose
90 its internals to us. Only one of the two functors is called.
92 This paint lock is released after the whole asynchronous
93 procoess of rewinding the current effect is completed. It
94 prevents intermediate repaints that would show partial replay
96 @param rSlideRewindFunctor
97 This functor is called when the current slide is to be
98 redisplayed. When it is called then the other functor is not
100 @param rPreviousSlideFunctor
101 This functor is called to switch to the previous slide. When it
102 is called then the other functor is not called.
105 const ::boost::shared_ptr
<ScreenUpdater::UpdateLock
>& rpPaintLock
,
106 const ::boost::function
<void(void)>& rSlideRewindFunctor
,
107 const ::boost::function
<void(void)>& rPreviousSlideFunctor
);
109 /** Call this method after gotoPreviousEffect() triggered a slide change
110 to the previous slide.
112 void skipAllMainSequenceEffects (void);
115 EventMultiplexer
& mrEventMultiplexer
;
116 EventQueue
& mrEventQueue
;
117 UserEventQueue
& mrUserEventQueue
;
119 EventHandlerSharedPtr mpSlideStartHandler
;
120 EventHandlerSharedPtr mpSlideEndHandler
;
121 AnimationEventHandlerSharedPtr mpAnimationStartHandler
;
123 /** The number off main sequence effects so far.
125 sal_Int32 mnMainSequenceEffectCount
;
127 /** This is the currently scheduled event that executes the asynchronous
128 part of the effect rewinding. It is also used as flag that prevents
131 EventSharedPtr mpAsynchronousRewindEvent
;
133 css::uno::Reference
<css::animations::XAnimationNode
> mxCurrentAnimationRootNode
;
134 ::boost::shared_ptr
<ScreenUpdater::UpdateLock
> mpPaintLock
;
136 bool mbNonUserTriggeredMainSequenceEffectSeen
;
138 void initialize (void);
140 bool resetEffectCount (void);
141 /** Called by listeners when an animation (not necessarily of a main
142 sequence effect) starts.
144 bool notifyAnimationStart (const AnimationNodeSharedPtr
& rpNode
);
146 /** Count the number of effects (or effect groups) in the main effect
149 sal_Int32
countMainSequenceEffects (void);
151 /** Skip the next main sequence effect.
153 void skipSingleMainSequenceEffects (void);
155 /** Skip the specified number of main sequence effects.
157 void skipSomeMainSequenceEffects (const sal_Int32 nSkipCount
);
159 /** Rewind the last effect of the main effect sequence by replaying all
162 The number of main sequence effects to replay.
163 @param bRedisplayCurrentSlide
164 When <TRUE/> then the current slide is redisplayed before the
165 effects are replayed.
166 @param rSlideRewindFunctor
167 This functor is used to redisplay the current slide.
169 void asynchronousRewind (
170 sal_Int32 nEffectCount
,
171 const bool bRedisplayCurrentSlide
,
172 const boost::function
<void(void)>& rSlideRewindFunctor
);
174 /** Go to the previous slide and replay all of its main sequence effects
176 @param rPreviousSlideFunctor
177 This functor is used to go to the previous slide.
179 void asynchronousRewindToPreviousSlide (
180 const ::boost::function
<void(void)>& rPreviousSlideFunctor
);
183 } } // end of namespace ::slideshow::internal