Apache OpenOffice (AOO) Bugzilla – Issue 86351
OO used in a server (java) : Impossible to call a macro in a document
Last modified: 2017-05-20 11:27:33 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...
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);
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);
Created attachment 51654 [details] ODT with the simple macro
This is not P1 but probably P2. Andreas, any clue about this?
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
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.
Yes, that is exactly what i did : XFrame vFrameDoc = ((XModel) UnoRuntime.queryInterface(XModel.class, vDocSrc)).getCurrentController().getFrame();
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.
Reset assigne to the default "issues@openoffice.apache.org".