Issue 63162 - API: Impossible to close a Base document
Summary: API: Impossible to close a Base document
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: marc.neumann
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-14 13:10 UTC by bmarcelly
Modified: 2013-02-24 21:09 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2006-03-14 13:10:57 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)
Comment 1 Frank Schönheit 2006-03-15 08:55:38 UTC
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.
Comment 2 Frank Schönheit 2006-03-15 08:56:43 UTC
adjusting summary to reflect that it's an API problem
Comment 3 Frank Schönheit 2006-03-16 09:57:16 UTC
fixed in CWS dba203a
Comment 4 Frank Schönheit 2006-03-16 10:04:30 UTC
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 ....
Comment 5 Frank Schönheit 2006-03-22 07:35:48 UTC
fs-> msc: please verify in CWS dba203a

re-open issue and reassign to msc
Comment 6 Frank Schönheit 2006-03-22 07:35:55 UTC
reassign to msc
Comment 7 Frank Schönheit 2006-03-22 07:35:59 UTC
reset resolution to FIXED
Comment 8 marc.neumann 2006-03-23 08:13:07 UTC
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>
Comment 9 marc.neumann 2006-04-06 08:50:47 UTC
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