22 #include <osl/diagnose.h>
25 #include <com/sun/star/awt/XWindow.hpp>
26 #include <com/sun/star/awt/XTopWindow.hpp>
28 using namespace ::
cppu;
29 using namespace ::
osl;
38 #define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \
41 OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( cppu::UnoType<INTERFACE>::get() ); \
43 if( pContainer != nullptr ) \
45 OInterfaceIteratorHelper aIterator( *pContainer ); \
46 EVENTTYP aLocalEvent = EVENT; \
49 aLocalEvent.Source = m_xControl; \
51 if( aLocalEvent.Source.is() ) \
53 if( aIterator.hasMoreElements() ) \
55 INTERFACE * pListener = static_cast<INTERFACE *>(aIterator.next()); \
58 pListener->METHOD( aLocalEvent ); \
60 catch(const RuntimeException& ) \
71 const Reference< XWindow >& xPeer )
83 , XMouseMotionListener()
85 , XTopWindowListener()
86 , OWeakObject(aCopyInstance)
105 static_cast< XWindowListener* > (
this ) ,
106 static_cast< XKeyListener* > (
this ) ,
107 static_cast< XFocusListener* > (
this ) ,
108 static_cast< XMouseListener* > (
this ) ,
109 static_cast< XMouseMotionListener* > (
this ) ,
110 static_cast< XPaintListener* > (
this ) ,
111 static_cast< XTopWindowListener* > (
this ) ,
112 static_cast< XTopWindowListener* > (
this )
117 if ( aReturn.hasValue() )
125 return OWeakObject::queryInterface( rType );
137 OWeakObject::acquire();
148 OWeakObject::release();
164 for(
const auto& rContainedType : aContainedTypes )
173 for(
const auto& rContainedType : aContainedTypes )
190 const Reference< XInterface >& xListener )
206 const Reference< XInterface >& xListener )
389 xPeer->addWindowListener(
this );
391 xPeer->addKeyListener(
this );
393 xPeer->addFocusListener(
this );
395 xPeer->addMouseListener(
this );
397 xPeer->addMouseMotionListener(
this );
399 xPeer->addPaintListener(
this );
402 Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
404 xTop->addTopWindowListener(
this );
408 OSL_FAIL(
"unknown listener" );
419 xPeer->removeWindowListener(
this );
421 xPeer->removeKeyListener(
this );
423 xPeer->removeFocusListener(
this );
425 xPeer->removeMouseListener(
this );
427 xPeer->removeMouseMotionListener(
this );
429 xPeer->removePaintListener(
this );
432 Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
434 xTop->removeTopWindowListener(
this );
438 OSL_FAIL(
"unknown listener" );
virtual void SAL_CALL mouseMoved(const css::awt::MouseEvent &aEvent) override
void impl_adviseToPeer(const css::uno::Reference< css::awt::XWindow > &xPeer, const css::uno::Type &aType)
Remove the listener from the peer.
void unadvise(const css::uno::Type &aType, const css::uno::Reference< css::uno::XInterface > &xListener)
Remove the specified listener from the source.
void advise(const css::uno::Type &aType, const css::uno::Reference< css::uno::XInterface > &xListener)
Add the specified listener to the source.
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &aEvent) override
virtual void SAL_CALL windowClosed(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL keyReleased(const css::awt::KeyEvent &aEvent) override
sal_Int32 SAL_CALL removeInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
virtual void SAL_CALL windowOpened(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &aEvent) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported The interfaces are searched by type.
virtual void SAL_CALL windowActivated(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL mouseDragged(const css::awt::MouseEvent &aEvent) override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &aEvent) override
virtual void SAL_CALL focusLost(const css::awt::FocusEvent &aEvent) override
void setPeer(const css::uno::Reference< css::awt::XWindow > &xPeer)
Remove all listeners from the previous set peer and add the needed listeners to rPeer.
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerHolder
virtual void SAL_CALL keyPressed(const css::awt::KeyEvent &aEvent) override
sal_Int32 SAL_CALL addInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
virtual void SAL_CALL focusGained(const css::awt::FocusEvent &aEvent) override
virtual void SAL_CALL windowDeactivated(const css::lang::EventObject &aEvent) override
css::uno::WeakReference< css::awt::XWindow > m_xControl
The source of the events. Normally this is the peer object.
OMRCListenerMultiplexerHelper(const css::uno::Reference< css::awt::XWindow > &xControl, const css::uno::Reference< css::awt::XWindow > &xPeer)
constructor Create a Multiplexer of XWindowEvents.
virtual void SAL_CALL disposing(const css::lang::EventObject &aSource) override
#define MULTIPLEX(INTERFACE, METHOD, EVENTTYP, EVENT)
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &aEvent) override
void SAL_CALL disposeAndClear(const css::lang::EventObject &rEvt)
virtual void SAL_CALL acquire() override
increment refcount XInterface release() A RuntimeException is thrown.
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &aEvent) override
virtual void SAL_CALL windowNormalized(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL windowHidden(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &aEvent) override
css::uno::Sequence< css::uno::Type > SAL_CALL getContainedTypes() const
virtual void SAL_CALL windowMinimized(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &aEvent) override
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &aEvent) override
virtual void SAL_CALL release() override
decrement refcount XInterface acquire() A RuntimeException is thrown.
virtual void SAL_CALL windowClosing(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::awt::XWindow > m_xPeer
virtual ~OMRCListenerMultiplexerHelper() override
void impl_unadviseFromPeer(const css::uno::Reference< css::awt::XWindow > &xPeer, const css::uno::Type &aType)
Add the listener to the peer.
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
void disposeAndClear()
Remove all listeners and send a disposing message.