Tobias Krais wrote: > Hi together, > > this is my last day working for my current company and I'm hanging on > following thing: I have to write one more UNO package. In this > component, I need to get the current XComponent. I asked the question > how to get the current XComponent out of an XFrame last march and got > following answer: > -----%<----- > XComponent xComponent = (XComponent) > UnoRuntime.queryInterface(XComponent.class, xFrame); > -----%<-----
I don't know who gave you this answer but it is either wrong or you have been misunderstood (or your question was misleading). A frame is an object implementing XComponent (amongst other interfaces) and the code above retrieves this interface. As XFrame is derived from XComponent it is not surprising that both interfaces references are the same proxy object. This also means that the queryInterface call is superfluous as an XFrame "is" an XComponent. The frame may contain a component that in case of documents attached to the frame is a controller object that also implements XComponent. The controller itself belongs to a model that also implements XComponent. Also here both object implement a lot more interfaces and XController and XModel again are derived from XComponent so again you don't need to use queryInterface if to get the XComponent interface from an XController or XModel interface. So the question remains what the "current" component of a frame should be. It must be either the controller or the model object. I assume it should be the same object that you get as "CurrentComponent" from the desktop in case the frame in question is the "current" one. As this is the model I assume that frame.getController().getModel() will give you your "current component". 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]
