Hi!I'm newbie for java operate the openoffice file.Now,i want to do page
turning for openoffice impress.I don't know where to config the port in these
code used:
com.sun.star.uno.XComponentContext xContext =
com.sun.star.comp.helper.Bootstrap.bootstrap();
System.out.println("Connected to a running office ...");
com.sun.star.lang.XMultiComponentFactory xMCF = xContext.getServiceManager();
String available = (xMCF != null ? "available" : "not available");
System.out.println("remote ServiceManager is " + available);
Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
xContext);
XComponentLoader xComponentLoader = (XComponentLoader)
UnoRuntime.queryInterface(XComponentLoader.class, desktop);
System.out.println("OK Done");
XComponentContext xcomponentcontext =
Bootstrap.createInitialComponentContext(null);
// create a connector, so that it can contact the office
XUnoUrlResolver urlResolver = UnoUrlResolver.create(xcomponentcontext);
Object initialObject =
urlResolver.resolve("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");
XMultiComponentFactory xOfficeFactory = (XMultiComponentFactory)
UnoRuntime.queryInterface(XMultiComponentFactory.class, initialObject);
// retrieve the component context as property (it is not yet exported from the
office)
// Query for the XPropertySet interface.
XPropertySet xProperySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xOfficeFactory);
// Get the default context from the office server.
Object oDefaultContext = xProperySet.getPropertyValue("DefaultContext");
// Query for the interface XComponentContext.
XComponentContext xOfficeComponentContext = (XComponentContext)
UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);
// now create the desktop service
// NOTE: use the office component context here!
Object oDesktop =
xOfficeFactory.createInstanceWithContext("com.sun.star.frame.Desktop",
xOfficeComponentContext);
Thanks!