summaryrefslogtreecommitdiff
path: root/wizards/source/sfdocuments
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source/sfdocuments')
-rw-r--r--wizards/source/sfdocuments/SF_Base.xba43
1 files changed, 43 insertions, 0 deletions
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
@@ -136,6 +136,49 @@ Catch:
End Function ' SFDocuments.SF_Base.CloseDocument
REM -----------------------------------------------------------------------------
+Public Function CloseFormDocument(Optional ByVal FormDocument As Variant) As Boolean
+''' Close the given form document
+''' Nothing happens if the form document is not open
+''' Args:
+''' FormDocument: a valid document form name as a case-sensitive string
+''' Returns:
+''' True if closure is successful
+''' Example:
+''' oDoc.CloseFormDocument("Folder1/myFormDocument")
+
+Dim bClose As Boolean ' Return value
+Dim oMainForm As Object ' com.sun.star.comp.sdb.Content
+Dim vFormNames As Variant ' Array of all document form names present in the document
+
+Const cstThisSub = "SFDocuments.Base.CloseFormDocument"
+Const cstSubArgs = "FormDocument"
+
+ 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
+ ' 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, "FormDocument", 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 ' SFDocuments.SF_Base.CloseFormDocument
+
+REM -----------------------------------------------------------------------------
Public Function FormDocuments() As Variant
''' Return the list of the FormDocuments contained in the Base document
''' Args: