Page 1 of 1

Cancel event propagation in an XEventListener

PostPosted: Mon Apr 13, 2015 11:49 am
by snnyspuc
Is there any possibility to cancel the event propagation in an XEventListener ?

I have a class, DocumentEventListener, implementing the XEventListener interface which is added as a listener with the following code:

Object globalEventBroadcaster = m_xContext.getServiceManager().createInstanceWithContext("com.sun.star.frame.GlobalEventBroadcaster", m_xContext);

XEventBroadcaster xEVBC = (XEventBroadcaster) UnoRuntime.queryInterface(XEventBroadcaster.class, globalEventBroadcaster);

xEVBC.addEventListener(new DocumentEventListener(m_xContext));

Re: Cancel event propagation in an XEventListener

PostPosted: Mon Apr 13, 2015 8:07 pm
by Villeroy
Remove the event listener. This requires a reference to the original listener you attached to the calling object. In Basic you would assign a global variable to the listener and add/remove this object as needed.