Apache OpenOffice (AOO) Bugzilla – Issue 63162
API: Impossible to close a Base document
Last modified: 2013-02-24 21:09:26 UTC
A Base document may be loaded by API, but it cannot be closed with the usual document.close(True) method : it throws CloseVetoException. Simple Basic example: Dim dbDoc As Object Dim adrOdb As String Dim OdbOpt() as new com.sun.star.beans.PropertyValue adrOdb = convertToURL("C:\Documents and Settings\Personne\Mes Documents\Databases\base2\usine.odb") dbDoc = StarDesktop.loadComponentFromURL(adrOdb, "_blank", 0, OdbOpt()) wait(3000) dbDoc.close(True) ' -> closeVetoException This is not consistent with other document types (Writer, Calc, etc) and does not follow the flowchart "Closing a model" from Developer's Guide 6.4.5. I did not encounter the problem in October 2005, on a 1.9.xx or 2.0.0 version. Found it on 2.0.1 and 2.0.2 For other readers of this issue, Franck provided this alternative solution, which works: dbDoc.currentController.Frame.close(True)
in fact, database documents behqave different than other documents here, and (worse) different than what is described in the DevGuide, which explicitly requires that closing a document should close all associated frames.
adjusting summary to reflect that it's an API problem
fixed in CWS dba203a
Okay, now database documents behave as other documents do (and as is required in the DevGuide): Closing the document implicitly closes all associated views. Also, closing the last view implicitly closes the document. There's a few implications: - Script developers who want to use a document need to ensure that it's not closed as long as they need it. That is, if a script doing potentially long-running processings on a document need to add as CloseVetoListener. Else, it might be possible that the user (while the script is running in the background) opens the very same document, and closes the view, and thus the document - which might break the script. - Script developers should definately close the document they use, even if they did not obtain it from a loadComponentFromURL. This is especially important for database documents, where there are more means to obtain the document (e.g. DatabaseContext.getByName( "..." ).getDatabaseDocument) - As a consequence of the previous item, the following scenario is possible: - A script obtains a document, and does some processing with it (which at least might involve reading some facets, not necessarily modifying it) - The user opens the very same document and works with it - The script finishs, closing the document => the user's views to the document are closed, too The last is an immediate consequence from the fact that views to not veto closing the document. However, it's by design (at least by what the DevGuide requires :), and should be exotic enough to not hurt ....
fs-> msc: please verify in CWS dba203a re-open issue and reassign to msc
reassign to msc
reset resolution to FIXED
verified in cws dba203a Information about this cws can be found at <http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Id=3551&Path=SRC680%2Fdba203a>
Hi, this is fixed in the current master. The current master is available at http://download.openoffice.org/680/index.html I close this issue now. Bye Marc