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 .
22 #include <sal/config.h>
24 #include <rtl/ref.hxx>
26 template <typename Arg
, typename Ret
> class Link
;
33 enum class EventMultiplexerEventId
35 /** The EventMultiplexer itself is being disposed. Called for a live
36 EventMultiplexer. Removing a listener as response is not necessary,
41 /** The selection in the center pane has changed.
45 /** The selection in the slide sorter has changed, regardless of whether
46 the slide sorter is displayed in the left pane or the center pane.
50 /** The current page has changed.
54 /** The current MainViewShell (the ViewShell displayed in the center
55 pane) has been removed.
59 /** A new ViewShell has been made the MainViewShell.
63 /** A new ViewShell is being displayed in one of the panes. Note that
64 for the ViewShell in the center pane both this event type and
65 EventId::MainViewAdded is broadcasted.
69 /** Edit mode was (or is being) switched to normal mode. Find
70 EventId::EditModeMaster below.
74 /** One or more pages have been inserted into or deleted from the model.
78 /** Text editing in one of the shapes in the MainViewShell has started.
82 /** Text editing in one of the shapes in the MainViewShell has ended.
86 /** A UNO controller has been attached to the UNO frame.
90 /** A UNO controller has been detached to the UNO frame.
94 /** The state of a shape has changed. The page is available in the user data.
98 /** A shape has been inserted to a page. The page is available in the
103 /** A shape has been removed from a page. The page is available in the
108 /** A configuration update has been completed.
110 ConfigurationUpdated
,
112 /** Edit mode was (or is being) switched to master mode.
119 class EventMultiplexerEvent
122 EventMultiplexerEventId meEventId
;
123 const void* mpUserData
;
125 EventMultiplexerEvent(EventMultiplexerEventId eEventId
, const void* pUserData
);
128 /** This convenience class makes it easy to listen to various events that
129 originally are broadcasted via different channels.
131 There is usually one EventMultiplexer instance per ViewShellBase().
132 Call the laters GetEventMultiplexer() method to get access to that
135 class EventMultiplexer
138 /** Create new EventMultiplexer for the given ViewShellBase object.
140 EventMultiplexer(ViewShellBase
& rBase
);
143 /** Add an event listener that will be informed about the specified
146 The callback to call as soon as one of the event specified by
147 aEventTypeSet is received by the EventMultiplexer.
149 void AddEventListener(const Link
<EventMultiplexerEvent
&, void>& rCallback
);
151 /** Remove an event listener for the specified event types.
153 void RemoveEventListener(const Link
<EventMultiplexerEvent
&, void>& rCallback
);
155 /** This method is used for out-of-line events. An event of the
156 specified type will be sent to all listeners that are registered for
159 The type of the event.
161 Some data sent to the listeners along with the event.
163 void MultiplexEvent(EventMultiplexerEventId eEventId
, void const* pUserData
);
166 class Implementation
;
167 rtl::Reference
<Implementation
> mpImpl
;
170 } // end of namespace ::sd::tools
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */