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