1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SD_SOURCE_UI_INC_EVENTMULTIPLEXER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_EVENTMULTIPLEXER_HXX
23 #include <sal/config.h>
25 #include <rtl/ref.hxx>
27 template <typename Arg
, typename Ret
> class Link
;
34 enum class EventMultiplexerEventId
36 /** The EventMultiplexer itself is being disposed. Called for a live
37 EventMultiplexer. Removing a listener as response is not necessary,
42 /** The selection in the center pane has changed.
46 /** The selection in the slide sorter has changed, regardless of whether
47 the slide sorter is displayed in the left pane or the center pane.
51 /** The current page has changed.
55 /** The current MainViewShell (the ViewShell displayed in the center
56 pane) has been removed.
60 /** A new ViewShell has been made the MainViewShell.
64 /** A new ViewShell is being displayed in one of the panes. Note that
65 for the ViewShell in the center pane both this event type and
66 EventId::MainViewAdded is broadcasted.
70 /** Edit mode was (or is being) switched to normal mode. Find
71 EventId::EditModeMaster below.
75 /** One or more pages have been inserted into or deleted from the model.
79 /** Text editing in one of the shapes in the MainViewShell has started.
83 /** Text editing in one of the shapes in the MainViewShell has ended.
87 /** A UNO controller has been attached to the UNO frame.
91 /** A UNO controller has been detached to the UNO frame.
95 /** The state of a shape has changed. The page is available in the user data.
99 /** A shape has been inserted to a page. The page is available in the
104 /** A shape has been removed from a page. The page is available in the
109 /** A configuration update has been completed.
111 ConfigurationUpdated
,
113 /** Edit mode was (or is being) switched to master mode.
118 namespace sd
{ namespace tools
{
120 class EventMultiplexerEvent
123 EventMultiplexerEventId
const meEventId
;
124 const void* mpUserData
;
126 EventMultiplexerEvent (
127 EventMultiplexerEventId eEventId
,
128 const void* pUserData
);
131 /** This convenience class makes it easy to listen to various events that
132 originally are broadcasted via different channels.
134 There is usually one EventMultiplexer instance per ViewShellBase().
135 Call the laters GetEventMultiplexer() method to get access to that
138 class EventMultiplexer
141 /** Create new EventMultiplexer for the given ViewShellBase object.
143 EventMultiplexer (ViewShellBase
& rBase
);
146 /** Add an event listener that will be informed about the specified
149 The callback to call as soon as one of the event specified by
150 aEventTypeSet is received by the EventMultiplexer.
152 void AddEventListener(const Link
<EventMultiplexerEvent
&,void>& rCallback
);
154 /** Remove an event listener for the specified event types.
156 void RemoveEventListener(const Link
<EventMultiplexerEvent
&,void>& rCallback
);
158 /** This method is used for out-of-line events. An event of the
159 specified type will be sent to all listeners that are registered for
162 The type of the event.
164 Some data sent to the listeners along with the event.
167 EventMultiplexerEventId eEventId
,
168 void const * pUserData
);
171 class Implementation
;
172 rtl::Reference
<Implementation
> mpImpl
;
175 } } // end of namespace ::sd::tools
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */