Cancel event propagation in an XEventListener

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
snnyspuc
Posts: 1
Joined: Mon Apr 13, 2015 11:48 am

Cancel event propagation in an XEventListener

Post 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));
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cancel event propagation in an XEventListener

Post 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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply