1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ 25 #define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ 26 27 #include <toolkit/dllapi.h> 28 #include <com/sun/star/lang/XEventListener.hpp> 29 #include <com/sun/star/awt/XFocusListener.hpp> 30 #include <com/sun/star/awt/XWindowListener.hpp> 31 #include <com/sun/star/awt/XVclContainerListener.hpp> 32 #include <com/sun/star/awt/XKeyListener.hpp> 33 #include <com/sun/star/awt/XMouseListener.hpp> 34 #include <com/sun/star/awt/XMouseMotionListener.hpp> 35 #include <com/sun/star/awt/XPaintListener.hpp> 36 #include <com/sun/star/awt/XTopWindowListener.hpp> 37 #include <com/sun/star/awt/XTextListener.hpp> 38 #include <com/sun/star/awt/XActionListener.hpp> 39 #include <com/sun/star/awt/XItemListener.hpp> 40 #include <com/sun/star/container/XContainerListener.hpp> 41 #include <com/sun/star/awt/XSpinListener.hpp> 42 #include <com/sun/star/awt/XAdjustmentListener.hpp> 43 #include <com/sun/star/awt/XMenuListener.hpp> 44 #include <com/sun/star/awt/tree/XTreeExpansionListener.hpp> 45 #include <com/sun/star/awt/tree/XTreeEditListener.hpp> 46 #include <com/sun/star/view/XSelectionChangeListener.hpp> 47 #include <com/sun/star/util/VetoException.hpp> 48 #include <cppuhelper/weak.hxx> 49 #include <cppuhelper/interfacecontainer.hxx> 50 #include <osl/mutex.hxx> 51 #include <toolkit/helper/mutexhelper.hxx> 52 #include <toolkit/helper/macros.hxx> 53 #include <com/sun/star/awt/grid/XGridSelectionListener.hpp> 54 #include <com/sun/star/awt/tab/XTabPageContainerListener.hpp> 55 // ---------------------------------------------------- 56 // class ListenerMultiplexerBase 57 // ---------------------------------------------------- 58 59 class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase : public MutexHelper, 60 public ::cppu::OInterfaceContainerHelper, 61 public ::com::sun::star::uno::XInterface 62 { 63 private: 64 ::cppu::OWeakObject& mrContext; 65 66 protected: GetContext()67 ::cppu::OWeakObject& GetContext() { return mrContext; } 68 69 public: 70 ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ); 71 virtual ~ListenerMultiplexerBase(); 72 73 // ::com::sun::star::uno::XInterface 74 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()75 void SAL_CALL acquire() throw() { mrContext.acquire(); } release()76 void SAL_CALL release() throw() { mrContext.release(); } 77 }; 78 79 80 // ---------------------------------------------------- 81 // class EventListenerMultiplexer 82 // ---------------------------------------------------- 83 DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, ::com::sun::star::lang::XEventListener ) 84 DECL_LISTENERMULTIPLEXER_END 85 86 // ---------------------------------------------------- 87 // class FocusListenerMultiplexer 88 // ---------------------------------------------------- 89 DECL_LISTENERMULTIPLEXER_START( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener ) 90 void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException); 91 void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException); 92 DECL_LISTENERMULTIPLEXER_END 93 94 95 // ---------------------------------------------------- 96 // class WindowListenerMultiplexer 97 // ---------------------------------------------------- 98 DECL_LISTENERMULTIPLEXER_START( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener ) 99 void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException); 100 void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException); 101 void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 102 void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 103 DECL_LISTENERMULTIPLEXER_END 104 105 106 107 // ---------------------------------------------------- 108 // class VclContainerListenerMultiplexer 109 // ---------------------------------------------------- 110 DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener ) 111 void SAL_CALL windowAdded( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException); 112 void SAL_CALL windowRemoved( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException); 113 DECL_LISTENERMULTIPLEXER_END 114 115 // ---------------------------------------------------- 116 // class KeyListenerMultiplexer 117 // ---------------------------------------------------- 118 DECL_LISTENERMULTIPLEXER_START( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener ) 119 void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException); 120 void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException); 121 DECL_LISTENERMULTIPLEXER_END 122 123 // ---------------------------------------------------- 124 // class MouseListenerMultiplexer 125 // ---------------------------------------------------- 126 DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener ) 127 void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 128 void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 129 void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 130 void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 131 DECL_LISTENERMULTIPLEXER_END 132 133 // ---------------------------------------------------- 134 // class MouseMotionListenerMultiplexer 135 // ---------------------------------------------------- 136 DECL_LISTENERMULTIPLEXER_START( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener ) 137 void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 138 void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); 139 DECL_LISTENERMULTIPLEXER_END 140 141 // ---------------------------------------------------- 142 // class PaintListenerMultiplexer 143 // ---------------------------------------------------- 144 DECL_LISTENERMULTIPLEXER_START( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener ) 145 void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw(::com::sun::star::uno::RuntimeException); 146 DECL_LISTENERMULTIPLEXER_END 147 148 // ---------------------------------------------------- 149 // class TopWindowListenerMultiplexer 150 // ---------------------------------------------------- 151 DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener ) 152 void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 153 void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 154 void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 155 void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 156 void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 157 void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 158 void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); 159 DECL_LISTENERMULTIPLEXER_END 160 161 // ---------------------------------------------------- 162 // class TextListenerMultiplexer 163 // ---------------------------------------------------- 164 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener ) 165 void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 166 DECL_LISTENERMULTIPLEXER_END 167 168 // ---------------------------------------------------- 169 // class ActionListenerMultiplexer 170 // ---------------------------------------------------- 171 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener ) 172 void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 173 DECL_LISTENERMULTIPLEXER_END 174 175 // ---------------------------------------------------- 176 // class ItemListenerMultiplexer 177 // ---------------------------------------------------- 178 DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener ) 179 void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 180 DECL_LISTENERMULTIPLEXER_END 181 182 // ---------------------------------------------------- 183 // class ContainerListenerMultiplexer 184 // ---------------------------------------------------- 185 DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener ) 186 void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 187 void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 188 void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 189 DECL_LISTENERMULTIPLEXER_END 190 191 // ---------------------------------------------------- 192 // class SpinListenerMultiplexer 193 // ---------------------------------------------------- 194 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener ) 195 void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 196 void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 197 void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 198 void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 199 DECL_LISTENERMULTIPLEXER_END 200 201 // ---------------------------------------------------- 202 // class AdjustmentListenerMultiplexer 203 // ---------------------------------------------------- 204 DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener ) 205 void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 206 DECL_LISTENERMULTIPLEXER_END 207 208 // ---------------------------------------------------- 209 // class MenuListenerMultiplexer 210 // ---------------------------------------------------- 211 DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) 212 void SAL_CALL itemHighlighted( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 213 void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 214 void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 215 void SAL_CALL itemDeactivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 216 DECL_LISTENERMULTIPLEXER_END 217 218 // ---------------------------------------------------- 219 // class TreeSelectionListenerMultiplexer 220 // ---------------------------------------------------- 221 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener ) 222 virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); 223 DECL_LISTENERMULTIPLEXER_END 224 225 // ---------------------------------------------------- 226 // class TreeExpansionListenerMultiplexer 227 // ---------------------------------------------------- 228 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener ) 229 virtual void SAL_CALL requestChildNodes( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 230 virtual void SAL_CALL treeExpanding( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); 231 virtual void SAL_CALL treeCollapsing( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); 232 virtual void SAL_CALL treeExpanded( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 233 virtual void SAL_CALL treeCollapsed( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 234 DECL_LISTENERMULTIPLEXER_END 235 236 // ---------------------------------------------------- 237 // class TreeEditListenerMultiplexer 238 // ---------------------------------------------------- 239 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener ) 240 virtual void SAL_CALL nodeEditing( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException,::com::sun::star::util::VetoException); 241 virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException); 242 DECL_LISTENERMULTIPLEXER_END 243 244 // ---------------------------------------------------- 245 // class SelectionListenerMultiplexer 246 // ---------------------------------------------------- 247 DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener ) 248 void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 249 DECL_LISTENERMULTIPLEXER_END 250 251 // ---------------------------------------------------- 252 // class TabPageListenerMultiplexer 253 // ---------------------------------------------------- 254 DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener ) 255 void SAL_CALL tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 256 DECL_LISTENERMULTIPLEXER_END 257 258 #endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ 259 260