Issue 79852 - Addons menu doesn't work from in document created from a templace
Summary: Addons menu doesn't work from in document created from a templace
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: cbrunet
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-21 03:28 UTC by cbrunet
Modified: 2013-02-24 21:08 UTC (History)
2 users (show)

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


Attachments
Example minimal extension that show the problem (1.96 KB, application/octet-stream)
2007-07-21 03:30 UTC, cbrunet
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description cbrunet 2007-07-21 03:28:59 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.
Comment 1 cbrunet 2007-07-21 03:30:27 UTC
Created attachment 46955 [details]
Example minimal extension that show the problem
Comment 2 jsc 2007-07-23 07:10:43 UTC
jsc -> cd: seems to be one for you
Comment 3 carsten.driesner 2007-08-02 08:43:03 UTC
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.
Comment 4 carsten.driesner 2007-12-04 15:02:36 UTC
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.
Comment 5 carsten.driesner 2007-12-05 12:32:54 UTC
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.
Comment 6 carsten.driesner 2007-12-05 12:34:02 UTC
cd: As this issue describes not a bug I have to set it to "INVALID".
Comment 7 Mechtilde 2008-11-06 13:40:06 UTC
close the invalid issue