diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2020-12-20 14:23:34 +0100 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2020-12-20 15:37:03 +0100 |
commit | e3fe4a46104d9379bca3302fd9ed3883915f2d80 (patch) | |
tree | 8b5a38d8b597413d7d0028fd502d2a18c64556aa /wizards/source/sfdocuments | |
parent | 22f7411ecfe0ecc2a62bbc85a6ed27977df03e89 (diff) |
ScriptForge - new CloseFormDocument() method
Only when form instance is inside a Base form document
Change-Id: I6fd0cf1d77588b9720efb2c45384371a122dbd4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108048
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards/source/sfdocuments')
-rw-r--r-- | wizards/source/sfdocuments/SF_Form.xba | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/wizards/source/sfdocuments/SF_Form.xba b/wizards/source/sfdocuments/SF_Form.xba index ca4be09e56df..a6c4a074d0b9 100644 --- a/wizards/source/sfdocuments/SF_Form.xba +++ b/wizards/source/sfdocuments/SF_Form.xba @@ -258,6 +258,46 @@ Catch: End Function ' SFDocuments.SF_Form.Activate REM ----------------------------------------------------------------------------- +Public Function CloseFormDocument() As Boolean +''' Close the form document containing the actual form instance +''' The form instance is disposed +''' The method does nothong if the actual form is not located in a Base form document +''' Args: +''' Returns: +''' True if closure is successful +''' Example: +''' myForm.CloseFormDocument() + +Dim bClose As Boolean ' Return value +Dim oContainer As Object ' com.sun.star.awt.XWindow +Const cstThisSub = "SFDocuments.Form.CloseFormDocument" +Const cstSubArgs = "" + + If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + bClose = False + +Check: + If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not _IsStillAlive() Then GoTo Finally + End If +Try: + Select Case _FormType + Case ISDOCFORM, ISCALCFORM, ISSUBFORM + Case ISBASEFORM + _MainForm.close() + Dispose() + bClose = True + End Select + +Finally: + CloseFormDocument = bClose + ScriptForge.SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +End Function ' SFDocuments.SF_Form.CloseFormDocument + +REM ----------------------------------------------------------------------------- Public Function Controls(Optional ByVal ControlName As Variant) As Variant ''' Return either ''' - the list of the controls contained in the Form |