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: SlsAnimator.hxx,v $
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>
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.
50 : private ::boost::noncopyable
53 Animator (SlideSorter
& rSlideSorter
);
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.
65 The animation operation.
67 The duration in milli seconds.
70 const AnimationFunction
& rAnimation
,
71 const sal_Int32 nDuration
);
74 SlideSorter
& mrSlideSorter
;
78 typedef ::std::vector
<boost::shared_ptr
<Animation
> > AnimationList
;
79 AnimationList maAnimations
;
82 ::boost::scoped_ptr
<DrawLock
> mpDrawLock
;
84 DECL_LINK(TimeoutHandler
, Timer
*);
86 /** Execute one step of every active animation.
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