Frank Schönheit - Sun Microsystems Germany wrote: > Hi Laurent, > >> com.sun.star.util.CloseVetoException > > That's okay :), and it was a bug that this exception wasn't thrown > before. (Hmm. Thinking about it, do the other document types behave the > same way?) > > The idea is that as long as a view to the document exists, you cannot > close the document - the view will veto is. This is because there's no > possibility to decide that the view was created (with your > 'loadComponentFromURL( ..., "_blank", ... )') by the same script which > is now trying to close the document - it could also be a view created by > the user via File|Open.
I think that this is an API misuse. A view never should veto closing the document and in fact all other documents in OOo will not behave this way. It doesn't matter how the view was created. Otherwise a view also needs to veto against its own closing via API. Where's the logic? The CloseVetoException was thought to circumvent the fact that at times you can't close a document without a crash (open dialogs in a view, print in progress etc.). Even data loss (because the document is still modified and not saved) is not a reason for a veto exception. > So, if you want to close the view (I suppose this is what you really > want: get rid of the window displaying the document), then obtain the > CurrentController of the model, and close the frame this controller > lives in. > > If this was the last frame, the document should be closed automatically > (if not, it's a bug). If there are more frames, you can iterate through > them (CurrentController will point to the controller in the next frame, > after you closed the previous one). However, this is rather unlikely for > database documents, which to not have the "multiple views per document" > (Window|New window) feature, at least not in the usual sense. What you describe can be done by the model itself in its close() implementation. Ciao, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
