xref: /trunk/main/slideshow/source/inc/activity.hxx (revision aaef562f)
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 INCLUDED_SLIDESHOW_ACTIVITY_HXX
25 #define INCLUDED_SLIDESHOW_ACTIVITY_HXX
26 
27 #include <sal/types.h>
28 
29 #include <boost/shared_ptr.hpp>
30 
31 #include "disposable.hxx"
32 
33 
34 /* Definition of Activity interface */
35 
36 namespace slideshow
37 {
38     namespace internal
39     {
40 
41         class Activity : public Disposable
42         {
43         public:
44             /** Perform the activity associated with this interface's
45                 implementation.
46 
47                 @return true, if activity continues, or false, if activity has
48                 ended.
49             */
50             virtual bool perform() = 0;
51 
52             /** Calculates whether the activity lags time.
53 
54             	If this method returns a time lag greater than 0.0,
55             	the ActivitiesQueue will adjust the global slideshow
56             	time, by subtracting the given amount of lag.
57 
58                 @return time lag or 0.0. Value must be greater or
59                 equal than zero.
60             */
61             virtual double calcTimeLag() const = 0;
62 
63             /** Query whether this activity is still continuing
64 
65 	            @return true, if this activity still
66 	            continues. Returns false, if activity has ended. It is
67 	            required that operator() returns false, when
68 	            isActive() returns false. Furthermore, it is required
69 	            that the inactive state is persistent; an activity
70 	            that has become inactive (i.e. isActive() once
71 	            returned false) must stay in that state eternally.
72             */
73             virtual bool isActive() const = 0;
74 
75             /** Notifies the Activity that it has now left the
76                 ActivitiesQueue
77 
78                 Use this method to react on the queue removal
79                 event. For animated shapes, this is e.g. used to
80                 switch back to the non-sprite presentation mode of the
81                 shape.
82              */
83             virtual void dequeued() = 0;
84 
85             /** Forces this activity deactivate and get to its end state
86                 (if possible), but does _not_ dispose.
87             */
88             virtual void end() = 0;
89         };
90 
91         typedef ::boost::shared_ptr< Activity > ActivitySharedPtr;
92 
93     }
94 }
95 
96 #endif /* INCLUDED_SLIDESHOW_ACTIVITY_HXX */
97