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