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 _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
21 #define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
23 #include <toolkit/dllapi.h>
24 #include <com/sun/star/lang/XEventListener.hpp>
25 #include <com/sun/star/awt/XFocusListener.hpp>
26 #include <com/sun/star/awt/XWindowListener.hpp>
27 #include <com/sun/star/awt/XVclContainerListener.hpp>
28 #include <com/sun/star/awt/XKeyListener.hpp>
29 #include <com/sun/star/awt/XMouseListener.hpp>
30 #include <com/sun/star/awt/XMouseMotionListener.hpp>
31 #include <com/sun/star/awt/XPaintListener.hpp>
32 #include <com/sun/star/awt/XTopWindowListener.hpp>
33 #include <com/sun/star/awt/XTextListener.hpp>
34 #include <com/sun/star/awt/XActionListener.hpp>
35 #include <com/sun/star/awt/XItemListener.hpp>
36 #include <com/sun/star/awt/XTabListener.hpp>
37 #include <com/sun/star/container/XContainerListener.hpp>
38 #include <com/sun/star/awt/XSpinListener.hpp>
39 #include <com/sun/star/awt/XAdjustmentListener.hpp>
40 #include <com/sun/star/awt/XMenuListener.hpp>
41 #include <com/sun/star/awt/tree/XTreeExpansionListener.hpp>
42 #include <com/sun/star/awt/tree/XTreeEditListener.hpp>
43 #include <com/sun/star/view/XSelectionChangeListener.hpp>
44 #include <com/sun/star/util/VetoException.hpp>
45 #include <cppuhelper/weak.hxx>
46 #include <cppuhelper/interfacecontainer.hxx>
47 #include <osl/mutex.hxx>
48 #include <toolkit/helper/mutexhelper.hxx>
49 #include <toolkit/helper/macros.hxx>
50 #include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
51 #include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
52 // ----------------------------------------------------
53 // class ListenerMultiplexerBase
54 // ----------------------------------------------------
56 class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase
: public MutexHelper
,
57 public ::cppu::OInterfaceContainerHelper
,
58 public ::com::sun::star::uno::XInterface
61 ::cppu::OWeakObject
& mrContext
;
64 ::cppu::OWeakObject
& GetContext() { return mrContext
; }
67 ListenerMultiplexerBase( ::cppu::OWeakObject
& rSource
);
68 virtual ~ListenerMultiplexerBase();
70 // ::com::sun::star::uno::XInterface
71 ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
72 void SAL_CALL
acquire() throw() { mrContext
.acquire(); }
73 void SAL_CALL
release() throw() { mrContext
.release(); }
77 // ----------------------------------------------------
78 // class EventListenerMultiplexer
79 // ----------------------------------------------------
80 DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer
, ::com::sun::star::lang::XEventListener
)
81 DECL_LISTENERMULTIPLEXER_END
83 // ----------------------------------------------------
84 // class FocusListenerMultiplexer
85 // ----------------------------------------------------
86 DECL_LISTENERMULTIPLEXER_START( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
)
87 void SAL_CALL
focusGained( const ::com::sun::star::awt::FocusEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
88 void SAL_CALL
focusLost( const ::com::sun::star::awt::FocusEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
89 DECL_LISTENERMULTIPLEXER_END
92 // ----------------------------------------------------
93 // class WindowListenerMultiplexer
94 // ----------------------------------------------------
95 DECL_LISTENERMULTIPLEXER_START( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
)
96 void SAL_CALL
windowResized( const ::com::sun::star::awt::WindowEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
97 void SAL_CALL
windowMoved( const ::com::sun::star::awt::WindowEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
98 void SAL_CALL
windowShown( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
99 void SAL_CALL
windowHidden( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
100 DECL_LISTENERMULTIPLEXER_END
104 // ----------------------------------------------------
105 // class VclContainerListenerMultiplexer
106 // ----------------------------------------------------
107 DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
)
108 void SAL_CALL
windowAdded( const ::com::sun::star::awt::VclContainerEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
109 void SAL_CALL
windowRemoved( const ::com::sun::star::awt::VclContainerEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
110 DECL_LISTENERMULTIPLEXER_END
112 // ----------------------------------------------------
113 // class KeyListenerMultiplexer
114 // ----------------------------------------------------
115 DECL_LISTENERMULTIPLEXER_START( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
)
116 void SAL_CALL
keyPressed( const ::com::sun::star::awt::KeyEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
117 void SAL_CALL
keyReleased( const ::com::sun::star::awt::KeyEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
118 DECL_LISTENERMULTIPLEXER_END
120 // ----------------------------------------------------
121 // class MouseListenerMultiplexer
122 // ----------------------------------------------------
123 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
)
124 void SAL_CALL
mousePressed( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
125 void SAL_CALL
mouseReleased( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
126 void SAL_CALL
mouseEntered( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
127 void SAL_CALL
mouseExited( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
128 DECL_LISTENERMULTIPLEXER_END
130 // ----------------------------------------------------
131 // class MouseMotionListenerMultiplexer
132 // ----------------------------------------------------
133 DECL_LISTENERMULTIPLEXER_START( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
)
134 void SAL_CALL
mouseDragged( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
135 void SAL_CALL
mouseMoved( const ::com::sun::star::awt::MouseEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
136 DECL_LISTENERMULTIPLEXER_END
138 // ----------------------------------------------------
139 // class PaintListenerMultiplexer
140 // ----------------------------------------------------
141 DECL_LISTENERMULTIPLEXER_START( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
)
142 void SAL_CALL
windowPaint( const ::com::sun::star::awt::PaintEvent
& e
) throw(::com::sun::star::uno::RuntimeException
);
143 DECL_LISTENERMULTIPLEXER_END
145 // ----------------------------------------------------
146 // class TopWindowListenerMultiplexer
147 // ----------------------------------------------------
148 DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
)
149 void SAL_CALL
windowOpened( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
150 void SAL_CALL
windowClosing( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
151 void SAL_CALL
windowClosed( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
152 void SAL_CALL
windowMinimized( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
153 void SAL_CALL
windowNormalized( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
154 void SAL_CALL
windowActivated( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
155 void SAL_CALL
windowDeactivated( const ::com::sun::star::lang::EventObject
& e
) throw(::com::sun::star::uno::RuntimeException
);
156 DECL_LISTENERMULTIPLEXER_END
158 // ----------------------------------------------------
159 // class TextListenerMultiplexer
160 // ----------------------------------------------------
161 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
)
162 void SAL_CALL
textChanged( const ::com::sun::star::awt::TextEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
163 DECL_LISTENERMULTIPLEXER_END
165 // ----------------------------------------------------
166 // class ActionListenerMultiplexer
167 // ----------------------------------------------------
168 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
)
169 void SAL_CALL
actionPerformed( const ::com::sun::star::awt::ActionEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
170 DECL_LISTENERMULTIPLEXER_END
172 // ----------------------------------------------------
173 // class ItemListenerMultiplexer
174 // ----------------------------------------------------
175 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
)
176 void SAL_CALL
itemStateChanged( const ::com::sun::star::awt::ItemEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
177 DECL_LISTENERMULTIPLEXER_END
179 // ----------------------------------------------------
180 // class TabListenerMultiplexer
181 // ----------------------------------------------------
182 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
)
183 void SAL_CALL
inserted( ::sal_Int32 ID
) throw (::com::sun::star::uno::RuntimeException
);
184 void SAL_CALL
removed( ::sal_Int32 ID
) throw (::com::sun::star::uno::RuntimeException
);
185 void SAL_CALL
changed( ::sal_Int32 ID
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& Properties
) throw (::com::sun::star::uno::RuntimeException
);
186 void SAL_CALL
activated( ::sal_Int32 ID
) throw (::com::sun::star::uno::RuntimeException
);
187 void SAL_CALL
deactivated( ::sal_Int32 ID
) throw (::com::sun::star::uno::RuntimeException
);
188 DECL_LISTENERMULTIPLEXER_END
190 // ----------------------------------------------------
191 // class ContainerListenerMultiplexer
192 // ----------------------------------------------------
193 DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
)
194 void SAL_CALL
elementInserted( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
195 void SAL_CALL
elementRemoved( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
196 void SAL_CALL
elementReplaced( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
197 DECL_LISTENERMULTIPLEXER_END
199 // ----------------------------------------------------
200 // class SpinListenerMultiplexer
201 // ----------------------------------------------------
202 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
)
203 void SAL_CALL
up( const ::com::sun::star::awt::SpinEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
204 void SAL_CALL
down( const ::com::sun::star::awt::SpinEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
205 void SAL_CALL
first( const ::com::sun::star::awt::SpinEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
206 void SAL_CALL
last( const ::com::sun::star::awt::SpinEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
207 DECL_LISTENERMULTIPLEXER_END
209 // ----------------------------------------------------
210 // class AdjustmentListenerMultiplexer
211 // ----------------------------------------------------
212 DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
)
213 void SAL_CALL
adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
214 DECL_LISTENERMULTIPLEXER_END
216 // ----------------------------------------------------
217 // class MenuListenerMultiplexer
218 // ----------------------------------------------------
219 DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
)
220 void SAL_CALL
highlight( const ::com::sun::star::awt::MenuEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
221 void SAL_CALL
select( const ::com::sun::star::awt::MenuEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
222 void SAL_CALL
activate( const ::com::sun::star::awt::MenuEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
223 void SAL_CALL
deactivate( const ::com::sun::star::awt::MenuEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
);
224 DECL_LISTENERMULTIPLEXER_END
226 // ----------------------------------------------------
227 // class TreeSelectionListenerMultiplexer
228 // ----------------------------------------------------
229 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
)
230 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
231 DECL_LISTENERMULTIPLEXER_END
233 // ----------------------------------------------------
234 // class TreeExpansionListenerMultiplexer
235 // ----------------------------------------------------
236 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
)
237 virtual void SAL_CALL
requestChildNodes( const ::com::sun::star::awt::tree::TreeExpansionEvent
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
238 virtual void SAL_CALL
treeExpanding( const ::com::sun::star::awt::tree::TreeExpansionEvent
& aEvent
) throw (::com::sun::star::awt::tree::ExpandVetoException
, ::com::sun::star::uno::RuntimeException
);
239 virtual void SAL_CALL
treeCollapsing( const ::com::sun::star::awt::tree::TreeExpansionEvent
& aEvent
) throw (::com::sun::star::awt::tree::ExpandVetoException
, ::com::sun::star::uno::RuntimeException
);
240 virtual void SAL_CALL
treeExpanded( const ::com::sun::star::awt::tree::TreeExpansionEvent
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
241 virtual void SAL_CALL
treeCollapsed( const ::com::sun::star::awt::tree::TreeExpansionEvent
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
242 DECL_LISTENERMULTIPLEXER_END
244 // ----------------------------------------------------
245 // class TreeEditListenerMultiplexer
246 // ----------------------------------------------------
247 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeEditListener
)
248 virtual void SAL_CALL
nodeEditing( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::tree::XTreeNode
>& Node
) throw (::com::sun::star::uno::RuntimeException
,::com::sun::star::util::VetoException
);
249 virtual void SAL_CALL
nodeEdited( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::tree::XTreeNode
>& Node
, const OUString
& NewText
) throw (::com::sun::star::uno::RuntimeException
);
250 DECL_LISTENERMULTIPLEXER_END
252 // ----------------------------------------------------
253 // class SelectionListenerMultiplexer
254 // ----------------------------------------------------
255 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer
, ::com::sun::star::awt::grid::XGridSelectionListener
)
256 void SAL_CALL
selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
257 DECL_LISTENERMULTIPLEXER_END
259 // ----------------------------------------------------
260 // class TabPageListenerMultiplexer
261 // ----------------------------------------------------
262 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer
, ::com::sun::star::awt::tab::XTabPageContainerListener
)
263 void SAL_CALL
tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
264 DECL_LISTENERMULTIPLEXER_END
266 #endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */