Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | Addons menu doesn't work from in document created from a templace | ||||||
---|---|---|---|---|---|---|---|
Product: | App Dev | Reporter: | cbrunet <charles.fmj> | ||||
Component: | api | Assignee: | cbrunet <charles.fmj> | ||||
Status: | CLOSED NOT_AN_OOO_ISSUE | QA Contact: | issues@api <issues> | ||||
Severity: | Trivial | ||||||
Priority: | P3 | CC: | issues, pagalmes.lists | ||||
Version: | 3.3.0 or older (OOo) | ||||||
Target Milestone: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Issue Type: | DEFECT | Latest Confirmation in: | --- | ||||
Developer Difficulty: | --- | ||||||
Attachments: |
|
Description
cbrunet
2007-07-21 03:28:59 UTC
Created attachment 46955 [details]
Example minimal extension that show the problem
jsc -> cd: seems to be one for you cd: Confirmed and accepted. I don't know why it doesn't work as the add-on code is not responsible to provide the function. It just tries to dispatch the URL. Set target to OOo 2.4. cd: Current status of this issue. The execution of the Basic macro is prevented due to some code in sfx2\source\appl\appuno.cxx, L. 1810. It's strange that this code is passed successfully with a new document create with "File - New" but not when the Add-on creates a document via the Basic macro. cd->cbrunet: It's not a bug but a feature. You have to provide more information to loadComponentFromURL to enable the execution of macros. The default handling of loadComponentFromURL disables the execution of macros for the loaded document. As your add-on uses a Basic macro that's exactly your problem. The following Basic script provides the needed information to enable macro execution. Your example works with a "Medium" macro security with my Office. REM ***** BASIC ***** Sub Main Dim oDoc Dim sPath$ Dim a(2) As New com.sun.star.beans.PropertyValue a(0).Name = "AsTemplate" a(0).Value = true a(1).Name = "MacroExecutionMode" a(1).Value = com.sun.star.document.MacroExecMode.USE_CONFIG a(2).Name = "InteractionHandler" a(2).Value = CreateUnoService( "com.sun.star.task.InteractionHandler" ) sPath$ = "file:///D:/DocTemplate.ott" oDoc = StarDesktop.LoadComponentFromUrl(sPath$, "_blank" , 0, a()) End Sub We recommend to use the dispatch API to load documents. The dispatch API is used by the menu and toolbar functions which guarantees that it provides the "right" properties to loadComponentFromURL. cd: As this issue describes not a bug I have to set it to "INVALID". close the invalid issue |