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 <cppuhelper/weak.hxx>
45 #include <comphelper/interfacecontainer2.hxx>
46 #include <toolkit/helper/mutexhelper.hxx>
47 #include <toolkit/helper/macros.hxx>
48 #include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
49 #include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
51 // class ListenerMultiplexerBase
54 class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase
: public MutexHelper
,
55 public ::comphelper::OInterfaceContainerHelper2
,
56 public css::uno::XInterface
59 ::cppu::OWeakObject
& mrContext
;
62 ::cppu::OWeakObject
& GetContext() { return mrContext
; }
65 ListenerMultiplexerBase( ::cppu::OWeakObject
& rSource
);
66 virtual ~ListenerMultiplexerBase();
68 // css::uno::XInterface
69 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
70 void SAL_CALL
acquire() throw() override
{ mrContext
.acquire(); }
71 void SAL_CALL
release() throw() override
{ mrContext
.release(); }
75 // class EventListenerMultiplexer
77 DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer
, css::lang::XEventListener
)
78 DECL_LISTENERMULTIPLEXER_END
81 // class FocusListenerMultiplexer
83 DECL_LISTENERMULTIPLEXER_START_DLLPUB( FocusListenerMultiplexer
, css::awt::XFocusListener
)
84 void SAL_CALL
focusGained( const css::awt::FocusEvent
& e
) override
;
85 void SAL_CALL
focusLost( const css::awt::FocusEvent
& e
) override
;
86 DECL_LISTENERMULTIPLEXER_END
89 // class WindowListenerMultiplexer
91 DECL_LISTENERMULTIPLEXER_START_DLLPUB( WindowListenerMultiplexer
, css::awt::XWindowListener
)
92 void SAL_CALL
windowResized( const css::awt::WindowEvent
& e
) override
;
93 void SAL_CALL
windowMoved( const css::awt::WindowEvent
& e
) override
;
94 void SAL_CALL
windowShown( const css::lang::EventObject
& e
) override
;
95 void SAL_CALL
windowHidden( const css::lang::EventObject
& e
) override
;
96 DECL_LISTENERMULTIPLEXER_END
99 // class VclContainerListenerMultiplexer
101 DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer
, css::awt::XVclContainerListener
)
102 void SAL_CALL
windowAdded( const css::awt::VclContainerEvent
& e
) override
;
103 void SAL_CALL
windowRemoved( const css::awt::VclContainerEvent
& e
) override
;
104 DECL_LISTENERMULTIPLEXER_END
107 // class KeyListenerMultiplexer
109 DECL_LISTENERMULTIPLEXER_START_DLLPUB( KeyListenerMultiplexer
, css::awt::XKeyListener
)
110 void SAL_CALL
keyPressed( const css::awt::KeyEvent
& e
) override
;
111 void SAL_CALL
keyReleased( const css::awt::KeyEvent
& e
) override
;
112 DECL_LISTENERMULTIPLEXER_END
115 // class MouseListenerMultiplexer
117 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer
, css::awt::XMouseListener
)
118 void SAL_CALL
mousePressed( const css::awt::MouseEvent
& e
) override
;
119 void SAL_CALL
mouseReleased( const css::awt::MouseEvent
& e
) override
;
120 void SAL_CALL
mouseEntered( const css::awt::MouseEvent
& e
) override
;
121 void SAL_CALL
mouseExited( const css::awt::MouseEvent
& e
) override
;
122 DECL_LISTENERMULTIPLEXER_END
125 // class MouseMotionListenerMultiplexer
127 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseMotionListenerMultiplexer
, css::awt::XMouseMotionListener
)
128 void SAL_CALL
mouseDragged( const css::awt::MouseEvent
& e
) override
;
129 void SAL_CALL
mouseMoved( const css::awt::MouseEvent
& e
) override
;
130 DECL_LISTENERMULTIPLEXER_END
133 // class PaintListenerMultiplexer
135 DECL_LISTENERMULTIPLEXER_START_DLLPUB( PaintListenerMultiplexer
, css::awt::XPaintListener
)
136 void SAL_CALL
windowPaint( const css::awt::PaintEvent
& e
) override
;
137 DECL_LISTENERMULTIPLEXER_END
140 // class TopWindowListenerMultiplexer
142 DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer
, css::awt::XTopWindowListener
)
143 void SAL_CALL
windowOpened( const css::lang::EventObject
& e
) override
;
144 void SAL_CALL
windowClosing( const css::lang::EventObject
& e
) override
;
145 void SAL_CALL
windowClosed( const css::lang::EventObject
& e
) override
;
146 void SAL_CALL
windowMinimized( const css::lang::EventObject
& e
) override
;
147 void SAL_CALL
windowNormalized( const css::lang::EventObject
& e
) override
;
148 void SAL_CALL
windowActivated( const css::lang::EventObject
& e
) override
;
149 void SAL_CALL
windowDeactivated( const css::lang::EventObject
& e
) override
;
150 DECL_LISTENERMULTIPLEXER_END
153 // class TextListenerMultiplexer
155 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer
, css::awt::XTextListener
)
156 void SAL_CALL
textChanged( const css::awt::TextEvent
& rEvent
) override
;
157 DECL_LISTENERMULTIPLEXER_END
160 // class ActionListenerMultiplexer
162 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ActionListenerMultiplexer
, css::awt::XActionListener
)
163 void SAL_CALL
actionPerformed( const css::awt::ActionEvent
& rEvent
) override
;
164 DECL_LISTENERMULTIPLEXER_END
167 // class ItemListenerMultiplexer
169 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer
, css::awt::XItemListener
)
170 void SAL_CALL
itemStateChanged( const css::awt::ItemEvent
& rEvent
) override
;
171 DECL_LISTENERMULTIPLEXER_END
174 // class TabListenerMultiplexer
176 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer
, css::awt::XTabListener
)
177 void SAL_CALL
inserted( ::sal_Int32 ID
) override
;
178 void SAL_CALL
removed( ::sal_Int32 ID
) override
;
179 void SAL_CALL
changed( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) override
;
180 void SAL_CALL
activated( ::sal_Int32 ID
) override
;
181 void SAL_CALL
deactivated( ::sal_Int32 ID
) override
;
182 DECL_LISTENERMULTIPLEXER_END
185 // class ContainerListenerMultiplexer
187 DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer
, css::container::XContainerListener
)
188 void SAL_CALL
elementInserted( const css::container::ContainerEvent
& Event
) override
;
189 void SAL_CALL
elementRemoved( const css::container::ContainerEvent
& Event
) override
;
190 void SAL_CALL
elementReplaced( const css::container::ContainerEvent
& Event
) override
;
191 DECL_LISTENERMULTIPLEXER_END
194 // class SpinListenerMultiplexer
196 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer
, css::awt::XSpinListener
)
197 void SAL_CALL
up( const css::awt::SpinEvent
& rEvent
) override
;
198 void SAL_CALL
down( const css::awt::SpinEvent
& rEvent
) override
;
199 void SAL_CALL
first( const css::awt::SpinEvent
& rEvent
) override
;
200 void SAL_CALL
last( const css::awt::SpinEvent
& rEvent
) override
;
201 DECL_LISTENERMULTIPLEXER_END
204 // class AdjustmentListenerMultiplexer
206 DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer
, css::awt::XAdjustmentListener
)
207 void SAL_CALL
adjustmentValueChanged( const css::awt::AdjustmentEvent
& rEvent
) override
;
208 DECL_LISTENERMULTIPLEXER_END
211 // class MenuListenerMultiplexer
213 DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer
, css::awt::XMenuListener
)
214 void SAL_CALL
itemHighlighted( const css::awt::MenuEvent
& rEvent
) override
;
215 void SAL_CALL
itemSelected( const css::awt::MenuEvent
& rEvent
) override
;
216 void SAL_CALL
itemActivated( const css::awt::MenuEvent
& rEvent
) override
;
217 void SAL_CALL
itemDeactivated( const css::awt::MenuEvent
& rEvent
) override
;
218 DECL_LISTENERMULTIPLEXER_END
221 // class TreeSelectionListenerMultiplexer
223 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer
, css::view::XSelectionChangeListener
)
224 virtual void SAL_CALL
selectionChanged( const css::lang::EventObject
& aEvent
) override
;
225 DECL_LISTENERMULTIPLEXER_END
228 // class TreeExpansionListenerMultiplexer
230 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer
, css::awt::tree::XTreeExpansionListener
)
231 virtual void SAL_CALL
requestChildNodes( const css::awt::tree::TreeExpansionEvent
& aEvent
) override
;
232 virtual void SAL_CALL
treeExpanding( const css::awt::tree::TreeExpansionEvent
& aEvent
) override
;
233 virtual void SAL_CALL
treeCollapsing( const css::awt::tree::TreeExpansionEvent
& aEvent
) override
;
234 virtual void SAL_CALL
treeExpanded( const css::awt::tree::TreeExpansionEvent
& aEvent
) override
;
235 virtual void SAL_CALL
treeCollapsed( const css::awt::tree::TreeExpansionEvent
& aEvent
) override
;
236 DECL_LISTENERMULTIPLEXER_END
239 // class TreeEditListenerMultiplexer
241 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer
, css::awt::tree::XTreeEditListener
)
242 virtual void SAL_CALL
nodeEditing( const css::uno::Reference
< css::awt::tree::XTreeNode
>& Node
) override
;
243 virtual void SAL_CALL
nodeEdited( const css::uno::Reference
< css::awt::tree::XTreeNode
>& Node
, const OUString
& NewText
) override
;
244 DECL_LISTENERMULTIPLEXER_END
247 // class SelectionListenerMultiplexer
249 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer
, css::awt::grid::XGridSelectionListener
)
250 void SAL_CALL
selectionChanged( const css::awt::grid::GridSelectionEvent
& aEvent
) override
;
251 DECL_LISTENERMULTIPLEXER_END
254 // class TabPageListenerMultiplexer
256 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer
, css::awt::tab::XTabPageContainerListener
)
257 void SAL_CALL
tabPageActivated( const css::awt::tab::TabPageActivatedEvent
& aEvent
) override
;
258 DECL_LISTENERMULTIPLEXER_END
260 #endif // INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */