Tobias Krais wrote:
Hi Stephan,

I extend the code below for better understanding, what I mean.

-----%<-----
System.out.println(this.xComponent);

XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
    this.xComponent);
System.out.println(xModel);

XController xController = xModel.getCurrentController();
System.out.println(xController);

XComponent myComp = (XComponent)
    UnoRuntime.queryInterface(XComponent.class,
             xController);
System.out.println(myComp);

XStorable xStorable = (XStorable)
        UnoRuntime.queryInterface(XStorable.class, myComp);

// This will be null
System.out.println(xStorable);

xStorable = (XStorable)
        UnoRuntime.queryInterface(XStorable.class, this.xComponent);

// This is the correct XStorable
System.out.println(xStorable);
-----%<-----

Am I right when I assume that myComp is the same as in the first line
and that it does not make a difference in using it?

Obviously not. You have two different UNO objects here, "this.xComponent" and "xModel.getCurrentController". The UNO object "this.xComponent" obviously supports XModel and XStorable (as querying that UNO object for those interfaces returns a non-null reference), and the UNO object "xModel.getCurrentController" obviously supports XController and XComponent, but not XStorable (as querying that UNO object for that interface returns a null reference).

If so, why is the xStorable derived from myComp = null and the xStorable
derived from this.xComponent the correct value?

Maybe this behaviour is correct. If so, please tell me why. What I want
to explain all the time is, that I think there should be no difference
using myComp and this.xComponent, but it is a great difference.

I know much about UNO technology in general, but little about the specifics of the OOo API, so I have no idea whether this.xComponent and ((XModel)this.xComponent).getCurrentController() should reference the same UNO object. I saw Mathias Bauer (who does know all the specifics of the OOo API) already answer on this thread, maybe you should re-read his post.

-Stephan

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

Reply via email to