Hi Ines,

Ines Pfauch wrote:
On 10.03.2005, at 14:09, Christoph Lutz wrote:



XDesktop desktop = (XDesktop)xmulticomponentfactory.createInstanceWithContext ("com.sun.star.frame.Desktop", ctx);




Unfortunately I get a ClassCastException at the line above. To get the URL is the only thing I need. I dont program more in java for OOo, and the developers guide is very complicated for me...

you have to query for the XDesktop interface.

Object oDesktop = xmulticomponentfactory.createInstanceWithContext ("com.sun.star.frame.Desktop", ctx);
XDEsktop xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, oDesktop);


createInstanceWithcontext returns an XInterface and you have to query to the interface you want to use. This is the general concept of the UNO API, you have to query to a different "functional view" of an object before you can use this specific functionality. And of course we have identified this as a problem for many users.
The new UNO ease of use features provide the opportunity to eliminate for example the queryInterface call by using multiple inheritance interfaces. But this improvement is at the moment only available for new API's. I hope that we can adapt this features to existing and often used API's in the near future to simplify the usage of this often used API's. But i can't say when and for which API's this simplification will be available.
But we are working on further improvements in this area!


- Juergen





---------------------------------------------------------------------
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]



Reply via email to