Apache OpenOffice (AOO) Bugzilla – Issue 70149
Runing macro when document is closed doesn't work
Last modified: 2017-05-20 11:27:33 UTC
Under Tools -> Configure -> Events in Writer there are two events regarding the closing of a document: Document close and Document is closing (in German i.e Dokument schließen and Dokument wird geschlossen. The first is executed before the user is asked whether he is sure and whether he wants to save and the second is executed when the document is really closed. In my case, I want to implement the second but here is my problem: Writer seems to dispose the basic code before the macro is executed thus throwing an error upon closing the document. To reproduce try the following: - Create a new Writer document - Create a macro. Sub DocumentIsClosing msgbox "DocumentIsClosing" End Sub - Tools -> Configure -> Events -> Document is closing -> Assign --> select the unnamed document -> Standard -> Modul1 -> DocumentIsClosing --> OK --> OK - save the document - close the document --> Error in scripting framework: BasicProviderImpl::getScript: no script! Apparently the scripts are removed, before the actual document is closed. This would work if the code would be placed in a library outside the document. But in my scenario described in http://www.oooforum.org/forum/ viewtopic.phtml?p=176559#176559 this is not practicable. I need the code to be inside the document being closed. My suggestion would be to keep the scripts until all relevant events have been fired. Macros in a document should no rely on funtionality in an external library. Background: Upon opening the document I assign listeners to form controls that have to be removed upon closing. If this removal isn't done, OOo crashes. P.S. If this isn't the correct component for the issue, please move it. I wasn't very sure about which component to choose.
Created attachment 39606 [details] Bugdoc with example macro and event binding
i can reproduce this error and we will take a look on it
jsc -> ab: as discussed you will take a closer look on it
STARTED, 2.1
While this bug is being worked on, there is a workaround at http:// www.oooforum.org/forum/viewtopic.phtml?p=178550#178550 using an EventListener on the Document->Disposing event that does the job
ScriptProtocolHandler::createScriptProvider can't get model any more. Needs further evalution. P2 -> P3 according to priotity rules. -> OOo 2.2
P2 -> P3, next try
2.x due to limited resources. Has to be evaluated and targeted together with all other 2.x tasks.
-> 3.x
Reset assigne to the default "issues@openoffice.apache.org".