1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SDEXT_PRESENTER_ANIMATOR_HXX
25 #define SDEXT_PRESENTER_ANIMATOR_HXX
26 
27 #include "PresenterAnimation.hxx"
28 #include <cppuhelper/basemutex.hxx>
29 #include <map>
30 #include <boost/noncopyable.hpp>
31 #include <boost/scoped_ptr.hpp>
32 
33 namespace sdext { namespace presenter {
34 
35 /** Simple animation management.  Call AddAnimation to run animations
36     concurrently or one of the other.  See PresenterAnimation for details of
37     how to specify animations.
38 */
39 class PresenterAnimator
40     : private ::boost::noncopyable,
41       private ::cppu::BaseMutex
42 {
43 public:
44     PresenterAnimator (void);
45     virtual ~PresenterAnimator (void);
46 
47     /** Add an animation.  The time at which to start and end this animation
48         is provided by the animation itself.
49     */
50     void AddAnimation (const SharedPresenterAnimation& rpAnimation);
51 
52 private:
53     typedef ::std::multimap<sal_uInt64,SharedPresenterAnimation> AnimationList;
54     AnimationList maFutureAnimations;
55     AnimationList maActiveAnimations;
56     sal_Int32 mnCurrentTaskId;
57     sal_uInt64 mnNextTime;
58 
59     void Process (void);
60     void ActivateAnimations (const sal_uInt64 nCurrentTime);
61     void ScheduleNextRun (void);
62     void ScheduleNextRun (const sal_uInt64 nStartTime);
63 
64 };
65 
66 } } // end of namespace ::sdext::presenter
67 
68 #endif
69