Issue 86351 - OO used in a server (java) : Impossible to call a macro in a document
Summary: OO used in a server (java) : Impossible to call a macro in a document
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P2 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-22 12:23 UTC by apourche
Modified: 2017-05-20 11:27 UTC (History)
3 users (show)

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


Attachments
ODT with the simple macro (88.09 KB, application/vnd.oasis.opendocument.text)
2008-02-22 12:28 UTC, apourche
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description apourche 2008-02-22 12:23:32 UTC
In java, when I call a macro in a writer document load with property
"Hidden=true", i have this error :
"
Caused by: com.sun.star.script.provider.ScriptFrameworkErrorException:
BasicProviderImpl::getScript: no script!
	at
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:187)
	at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:153)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:349)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:318)
	at
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
	at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:657)
"

When i load the document with property "Hidden=false" and call the same macro,
all is OK.

This is a big bug to use OO as a server tools...
Comment 1 apourche 2008-02-22 12:25:13 UTC
Means to load the document :
String vUrl =
com.sun.star.uri.ExternalUriReferenceTranslator.create(OoBootstrap.sComponentContext).translateToInternal(((File)
pSrc).toURL().toExternalForm());//"file://".concat(((File)
pSrc).toURL().toExternalForm().substring(5));
PropertyValue vProps[] = new PropertyValue[3];
vProps[0] = new PropertyValue();
vProps[0].Name = "Hidden";
vProps[0].Value = Boolean.TRUE;
vProps[1] = new PropertyValue();
vProps[1].Name = "UpdateDocMode";
vProps[1].Value = new Short(UpdateDocMode.FULL_UPDATE);
vProps[2] = new PropertyValue();
vProps[2].Name = "MacroExecutionMode";
vProps[2].Value = new Short(MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
Object vDocSrc = vCompLoader.loadComponentFromURL(vUrl, "_blank", 0, vProps);
Comment 2 apourche 2008-02-22 12:26:34 UTC
Means to call macro :
XDispatchHelper vDipatchHelper = (XDispatchHelper)
UnoRuntime.queryInterface(XDispatchHelper.class,
OoBootstrap.createService("com.sun.star.frame.DispatchHelper"));
vDipatchHelper.executeDispatch((XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class, vFrameDoc),
"vnd.sun.star.script:SCENARI.keepAuto.Main?language=Basic&location=document",
"", 0, null);
			
Comment 3 apourche 2008-02-22 12:28:00 UTC
Created attachment 51654 [details]
ODT with the simple macro
Comment 4 kay.ramme 2008-02-22 12:57:19 UTC
This is not P1 but probably P2. 

Andreas, any clue about this?
Comment 5 ab 2008-03-11 11:24:18 UTC
Needs evaluation. I even doubt this is P2 as I don't see the significant
number of customers affected here. STARTED, OOo 3.x for now
Comment 6 richfearn 2008-03-19 17:10:25 UTC
Where does your vFrameDoc parameter come from? Are you using
desktop.getCurrentFrame(), or are you getting it from the spreadsheet document
itself (vDocSrc) ?

If you're not already doing this, try converting the spreadsheet to an XModel
and get the frame from that:

  XModel model = (XModel) UnoRuntime.queryInterface(XModel.class, vDocSrc);
  XFrame frame = model.getCurrentController().getFrame();

and use frame instead of vFrameDoc.
Comment 7 apourche 2008-03-31 14:48:53 UTC
Yes, that is exactly what i did :
XFrame vFrameDoc = ((XModel) UnoRuntime.queryInterface(XModel.class,
vDocSrc)).getCurrentController().getFrame();
Comment 8 mux2005 2008-10-02 13:24:50 UTC
Our organization has hit this problem, too and it's a usability issue for us.
The user triggers an action on the server (e.g. via a web app) and the
user-visible result is supposed to be that a document comes out of the user's
printer. From the user's POV he is interacting with a server. It's very
undesirable to have an unexpected OpenOffice.org window pop up on the user in
which he can observe (or even worse disturb by careless mouse clicks/key
presses) the macro-driven document generation.

I have examined the problem and I've noticed that the XBrowseNode-tree for an
invisible document lacks the macro-leaves, i.e. if you take the
XScriptProviderSupplier interface of the invisible document and then use
getScriptProvider() to get its script provider (which implements XBrowseNode)
and start walking the XBrowseNode tree, you get the child node "Basic", but this
node has no children. It should have the Basic macros as children. Maybe this
information can help pinpoint the issue.
Comment 9 Marcus 2017-05-20 11:27:33 UTC
Reset assigne to the default "issues@openoffice.apache.org".