wizards/source/sfdocuments/SF_Base.xba | 25 ++++++++++--------------- wizards/source/sfdocuments/SF_Form.xba | 1 - 2 files changed, 10 insertions(+), 16 deletions(-)
New commits: commit 60778f053ab0740a3339d4b06595bb6327cf3599 Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Wed Apr 14 15:01:22 2021 +0200 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Thu Apr 15 11:20:34 2021 +0200 ScriptForge - (SFDocuments) Fix SF_Base.OpenFormDocument() When a Base form is: 1. opened with OpenFormDocument(), then closed 2. Opened manually in Edit mode, then closed 3. Reopened with OpenFormDocument() in normal mode - it again gets opened in Edit mode - its closure is not executed, neither by program nor manually The OpenFormDocument() method is simplified: the invoked loadComponent method may be executed even when the form is already open. It simply activates the form which is exactly the expected bahaviour. Additionally: - the opening mode is checked after the open and, if not matching the expected DesignMode argument, reset. - the alive check of a form (IsStillAlive()) does not require a database connection anymore Change-Id: I5f55e45b246867d19e514e0d820f164790dec300 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114092 Tested-by: Jenkins Tested-by: Jean-Pierre Ledure <j...@ledure.be> Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index e9f9075f4fd7..f0310d0da48a 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -428,6 +428,7 @@ Public Function OpenFormDocument(Optional ByVal FormDocument As Variant _ Dim bOpen As Boolean ' Return value Dim vFormNames As Variant ' Array of all document form names present in the document Dim oContainer As Object ' com.sun.star.awt.XWindow +Dim oNewForm As Object ' Output of loadComponent() Const cstThisSub = "SFDocuments.Base.OpenFormDocument" Const cstSubArgs = "FormDocument, [DesignMode=False]" @@ -446,22 +447,16 @@ Check: End If Try: - If IsLoaded(FormDocument) Then ' Activate - Set oContainer = _FormDocuments.getByHierarchicalName(FormDocument).Component.CurrentController.Frame.ContainerWindow - With oContainer - If .isVisible() = False Then .setVisible(True) - .IsMinimized = False - .setFocus() - .toFront() ' Force window change in Linux - Wait 1 ' Bypass desynchro issue in Linux + With _Component.CurrentController + If Not .IsConnected Then .connect() + ' loadComponent activates the form when already loaded + Set oNewForm = .loadComponent(com.sun.star.sdb.application.DatabaseObject.FORM, FormDocument, DesignMode) + ' When user opened manually the form in design mode and closed it, the next execution in normal mode needs to be confirmed as below + With oNewForm.CurrentController + If .isFormDesignMode() <> DesignMode Then .setFormDesignMode(DesignMode) End With - Else ' Open - With _Component.CurrentController - If Not .IsConnected Then .connect() - .loadComponent(com.sun.star.sdb.application.DatabaseObject.FORM, FormDocument, DesignMode) - End With - bOpen = True - End If + End With + bOpen = True Finally: OpenFormDocument = bOpen diff --git a/wizards/source/sfdocuments/SF_Form.xba b/wizards/source/sfdocuments/SF_Form.xba index 197aad194a28..0af834aea4d6 100644 --- a/wizards/source/sfdocuments/SF_Form.xba +++ b/wizards/source/sfdocuments/SF_Form.xba @@ -1296,7 +1296,6 @@ Check: Try: ' At main form termination, all database connections are lost bAlive = Not IsNull(_Form) - If bAlive Then bAlive = Not IsNull(_Form.ActiveConnection) If Not bAlive Then GoTo Catch Finally: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits