Update ooo320-m1
[ooovba.git] / sd / source / ui / slidesorter / inc / controller / SlsAnimator.hxx
blobc408cdf38b48b3c6636e91d2c869892e94a52da9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsAnimator.hxx,v $
11 * $Revision: 1.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SD_SLIDESORTER_CONTROLLER_ANIMATOR_HXX
33 #define SD_SLIDESORTER_CONTROLLER_ANIMATOR_HXX
35 #include "SlideSorter.hxx"
36 #include <vcl/timer.hxx>
37 #include <sal/types.h>
38 #include <vector>
39 #include <boost/function.hpp>
40 #include <boost/noncopyable.hpp>
41 #include <boost/scoped_ptr.hpp>
42 #include <boost/shared_ptr.hpp>
45 namespace sd { namespace slidesorter { namespace controller {
47 /** Experimental class for simple eye candy animations.
49 class Animator
50 : private ::boost::noncopyable
52 public:
53 Animator (SlideSorter& rSlideSorter);
54 ~Animator (void);
56 /** An animation object is called with values between 0 and 1 as single
57 argument to its operator() method.
59 typedef ::boost::function1<void, double> AnimationFunction;
61 /** Schedule a new animation for execution. The () operator of that
62 animation will be called with increasing values between 0 and 1 for
63 the specified duration.
64 @param rAnimation
65 The animation operation.
66 @param nDuration
67 The duration in milli seconds.
69 void AddAnimation (
70 const AnimationFunction& rAnimation,
71 const sal_Int32 nDuration);
73 private:
74 SlideSorter& mrSlideSorter;
75 Timer maTimer;
77 class Animation;
78 typedef ::std::vector<boost::shared_ptr<Animation> > AnimationList;
79 AnimationList maAnimations;
81 class DrawLock;
82 ::boost::scoped_ptr<DrawLock> mpDrawLock;
84 DECL_LINK(TimeoutHandler, Timer*);
86 /** Execute one step of every active animation.
87 @return
88 When one or more animation has finished then <TRUE/> is
89 returned. Call CleanUpAnimationList() in this case.
91 bool ServeAnimations (void);
93 /** Remove animations that have expired.
95 void CleanUpAnimationList (void);
98 } } } // end of namespace ::sd::slidesorter::controller
100 #endif