fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / sdr / event / eventhandler.hxx
blob91ac5491e5c668fdeee78a00ca3458c006072413
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SDR_EVENT_EVENTHANDLER_HXX
21 #define _SDR_EVENT_EVENTHANDLER_HXX
23 #include <sal/types.h>
25 #include <vector>
26 #include <vcl/timer.hxx>
28 //////////////////////////////////////////////////////////////////////////////
29 // predeclarations
31 namespace sdr
33 namespace event
35 class BaseEvent;
36 class EventHandler;
38 // typedefs for a list of BaseEvents
39 typedef ::std::vector< BaseEvent* > BaseEventVector;
40 } // end of namespace event
41 } // end of namespace sdr
43 //////////////////////////////////////////////////////////////////////////////
45 namespace sdr
47 namespace event
49 class BaseEvent
51 // the EventHandler this event is registered at
52 EventHandler& mrEventHandler;
54 public:
55 // basic constructor.
56 BaseEvent(EventHandler& rEventHandler);
58 // destructor
59 virtual ~BaseEvent();
61 // the called method if the event is triggered
62 virtual void ExecuteEvent() = 0;
64 } // end of namespace event
65 } // end of namespace sdr
67 //////////////////////////////////////////////////////////////////////////////
69 namespace sdr
71 namespace event
73 class EventHandler
75 BaseEventVector maVector;
77 // to allow BaseEvents to use the add/remove functionality
78 friend class BaseEvent;
80 // methods to add/remove events. These are private since
81 // they are used from BaseEvent only.
82 void AddEvent(BaseEvent& rBaseEvent);
83 void RemoveEvent(BaseEvent& rBaseEvent);
85 // access to a event, 0L when no more events
86 BaseEvent* GetEvent();
88 public:
89 // basic constructor.
90 EventHandler();
92 // destructor
93 virtual ~EventHandler();
95 // Trigger and consume the events
96 virtual void ExecuteEvents();
98 // for control
99 bool IsEmpty() const;
101 } // end of namespace event
102 } // end of namespace sdr
104 //////////////////////////////////////////////////////////////////////////////
106 namespace sdr
108 namespace event
110 class TimerEventHandler : public EventHandler, public Timer
112 public:
113 // basic constructor.
114 TimerEventHandler(sal_uInt32 nTimeout = 1L);
116 // destructor
117 virtual ~TimerEventHandler();
119 // The timer when it is triggered; from class Timer
120 virtual void Timeout();
122 // reset the timer
123 void Restart();
125 } // end of namespace event
126 } // end of namespace sdr
128 //////////////////////////////////////////////////////////////////////////////
130 #endif //_SDR_EVENT_EVENTHANDLER_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */