Hi Andre,
don't worry, XMultiServiceFactory works often as well for older
implementation objects. I would recommend that if you want to create new
instances of services globally over the service manager you should
always use XMultiComponentFactory. It's the newer and recommended way.
For context dependent services (e.g. the context of a text document) you
have to use the document specific XMultiServiceFactory. It depends but
as mentioned before XMultiComponentFacory is the recommended way and
should be preferred used if possible.
Juergen
Andre Heine wrote:
Hi Tobias,
thanks for your code:-)
Some code snippets from the developerguide uses
explicit "XMultiServiceFactory" but I must use "XMultiComponentFactory"...
I need some time to realize it;()
Greetings
Andre
Am Dienstag, 5. Februar 2008 09:52 schrieb Tobias Krais:
Hi Andre,
sorry, a little failure occured in my example:
-----%<-----
package de.designtouse.test;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public class Test2 {
public static void main(String args[]) {
XComponentContext xComponentContext = null;
try {
// Connect or start a OpenOffice instance
xComponentContext = Bootstrap.bootstrap();
}
catch (com.sun.star.comp.helper.BootstrapException e){
}
// get OO desktop
XMultiComponentFactory xMCF =
xComponentContext.getServiceManager();
try {
Object configProvider = xMCF.createInstanceWithContext(
"com.sun.star.configuration.ConfigurationProvider",
xComponentContext);
XMultiServiceFactory xMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class,
configProvider);
}
catch(Exception e) {
}
}
}
-----%<-----
Greetings, Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]