Hello Alexander,

On Saturday 10 October 2009, 21:30, Alexander Anisimov wrote:
> > I understood you are talking here about a document UI, not a module
> > level.
> 
> Yes, you are quite right.
> 
> I have looked this sample. Its very useful for me. But there is problem:
> 
> When you getting document configuration manager, it looks like
> 
> Dim oDoc as Object
> 
> > oDoc = ThisComponent
> >
> > Dim oUIConfigurationManager as Object
> > oUIConfigurationManager = oDoc.getUIConfigurationManager()
> 
> but I am writing application in Java. And I can not understand how to get
> this configuration manager.

sorry, I was too lazy to write something new in Java, I just copied and pasted 
some OOo Basic code I have.

First lesson in OOo API must be: learn how to use the API reference.

So, you don't know how to get access to this method 
getUIConfigurationManager()?
then search for it in the global index:

http://api.openoffice.org/docs/common/ref/index-files/index-7.html

there you find two methods:

getUIConfigurationManager() - function in interface 
::com::sun::star::ui:: .XUIConfigurationManagerSupplier

getUIConfigurationManager() - function in interface 
::com::sun::star::ui:: .XModuleUIConfigurationManagerSupplier

the names of the interfaces tell you everything: the one with xxxModulexxx is 
for accessing the global UI configuration.

::com::sun::star::ui:: XUIConfigurationManagerSupplier is implemented by the 
documents.

So query this last interface on the object you get with 
loadComponentFromURL(), check the reference is not null, and then invoke 
getUIConfigurationManager() 


> XComponentContext xContext = Bootstrap.bootstrap();
> 
> > XMultiComponentFactory xMCF = xContext.getServiceManager();
> > Object oDesktop =
> > xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
> > XComponentLoader xCLoader = (XComponentLoader)
> > UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
> > PropertyValue[] szEmptyArgs = new PropertyValue[0];
> > XComponent Doc = xCLoader.loadComponentFromURL("private:factory/swriter",
> > "_blank", 0, szEmptyArgs);
> 
> And now, how to get configuration manager. There is no
> getUIConfiguratinManager method in Doc.

you get by loadComponentFromURL() an object that implements XComponent.
On that object you have to query all the interfaces it is supposed to 
implement (or all interfaces you intend to use, if the object does not 
implement it, you'll get a null reference).
In your case, query XUIConfigurationManagerSupplier

As it may be quite difficult to remember all interfaces an object implements, 
for learning the OOo API you may find useful a tool called Xray that can 
introspect every object in OOo API.

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to