Cancel event propagation in an XEventListener

The Application Programming Interface and the OASIS Open Document Format

Cancel event propagation in an XEventListener

Postby bcris » Wed Oct 26, 2011 11:12 am

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:

Code: Select all   Expand viewCollapse view
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));


In this class I intercept the OnPrepareViewClosing event and call a project specific closing functionality, where at some point a project specific question message appears asking if the document should be saved (it has the buttons: yes, no, cancel).

If the user chooses to save the document, the project specific saving functionality is processed, that includes setting the modified flag to false and than the DocumentEventListener functionality is finished, the event is further propagated and Open Office closes the document.

If however, the user chooses to cancel the closing than the project specific handling is finished, the modified flag is not set to false, the event is further propagated and the Open Office specific question message about saving the document appears. Is there any possibility to cancel the event propagation from within the DocumentEventListener class ?

Thanks in advance !
OpenOffice 3.3 on Windows XP SP3
bcris
 
Posts: 21
Joined: Wed Aug 17, 2011 3:51 pm

Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 3 guests