hello Daniel,

Daniel Watkins escribió:
Hello again,

I've run into yet another problem.  I'm looking to load another document
into a frame I've already created (or, failing that, I'd like to reuse
the window).

At the moment, to load the first document, I'm running:
    self.doc = self.frame.loadComponentFromURL(url, "_self", 2, (hidden,))
where 'self.frame' is an instance of 'com.sun.star.frame.Frame'.  This
works fine.

I'm trying to use exactly the same code to load the second document into
the same Frame, but this causes a segmentation fault.

Could you get the stack trace? It would be interesting to know the reason.

Any way, if you appended the XFrame to the XFrames, you can reuse the frame and load another component in(side) it: the load environment will take care of closing the component that was set on the frame before.

If you didn't append the XFrame to the XFrames, then you may have to close the document previously loaded before trying to load another one.

Some reasons I can imagine (== I didn't test them, nor know how the implementation works):

* are you trying to load the second document with the *Hidden* flag, inside the frame whose container window is *visible*? I don't know if this may work. For example, there was a time when loading a document in hidden mode, and then setting the container window visible, crashed OOo.

* are you setting the LayoutManager to null? This technique works (I've learned it from OAppDetailPageHelper::showPreview in dbaccess/source/ui/app/AppDetailPageHelper.cxx [http://svn.services.openoffice.org/ooo/trunk/dbaccess/source/ui/app/AppDetailPageHelper.cxx]); but in this context (loading a presentation document and starting the presentation immediately) it may not work.

As an alternative you could try the not so easy way of destroying all UI elements, but you will have to listen to frame actions (with an css.frame.XFrameActionListener; a css.frame.XLayoutManagerListener may work, but its notification are IMHO not very informative) as the LayoutManager will try to recreate them, or other new one as the context changes. If choosing this way, you will also have to get rid of Impress panes; you'll have to use the drawing framework (http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/framework/module-ix.html).


Concerning the first way (loading another document in an alreay existing frame, that was first appended to the XFrames), I tried this with to presentations, and they worked. Although there may be some issues (in a non-product build I build myself, in one case I got a several error messages [one for example "Error: Exception in SwitchToViewShell_Impl - urgent issue. Please contact development!"], and the document opened in a blank window with no view at all. So, yes, something may not work as expected, although what you're doing is in theory right.

Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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

Reply via email to