Apache OpenOffice (AOO) Bugzilla – Issue 118896
BASIC needs a throwRuntimeException() function
Last modified: 2013-02-24 21:00:34 UTC
There are some things that can only be done by throwing an exception. For example, Page 13 of http://www.openoffice.org/documentation/HOW_TO/various_topics/VbaStarBasicXref.pdf, addressing the differences between VBA and OOo BASIC happily states that "To cancel the close in OOo, you must register a listener for the close event and then veto the close." But at http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/XCloseListener.html we read that to veto the close the listener has to throw a closeVetoException. Which BASIC can't do. So you have to jump through a lot of hoops, register a dispatch interceptor, crash the application if you get it wrong, etc. Something like throwRuntimeException("com.sun.star.util.CloseVetoException") would make life easier.
For your information, read this message from Mathias Bauer : http://www.mail-archive.com/dev@api.openoffice.org/msg03222.html My attempts to use the service com.sun.star.embed.InstanceLocker from Basic were unsuccessful, the document still closes.
com.sun.star.embed.InstanceLocker will prevent closure of a document, but not usefully if the user has tried to close it, since the frame still closes: see Bug 118965. Using an InstanceLocker on the frame can stop the user closing a document, but requires caution if the document is closed using the api, since it is possible for the frame to remain, displaying a document that no longer exists. See the test document at the above bug.
getting rid of value "enhancement" for field "severity". For enhancement the field "issue type" shall be used.