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_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
21 #define INCLUDED_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 <comphelper/interfacecontainer2.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>
53 // class ListenerMultiplexerBase
56 class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase
: public MutexHelper
,
57 public ::comphelper::OInterfaceContainerHelper2
,
58 public css::uno::XInterface
61 ::cppu::OWeakObject
& mrContext
;
64 ::cppu::OWeakObject
& GetContext() { return mrContext
; }
67 ListenerMultiplexerBase( ::cppu::OWeakObject
& rSource
);
68 virtual ~ListenerMultiplexerBase();
70 // css::uno::XInterface
71 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) throw(css::uno::RuntimeException
, std::exception
) override
;
72 void SAL_CALL
acquire() throw() override
{ mrContext
.acquire(); }
73 void SAL_CALL
release() throw() override
{ mrContext
.release(); }
77 // class EventListenerMultiplexer
79 DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer
, css::lang::XEventListener
)
80 DECL_LISTENERMULTIPLEXER_END
83 // class FocusListenerMultiplexer
85 DECL_LISTENERMULTIPLEXER_START_DLLPUB( FocusListenerMultiplexer
, css::awt::XFocusListener
)
86 void SAL_CALL
focusGained( const css::awt::FocusEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
87 void SAL_CALL
focusLost( const css::awt::FocusEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
88 DECL_LISTENERMULTIPLEXER_END
91 // class WindowListenerMultiplexer
93 DECL_LISTENERMULTIPLEXER_START_DLLPUB( WindowListenerMultiplexer
, css::awt::XWindowListener
)
94 void SAL_CALL
windowResized( const css::awt::WindowEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
95 void SAL_CALL
windowMoved( const css::awt::WindowEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
96 void SAL_CALL
windowShown( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
97 void SAL_CALL
windowHidden( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
98 DECL_LISTENERMULTIPLEXER_END
101 // class VclContainerListenerMultiplexer
103 DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer
, css::awt::XVclContainerListener
)
104 void SAL_CALL
windowAdded( const css::awt::VclContainerEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
105 void SAL_CALL
windowRemoved( const css::awt::VclContainerEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
106 DECL_LISTENERMULTIPLEXER_END
109 // class KeyListenerMultiplexer
111 DECL_LISTENERMULTIPLEXER_START_DLLPUB( KeyListenerMultiplexer
, css::awt::XKeyListener
)
112 void SAL_CALL
keyPressed( const css::awt::KeyEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
113 void SAL_CALL
keyReleased( const css::awt::KeyEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
114 DECL_LISTENERMULTIPLEXER_END
117 // class MouseListenerMultiplexer
119 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer
, css::awt::XMouseListener
)
120 void SAL_CALL
mousePressed( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
121 void SAL_CALL
mouseReleased( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
122 void SAL_CALL
mouseEntered( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
123 void SAL_CALL
mouseExited( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
124 DECL_LISTENERMULTIPLEXER_END
127 // class MouseMotionListenerMultiplexer
129 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseMotionListenerMultiplexer
, css::awt::XMouseMotionListener
)
130 void SAL_CALL
mouseDragged( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
131 void SAL_CALL
mouseMoved( const css::awt::MouseEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
132 DECL_LISTENERMULTIPLEXER_END
135 // class PaintListenerMultiplexer
137 DECL_LISTENERMULTIPLEXER_START_DLLPUB( PaintListenerMultiplexer
, css::awt::XPaintListener
)
138 void SAL_CALL
windowPaint( const css::awt::PaintEvent
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
139 DECL_LISTENERMULTIPLEXER_END
142 // class TopWindowListenerMultiplexer
144 DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer
, css::awt::XTopWindowListener
)
145 void SAL_CALL
windowOpened( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
146 void SAL_CALL
windowClosing( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
147 void SAL_CALL
windowClosed( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
148 void SAL_CALL
windowMinimized( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
149 void SAL_CALL
windowNormalized( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
150 void SAL_CALL
windowActivated( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
151 void SAL_CALL
windowDeactivated( const css::lang::EventObject
& e
) throw(css::uno::RuntimeException
, std::exception
) override
;
152 DECL_LISTENERMULTIPLEXER_END
155 // class TextListenerMultiplexer
157 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer
, css::awt::XTextListener
)
158 void SAL_CALL
textChanged( const css::awt::TextEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
159 DECL_LISTENERMULTIPLEXER_END
162 // class ActionListenerMultiplexer
164 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ActionListenerMultiplexer
, css::awt::XActionListener
)
165 void SAL_CALL
actionPerformed( const css::awt::ActionEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
166 DECL_LISTENERMULTIPLEXER_END
169 // class ItemListenerMultiplexer
171 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer
, css::awt::XItemListener
)
172 void SAL_CALL
itemStateChanged( const css::awt::ItemEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
173 DECL_LISTENERMULTIPLEXER_END
176 // class TabListenerMultiplexer
178 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer
, css::awt::XTabListener
)
179 void SAL_CALL
inserted( ::sal_Int32 ID
) throw (css::uno::RuntimeException
, std::exception
) override
;
180 void SAL_CALL
removed( ::sal_Int32 ID
) throw (css::uno::RuntimeException
, std::exception
) override
;
181 void SAL_CALL
changed( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) throw (css::uno::RuntimeException
, std::exception
) override
;
182 void SAL_CALL
activated( ::sal_Int32 ID
) throw (css::uno::RuntimeException
, std::exception
) override
;
183 void SAL_CALL
deactivated( ::sal_Int32 ID
) throw (css::uno::RuntimeException
, std::exception
) override
;
184 DECL_LISTENERMULTIPLEXER_END
187 // class ContainerListenerMultiplexer
189 DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer
, css::container::XContainerListener
)
190 void SAL_CALL
elementInserted( const css::container::ContainerEvent
& Event
) throw(css::uno::RuntimeException
, std::exception
) override
;
191 void SAL_CALL
elementRemoved( const css::container::ContainerEvent
& Event
) throw(css::uno::RuntimeException
, std::exception
) override
;
192 void SAL_CALL
elementReplaced( const css::container::ContainerEvent
& Event
) throw(css::uno::RuntimeException
, std::exception
) override
;
193 DECL_LISTENERMULTIPLEXER_END
196 // class SpinListenerMultiplexer
198 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer
, css::awt::XSpinListener
)
199 void SAL_CALL
up( const css::awt::SpinEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
200 void SAL_CALL
down( const css::awt::SpinEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
201 void SAL_CALL
first( const css::awt::SpinEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
202 void SAL_CALL
last( const css::awt::SpinEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
203 DECL_LISTENERMULTIPLEXER_END
206 // class AdjustmentListenerMultiplexer
208 DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer
, css::awt::XAdjustmentListener
)
209 void SAL_CALL
adjustmentValueChanged( const css::awt::AdjustmentEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
210 DECL_LISTENERMULTIPLEXER_END
213 // class MenuListenerMultiplexer
215 DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer
, css::awt::XMenuListener
)
216 void SAL_CALL
itemHighlighted( const css::awt::MenuEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
217 void SAL_CALL
itemSelected( const css::awt::MenuEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
218 void SAL_CALL
itemActivated( const css::awt::MenuEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
219 void SAL_CALL
itemDeactivated( const css::awt::MenuEvent
& rEvent
) throw(css::uno::RuntimeException
, std::exception
) override
;
220 DECL_LISTENERMULTIPLEXER_END
223 // class TreeSelectionListenerMultiplexer
225 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer
, css::view::XSelectionChangeListener
)
226 virtual void SAL_CALL
selectionChanged( const css::lang::EventObject
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
227 DECL_LISTENERMULTIPLEXER_END
230 // class TreeExpansionListenerMultiplexer
232 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer
, css::awt::tree::XTreeExpansionListener
)
233 virtual void SAL_CALL
requestChildNodes( const css::awt::tree::TreeExpansionEvent
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
234 virtual void SAL_CALL
treeExpanding( const css::awt::tree::TreeExpansionEvent
& aEvent
) throw (css::awt::tree::ExpandVetoException
, css::uno::RuntimeException
, std::exception
) override
;
235 virtual void SAL_CALL
treeCollapsing( const css::awt::tree::TreeExpansionEvent
& aEvent
) throw (css::awt::tree::ExpandVetoException
, css::uno::RuntimeException
, std::exception
) override
;
236 virtual void SAL_CALL
treeExpanded( const css::awt::tree::TreeExpansionEvent
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
237 virtual void SAL_CALL
treeCollapsed( const css::awt::tree::TreeExpansionEvent
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
238 DECL_LISTENERMULTIPLEXER_END
241 // class TreeEditListenerMultiplexer
243 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer
, css::awt::tree::XTreeEditListener
)
244 virtual void SAL_CALL
nodeEditing( const css::uno::Reference
< css::awt::tree::XTreeNode
>& Node
) throw (css::uno::RuntimeException
,css::util::VetoException
, std::exception
) override
;
245 virtual void SAL_CALL
nodeEdited( const css::uno::Reference
< css::awt::tree::XTreeNode
>& Node
, const OUString
& NewText
) throw (css::uno::RuntimeException
, std::exception
) override
;
246 DECL_LISTENERMULTIPLEXER_END
249 // class SelectionListenerMultiplexer
251 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer
, css::awt::grid::XGridSelectionListener
)
252 void SAL_CALL
selectionChanged( const css::awt::grid::GridSelectionEvent
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
253 DECL_LISTENERMULTIPLEXER_END
256 // class TabPageListenerMultiplexer
258 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer
, css::awt::tab::XTabPageContainerListener
)
259 void SAL_CALL
tabPageActivated( const css::awt::tab::TabPageActivatedEvent
& aEvent
) throw (css::uno::RuntimeException
, std::exception
) override
;
260 DECL_LISTENERMULTIPLEXER_END
262 #endif // INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */