1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: listenermultiplexer.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 //#include "precompiled_toolkit.hxx"
33 #include "precompiled_toolkit.hxx"
34 #include <toolkit/helper/listenermultiplexer.hxx>
35 #include <com/sun/star/lang/DisposedException.hpp>
37 // ----------------------------------------------------
38 // class ListenerMultiplexerBase
39 // ----------------------------------------------------
40 ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject
& rSource
)
41 : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource
)
45 ListenerMultiplexerBase::~ListenerMultiplexerBase()
49 // ::com::sun::star::uno::XInterface
50 ::com::sun::star::uno::Any
ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
52 return ::cppu::queryInterface( rType
, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface
*, this ) );
56 // ----------------------------------------------------
57 // class EventListenerMultiplexer
58 // ----------------------------------------------------
59 EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject
& rSource
)
60 : ListenerMultiplexerBase( rSource
)
64 // ::com::sun::star::uno::XInterface
65 ::com::sun::star::uno::Any
EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
67 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
68 SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener
*, this ) );
69 return (aRet
.hasValue() ? aRet
: ListenerMultiplexerBase::queryInterface( rType
));
72 // ::com::sun::star::lang::XEventListener
73 void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject
& ) throw(::com::sun::star::uno::RuntimeException
)
77 // ----------------------------------------------------
78 // class FocusListenerMultiplexer
79 // ----------------------------------------------------
80 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
)
81 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusGained
, ::com::sun::star::awt::FocusEvent
)
82 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer
, ::com::sun::star::awt::XFocusListener
, focusLost
, ::com::sun::star::awt::FocusEvent
)
84 // ----------------------------------------------------
85 // class WindowListenerMultiplexer
86 // ----------------------------------------------------
87 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
)
88 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowResized
, ::com::sun::star::awt::WindowEvent
)
89 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowMoved
, ::com::sun::star::awt::WindowEvent
)
90 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowShown
, ::com::sun::star::lang::EventObject
)
91 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer
, ::com::sun::star::awt::XWindowListener
, windowHidden
, ::com::sun::star::lang::EventObject
)
93 // ----------------------------------------------------
94 // class VclContainerListenerMultiplexer
95 // ----------------------------------------------------
96 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
)
97 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowAdded
, ::com::sun::star::awt::VclContainerEvent
)
98 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer
, ::com::sun::star::awt::XVclContainerListener
, windowRemoved
, ::com::sun::star::awt::VclContainerEvent
)
100 // ----------------------------------------------------
101 // class KeyListenerMultiplexer
102 // ----------------------------------------------------
103 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
)
104 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyPressed
, ::com::sun::star::awt::KeyEvent
)
105 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer
, ::com::sun::star::awt::XKeyListener
, keyReleased
, ::com::sun::star::awt::KeyEvent
)
107 // ----------------------------------------------------
108 // class MouseListenerMultiplexer
109 // ----------------------------------------------------
110 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
)
111 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mousePressed
, ::com::sun::star::awt::MouseEvent
)
112 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseReleased
, ::com::sun::star::awt::MouseEvent
)
113 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseEntered
, ::com::sun::star::awt::MouseEvent
)
114 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer
, ::com::sun::star::awt::XMouseListener
, mouseExited
, ::com::sun::star::awt::MouseEvent
)
116 // ----------------------------------------------------
117 // class MouseMotionListenerMultiplexer
118 // ----------------------------------------------------
119 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
)
120 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseDragged
, ::com::sun::star::awt::MouseEvent
)
121 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer
, ::com::sun::star::awt::XMouseMotionListener
, mouseMoved
, ::com::sun::star::awt::MouseEvent
)
123 // ----------------------------------------------------
124 // class PaintListenerMultiplexer
125 // ----------------------------------------------------
126 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
)
127 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer
, ::com::sun::star::awt::XPaintListener
, windowPaint
, ::com::sun::star::awt::PaintEvent
)
129 // ----------------------------------------------------
130 // class TopWindowListenerMultiplexer
131 // ----------------------------------------------------
132 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
)
133 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowOpened
, ::com::sun::star::lang::EventObject
)
134 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosing
, ::com::sun::star::lang::EventObject
)
135 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowClosed
, ::com::sun::star::lang::EventObject
)
136 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowMinimized
, ::com::sun::star::lang::EventObject
)
137 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowNormalized
, ::com::sun::star::lang::EventObject
)
138 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowActivated
, ::com::sun::star::lang::EventObject
)
139 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer
, ::com::sun::star::awt::XTopWindowListener
, windowDeactivated
, ::com::sun::star::lang::EventObject
)
141 // ----------------------------------------------------
142 // class TextListenerMultiplexer
143 // ----------------------------------------------------
144 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
)
145 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer
, ::com::sun::star::awt::XTextListener
, textChanged
, ::com::sun::star::awt::TextEvent
)
147 // ----------------------------------------------------
148 // class ActionListenerMultiplexer
149 // ----------------------------------------------------
150 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
)
151 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer
, ::com::sun::star::awt::XActionListener
, actionPerformed
, ::com::sun::star::awt::ActionEvent
)
153 // ----------------------------------------------------
154 // class ItemListenerMultiplexer
155 // ----------------------------------------------------
156 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
)
157 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer
, ::com::sun::star::awt::XItemListener
, itemStateChanged
, ::com::sun::star::awt::ItemEvent
)
159 // ----------------------------------------------------
160 // class ContainerListenerMultiplexer
161 // ----------------------------------------------------
162 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
)
163 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementInserted
, ::com::sun::star::container::ContainerEvent
)
164 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementRemoved
, ::com::sun::star::container::ContainerEvent
)
165 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer
, ::com::sun::star::container::XContainerListener
, elementReplaced
, ::com::sun::star::container::ContainerEvent
)
167 // ----------------------------------------------------
168 // class SpinListenerMultiplexer
169 // ----------------------------------------------------
170 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
)
171 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, up
, ::com::sun::star::awt::SpinEvent
)
172 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, down
, ::com::sun::star::awt::SpinEvent
)
173 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, first
, ::com::sun::star::awt::SpinEvent
)
174 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer
, ::com::sun::star::awt::XSpinListener
, last
, ::com::sun::star::awt::SpinEvent
)
176 // ----------------------------------------------------
177 // class AdjustmentListenerMultiplexer
178 // ----------------------------------------------------
179 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
)
180 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer
, ::com::sun::star::awt::XAdjustmentListener
, adjustmentValueChanged
, ::com::sun::star::awt::AdjustmentEvent
)
182 // ----------------------------------------------------
183 // class MenuListenerMultiplexer
184 // ----------------------------------------------------
185 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
)
186 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, highlight
, ::com::sun::star::awt::MenuEvent
)
187 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, select
, ::com::sun::star::awt::MenuEvent
)
188 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, activate
, ::com::sun::star::awt::MenuEvent
)
189 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer
, ::com::sun::star::awt::XMenuListener
, deactivate
, ::com::sun::star::awt::MenuEvent
)
191 // ----------------------------------------------------
192 // class TreeSelectionListenerMultiplexer
193 // ----------------------------------------------------
194 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
)
195 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer
, ::com::sun::star::view::XSelectionChangeListener
, selectionChanged
, ::com::sun::star::lang::EventObject
)
197 // ----------------------------------------------------
198 // class TreeSelectionListenerMultiplexer
199 // ----------------------------------------------------
200 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
)
201 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, requestChildNodes
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
202 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanding
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
203 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsing
, ::com::sun::star::awt::tree::TreeExpansionEvent
, ::com::sun::star::awt::tree::ExpandVetoException
)
204 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeExpanded
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
205 IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeExpansionListener
, treeCollapsed
, ::com::sun::star::awt::tree::TreeExpansionEvent
)
207 // ----------------------------------------------------
208 // class TreeEditListenerMultiplexer
209 // ----------------------------------------------------
210 IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer
, ::com::sun::star::awt::tree::XTreeEditListener
)