Hi Paolo,

Paolo Mantovani escribió:
Il sabato 14 giugno 2008 22:13:45 Ariel Constenla-Haile ha scritto:
[....]
http://api.openoffice.org/docs/common/ref/com/sun/star/script/provider/Scri
ptURIHelper.html for the service description ("This service is used to help
transform Scripting Framework storage locations to Scripting Framework
script URIs and vice versa."), this *seems* to be what you're looking for
(didn't try it yet in Basic, as there is no simple way to instantiate a
new-style service here;

I must admit that I don't know the exact meaning of "new-style service" but

a new style service is one that in order to get an instance, you don't
have *first* to instantiate it at the service manager by its name and
*then* get a reference to its interface(s) (because createInstance...
returns a generic XInterface that has to be safely casted).

In Java:

Object oDesktop = xContext.getServiceManager().createInstanceWithContext(
                    "com.sun.star.frame.Desktop", xContext);

            XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(
                    XDesktop.class, oDesktop);

            XComponentLoader xComponentLoader = (XComponentLoader)
UnoRuntime.queryInterface(
                    XComponentLoader.class, xDesktop);


A new style service has constructor(s) to instantiate it, and directly
returns a reference to its interface.
For example
http://api.openoffice.org/docs/common/ref/com/sun/star/deployment/ui/PackageManagerDialog.html

XAsynchronousExecutableDialog xPackageManagerDialog =
                    PackageManagerDialog.create(xContext, xWindow,
sContext);


For strictly type-safe languages like Java and C++ new-style services
(together with multiple inheritance) make things *simpler*, as seen in
the examples above.

But for OOo *Basic*, where we already have the simple
createUnoService(), things are - IMO - made *harder* ...

I've tried with createInstanceWithArguments on the service manager and it seems to work:

... as one can't use with them the createUnoService() shortcut, but
createInstanceWithArgumentsAndContext

Notice that one has to use the
css.lang.XMultiComponentFactory:createInstanceWithContext/createInstanceWithArgumentsAndContext,

not the old
css.lang.XMultiServiceFactory:createInstance/createInstanceWithArguments,
although the former still works; see Jürgen's comment on
http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=18526

And even this is not completely "safe" in OOo Basic, as it is
implementation specific; quoting Frank's in
http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=18530

"So, the bottom line is: createInstanceWithArguments[AndContext] *might*
work, but if it doesn't (or stops working the next version), don't
complain."

Frank's issue requesting support for new-style service constructors in
Basic is http://www.openoffice.org/issues/show_bug.cgi?id=82918,
targeted to 3.X due to lack of resources.

Regards
Ariel.

--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to