Hi Stephan,

>> -----%<-----
>> public void test() {
>>     XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
>>                this.xComponent);
>>     com.sun.star.frame.XController xController =
>>         xModel.getCurrentController();
>>        
>>     XComponent myComp = (XComponent)
>>         UnoRuntime.queryInterface(XComponent.class,
>>             xController);
>> }
>> -----%<-----

> To check whether two Java references are to the same UNO object, use
> com.sun.star.uno.UnoRuntime.areSame instead of java.lang.Object.equals.
>  (And since XController inherits from XComponent, the output you
> presented in a previous mail, that xController.toString() and
> myComp.toString() give the same output, as those two *are* the same Java
> object, is fully correct; there is not much use in queryInterface from
> derived XController to base XComponent.)

That is interesting. Thank you. But if I continue the code the following
way, I run into troubles (xPrintable will be null):
-----%<-----
// Querying for the interface XPrintable on the loaded document
XPrintable xPrintable = (XPrintable)
        UnoRuntime.queryInterface(XPrintable.class, myComp);
-----%<-----

How to solve this?

Greetings, Tobias

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

Reply via email to