xref: /aoo41x/main/slideshow/source/inc/activity.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_SLIDESHOW_ACTIVITY_HXX
29 #define INCLUDED_SLIDESHOW_ACTIVITY_HXX
30 
31 #include <sal/types.h>
32 
33 #include <boost/shared_ptr.hpp>
34 
35 #include "disposable.hxx"
36 
37 
38 /* Definition of Activity interface */
39 
40 namespace slideshow
41 {
42     namespace internal
43     {
44 
45         class Activity : public Disposable
46         {
47         public:
48             /** Perform the activity associated with this interface's
49                 implementation.
50 
51                 @return true, if activity continues, or false, if activity has
52                 ended.
53             */
54             virtual bool perform() = 0;
55 
56             /** Calculates whether the activity lags time.
57 
58             	If this method returns a time lag greater than 0.0,
59             	the ActivitiesQueue will adjust the global slideshow
60             	time, by subtracting the given amount of lag.
61 
62                 @return time lag or 0.0. Value must be greater or
63                 equal than zero.
64             */
65             virtual double calcTimeLag() const = 0;
66 
67             /** Query whether this activity is still continuing
68 
69 	            @return true, if this activity still
70 	            continues. Returns false, if activity has ended. It is
71 	            required that operator() returns false, when
72 	            isActive() returns false. Furthermore, it is required
73 	            that the inactive state is persistent; an activity
74 	            that has become inactive (i.e. isActive() once
75 	            returned false) must stay in that state eternally.
76             */
77             virtual bool isActive() const = 0;
78 
79             /** Notifies the Activity that it has now left the
80                 ActivitiesQueue
81 
82                 Use this method to react on the queue removal
83                 event. For animated shapes, this is e.g. used to
84                 switch back to the non-sprite presentation mode of the
85                 shape.
86              */
87             virtual void dequeued() = 0;
88 
89             /** Forces this activity deactivate and get to its end state
90                 (if possible), but does _not_ dispose.
91             */
92             virtual void end() = 0;
93         };
94 
95         typedef ::boost::shared_ptr< Activity > ActivitySharedPtr;
96 
97     }
98 }
99 
100 #endif /* INCLUDED_SLIDESHOW_ACTIVITY_HXX */
101