Issue 70149 - Runing macro when document is closed doesn't work
Summary: Runing macro when document is closed doesn't work
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL: http://www.oooforum.org/forum/viewtop...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-06 10:23 UTC by oisin_
Modified: 2017-05-20 11:27 UTC (History)
2 users (show)

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


Attachments
Bugdoc with example macro and event binding (8.70 KB, application/vnd.oasis.opendocument.text)
2006-10-06 12:28 UTC, jsc
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description oisin_ 2006-10-06 10:23:06 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.
Comment 1 jsc 2006-10-06 12:28:59 UTC
Created attachment 39606 [details]
Bugdoc with example macro and event binding
Comment 2 jsc 2006-10-06 12:30:02 UTC
i can reproduce this error and we will take a look on it
Comment 3 jsc 2006-10-11 09:42:33 UTC
jsc -> ab: as discussed you will take a closer look on it
Comment 4 ab 2006-10-12 11:55:29 UTC
STARTED, 2.1
Comment 5 oisin_ 2006-10-12 12:17:23 UTC
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
Comment 6 ab 2006-10-23 12:01:15 UTC
ScriptProtocolHandler::createScriptProvider can't get model any more.
Needs further evalution. P2 -> P3 according to priotity rules. -> OOo 2.2
Comment 7 ab 2006-10-23 12:02:03 UTC
P2 -> P3, next try
Comment 8 ab 2007-01-02 14:08:53 UTC
2.x due to limited resources.
Has to be evaluated and targeted together with all other 2.x tasks.
Comment 9 ab 2008-01-25 14:41:06 UTC
-> 3.x
Comment 10 Marcus 2017-05-20 11:27:33 UTC
Reset assigne to the default "issues@openoffice.apache.org".