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 #include <toolkit/helper/listenermultiplexer.hxx>
21 #include <com/sun/star/lang/DisposedException.hpp>
23 // ----------------------------------------------------
24 // class ListenerMultiplexerBase
25 // ----------------------------------------------------
26 ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject
& rSource
)
27 : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource
)
31 ListenerMultiplexerBase::~ListenerMultiplexerBase()
35 // ::com::sun::star::uno::XInterface
36 ::com::sun::star::uno::Any
ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
38 return ::cppu::queryInterface( rType
, (static_cast< ::com::sun::star::uno::XInterface
* >(this)) );
42 // ----------------------------------------------------
43 // class EventListenerMultiplexer
44 // ----------------------------------------------------
45 EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject
& rSource
)
46 : ListenerMultiplexerBase( rSource
)
50 // ::com::sun::star::uno::XInterface
51 ::com::sun::star::uno::Any
EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
53 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
54 (static_cast< ::com::sun::star::lang::XEventListener
* >(this)) );
55 return (aRet
.hasValue() ? aRet
: ListenerMultiplexerBase::queryInterface( rType
));
58 // ::com::sun::star::lang::XEventListener
59 void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject
& ) throw(::com::sun::star::uno::RuntimeException
)
63 // ----------------------------------------------------
64 // class FocusListenerMultiplexer
65 // ----------------------------------------------------
66 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
)
67 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusGained
, ::com::sun::star::awt::FocusEvent
)
68 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusLost
, ::com::sun::star::awt::FocusEvent
)
70 // ----------------------------------------------------
71 // class WindowListenerMultiplexer
72 // ----------------------------------------------------
73 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
)
74 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowResized
, ::com::sun::star::awt::WindowEvent
)
75 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowMoved
, ::com::sun::star::awt::WindowEvent
)
76 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowShown
, ::com::sun::star::lang::EventObject
)
77 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowHidden
, ::com::sun::star::lang::EventObject
)
79 // ----------------------------------------------------
80 // class VclContainerListenerMultiplexer
81 // ----------------------------------------------------
82 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
)
83 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowAdded
, ::com::sun::star::awt::VclContainerEvent
)
84 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowRemoved
, ::com::sun::star::awt::VclContainerEvent
)
86 // ----------------------------------------------------
87 // class KeyListenerMultiplexer
88 // ----------------------------------------------------
89 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
)
90 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyPressed
, ::com::sun::star::awt::KeyEvent
)
91 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyReleased
, ::com::sun::star::awt::KeyEvent
)
93 // ----------------------------------------------------
94 // class MouseListenerMultiplexer
95 // ----------------------------------------------------
96 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
)
97 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mousePressed
, ::com::sun::star::awt::MouseEvent
)
98 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseReleased
, ::com::sun::star::awt::MouseEvent
)
99 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseEntered
, ::com::sun::star::awt::MouseEvent
)
100 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseExited
, ::com::sun::star::awt::MouseEvent
)
102 // ----------------------------------------------------
103 // class MouseMotionListenerMultiplexer
104 // ----------------------------------------------------
105 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
)
106 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseDragged
, ::com::sun::star::awt::MouseEvent
)
107 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseMoved
, ::com::sun::star::awt::MouseEvent
)
109 // ----------------------------------------------------
110 // class PaintListenerMultiplexer
111 // ----------------------------------------------------
112 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
)
113 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
, windowPaint
, ::com::sun::star::awt::PaintEvent
)
115 // ----------------------------------------------------
116 // class TopWindowListenerMultiplexer
117 // ----------------------------------------------------
118 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
)
119 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowOpened
, ::com::sun::star::lang::EventObject
)
120 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosing
, ::com::sun::star::lang::EventObject
)
121 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosed
, ::com::sun::star::lang::EventObject
)
122 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowMinimized
, ::com::sun::star::lang::EventObject
)
123 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowNormalized
, ::com::sun::star::lang::EventObject
)
124 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowActivated
, ::com::sun::star::lang::EventObject
)
125 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowDeactivated
, ::com::sun::star::lang::EventObject
)
127 // ----------------------------------------------------
128 // class TextListenerMultiplexer
129 // ----------------------------------------------------
130 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
)
131 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
, textChanged
, ::com::sun::star::awt::TextEvent
)
133 // ----------------------------------------------------
134 // class ActionListenerMultiplexer
135 // ----------------------------------------------------
136 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
)
137 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
, actionPerformed
, ::com::sun::star::awt::ActionEvent
)
139 // ----------------------------------------------------
140 // class ItemListenerMultiplexer
141 // ----------------------------------------------------
142 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
)
143 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
, itemStateChanged
, ::com::sun::star::awt::ItemEvent
)
145 // ----------------------------------------------------
146 // class TabListenerMultiplexer
147 // ----------------------------------------------------
148 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
)
149 void TabListenerMultiplexer::inserted( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
)
150 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, inserted
, ::sal_Int32
)
151 void TabListenerMultiplexer::removed( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
)
152 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, removed
, ::sal_Int32
)
153 void TabListenerMultiplexer::changed( sal_Int32 evt
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& evt2
) throw(::com::sun::star::uno::RuntimeException
)
154 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, changed
, ::sal_Int32
, ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
> )
155 void TabListenerMultiplexer::activated( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
)
156 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, activated
, ::sal_Int32
)
157 void TabListenerMultiplexer::deactivated( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
)
158 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, deactivated
, ::sal_Int32
)
160 // ----------------------------------------------------
161 // class ContainerListenerMultiplexer
162 // ----------------------------------------------------
163 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
)
164 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementInserted
, ::com::sun::star::container::ContainerEvent
)
165 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementRemoved
, ::com::sun::star::container::ContainerEvent
)
166 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementReplaced
, ::com::sun::star::container::ContainerEvent
)
168 // ----------------------------------------------------
169 // class SpinListenerMultiplexer
170 // ----------------------------------------------------
171 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
)
172 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, up
, ::com::sun::star::awt::SpinEvent
)
173 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, down
, ::com::sun::star::awt::SpinEvent
)
174 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, first
, ::com::sun::star::awt::SpinEvent
)
175 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, last
, ::com::sun::star::awt::SpinEvent
)
177 // ----------------------------------------------------
178 // class AdjustmentListenerMultiplexer
179 // ----------------------------------------------------
180 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
)
181 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
, adjustmentValueChanged
, ::com::sun::star::awt::AdjustmentEvent
)
183 // ----------------------------------------------------
184 // class MenuListenerMultiplexer
185 // ----------------------------------------------------
186 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
)
187 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, highlight
, ::com::sun::star::awt::MenuEvent
)
188 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, select
, ::com::sun::star::awt::MenuEvent
)
189 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, activate
, ::com::sun::star::awt::MenuEvent
)
190 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, deactivate
, ::com::sun::star::awt::MenuEvent
)
192 // ----------------------------------------------------
193 // class TreeSelectionListenerMultiplexer
194 // ----------------------------------------------------
195 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
)
196 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
, selectionChanged
, ::com::sun::star::lang::EventObject
)
198 // ----------------------------------------------------
199 // class TreeSelectionListenerMultiplexer
200 // ----------------------------------------------------
201 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
)
202 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, requestChildNodes
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
203 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanding
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
204 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsing
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
205 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanded
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
206 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsed
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
208 // ----------------------------------------------------
209 // class TreeEditListenerMultiplexer
210 // ----------------------------------------------------
211 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeEditListener
)
213 // ----------------------------------------------------
214 // class SelectionListenerMultiplexer
215 // ----------------------------------------------------
216 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer
, ::com::sun::star::awt::grid::XGridSelectionListener
)
217 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer
, ::com::sun::star::awt::grid::XGridSelectionListener
, selectionChanged
, ::com::sun::star::awt::grid::GridSelectionEvent
)
219 // ----------------------------------------------------
220 // class SelectionListenerMultiplexer
221 // ----------------------------------------------------
222 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer
, ::com::sun::star::awt::tab::XTabPageContainerListener
)
223 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer
, ::com::sun::star::awt::tab::XTabPageContainerListener
, tabPageActivated
, ::com::sun::star::awt::tab::TabPageActivatedEvent
)
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */