Hi Ariel,
just a question looking at your Java code example:
... cut ..
xScriptURIHelper = ScriptURIHelper.create( xContext,sLanguage, sLoc );
... cut ...
Where did you find the documentation about this variant of instantiating
a new style services?
mmm ... is it documented somewhere? ... yes in Professional UNO:
Java language binding
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Mapping_of_Services
C++ language binding
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Mapping_of_Services
"The semantics of both explicit and implicit service constructors in C++
are as follows. They are the same as for Java:
* The first argument to a service constructor is always a
com.sun.star.uno.XComponentContext, which must be a non-null reference.
[...]"
Did I already mention that you are the *best*?
;-)
Thank's an awful lot!
but to be honest I didn't learn it from the Dev's Guide, but thanks to
the code completion in NetBeans/MS Visual Studio/et.al.
8-)
---
This is just for the record how one would be able to take advantage of
the new style service instantiation from ooRexx (and depicting the
"classic" style for comparison):
-- ***** ooRexx *****
xContext = uno.connect() -- connect to server and retrieve the XContext
/* load the UNO class */
clz=uno.loadClass("com.sun.star.script.provider.ScriptURIHelper")
/* new style service, returns already a XScriptURIHelper interface
object! */
xScriptURIHelper = clz~create(xContext,"ooRexx","share")
...
Or (classic style instantiation):
-- ***** ooRexx *****
xContext = uno.connect() -- connect to server and retrieve the XContext
oSM = xContext~getServiceManager -- retrieve XMultiComponentFactory
/* create the service object */
sSrvc = "com.sun.star.script.provider.ScriptURIHelper"
mArgs = uno.createArray(.bsf4rexx~string.class, 2) /* create a
java.lang.String array */
mArgs[1]="ooRexx" /* assign first argument */
mArgs[2]="share" /* assign second argument */
oScriptURIHelper =
oSM~createInstanceWithArgumentsAndContext(sSrvc,mArgs,xContext)
xScriptURIHelper = oScriptURIHelper~XScriptUriHelper /* query its interface
*/
...
That's *quite* a difference in coding efforts !
Regards,
---rony