bcris General User

Joined: 28 Sep 2011 Posts: 12
|
Posted: Wed Oct 19, 2011 12:54 am Post subject: Cancel event propagation in an XEventListener |
|
|
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: |
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 ! |
|