Issue 118896 - BASIC needs a throwRuntimeException() function
Summary: BASIC needs a throwRuntimeException() function
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-10 12:14 UTC by DonJaime
Modified: 2013-02-24 21:00 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description DonJaime 2012-02-10 12:14:57 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.
Comment 1 bmarcelly 2012-02-16 13:08:20 UTC
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.
Comment 2 DonJaime 2012-02-23 18:32:29 UTC
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.
Comment 3 Oliver-Rainer Wittmann 2012-06-13 12:16:32 UTC
getting rid of value "enhancement" for field "severity".
For enhancement the field "issue type" shall be used.