xref: /aoo41x/main/slideshow/source/inc/event.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 #ifndef INCLUDED_SLIDESHOW_EVENT_HXX
24 #define INCLUDED_SLIDESHOW_EVENT_HXX
25 
26 #include "disposable.hxx"
27 #include "debug.hxx"
28 #include <rtl/ustring.hxx>
29 #include <boost/shared_ptr.hpp>
30 #include <vector>
31 
32 namespace slideshow {
33 namespace internal {
34 
35 /** Definition of Event interface
36  */
37 class Event : public Disposable
38 {
39 public:
40 #if OSL_DEBUG_LEVEL > 1
Event(const::rtl::OUString & rsDescription)41     Event (const ::rtl::OUString& rsDescription) : msDescription(rsDescription) {};
42 #endif
43 
44     /** Execute the event.
45 
46         @return true, if event was successfully executed.
47     */
48     virtual bool fire() = 0;
49 
50     /** Query whether this event is still charged, i.e. able
51         to fire.
52 
53         Inactive events are ignored by the normal event
54         containers (EventQueue, UserEventQueue etc.), and no
55         explicit fire() is called upon them.
56 
57         @return true, if this event has already been fired.
58     */
59     virtual bool isCharged() const = 0;
60 
61     /** Query the activation time instant this event shall be
62         fired, if it was inserted at instant nCurrentTime into
63         the queue.
64 
65         @param nCurrentTime
66         The time from which the activation time is to be
67         calculated from.
68 
69         @return the time instant in seconds, on which this
70         event is to be fired.
71     */
72     virtual double getActivationTime( double nCurrentTime ) const = 0;
73 
74 #if OSL_DEBUG_LEVEL > 1
GetDescription(void) const75     ::rtl::OUString GetDescription (void) const { return msDescription; }
76 
77 private:
78     const ::rtl::OUString msDescription;
79 #endif
80 };
81 
82 typedef ::boost::shared_ptr< Event > EventSharedPtr;
83 typedef ::std::vector< EventSharedPtr > VectorOfEvents;
84 
85 } // namespace internal
86 } // namespace presentation
87 
88 #endif /* INCLUDED_SLIDESHOW_EVENT_HXX */
89