diff options
Diffstat (limited to 'UnoControls/source/base/multiplexer.cxx')
-rw-r--r-- | UnoControls/source/base/multiplexer.cxx | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx index 4ac7156eb2ae..59383e882eed 100644 --- a/UnoControls/source/base/multiplexer.cxx +++ b/UnoControls/source/base/multiplexer.cxx @@ -30,57 +30,57 @@ #include <osl/diagnose.h> -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::lang ; +using namespace ::cppu ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::awt ; +using namespace ::com::sun::star::lang ; namespace unocontrols{ //____________________________________________________________________________________________________________ -// macros +// macros //____________________________________________________________________________________________________________ -#define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \ +#define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \ \ - /* First get all interfaces from container with right type.*/ \ - OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( ::getCppuType((const Reference< INTERFACE >*)0) ); \ - /* Do the follow only, if elements in container exist.*/ \ - if( pContainer != NULL ) \ - { \ - OInterfaceIteratorHelper aIterator( *pContainer ); \ - EVENTTYP aLocalEvent = EVENT; \ - /* Remark: The control is the event source not the peer.*/ \ - /* We must change the source of the event. */ \ - aLocalEvent.Source = m_xControl ; \ - /* Is the control not destroyed? */ \ - if( aLocalEvent.Source.is() == sal_True ) \ - { \ - if( aIterator.hasMoreElements() ) \ - { \ - INTERFACE * pListener = (INTERFACE *)aIterator.next(); \ - try \ - { \ - pListener->METHOD( aLocalEvent ); \ - } \ - catch( RuntimeException& ) \ - { \ - /* Ignore all system exceptions from the listener! */ \ - } \ - } \ - } \ + /* First get all interfaces from container with right type.*/ \ + OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( ::getCppuType((const Reference< INTERFACE >*)0) ); \ + /* Do the follow only, if elements in container exist.*/ \ + if( pContainer != NULL ) \ + { \ + OInterfaceIteratorHelper aIterator( *pContainer ); \ + EVENTTYP aLocalEvent = EVENT; \ + /* Remark: The control is the event source not the peer.*/ \ + /* We must change the source of the event. */ \ + aLocalEvent.Source = m_xControl ; \ + /* Is the control not destroyed? */ \ + if( aLocalEvent.Source.is() == sal_True ) \ + { \ + if( aIterator.hasMoreElements() ) \ + { \ + INTERFACE * pListener = (INTERFACE *)aIterator.next(); \ + try \ + { \ + pListener->METHOD( aLocalEvent ); \ + } \ + catch( RuntimeException& ) \ + { \ + /* Ignore all system exceptions from the listener! */ \ + } \ + } \ + } \ } //____________________________________________________________________________________________________________ -// construct/destruct +// construct/destruct //____________________________________________________________________________________________________________ -OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const Reference< XWindow >& xControl , - const Reference< XWindow >& xPeer ) - : m_xPeer ( xPeer ) - , m_xControl ( xControl ) - , m_aListenerHolder ( m_aMutex ) +OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const Reference< XWindow >& xControl , + const Reference< XWindow >& xPeer ) + : m_xPeer ( xPeer ) + , m_xControl ( xControl ) + , m_aListenerHolder ( m_aMutex ) { } @@ -93,7 +93,7 @@ OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const OMRCListener , XPaintListener() , XTopWindowListener() , OWeakObject() - , m_aListenerHolder ( m_aMutex ) + , m_aListenerHolder ( m_aMutex ) { } @@ -102,25 +102,25 @@ OMRCListenerMultiplexerHelper::~OMRCListenerMultiplexerHelper() } //____________________________________________________________________________________________________________ -// XInterface +// XInterface //____________________________________________________________________________________________________________ Any SAL_CALL OMRCListenerMultiplexerHelper::queryInterface( const Type& rType ) throw( RuntimeException ) { // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + // Don't use mutex or guard in this method!!! Is a method of XInterface. // Ask for my own supported interfaces ... // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( rType , - static_cast< XWindowListener* > ( this ) , - static_cast< XKeyListener* > ( this ) , - static_cast< XFocusListener* > ( this ) , - static_cast< XMouseListener* > ( this ) , - static_cast< XMouseMotionListener* > ( this ) , - static_cast< XPaintListener* > ( this ) , - static_cast< XTopWindowListener* > ( this ) , - static_cast< XTopWindowListener* > ( this ) + Any aReturn ( ::cppu::queryInterface( rType , + static_cast< XWindowListener* > ( this ) , + static_cast< XKeyListener* > ( this ) , + static_cast< XFocusListener* > ( this ) , + static_cast< XMouseListener* > ( this ) , + static_cast< XMouseMotionListener* > ( this ) , + static_cast< XPaintListener* > ( this ) , + static_cast< XTopWindowListener* > ( this ) , + static_cast< XTopWindowListener* > ( this ) ) ); @@ -138,33 +138,33 @@ Any SAL_CALL OMRCListenerMultiplexerHelper::queryInterface( const Type& rType ) } //____________________________________________________________________________________________________________ -// XInterface +// XInterface //____________________________________________________________________________________________________________ void SAL_CALL OMRCListenerMultiplexerHelper::acquire() throw() { // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + // Don't use mutex or guard in this method!!! Is a method of XInterface. // Forward to baseclass OWeakObject::acquire(); } //____________________________________________________________________________________________________________ -// XInterface +// XInterface //____________________________________________________________________________________________________________ void SAL_CALL OMRCListenerMultiplexerHelper::release() throw() { // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + // Don't use mutex or guard in this method!!! Is a method of XInterface. // Forward to baseclass OWeakObject::release(); } //____________________________________________________________________________________________________________ -// operator +// operator //____________________________________________________________________________________________________________ OMRCListenerMultiplexerHelper::operator Reference< XInterface >() const @@ -173,16 +173,16 @@ OMRCListenerMultiplexerHelper::operator Reference< XInterface >() const } //____________________________________________________________________________________________________________ -// operator +// operator //____________________________________________________________________________________________________________ //OMRCListenerMultiplexerHelper& OMRCListenerMultiplexerHelper::operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance ) //{ -// return this ; +// return this ; //} //____________________________________________________________________________________________________________ -// container method +// container method //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) @@ -193,9 +193,9 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) if( m_xPeer.is() ) { // get all types from the listener added to the peer - Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); - const Type* pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); + Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + const Type* pArray = aContainedTypes.getConstArray(); + sal_Int32 nCount = aContainedTypes.getLength(); // loop over all listener types and remove the listeners from the peer for( sal_Int32 i=0; i<nCount; i++ ) impl_unadviseFromPeer( m_xPeer, pArray[i] ); @@ -204,9 +204,9 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) if( m_xPeer.is() ) { // get all types from the listener added to the peer - Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); - const Type* pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); + Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + const Type* pArray = aContainedTypes.getConstArray(); + sal_Int32 nCount = aContainedTypes.getLength(); // loop over all listener types and add the listeners to the peer for( sal_Int32 i = 0; i < nCount; i++ ) impl_adviseToPeer( m_xPeer, pArray[i] ); @@ -215,7 +215,7 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) } //____________________________________________________________________________________________________________ -// container method +// container method //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::disposeAndClear() @@ -226,11 +226,11 @@ void OMRCListenerMultiplexerHelper::disposeAndClear() } //____________________________________________________________________________________________________________ -// container method +// container method //____________________________________________________________________________________________________________ -void OMRCListenerMultiplexerHelper::advise( const Type& aType , - const Reference< XInterface >& xListener ) +void OMRCListenerMultiplexerHelper::advise( const Type& aType , + const Reference< XInterface >& xListener ) { MutexGuard aGuard( m_aMutex ); if( m_aListenerHolder.addInterface( aType, xListener ) == 1 ) @@ -244,11 +244,11 @@ void OMRCListenerMultiplexerHelper::advise( const Type& } //____________________________________________________________________________________________________________ -// container method +// container method //____________________________________________________________________________________________________________ -void OMRCListenerMultiplexerHelper::unadvise( const Type& aType , - const Reference< XInterface >& xListener ) +void OMRCListenerMultiplexerHelper::unadvise( const Type& aType , + const Reference< XInterface >& xListener ) { MutexGuard aGuard( m_aMutex ); if( m_aListenerHolder.removeInterface( aType, xListener ) == 0 ) @@ -262,7 +262,7 @@ void OMRCListenerMultiplexerHelper::unadvise( const Type& } //____________________________________________________________________________________________________________ -// XEventListener +// XEventListener //____________________________________________________________________________________________________________ void SAL_CALL OMRCListenerMultiplexerHelper::disposing( const EventObject& /*aSource*/ ) throw( RuntimeException ) @@ -273,7 +273,7 @@ void SAL_CALL OMRCListenerMultiplexerHelper::disposing( const EventObject& /*aSo } //____________________________________________________________________________________________________________ -// XFcousListener +// XFcousListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::focusGained(const FocusEvent& aEvent ) throw( RuntimeException ) @@ -282,7 +282,7 @@ void OMRCListenerMultiplexerHelper::focusGained(const FocusEvent& aEvent ) throw } //____________________________________________________________________________________________________________ -// XFcousListener +// XFcousListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::focusLost(const FocusEvent& aEvent ) throw( RuntimeException ) @@ -291,7 +291,7 @@ void OMRCListenerMultiplexerHelper::focusLost(const FocusEvent& aEvent ) throw( } //____________________________________________________________________________________________________________ -// XWindowListener +// XWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowResized(const WindowEvent& aEvent ) throw( RuntimeException ) @@ -300,7 +300,7 @@ void OMRCListenerMultiplexerHelper::windowResized(const WindowEvent& aEvent ) th } //____________________________________________________________________________________________________________ -// XWindowListener +// XWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowMoved(const WindowEvent& aEvent ) throw( RuntimeException ) @@ -309,7 +309,7 @@ void OMRCListenerMultiplexerHelper::windowMoved(const WindowEvent& aEvent ) thro } //____________________________________________________________________________________________________________ -// XWindowListener +// XWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowShown(const EventObject& aEvent ) throw( RuntimeException ) @@ -318,7 +318,7 @@ void OMRCListenerMultiplexerHelper::windowShown(const EventObject& aEvent ) thro } //____________________________________________________________________________________________________________ -// XWindowListener +// XWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowHidden(const EventObject& aEvent ) throw( RuntimeException ) @@ -327,7 +327,7 @@ void OMRCListenerMultiplexerHelper::windowHidden(const EventObject& aEvent ) thr } //____________________________________________________________________________________________________________ -// XKeyListener +// XKeyListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::keyPressed(const KeyEvent& aEvent) throw( RuntimeException ) @@ -336,7 +336,7 @@ void OMRCListenerMultiplexerHelper::keyPressed(const KeyEvent& aEvent) throw( Ru } //____________________________________________________________________________________________________________ -// XKeyListener +// XKeyListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::keyReleased(const KeyEvent& aEvent) throw( RuntimeException ) @@ -345,7 +345,7 @@ void OMRCListenerMultiplexerHelper::keyReleased(const KeyEvent& aEvent) throw( R } //____________________________________________________________________________________________________________ -// XMouseListener +// XMouseListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mousePressed(const MouseEvent& aEvent) throw( RuntimeException ) @@ -354,7 +354,7 @@ void OMRCListenerMultiplexerHelper::mousePressed(const MouseEvent& aEvent) throw } //____________________________________________________________________________________________________________ -// XMouseListener +// XMouseListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mouseReleased(const MouseEvent& aEvent) throw( RuntimeException ) @@ -363,7 +363,7 @@ void OMRCListenerMultiplexerHelper::mouseReleased(const MouseEvent& aEvent) thro } //____________________________________________________________________________________________________________ -// XMouseListener +// XMouseListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mouseEntered(const MouseEvent& aEvent) throw( RuntimeException ) @@ -372,7 +372,7 @@ void OMRCListenerMultiplexerHelper::mouseEntered(const MouseEvent& aEvent) throw } //____________________________________________________________________________________________________________ -// XMouseListener +// XMouseListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mouseExited(const MouseEvent& aEvent) throw( RuntimeException ) @@ -381,7 +381,7 @@ void OMRCListenerMultiplexerHelper::mouseExited(const MouseEvent& aEvent) throw( } //____________________________________________________________________________________________________________ -// XMouseMotionListener +// XMouseMotionListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mouseDragged(const MouseEvent& aEvent) throw( RuntimeException ) @@ -390,7 +390,7 @@ void OMRCListenerMultiplexerHelper::mouseDragged(const MouseEvent& aEvent) throw } //____________________________________________________________________________________________________________ -// XMouseMotionListener +// XMouseMotionListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::mouseMoved(const MouseEvent& aEvent) throw( RuntimeException ) @@ -399,7 +399,7 @@ void OMRCListenerMultiplexerHelper::mouseMoved(const MouseEvent& aEvent) throw( } //____________________________________________________________________________________________________________ -// XPaintListener +// XPaintListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowPaint(const PaintEvent& aEvent) throw( RuntimeException ) @@ -408,7 +408,7 @@ void OMRCListenerMultiplexerHelper::windowPaint(const PaintEvent& aEvent) throw( } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowOpened(const EventObject& aEvent) throw( RuntimeException ) @@ -417,7 +417,7 @@ void OMRCListenerMultiplexerHelper::windowOpened(const EventObject& aEvent) thro } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowClosing( const EventObject& aEvent ) throw( RuntimeException ) @@ -426,7 +426,7 @@ void OMRCListenerMultiplexerHelper::windowClosing( const EventObject& aEvent ) t } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowClosed( const EventObject& aEvent ) throw( RuntimeException ) @@ -435,7 +435,7 @@ void OMRCListenerMultiplexerHelper::windowClosed( const EventObject& aEvent ) th } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowMinimized( const EventObject& aEvent ) throw( RuntimeException ) @@ -444,7 +444,7 @@ void OMRCListenerMultiplexerHelper::windowMinimized( const EventObject& aEvent ) } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowNormalized( const EventObject& aEvent ) throw( RuntimeException ) @@ -453,7 +453,7 @@ void OMRCListenerMultiplexerHelper::windowNormalized( const EventObject& aEvent } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowActivated( const EventObject& aEvent ) throw( RuntimeException ) @@ -462,7 +462,7 @@ void OMRCListenerMultiplexerHelper::windowActivated( const EventObject& aEvent ) } //____________________________________________________________________________________________________________ -// XTopWindowListener +// XTopWindowListener //____________________________________________________________________________________________________________ void OMRCListenerMultiplexerHelper::windowDeactivated( const EventObject& aEvent ) throw( RuntimeException ) @@ -471,11 +471,11 @@ void OMRCListenerMultiplexerHelper::windowDeactivated( const EventObject& aEvent } //____________________________________________________________________________________________________________ -// protected method +// protected method //____________________________________________________________________________________________________________ -void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWindow >& xPeer , - const Type& aType ) +void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWindow >& xPeer , + const Type& aType ) { // add a listener to the source (peer) if( aType == ::getCppuType((const Reference< XWindowListener >*)0) ) @@ -503,11 +503,11 @@ void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWind } //____________________________________________________________________________________________________________ -// protected method +// protected method //____________________________________________________________________________________________________________ -void OMRCListenerMultiplexerHelper::impl_unadviseFromPeer( const Reference< XWindow >& xPeer , - const Type& aType ) +void OMRCListenerMultiplexerHelper::impl_unadviseFromPeer( const Reference< XWindow >& xPeer , + const Type& aType ) { // the last listener is removed, remove the listener from the source (peer) if( aType == ::getCppuType((const Reference< XWindowListener >*)0) ) |