Apache OpenOffice (AOO) Bugzilla – Issue 79852
Addons menu doesn't work from in document created from a templace
Last modified: 2013-02-24 21:08:40 UTC
When an Add-On create a document from a template, and that Add-On is in the Addon menu, the menu item doesn't work from the document created by the Add-on. The test-case will only work on Windows. You will need to modify the example extension to make it work on Linux. 1- Create a template called DocTemplate.ott and put it into C:\ 2- Install the attached extension 3- Call the command Tools > Addons > Nouveau document 4- A document is created from the template 5- Call the same command again 6- Nothing happens... * A new document should be created from the template.
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