Apache OpenOffice (AOO) Bugzilla – Issue 52649
Opening a form an a Base document closes when the macro finishes.
Last modified: 2013-02-24 21:07:20 UTC
I open a form contained in a Base document using: oFormDocs.loadComponentFromURL() The form opens, but closes when the macro completes. See the complete macro below. If I create an external variable that holds a reference to the document definition, however, then the form stays open. I discussed this with Frank Schönheit on the dba development mailing list, and he had two comments: 1. He agrees that I should not have to hold a reference to the form definition so that the form stays open. (This is the bug reported for this issue). 2. It seems silly that I need to provide an active connection. This active connections may become a resource leak because it is not closed (this is speculative of course). Dim oXXX Sub OpenFormInDB() Dim s As String 'Temporary string variable. Dim oDBDoc 'The database document that contains the form. Dim oFormDef 'com.sun.star.sdb.DocumentDefinition of the form. Dim oFormDocs 'The form documents container. Dim oFormDoc 'The actual form document. Dim oIHandler 'Interaction handler. Dim oCon 'Database connection. Dim oParms(1) As New com.sun.star.beans.PropertyValue Dim oBaseContext 'Global database context service. Dim oDataBase 'Database obtained from the database context. Dim sFormName$ Dim sURL$ sFormName = "Inventory_Form1" sURL = "file:///andrew0/home/andy/My%20Documents/Stamps_2005_07_22.odb" oDBDoc = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, Array()) oFormDocs = oDBDoc.getFormDocuments() oFormDef = oDBDoc.getFormDocuments().getByName(sFormName) REM Uncomment this next line to hold the form open 'oXXX = oFormDef REM The database context is required for the connection. oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDataBase = oBaseContext.getByName(sUrl) oCon = oDataBase.getConnection("", "") oParms(0).Name = "OpenMode" oParms(0).Value = "openDesign" oParms(1).Name = "ActiveConnection" oParms(1).Value = oCon oFormDoc = oFormDocs.loadComponentFromURL(sFormName, "", 0, oParms()) End Sub
sw->oj: your area methinks
I think this is a serious problem for scripting OpenOffice.org Base, so let's see if we can get this for 2.0.1 fs->oj: please investigate the effort and risk for fixing this.
After a short discussion this one is no 2.0.1 issue. That back to OOLater.
fixed in CWS dba201d (targeted for 2.0.1). Now the macro is as simple as: oDBDoc = StarDesktop.loadComponentFromURL(<document_url>, _ "_default", 0, Array()) oFormDocs = oDBDoc.getFormDocuments() oFormDoc = oFormDocs.loadComponentFromURL(<form_name>, "", 0, _ oParms()) No need to keep anything alive, no need to pass an active connection. side note: For loadComponentFormURL it's recommended to use "_default" instead of "_blank", since the former already cares for a document which is already opened, whereas "_blank" always loads the document into a new frame (possibly readonly)
fs-> msc: please verify in CWS dba201d re-open issue and reassign to msc
reassign to msc
set to fixed
verified in cws dba201d
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