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>
22 #include <cppuhelper/queryinterface.hxx>
24 // class ListenerMultiplexerBase
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
, std::exception
)
38 return ::cppu::queryInterface( rType
, (static_cast< ::com::sun::star::uno::XInterface
* >(this)) );
43 // class EventListenerMultiplexer
45 EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject
& rSource
)
46 : ListenerMultiplexerBase( rSource
)
50 void SAL_CALL
EventListenerMultiplexer::acquire() throw ()
52 return ListenerMultiplexerBase::acquire();
54 void SAL_CALL
EventListenerMultiplexer::release() throw ()
56 return ListenerMultiplexerBase::release();
59 // ::com::sun::star::uno::XInterface
60 ::com::sun::star::uno::Any
EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
62 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
63 (static_cast< ::com::sun::star::lang::XEventListener
* >(this)) );
64 return (aRet
.hasValue() ? aRet
: ListenerMultiplexerBase::queryInterface( rType
));
67 // ::com::sun::star::lang::XEventListener
68 void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject
& ) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
73 // class FocusListenerMultiplexer
75 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
)
76 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusGained
, ::com::sun::star::awt::FocusEvent
)
77 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusLost
, ::com::sun::star::awt::FocusEvent
)
80 // class WindowListenerMultiplexer
82 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
)
83 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowResized
, ::com::sun::star::awt::WindowEvent
)
84 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowMoved
, ::com::sun::star::awt::WindowEvent
)
85 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowShown
, ::com::sun::star::lang::EventObject
)
86 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowHidden
, ::com::sun::star::lang::EventObject
)
89 // class VclContainerListenerMultiplexer
91 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
)
92 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowAdded
, ::com::sun::star::awt::VclContainerEvent
)
93 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowRemoved
, ::com::sun::star::awt::VclContainerEvent
)
96 // class KeyListenerMultiplexer
98 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
)
99 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyPressed
, ::com::sun::star::awt::KeyEvent
)
100 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyReleased
, ::com::sun::star::awt::KeyEvent
)
103 // class MouseListenerMultiplexer
105 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
)
106 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mousePressed
, ::com::sun::star::awt::MouseEvent
)
107 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseReleased
, ::com::sun::star::awt::MouseEvent
)
108 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseEntered
, ::com::sun::star::awt::MouseEvent
)
109 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseExited
, ::com::sun::star::awt::MouseEvent
)
112 // class MouseMotionListenerMultiplexer
114 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
)
115 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseDragged
, ::com::sun::star::awt::MouseEvent
)
116 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseMoved
, ::com::sun::star::awt::MouseEvent
)
119 // class PaintListenerMultiplexer
121 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
)
122 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
, windowPaint
, ::com::sun::star::awt::PaintEvent
)
125 // class TopWindowListenerMultiplexer
127 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
)
128 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowOpened
, ::com::sun::star::lang::EventObject
)
129 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosing
, ::com::sun::star::lang::EventObject
)
130 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosed
, ::com::sun::star::lang::EventObject
)
131 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowMinimized
, ::com::sun::star::lang::EventObject
)
132 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowNormalized
, ::com::sun::star::lang::EventObject
)
133 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowActivated
, ::com::sun::star::lang::EventObject
)
134 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowDeactivated
, ::com::sun::star::lang::EventObject
)
137 // class TextListenerMultiplexer
139 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
)
140 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
, textChanged
, ::com::sun::star::awt::TextEvent
)
143 // class ActionListenerMultiplexer
145 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
)
146 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
, actionPerformed
, ::com::sun::star::awt::ActionEvent
)
149 // class ItemListenerMultiplexer
151 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
)
152 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
, itemStateChanged
, ::com::sun::star::awt::ItemEvent
)
155 // class TabListenerMultiplexer
157 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
)
158 void TabListenerMultiplexer::inserted( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
159 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, inserted
, ::sal_Int32
)
160 void TabListenerMultiplexer::removed( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
161 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, removed
, ::sal_Int32
)
162 void TabListenerMultiplexer::changed( sal_Int32 evt
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& evt2
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
163 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, changed
, ::sal_Int32
, ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
> )
164 void TabListenerMultiplexer::activated( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
165 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, activated
, ::sal_Int32
)
166 void TabListenerMultiplexer::deactivated( sal_Int32 evt
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
167 IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer
, ::com::sun::star::awt::XTabListener
, deactivated
, ::sal_Int32
)
170 // class ContainerListenerMultiplexer
172 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
)
173 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementInserted
, ::com::sun::star::container::ContainerEvent
)
174 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementRemoved
, ::com::sun::star::container::ContainerEvent
)
175 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementReplaced
, ::com::sun::star::container::ContainerEvent
)
178 // class SpinListenerMultiplexer
180 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
)
181 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, up
, ::com::sun::star::awt::SpinEvent
)
182 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, down
, ::com::sun::star::awt::SpinEvent
)
183 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, first
, ::com::sun::star::awt::SpinEvent
)
184 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, last
, ::com::sun::star::awt::SpinEvent
)
187 // class AdjustmentListenerMultiplexer
189 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
)
190 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
, adjustmentValueChanged
, ::com::sun::star::awt::AdjustmentEvent
)
193 // class MenuListenerMultiplexer
195 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
)
196 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, itemHighlighted
, ::com::sun::star::awt::MenuEvent
)
197 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, itemSelected
, ::com::sun::star::awt::MenuEvent
)
198 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, itemActivated
, ::com::sun::star::awt::MenuEvent
)
199 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, itemDeactivated
, ::com::sun::star::awt::MenuEvent
)
202 // class TreeSelectionListenerMultiplexer
204 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
)
205 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
, selectionChanged
, ::com::sun::star::lang::EventObject
)
208 // class TreeSelectionListenerMultiplexer
210 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
)
211 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, requestChildNodes
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
212 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanding
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
213 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsing
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
214 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanded
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
215 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsed
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
218 // class TreeEditListenerMultiplexer
220 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeEditListener
)
223 // class SelectionListenerMultiplexer
225 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer
, ::com::sun::star::awt::grid::XGridSelectionListener
)
226 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer
, ::com::sun::star::awt::grid::XGridSelectionListener
, selectionChanged
, ::com::sun::star::awt::grid::GridSelectionEvent
)
229 // class SelectionListenerMultiplexer
231 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer
, ::com::sun::star::awt::tab::XTabPageContainerListener
)
232 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer
, ::com::sun::star::awt::tab::XTabPageContainerListener
, tabPageActivated
, ::com::sun::star::awt::tab::TabPageActivatedEvent
)
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */