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?

No.

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

myComp points to a Controller object. This object doesn not support
XStorable.

this.xComponent points to a Model object. This object *does* support
XStorable.

Both objects OTOH support XComponent (as some others do). And *all*
objects support XInterface. Where is the problem?

It seems that you mixed up the "component" of a frame (an abstract term
for the "something" that a frame may contain) with the interface
XComponent that can be (and is) implemented by a lot of objects in OOo,
most of them will never become attached to a frame.

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

myComp and this.xComponent from your example are interface references
that belong to different objects. You should read the chapter about
Frames, Controllers, Models in the DevGuide to understand the difference
between models and controllers.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.

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

Reply via email to