wizards/source/scriptforge/python/scriptforge.py |    3 +
 wizards/source/sfdocuments/SF_Base.xba           |   43 +++++++++++++++++++++++
 2 files changed, 46 insertions(+)

New commits:
commit 2366c24ffe564643ca616d848a477ba382e9fe50
Author:     Jean-Pierre Ledure <[email protected]>
AuthorDate: Tue Jul 13 16:30:16 2021 +0200
Commit:     Jean-Pierre Ledure <[email protected]>
CommitDate: Wed Jul 14 10:45:15 2021 +0200

    ScriptForge - (SF_Base) new CloseFormDocument() method
    
    The closure of a form document is available from
    the SF_Form service.
    
    A form document is since recent commits associated with
    actions like PrintOut() that do not require to access
    its internal forms.
    
    As a consequence, the closure of a form document from
    the SF_Base service gains in relevance.
    
    Hence the actual commit.
    
    Change-Id: I9d4af078e6631d18c2d92c17249be6025ac9dfdd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118857
    Tested-by: Jean-Pierre Ledure <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <[email protected]>

diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index 5e3b2c6c7a8c..16dbca2b4fd2 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1794,6 +1794,9 @@ class SFDocuments:
         def CloseDocument(self, saveask = True):
             return self.ExecMethod(self.vbMethod, 'CloseDocument', saveask)
 
+        def CloseFormDocument(self, formdocument):
+            return self.ExecMethod(self.vbMethod, 'CloseFormDocument', 
formdocument)
+
         def FormDocuments(self):
             return self.ExecMethod(self.vbMethod + self.flgArrayRet, 
'FormDocuments')
 
diff --git a/wizards/source/sfdocuments/SF_Base.xba 
b/wizards/source/sfdocuments/SF_Base.xba
index 52fc0fd768c2..ae2a23e9f0d3 100644
--- a/wizards/source/sfdocuments/SF_Base.xba
+++ b/wizards/source/sfdocuments/SF_Base.xba
@@ -135,6 +135,49 @@ Catch:
        GoTo Finally
 End Function   &apos;   SFDocuments.SF_Base.CloseDocument
 
+REM 
-----------------------------------------------------------------------------
+Public Function CloseFormDocument(Optional ByVal FormDocument As Variant) As 
Boolean
+&apos;&apos;&apos;     Close the given form document
+&apos;&apos;&apos;     Nothing happens if the form document is not open
+&apos;&apos;&apos;     Args:
+&apos;&apos;&apos;             FormDocument: a valid document form name as a 
case-sensitive string
+&apos;&apos;&apos;     Returns:
+&apos;&apos;&apos;             True if closure is successful
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;                     
oDoc.CloseFormDocument(&quot;Folder1/myFormDocument&quot;)
+
+Dim bClose As Boolean                          &apos;  Return value
+Dim oMainForm As Object                                &apos;  
com.sun.star.comp.sdb.Content
+Dim vFormNames As Variant                      &apos;  Array of all document 
form names present in the document
+
+Const cstThisSub = &quot;SFDocuments.Base.CloseFormDocument&quot;
+Const cstSubArgs = &quot;FormDocument&quot;
+
+       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
+               &apos;  Build list of available FormDocuments recursively with 
_CollectFormDocuments
+               If IsNull(_FormDocuments) Then Set _FormDocuments = 
_Component.getFormDocuments()
+               vFormNames = Split(_CollectFormDocuments(_FormDocuments), 
cstToken)
+               If Not ScriptForge.SF_Utils._Validate(FormDocument, 
&quot;FormDocument&quot;, V_STRING, vFormNames) Then GoTo Finally
+       End If
+       If Not IsLoaded(FormDocument) Then GoTo Finally
+
+Try:
+       Set oMainForm = _FormDocuments.getByHierarchicalName(FormDocument)
+       bClose = oMainForm.close()
+
+Finally:
+       CloseFormDocument = bClose
+       ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+       Exit Function
+Catch:
+       GoTo Finally
+End Function   &apos;  SFDocuments.SF_Base.CloseFormDocument
+
 REM 
-----------------------------------------------------------------------------
 Public Function FormDocuments() As Variant
 &apos;&apos;&apos;     Return the list of the FormDocuments contained in the 
Base document
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to