summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2020-11-05 16:22:30 +0100
committerJean-Pierre Ledure <jp@ledure.be>2020-11-05 16:22:30 +0100
commit9597440731cad723434df0867dbe97506201df29 (patch)
tree72a8ca9fda430c4a3ff031a5df583ab415fbf901 /wizards
parent584e32d7c776e562447697e07592bb992700f313 (diff)
ScriptForge - SFDialogs library
Additional "LibreOffice Macros & Dialogs" library Change-Id: I0bce9d8a19025e4184e847941a3c79f4a210b1ae
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/sfdialogs/SF_Dialog.xba693
-rw-r--r--wizards/source/sfdialogs/SF_DialogControl.xba1099
-rw-r--r--wizards/source/sfdialogs/SF_Register.xba327
-rw-r--r--wizards/source/sfdialogs/__License.xba26
-rw-r--r--wizards/source/sfdialogs/dialog.xlb3
-rw-r--r--wizards/source/sfdialogs/script.xlb8
6 files changed, 2156 insertions, 0 deletions
diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba
new file mode 100644
index 000000000000..63abb011aeea
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_Dialog.xba
@@ -0,0 +1,693 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Dialog" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
+REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
+REM === The SFDialogs library is one of the associated libraries. ===
+REM === Full documentation is available on https://help.libreoffice.org/ ===
+REM =======================================================================================================================
+
+Option Compatible
+Option ClassModule
+
+Option Explicit
+
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+&apos;&apos;&apos; SF_Dialog
+&apos;&apos;&apos; =========
+&apos;&apos;&apos; Management of dialogs defined with the Basic IDE
+&apos;&apos;&apos; Each instance of the current class represents a single dialog box displayed to the user
+&apos;&apos;&apos;
+&apos;&apos;&apos; A dialog box can be displayed in modal or in non-modal modes
+&apos;&apos;&apos; In modal mode, the box is displayed and the execution of the macro process is suspended
+&apos;&apos;&apos; until one of the OK or Cancel buttons is pressed. In the meantime, other user actions
+&apos;&apos;&apos; executed on the box can trigger specific actions.
+&apos;&apos;&apos; In non-modal mode, the dialog box is &quot;floating&quot; on the user desktop and the execution
+&apos;&apos;&apos; of the macro process continues normally
+&apos;&apos;&apos; A dialog box disappears from memory after its explicit termination.
+&apos;&apos;&apos;
+&apos;&apos;&apos; Service invocation and usage:
+&apos;&apos;&apos; Dim myDialog As Object, lButton As Long
+&apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, Container, Library, DialogName)
+&apos;&apos;&apos; &apos; Args:
+&apos;&apos;&apos; &apos; Container: &quot;GlobalScope&quot; for preinstalled libraries
+&apos;&apos;&apos; &apos; A window name (see its definition in the ScriptForge.UI service)
+&apos;&apos;&apos; &apos; &quot;&quot; (default) = the current document
+&apos;&apos;&apos; &apos; Library: The (case-sensitive) name of a library contained in the container
+&apos;&apos;&apos; &apos; Default = &quot;Standard&quot;
+&apos;&apos;&apos; &apos; DialogName: a case-sensitive string designating the dialog where it is about
+&apos;&apos;&apos; &apos; ... Initialize controls ...
+&apos;&apos;&apos; lButton = myDialog.Execute() &apos; Default mode = Modal
+&apos;&apos;&apos; If lButton = myDialog.OKBUTTON Then
+&apos;&apos;&apos; &apos; ... Process controls and do what is needed
+&apos;&apos;&apos; End If
+&apos;&apos;&apos; myDialog.Terminate()
+&apos;&apos;&apos;
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+
+REM ================================================================== EXCEPTIONS
+
+Private Const DIALOGDEADERROR = &quot;DIALOGDEADERROR&quot;
+
+REM ============================================================= PRIVATE MEMBERS
+
+Private [Me] As Object
+Private [_Parent] As Object
+Private ObjectType As String &apos; Must be DIALOG
+Private ServiceName As String
+
+&apos; Dialog location
+Private _Container As String
+Private _Library As String
+Private _Name As String
+Private _CacheIndex As Long &apos; Index in cache storage
+
+&apos; Dialog UNO references
+Private _DialogProvider As Object &apos; com.sun.star.io.XInputStreamProvider
+Private _DialogControl As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+Private _DialogModel As Object &apos; com.sun.star.awt.XControlModel - stardiv.Toolkit.UnoControlDialogModel
+
+&apos; Dialog attributes
+Private _Displayed As Boolean &apos; True after Execute()
+Private _Modal As Boolean &apos; Set by Execute()
+
+REM ============================================================ MODULE CONSTANTS
+
+Private Const OKBUTTON = 1
+Private Const CANCELBUTTON = 0
+
+REM ===================================================== CONSTRUCTOR/DESCTRUCTOR
+
+REM -----------------------------------------------------------------------------
+Private Sub Class_Initialize()
+ Set [Me] = Nothing
+ Set [_Parent] = Nothing
+ ObjectType = &quot;DIALOG&quot;
+ ServiceName = &quot;SFDialogs.Dialog&quot;
+ _Container = &quot;&quot;
+ _Library = &quot;&quot;
+ _Name = &quot;&quot;
+ _CacheIndex = -1
+ Set _DialogProvider = Nothing
+ Set _DialogControl = Nothing
+ Set _DialogModel = Nothing
+ _Displayed = False
+ _Modal = True
+End Sub &apos; SFDialogs.SF_Dialog Constructor
+
+REM -----------------------------------------------------------------------------
+Private Sub Class_Terminate()
+ Call Class_Initialize()
+End Sub &apos; SFDialogs.SF_Dialog Destructor
+
+REM -----------------------------------------------------------------------------
+Public Function Dispose() As Variant
+ If _CacheIndex &gt;= 0 Then Terminate()
+ Call Class_Terminate()
+ Set Dispose = Nothing
+End Function &apos; SFDialogs.SF_Dialog Explicit Destructor
+
+REM ================================================================== PROPERTIES
+
+REM -----------------------------------------------------------------------------
+Property Get Caption() As Variant
+&apos;&apos;&apos; The Caption property refers to the title of the dialog
+ Caption = _PropertyGet(&quot;Caption&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Caption (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Caption(Optional ByVal pvCaption As Variant)
+&apos;&apos;&apos; Set the updatable property Caption
+ _PropertySet(&quot;Caption&quot;, pvCaption)
+End Property &apos; SFDialogs.SF_Dialog.Caption (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Height() As Variant
+&apos;&apos;&apos; The Height property refers to the height of the dialog box
+ Height = _PropertyGet(&quot;Height&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Height (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Height(Optional ByVal pvHeight As Variant)
+&apos;&apos;&apos; Set the updatable property Height
+ _PropertySet(&quot;Height&quot;, pvHeight)
+End Property &apos; SFDialogs.SF_Dialog.Height (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Modal() As Boolean
+&apos;&apos;&apos; The Modal property specifies if the dialog box has been executed in modal mode
+ Modal = _PropertyGet(&quot;Modal&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Modal (get)
+
+REM -----------------------------------------------------------------------------
+Property Get Name() As String
+&apos;&apos;&apos; Return the name of the actual dialog
+ Name = _PropertyGet(&quot;Name&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Name
+
+REM -----------------------------------------------------------------------------
+Property Get Page() As Variant
+&apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step. The Page property of the Dialog object defines which page of the dialog is active.
+&apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
+&apos;&apos;&apos; For example, if a control has a page value of 1, it is only visible on page 1 of the dialog.
+&apos;&apos;&apos; If the page value of the dialog is increased from 1 to 2, then all controls with a page value of 1 disappear and all controls with a page value of 2 become visible.
+ Page = _PropertyGet(&quot;Page&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Page (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Page(Optional ByVal pvPage As Variant)
+&apos;&apos;&apos; Set the updatable property Page
+ _PropertySet(&quot;Page&quot;, pvPage)
+End Property &apos; SFDialogs.SF_Dialog.Page (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Visible() As Variant
+&apos;&apos;&apos; The Visible property is False before the Execute() statement
+ Visible = _PropertyGet(&quot;Visible&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Visible (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Visible(Optional ByVal pvVisible As Variant)
+&apos;&apos;&apos; Set the updatable property Visible
+ _PropertySet(&quot;Visible&quot;, pvVisible)
+End Property &apos; SFDialogs.SF_Dialog.Visible (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Width() As Variant
+&apos;&apos;&apos; The Width property refers to the Width of the dialog box
+ Width = _PropertyGet(&quot;Width&quot;)
+End Property &apos; SFDialogs.SF_Dialog.Width (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Width(Optional ByVal pvWidth As Variant)
+&apos;&apos;&apos; Set the updatable property Width
+ _PropertySet(&quot;Width&quot;, pvWidth)
+End Property &apos; SFDialogs.SF_Dialog.Width (let)
+
+REM -----------------------------------------------------------------------------
+Property Get XDialogModel() As Object
+&apos;&apos;&apos; The XDialogModel property returns the model UNO object of the dialog
+ XDialogModel = _PropertyGet(&quot;XDialogModel&quot;)
+End Property &apos; SFDialogs.SF_Dialog.XDialogModel (get)
+
+REM -----------------------------------------------------------------------------
+Property Get XDialogView() As Object
+&apos;&apos;&apos; The XDialogView property returns the view UNO object of the dialog
+ XDialogView = _PropertyGet(&quot;XDialogView&quot;)
+End Property &apos; SFDialogs.SF_Dialog.XDialogView (get)
+
+REM ===================================================================== METHODS
+
+REM -----------------------------------------------------------------------------
+Public Function Activate() As Boolean
+&apos;&apos;&apos; Set the focus on the current dialog instance
+&apos;&apos;&apos; Probably called from after an event occurrence or to focus on a non-modal dialog
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True if focusing is successful
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim oDlg As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
+&apos;&apos;&apos; oDlg.Activate()
+
+Dim bActivate As Boolean &apos; Return value
+Const cstThisSub = &quot;SFDialogs.Dialog.Activate&quot;
+Const cstSubArgs = &quot;&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bActivate = False
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not _IsStillAlive() Then GoTo Finally
+ End If
+Try:
+ If Not IsNull(_DialogControl) Then
+ _DialogControl.setFocus()
+ bActivate = True
+ End If
+
+Finally:
+ Activate = bActivate
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.Activate
+
+REM -----------------------------------------------------------------------------
+Public Function Controls(Optional ByVal ControlName As Variant) As Variant
+&apos;&apos;&apos; Return either
+&apos;&apos;&apos; - the list of the controls contained in the dialog
+&apos;&apos;&apos; - a dialog control object based on its name
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; ControlName: a valid control name as a case-sensitive string. If absent the list is returned
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; A zero-base array of strings if ControlName is absent
+&apos;&apos;&apos; An instance of the SF_DialogControl class if ControlName exists
+&apos;&apos;&apos; Exceptions:
+&apos;&apos;&apos; ControlName is invalid
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim myDialog As Object, myList As Variant, myControl As Object
+&apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, Container, Library, DialogName)
+&apos;&apos;&apos; myList = myDialog.Controls()
+&apos;&apos;&apos; Set myControl = myDialog.Controls(&quot;myTextBox&quot;)
+
+Dim oControl As Object &apos; The new control class instance
+Const cstThisSub = &quot;SFDialogs.Dialog.Controls&quot;
+Const cstSubArgs = &quot;[ControlName]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+
+Check:
+ If IsMissing(ControlName) Or IsEmpty(ControlName) Then ControlName = &quot;&quot;
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not _IsStillAlive() Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING) Then GoTo Finally
+ End If
+
+Try:
+ If Len(ControlName) = 0 Then
+ Controls = _DialogModel.getElementNames()
+ Else
+ If Not _DialogModel.hasByName(ControlName) Then GoTo CatchNotFound
+ &apos; Create the new dialog control class instance
+ Set oControl = New SF_DialogControl
+ With oControl
+ ._Name = ControlName
+ Set .[Me] = oControl
+ Set .[_Parent] = [Me]
+ ._DialogName = _Name
+ Set ._ControlModel = _DialogModel.getByName(ControlName)
+ Set ._ControlView = _DialogControl.getControl(ControlName)
+ ._Initialize()
+ End With
+ Set Controls = oControl
+ End If
+
+Finally:
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchNotFound:
+ ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING, _DialogModel.getElementNames())
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.Controls
+
+REM -----------------------------------------------------------------------------
+Public Sub EndExecute(Optional ByVal ReturnValue As Variant)
+&apos;&apos;&apos; Ends the display of a modal dialog and gives back the argument
+&apos;&apos;&apos; as return value for the current Execute() action
+&apos;&apos;&apos; EndExecute is usually contained in the processing of a macro
+&apos;&apos;&apos; triggered by a dialog or control event
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; ReturnValue: must be numeric. The value passed to the running Execute() method
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Sub OnEvent(poEvent As Variant)
+&apos;&apos;&apos; Dim oDlg As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+&apos;&apos;&apos; oDlg.EndExecute(25)
+&apos;&apos;&apos; End Sub
+
+Dim lExecute As Long &apos; Alias of ReturnValue
+Const cstThisSub = &quot;SFDialogs.Dialog.EndExecute&quot;
+Const cstSubArgs = &quot;ReturnValue&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not _IsStillAlive() Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(ReturnValue, &quot;ReturnValue&quot;, V_NUMERIC) Then GoTo Finally
+ End If
+
+Try:
+ lExecute = CLng(ReturnValue)
+ Call _DialogControl.endDialog(lExecute)
+
+Finally:
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Sub
+Catch:
+ GoTo Finally
+End Sub &apos; SFDialogs.SF_Dialog.EndExecute
+
+REM -----------------------------------------------------------------------------
+Public Function Execute(Optional ByVal Modal As Variant) As Long
+&apos;&apos;&apos; Display the dialog and wait for its termination by the user
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Modal: False when non-modal dialog. Default = True
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; 0 = Cancel button pressed
+&apos;&apos;&apos; 1 = OK button pressed
+&apos;&apos;&apos; Otherwise: the dialog stopped with an EndExecute statement executed from a dialog or control event
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim oDlg As Object, lReturn As Long
+&apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
+&apos;&apos;&apos; lReturn = oDlg.Execute()
+&apos;&apos;&apos; Select Case lReturn
+
+Dim lExecute As Long &apos; Return value
+Const cstThisSub = &quot;SFDialogs.Dialog.Execute&quot;
+Const cstSubArgs = &quot;[Modal=True]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ lExecute = -1
+
+Check:
+ If IsMissing(Modal) Or IsEmpty(Modal) Then Modal = True
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not _IsStillAlive() Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Modal, &quot;Modal&quot;, V_BOOLEAN) Then GoTo Finally
+ End If
+
+Try:
+ If Modal Then
+ _Modal = True
+ _Displayed = True
+ lExecute = _DialogControl.execute()
+ Select Case lExecute
+ Case 1 : lExecute = OKBUTTON
+ Case 0 : lExecute = CANCELBUTTON
+ Case Else
+ End Select
+ _Displayed = False
+ Else
+ _Modal = False
+ _Displayed = True
+ _DialogModel.DesktopAsParent = True
+ _DialogControl.setVisible(True)
+ lExecute = 0
+ End If
+
+Finally:
+ Execute = lExecute
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.Execute
+
+REM -----------------------------------------------------------------------------
+Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
+&apos;&apos;&apos; Return the actual value of the given property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; PropertyName: the name of the property as a string
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The actual value of the property
+&apos;&apos;&apos; Exceptions:
+&apos;&apos;&apos; ARGUMENTERROR The property does not exist
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; oDlg.GetProperty(&quot;Caption&quot;)
+
+Const cstThisSub = &quot;Model.GetProperty&quot;
+Const cstSubArgs = &quot;&quot;
+
+ If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ GetProperty = Null
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
+ End If
+
+Try:
+ GetProperty = _PropertyGet(PropertyName)
+
+Finally:
+ SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.GetProperty
+
+REM -----------------------------------------------------------------------------
+Public Function Methods() As Variant
+&apos;&apos;&apos; Return the list of public methods of the Model service as an array
+
+ Methods = Array( _
+ &quot;Activate&quot; _
+ , &quot;Controls&quot; _
+ , &quot;EndExecute&quot; _
+ , &quot;Execute&quot; _
+ , &quot;Terminate&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_Dialog.Methods
+
+REM -----------------------------------------------------------------------------
+Public Function Properties() As Variant
+&apos;&apos;&apos; Return the list or properties of the Timer class as an array
+
+ Properties = Array( _
+ &quot;Caption&quot; _
+ , &quot;Height&quot; _
+ , &quot;Modal&quot; _
+ , &quot;Name&quot; _
+ , &quot;Page&quot; _
+ , &quot;Visible&quot; _
+ , &quot;Width&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_Dialog.Properties
+
+REM -----------------------------------------------------------------------------
+Public Function SetProperty(Optional ByVal PropertyName As Variant _
+ , Optional ByRef Value As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Set a new value to the given property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; PropertyName: the name of the property as a string
+&apos;&apos;&apos; Value: its new value
+&apos;&apos;&apos; Exceptions
+&apos;&apos;&apos; ARGUMENTERROR The property does not exist
+
+Const cstThisSub = &quot;SFDialogs.Dialog.SetProperty&quot;
+Const cstSubArgs = &quot;PropertyName, Value&quot;
+
+ If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ SetProperty = False
+
+Check:
+ If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
+ End If
+
+Try:
+ SetProperty = _PropertySet(PropertyName, Value)
+
+Finally:
+ SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.SetProperty
+
+REM -----------------------------------------------------------------------------
+Public Function Terminate() As Boolean
+&apos;&apos;&apos; Terminate the dialog service for the current dialog instance
+&apos;&apos;&apos; After termination any action on the current instance will be ignored
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True if termination is successful
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim oDlg As Object, lReturn As Long
+&apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
+&apos;&apos;&apos; lreturn = oDlg.Execute()
+&apos;&apos;&apos; Select Case lReturn
+&apos;&apos;&apos; &apos; ...
+&apos;&apos;&apos; End Select
+&apos;&apos;&apos; oDlg.Terminate()
+
+Dim bTerminate As Boolean &apos; Return value
+Const cstThisSub = &quot;SFDialogs.Dialog.Terminate&quot;
+Const cstSubArgs = &quot;&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bTerminate = False
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not _IsStillAlive() Then GoTo Finally
+ End If
+Try:
+ _DialogControl.dispose()
+ Set _DialogControl = Nothing
+ SF_Register._CleanCacheEntry(_CacheIndex)
+ _CacheIndex = -1
+ Dispose()
+
+ bTerminate = True
+
+Finally:
+ Terminate = bTerminate
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.Terminate
+
+REM =========================================================== PRIVATE FUNCTIONS
+
+REM -----------------------------------------------------------------------------
+Public Sub _Initialize()
+&apos;&apos;&apos; Complete the object creation process:
+&apos;&apos;&apos; - Initialization of private members
+&apos;&apos;&apos; - Creation of the dialog graphical interface
+&apos;&apos;&apos; - Addition of the new object in the Dialogs buffer
+
+Try:
+ &apos; Create the graphical interface
+ Set _DialogControl = CreateUnoDialog(_DialogProvider)
+ Set _DialogModel = _DialogControl.Model
+
+ &apos; Add dialog reference to cache
+ _CacheIndex = SF_Register._AddDialogToCache(_DialogControl, [Me])
+ 85
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialog._Initialize
+
+REM -----------------------------------------------------------------------------
+Private Function _IsStillAlive(Optional ByVal pbError As Boolean) As Boolean
+&apos;&apos;&apos; Return True if the dialog service is still active
+&apos;&apos;&apos; If dead the actual instance is disposed. The execution is cancelled when pbError = True (default)
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; pbError: if True (default), raise a fatal error
+
+Dim bAlive As Boolean &apos; Return value
+Dim sDialog As String &apos; Alias of DialogName
+
+Check:
+ On Local Error GoTo Catch &apos; Anticipate DisposedException errors or alike
+ If IsMissing(pbError) Then pbError = True
+
+Try:
+ bAlive = ( Not IsNull(_DialogProvider) And Not IsNull(_DialogControl) )
+ If Not bAlive Then GoTo Catch
+
+Finally:
+ _IsStillAlive = bAlive
+ Exit Function
+Catch:
+ bAlive = False
+ On Error GoTo 0
+ sDialog = _Name
+ Dispose()
+ If pbError Then ScriptForge.SF_Exception.RaiseFatal(DIALOGDEADERROR, sDialog)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._IsStillAlive
+
+REM -----------------------------------------------------------------------------
+Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
+&apos;&apos;&apos; Return the value of the named property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psProperty: the name of the property
+
+Static oSession As Object &apos; Alias of SF_Session
+Dim cstThisSub As String
+Const cstSubArgs = &quot;&quot;
+
+ cstThisSub = &quot;SFDialogs.Dialog.get&quot; &amp; psProperty
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+
+ ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
+ If Not _IsStillAlive() Then GoTo Finally
+
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+ Select Case psProperty
+ Case &quot;Caption&quot;
+ If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _PropertyGet = _DialogModel.Title
+ Case &quot;Height&quot;
+ If oSession.HasUNOProperty(_DialogModel, &quot;Height&quot;) Then _PropertyGet = _DialogModel.Height
+ Case &quot;Modal&quot;
+ _PropertyGet = _Modal
+ Case &quot;Name&quot;
+ _PropertyGet = _Name
+ Case &quot;Page&quot;
+ If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then _PropertyGet = _DialogModel.Step
+ Case &quot;Visible&quot;
+ If oSession.HasUnoMethod(_DialogControl, &quot;isVisible&quot;) Then _PropertyGet = CBool(_DialogControl.isVisible())
+ Case &quot;Width&quot;
+ If oSession.HasUNOProperty(_DialogModel, &quot;Width&quot;) Then _PropertyGet = _DialogModel.Width
+ Case &quot;XDialogModel&quot;
+ Set _PropertyGet = _DialogModel
+ Case &quot;XDialogView&quot;
+ Set _PropertyGet = _DialogControl
+ Case Else
+ _PropertyGet = Null
+ End Select
+
+Finally:
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._PropertyGet
+
+REM -----------------------------------------------------------------------------
+Private Function _PropertySet(Optional ByVal psProperty As String _
+ , Optional ByVal pvValue As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Set the new value of the named property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psProperty: the name of the property
+&apos;&apos;&apos; pvValue: the new value of the given property
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True if successful
+
+Dim bSet As Boolean &apos; Return value
+Static oSession As Object &apos; Alias of SF_Session
+Dim cstThisSub As String
+Const cstSubArgs = &quot;Value&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bSet = False
+
+ cstThisSub = &quot;SFDialogs.Dialog.set&quot; &amp; psProperty
+ ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
+ If Not _IsStillAlive() Then GoTo Finally
+
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+ bSet = True
+ Select Case UCase(psProperty)
+ Case UCase(&quot;Caption&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _DialogModel.Title = pvValue
+ Case UCase(&quot;Height&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUNOProperty(_DialogModel, &quot;Height&quot;) Then _DialogModel.Height = pvValue
+ Case UCase(&quot;Page&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then _DialogModel.Step = CLng(pvValue)
+ Case UCase(&quot;Visible&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoMethod(_DialogControl, &quot;setVisible&quot;) Then _DialogControl.setVisible(pvValue)
+ Case UCase(&quot;Width&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUNOProperty(_DialogModel, &quot;Width&quot;) Then _DialogModel.Width = pvValue
+ Case Else
+ bSet = False
+ End Select
+
+Finally:
+ _PropertySet = bSet
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._PropertySet
+
+REM -----------------------------------------------------------------------------
+Private Function _Repr() As String
+&apos;&apos;&apos; Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Return:
+&apos;&apos;&apos; &quot;[DIALOG]: Container.Library.Name&quot;
+
+ _Repr = &quot;[DIALOG]: &quot; &amp; _Container &amp; &quot;.&quot; &amp; _Library &amp; &quot;.&quot; &amp; _Name
+
+End Function &apos; SFDialogs.SF_Dialog._Repr
+
+REM ============================================ END OF SFDIALOGS.SF_DIALOG
+</script:module> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
new file mode 100644
index 000000000000..3d1494a5c36c
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -0,0 +1,1099 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_DialogControl" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
+REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
+REM === The SFDialogs library is one of the associated libraries. ===
+REM === Full documentation is available on https://help.libreoffice.org/ ===
+REM =======================================================================================================================
+
+Option Compatible
+Option ClassModule
+
+Option Explicit
+
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+&apos;&apos;&apos; SF_DialogControl
+&apos;&apos;&apos; ================
+&apos;&apos;&apos; Manage the controls belonging to a dialog defined with the Basic IDE
+&apos;&apos;&apos; Each instance of the current class represents a single control within a dialog box
+&apos;&apos;&apos;
+&apos;&apos;&apos; The focus is clearly set on getting and setting the values displayed by the controls of the dialog box,
+&apos;&apos;&apos; not on their formatting. The latter is easily accessible via the XControlModel and XControlView
+&apos;&apos;&apos; UNO objects.
+&apos;&apos;&apos; Essentially a single property &quot;Value&quot; maps many alternative UNO properties depending each on
+&apos;&apos;&apos; the control type.
+&apos;&apos;&apos;
+&apos;&apos;&apos; Service invocation:
+&apos;&apos;&apos; Dim myDialog As Object, myControl As Object
+&apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, &quot;GlobalScope&quot;, myLibrary, DialogName)
+&apos;&apos;&apos; Set myControl = myDialog.Controls(&quot;myTextBox&quot;)
+&apos;&apos;&apos; myControl.Value = &quot;Dialog started at &quot; &amp; Now()
+&apos;&apos;&apos; myDialog.Execute()
+&apos;&apos;&apos; &apos; ... process the controls actual values
+&apos;&apos;&apos; myDialog.Terminate()
+&apos;&apos;&apos;
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+
+REM ================================================================== EXCEPTIONS
+
+Private Const CONTROLTYPEERROR = &quot;CONTROLTYPEERROR&quot;
+Private Const TEXTFIELDERROR = &quot;TEXTFIELDERROR&quot;
+
+REM ============================================================= PRIVATE MEMBERS
+
+Private [Me] As Object
+Private [_Parent] As Object
+Private ObjectType As String &apos; Must be DIALOGCONTROL
+Private ServiceName As String
+
+&apos; Control naming
+Private _Name As String
+Private _DialogName As String &apos; Parent dialog name
+
+&apos; Control UNO references
+Private _ControlModel As Object &apos; com.sun.star.awt.XControlModel
+Private _ControlView As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+
+&apos; Control attributes
+Private _ImplementationName As String
+Private _ControlType As String &apos; One of the CTLxxx constants
+
+REM ============================================================ MODULE CONSTANTS
+
+Private Const CTLBUTTON = &quot;Button&quot;
+Private Const CTLCHECKBOX = &quot;CheckBox&quot;
+Private Const CTLCOMBOBOX = &quot;ComboBox&quot;
+Private Const CTLCURRENCYFIELD = &quot;CurrencyField&quot;
+Private Const CTLDATEFIELD = &quot;DateField&quot;
+Private Const CTLFILECONTROL = &quot;FileControl&quot;
+Private Const CTLFIXEDLINE = &quot;FixedLine&quot;
+Private Const CTLFIXEDTEXT = &quot;FixedText&quot;
+Private Const CTLFORMATTEDFIELD = &quot;FormattedField&quot;
+Private Const CTLGROUPBOX = &quot;GroupBox&quot;
+Private Const CTLIMAGECONTROL = &quot;ImageControl&quot;
+Private Const CTLLISTBOX = &quot;ListBox&quot;
+Private Const CTLNUMERICFIELD = &quot;NumericField&quot;
+Private Const CTLPATTERNFIELD = &quot;PatternField&quot;
+Private Const CTLPROGRESSBAR = &quot;ProgressBar&quot;
+Private Const CTLRADIOBUTTON = &quot;RadioButton&quot;
+Private Const CTLSCROLLBAR = &quot;ScrollBar&quot;
+Private Const CTLTEXTFIELD = &quot;TextField&quot;
+Private Const CTLTIMEFIELD = &quot;TimeField&quot;
+
+REM ===================================================== CONSTRUCTOR/DESCTRUCTOR
+
+REM -----------------------------------------------------------------------------
+Private Sub Class_Initialize()
+ Set [Me] = Nothing
+ Set [_Parent] = Nothing
+ ObjectType = &quot;DIALOGCONTROL&quot;
+ ServiceName = &quot;SFDialogs.DialogControl&quot;
+ _Name = &quot;&quot;
+ _DialogName = &quot;&quot;
+ Set _ControlModel = Nothing
+ Set _ControlView = Nothing
+ _ImplementationName = &quot;&quot;
+ _ControlType = &quot;&quot;
+End Sub &apos; SFDialogs.SF_DialogControl Constructor
+
+REM -----------------------------------------------------------------------------
+Private Sub Class_Terminate()
+ Call Class_Initialize()
+End Sub &apos; SFDialogs.SF_DialogControl Destructor
+
+REM -----------------------------------------------------------------------------
+Public Function Dispose() As Variant
+ Call Class_Terminate()
+ Set Dispose = Nothing
+End Function &apos; SFDialogs.SF_DialogControl Explicit Destructor
+
+REM ================================================================== PROPERTIES
+
+REM -----------------------------------------------------------------------------
+Property Get Cancel() As Variant
+&apos;&apos;&apos; The Cancel property specifies if a command button has or not the behaviour of a Cancel button.
+ Cancel = _PropertyGet(&quot;Cancel&quot;, False)
+End Property &apos; SFDialogs.SF_DialogControl.Cancel (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Cancel(Optional ByVal pvCancel As Variant)
+&apos;&apos;&apos; Set the updatable property Cancel
+ _PropertySet(&quot;Cancel&quot;, pvCancel)
+End Property &apos; SFDialogs.SF_DialogControl.Cancel (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Caption() As Variant
+&apos;&apos;&apos; The Caption property refers to the text associated with the control
+ Caption = _PropertyGet(&quot;Caption&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Caption (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Caption(Optional ByVal pvCaption As Variant)
+&apos;&apos;&apos; Set the updatable property Caption
+ _PropertySet(&quot;Caption&quot;, pvCaption)
+End Property &apos; SFDialogs.SF_DialogControl.Caption (let)
+
+REM -----------------------------------------------------------------------------
+Property Get ControlType() As String
+&apos;&apos;&apos; Return the type of the actual control: &quot;CheckBox&quot;, &quot;TextField&quot;, &quot;DateField&quot;, ...
+ ControlType = _PropertyGet(&quot;ControlType&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.ControlType
+
+REM -----------------------------------------------------------------------------
+Property Get Default() As Variant
+&apos;&apos;&apos; The Default property specifies whether a command button is the default (OK) button.
+ Default = _PropertyGet(&quot;Default&quot;, False)
+End Property &apos; SFDialogs.SF_DialogControl.Default (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Default(Optional ByVal pvDefault As Variant)
+&apos;&apos;&apos; Set the updatable property Default
+ _PropertySet(&quot;Default&quot;, pvDefault)
+End Property &apos; SFDialogs.SF_DialogControl.Default (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Enabled() As Variant
+&apos;&apos;&apos; The Enabled property specifies if the control is accessible with the cursor.
+ Enabled = _PropertyGet(&quot;Enabled&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Enabled (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Enabled(Optional ByVal pvEnabled As Variant)
+&apos;&apos;&apos; Set the updatable property Enabled
+ _PropertySet(&quot;Enabled&quot;, pvEnabled)
+End Property &apos; SFDialogs.SF_DialogControl.Enabled (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Format() As Variant
+&apos;&apos;&apos; The Format property specifies the format in which to display dates and times.
+ Format = _PropertyGet(&quot;Format&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Format (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Format(Optional ByVal pvFormat As Variant)
+&apos;&apos;&apos; Set the updatable property Format
+&apos;&apos;&apos; NB: Format is read-only for formatted field controls
+ _PropertySet(&quot;Format&quot;, pvFormat)
+End Property &apos; SFDialogs.SF_DialogControl.Format (let)
+
+REM -----------------------------------------------------------------------------
+Property Get ListCount() As Long
+&apos;&apos;&apos; The ListCount property specifies the number of rows in a list box or a combo box
+ ListCount = _PropertyGet(&quot;ListCount&quot;, 0)
+End Property &apos; SFDialogs.SF_DialogControl.ListCount (get)
+
+REM -----------------------------------------------------------------------------
+Property Get ListIndex() As Variant
+&apos;&apos;&apos; The ListIndex property specifies which item is selected in a list box or combo box.
+&apos;&apos;&apos; In case of multiple selection, the index of the first one is returned or only one is set
+ ListIndex = _PropertyGet(&quot;ListIndex&quot;, -1)
+End Property &apos; SFDialogs.SF_DialogControl.ListIndex (get)
+
+REM -----------------------------------------------------------------------------
+Property Let ListIndex(Optional ByVal pvListIndex As Variant)
+&apos;&apos;&apos; Set the updatable property ListIndex
+ _PropertySet(&quot;ListIndex&quot;, pvListIndex)
+End Property &apos; SFDialogs.SF_DialogControl.ListIndex (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Locked() As Variant
+&apos;&apos;&apos; The Locked property specifies if a control is read-only
+ Locked = _PropertyGet(&quot;Locked&quot;, False)
+End Property &apos; SFDialogs.SF_DialogControl.Locked (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Locked(Optional ByVal pvLocked As Variant)
+&apos;&apos;&apos; Set the updatable property Locked
+ _PropertySet(&quot;Locked&quot;, pvLocked)
+End Property &apos; SFDialogs.SF_DialogControl.Locked (let)
+
+REM -----------------------------------------------------------------------------
+Property Get MultiSelect() As Variant
+&apos;&apos;&apos; The MultiSelect property specifies whether a user can make multiple selections in a listbox
+ MultiSelect = _PropertyGet(&quot;MultiSelect&quot;, False)
+End Property &apos; SFDialogs.SF_DialogControl.MultiSelect (get)
+
+REM -----------------------------------------------------------------------------
+Property Let MultiSelect(Optional ByVal pvMultiSelect As Variant)
+&apos;&apos;&apos; Set the updatable property MultiSelect
+ _PropertySet(&quot;MultiSelect&quot;, pvMultiSelect)
+End Property &apos; SFDialogs.SF_DialogControl.MultiSelect (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Name() As String
+&apos;&apos;&apos; Return the name of the actual control
+ Name = _PropertyGet(&quot;Name&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Name
+
+REM -----------------------------------------------------------------------------
+Property Get Page() As Variant
+&apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step. The Page property of the Dialog object defines which page of the dialog is active.
+&apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
+&apos;&apos;&apos; For example, if a control has a page value of 1, it is only visible on page 1 of the dialog.
+&apos;&apos;&apos; If the page value of the dialog is increased from 1 to 2, then all controls with a page value of 1 disappear and all controls with a page value of 2 become visible.
+ Page = _PropertyGet(&quot;Page&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Page (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Page(Optional ByVal pvPage As Variant)
+&apos;&apos;&apos; Set the updatable property Page
+ _PropertySet(&quot;Page&quot;, pvPage)
+End Property &apos; SFDialogs.SF_DialogControl.Page (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Parent() As Object
+&apos;&apos;&apos; Return the Parent dialog object of the actual control
+ Parent = _PropertyGet(&quot;Parent&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.Parent
+
+REM -----------------------------------------------------------------------------
+Property Get Picture() As Variant
+&apos;&apos;&apos; The Picture property specifies a bitmap or other type of graphic to be displayed on the specified control
+ Picture = _PropertyGet(&quot;Picture&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Picture (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Picture(Optional ByVal pvPicture As Variant)
+&apos;&apos;&apos; Set the updatable property Picture
+ _PropertySet(&quot;Picture&quot;, pvPicture)
+End Property &apos; SFDialogs.SF_DialogControl.Picture (let)
+
+REM -----------------------------------------------------------------------------
+Property Get RowSource() As Variant
+&apos;&apos;&apos; The RowSource property specifies the data contained in a combobox or a listbox
+&apos;&apos;&apos; as a zero-based array of string values
+ RowSource = _PropertyGet(&quot;RowSource&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.RowSource (get)
+
+REM -----------------------------------------------------------------------------
+Property Let RowSource(Optional ByVal pvRowSource As Variant)
+&apos;&apos;&apos; Set the updatable property RowSource
+ _PropertySet(&quot;RowSource&quot;, pvRowSource)
+End Property &apos; SFDialogs.SF_DialogControl.RowSource (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Text() As Variant
+&apos;&apos;&apos; The Text property specifies the actual content of the control like it is displayed on the screen
+ Text = _PropertyGet(&quot;Text&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Text (get)
+
+REM -----------------------------------------------------------------------------
+Property Get TipText() As Variant
+&apos;&apos;&apos; The TipText property specifies the text that appears in a screentip when you hold the mouse pointer over a control
+ TipText = _PropertyGet(&quot;TipText&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.TipText (get)
+
+REM -----------------------------------------------------------------------------
+Property Let TipText(Optional ByVal pvTipText As Variant)
+&apos;&apos;&apos; Set the updatable property TipText
+ _PropertySet(&quot;TipText&quot;, pvTipText)
+End Property &apos; SFDialogs.SF_DialogControl.TipText (let)
+
+REM -----------------------------------------------------------------------------
+Property Get TripleState() As Variant
+&apos;&apos;&apos; The TripleState property specifies how a check box will display Null values
+&apos;&apos;&apos; When True, the control will cycle through states for Yes, No, and Null values. The control appears dimmed (grayed) when its Value property is set to Null.
+&apos;&apos;&apos; When False, the control will cycle through states for Yes and No values. Null values display as if they were No values.
+ TripleState = _PropertyGet(&quot;TripleState&quot;, False)
+End Property &apos; SFDialogs.SF_DialogControl.TripleState (get)
+
+REM -----------------------------------------------------------------------------
+Property Let TripleState(Optional ByVal pvTripleState As Variant)
+&apos;&apos;&apos; Set the updatable property TripleState
+ _PropertySet(&quot;TripleState&quot;, pvTripleState)
+End Property &apos; SFDialogs.SF_DialogControl.TripleState (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Value() As Variant
+&apos;&apos;&apos; The Value property specifies the data contained in the control
+ Value = _PropertyGet(&quot;Value&quot;, Empty)
+End Property &apos; SFDialogs.SF_DialogControl.Value (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Value(Optional ByVal pvValue As Variant)
+&apos;&apos;&apos; Set the updatable property Value
+ _PropertySet(&quot;Value&quot;, pvValue)
+End Property &apos; SFDialogs.SF_DialogControl.Value (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Visible() As Variant
+&apos;&apos;&apos; The Visible property specifies if the control is accessible with the cursor.
+ Visible = _PropertyGet(&quot;Visible&quot;, True)
+End Property &apos; SFDialogs.SF_DialogControl.Visible (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Visible(Optional ByVal pvVisible As Variant)
+&apos;&apos;&apos; Set the updatable property Visible
+ _PropertySet(&quot;Visible&quot;, pvVisible)
+End Property &apos; SFDialogs.SF_DialogControl.Visible (let)
+
+REM -----------------------------------------------------------------------------
+Property Get XControlModel() As Object
+&apos;&apos;&apos; The XControlModel property returns the model UNO object of the control
+ XControlModel = _PropertyGet(&quot;XControlModel&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.XControlModel (get)
+
+REM -----------------------------------------------------------------------------
+Property Get XControlView() As Object
+&apos;&apos;&apos; The XControlView property returns the view UNO object of the control
+ XControlView = _PropertyGet(&quot;XControlView&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.XControlView (get)
+
+REM ===================================================================== METHODS
+
+REM -----------------------------------------------------------------------------
+Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
+&apos;&apos;&apos; Return the actual value of the given property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; PropertyName: the name of the property as a string
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The actual value of the property
+&apos;&apos;&apos; If the property does not exist, returns Null
+&apos;&apos;&apos; Exceptions:
+&apos;&apos;&apos; see the exceptions of the individual properties
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; myModel.GetProperty(&quot;MyProperty&quot;)
+
+Const cstThisSub = &quot;SFDialogs.DialogControl.GetProperty&quot;
+Const cstSubArgs = &quot;&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ GetProperty = Null
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
+ End If
+
+Try:
+ GetProperty = _PropertyGet(PropertyName)
+
+Finally:
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.GetProperty
+
+REM -----------------------------------------------------------------------------
+Public Function Methods() As Variant
+&apos;&apos;&apos; Return the list of public methods of the Model service as an array
+
+ Methods = Array( _
+ &quot;SetFocus&quot; _
+ , &quot;WriteLine&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_DialogControl.Methods
+
+REM -----------------------------------------------------------------------------
+Public Function Properties() As Variant
+&apos;&apos;&apos; Return the list or properties of the Timer class as an array
+
+ Properties = Array( _
+ &quot;Cancel&quot; _
+ , &quot;Caption&quot; _
+ , &quot;ControlType&quot; _
+ , &quot;Default&quot; _
+ , &quot;Enabled&quot; _
+ , &quot;Format&quot; _
+ , &quot;ListCount&quot; _
+ , &quot;ListIndex&quot; _
+ , &quot;Locked&quot; _
+ , &quot;MultiSelect&quot; _
+ , &quot;Name&quot; _
+ , &quot;Page&quot; _
+ , &quot;Parent&quot; _
+ , &quot;Picture&quot; _
+ , &quot;RowSource&quot; _
+ , &quot;Text&quot; _
+ , &quot;TipText&quot; _
+ , &quot;TripleState&quot; _
+ , &quot;Value&quot; _
+ , &quot;Visible&quot; _
+ , &quot;XControlModel&quot; _
+ , &quot;XControlView&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_DialogControl.Properties
+
+REM -----------------------------------------------------------------------------
+Public Function SetFocus() As Boolean
+&apos;&apos;&apos; Set the focus on the current Control instance
+&apos;&apos;&apos; Probably called from after an event occurrence
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True if focusing is successful
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim oDlg As Object, oControl As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myControl&quot;) &apos; Control stored in current document&apos;s standard library
+&apos;&apos;&apos; Set oControl = oDlg.Controls(&quot;thisControl&quot;)
+&apos;&apos;&apos; oControl.SetFocus()
+
+Dim bSetFocus As Boolean &apos; Return value
+Const cstThisSub = &quot;SFDialogs.DialogControl.SetFocus&quot;
+Const cstSubArgs = &quot;&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bSetFocus = False
+
+Check:
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not [_Parent]._IsStillAlive() Then GoTo Finally
+ End If
+
+Try:
+ If Not IsNull(_ControlView) Then
+ _ControlView.setFocus()
+ bSetFocus = True
+ End If
+
+Finally:
+ SetFocus = bSetFocus
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFControls.SF_DialogControl.SetFocus
+
+REM -----------------------------------------------------------------------------
+Public Function SetProperty(Optional ByVal PropertyName As Variant _
+ , Optional ByRef Value As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Set a new value to the given property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; PropertyName: the name of the property as a string
+&apos;&apos;&apos; Value: its new value
+&apos;&apos;&apos; Exceptions
+&apos;&apos;&apos; ARGUMENTERROR The property does not exist
+
+Const cstThisSub = &quot;SFDialogs.DialogControl.SetProperty&quot;
+Const cstSubArgs = &quot;PropertyName, Value&quot;
+
+ If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ SetProperty = False
+
+Check:
+ If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
+ End If
+
+Try:
+ SetProperty = _PropertySet(PropertyName, Value)
+
+Finally:
+ SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.SetProperty
+
+REM -----------------------------------------------------------------------------
+Public Function WriteLine(Optional ByVal Line As Variant) As Boolean
+&apos;&apos;&apos; Add a new line to a multiline TextField control
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Line: (default = &quot;&quot;) the line to insert at the end of the text box
+&apos;&apos;&apos; a newline character will be inserted before the line, if relevant
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True if insertion is successful
+&apos;&apos;&apos; Exceptions
+&apos;&apos;&apos; TEXTFIELDERROR Method applicable on multiline text fields only
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Dim oDlg As Object, oControl As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myControl&quot;) &apos; Control stored in current document&apos;s standard library
+&apos;&apos;&apos; Set oControl = oDlg.Controls(&quot;thisControl&quot;)
+&apos;&apos;&apos; oControl.WriteLine(&quot;a new line&quot;)
+
+Dim bWriteLine As Boolean &apos; Return value
+Dim lTextLength As Long &apos; Actual length of text in box
+Dim oSelection As New com.sun.star.awt.Selection
+Dim sNewLine As String &apos; Newline character(s)
+Const cstThisSub = &quot;SFDialogs.DialogControl.WriteLine&quot;
+Const cstSubArgs = &quot;[Line=&quot;&quot;&quot;&quot;]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bWriteLine = False
+
+Check:
+ If IsMissing(Line) Or IsEmpty(Line) Then Line = &quot;&quot;
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not [_Parent]._IsStillAlive() Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Line, &quot;Line&quot;, V_STRING) Then GoTo Finally
+ End If
+ If ControlType &lt;&gt; CTLTEXTFIELD Then GoTo CatchField
+ If _ControlModel.MultiLine = False Then GoTo CatchField
+
+Try:
+ _ControlModel.HardLineBreaks = True
+ sNewLine = ScriptForge.SF_String.sfNEWLINE
+ With _ControlView
+ lTextLength = Len(.getText())
+ If lTextLength = 0 Then &apos; Text field is still empty
+ oSelection.Min = 0 : oSelection.Max = 0
+ .setText(Line)
+ Else &apos; Put cursor at the end of the actual text
+ oSelection.Min = lTextLength : oSelection.Max = lTextLength
+ .insertText(oSelection, sNewLine &amp; Line)
+ End If
+ &apos; Put the cursor at the end of the inserted text
+ oSelection.Max = oSelection.Max + Len(sNewLine) + Len(Line)
+ oSelection.Min = oSelection.Max
+ .setSelection(oSelection)
+ End With
+ bWriteLine = True
+
+Finally:
+ WriteLine = bWriteLine
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchField:
+ ScriptForge.SF_Exception.RaiseFatal(TEXTFIELDERROR, _Name, _DialogName)
+ GoTo Finally
+End Function &apos; SFControls.SF_DialogControl.WriteLine
+
+REM =========================================================== PRIVATE FUNCTIONS
+
+REM -----------------------------------------------------------------------------
+Private Function _FormatsList() As Variant
+&apos;&apos;&apos; Return the allowed format entries as a zero-based array for Date and Time control types
+
+Dim vFormats() As Variant &apos; Return value
+
+ Select Case _ControlType
+ Case CTLDATEFIELD
+ vFormats = Array( _
+ &quot;Standard (short)&quot; _
+ , &quot;Standard (short YY)&quot; _
+ , &quot;Standard (short YYYY)&quot; _
+ , &quot;Standard (long)&quot; _
+ , &quot;DD/MM/YY&quot; _
+ , &quot;MM/DD/YY&quot; _
+ , &quot;YY/MM/DD&quot; _
+ , &quot;DD/MM/YYYY&quot; _
+ , &quot;MM/DD/YYYY&quot; _
+ , &quot;YYYY/MM/DD&quot; _
+ , &quot;YY-MM-DD&quot; _
+ , &quot;YYYY-MM-DD&quot; _
+ )
+ Case CTLTIMEFIELD
+ vFormats = Array( _
+ &quot;24h short&quot; _
+ , &quot;24h long&quot; _
+ , &quot;12h short&quot; _
+ , &quot;12h long&quot; _
+ )
+ Case Else
+ vFormats = Array()
+ End Select
+
+ _FormatsList = vFormats
+
+End Function &apos; SFDialogs.SF_DialogControl._FormatsList
+
+REM -----------------------------------------------------------------------------
+Public Sub _Initialize()
+&apos;&apos;&apos; Complete the object creation process:
+&apos;&apos;&apos; - Initialization of private members
+&apos;&apos;&apos; - Collection of main attributes
+
+Dim vServiceName As Variant &apos; Splitted service name
+Dim sType As String &apos; Last component of service name
+Try:
+ _ImplementationName = _ControlModel.getImplementationName()
+
+ &apos; Identify the control type
+ vServiceName = Split(_ControlModel.getServiceName(), &quot;.&quot;)
+ sType = vServiceName(UBound(vServiceName))
+ Select Case sType
+ Case &quot;UnoControlSpinButtonModel&quot;, &quot;TreeControlModel&quot;
+ _ControlType = &quot;&quot; &apos; Not supported
+ Case &quot;Edit&quot; : _ControlType = CTLTEXTFIELD
+ Case Else : _ControlType = sType
+ End Select
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_DialogControl._Initialize
+
+REM -----------------------------------------------------------------------------
+Private Function _PropertyGet(Optional ByVal psProperty As String _
+ , Optional ByVal pvDefault As Variant _
+ ) As Variant
+&apos;&apos;&apos; Return the value of the named property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psProperty: the name of the property
+&apos;&apos;&apos; pvDefault: the value returned when the property is not applicable on the control&apos;s type
+&apos;&apos;&apos; Getting a non-existing property for a specific control type should
+&apos;&apos;&apos; not generate an error to not disrupt the Basic IDE debugger
+
+Dim vGet As Variant &apos; Return value
+Static oSession As Object &apos; Alias of SF_Session
+Dim vSelection As Variant &apos; Alias of Model.SelectedItems
+Dim vList As Variant &apos; Alias of Model.StringItemList
+Dim lIndex As Long &apos; Index in StringItemList
+Dim sItem As String &apos; A single item
+Dim vDate As Variant &apos; com.sun.star.util.Date or com.sun.star.util.Time
+Dim vValues As Variant &apos; Array of listbox values
+Dim i As Long
+Dim cstThisSub As String
+Const cstSubArgs = &quot;&quot;
+
+ cstThisSub = &quot;SFDialogs.DialogControl.get&quot; &amp; psProperty
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+
+ ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
+ If Not [_Parent]._IsStillAlive() Then GoTo Finally
+
+ If IsMissing(pvDefault) Then pvDefault = Null
+ _PropertyGet = pvDefault
+
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+ Select Case psProperty
+ Case &quot;Cancel&quot;
+ Select Case _ControlType
+ Case CTLBUTTON
+ If oSession.HasUNOProperty(_ControlModel, &quot;PushButtonType&quot;) Then _PropertyGet = ( _ControlModel.PushButtonType = com.sun.star.awt.PushButtonType.CANCEL )
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Caption&quot;
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
+ If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _PropertyGet = _ControlModel.Label
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;ControlType&quot;
+ _PropertyGet = _ControlType
+ Case &quot;Default&quot;
+ Select Case _ControlType
+ Case CTLBUTTON
+ If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _PropertyGet = _ControlModel.DefaultButton
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Enabled&quot;
+ If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _PropertyGet = _ControlModel.Enabled
+ Case &quot;Format&quot;
+ Select Case _ControlType
+ Case CTLDATEFIELD
+ If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.DateFormat)
+ Case CTLTIMEFIELD
+ If oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.TimeFormat)
+ Case CTLFORMATTEDFIELD
+ If oSession.HasUNOProperty(_ControlModel, &quot;FormatsSupplier&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;FormatKey&quot;) Then
+ _PropertyGet = _ControlModel.FormatsSupplier.getNumberFormats.getByKey(_ControlModel.FormatKey).FormatString
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;ListCount&quot;
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLLISTBOX
+ If oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then _PropertyGet = UBound(_ControlModel.StringItemList) + 1
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;ListIndex&quot;
+ Select Case _ControlType
+ Case CTLCOMBOBOX
+ _PropertyGet = -1 &apos; Not found, multiselection
+ If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
+ _PropertyGet = ScriptForge.SF_Array.IndexOf(_ControlModel.StringItemList, _ControlModel.Text, CaseSensitive := True)
+ End If
+ Case CTLLISTBOX
+ _PropertyGet = -1 &apos; Not found, multiselection
+ If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
+ vSelection = _ControlModel.SelectedItems
+ If UBound(vSelection) &gt;= 0 Then _PropertyGet = vSelection(0)
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Locked&quot;
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLLISTBOX _
+ , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
+ If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _PropertyGet = _ControlModel.ReadOnly
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;MultiSelect&quot;
+ Select Case _ControlType
+ Case CTLLISTBOX
+ If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
+ _PropertyGet = _ControlModel.MultiSelection
+ ElseIf oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then &apos; Not documented: gridcontrols only TBC ??
+ _PropertyGet = _ControlModel.MultiSelectionSimpleMode
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Name&quot;
+ _PropertyGet = _Name
+ Case &quot;Page&quot;
+ If oSession.HasUnoProperty(_ControlModel, &quot;Step&quot;) Then _PropertyGet = _ControlModel.Step
+ Case &quot;Parent&quot;
+ Set _PropertyGet = [_Parent]
+ Case &quot;Picture&quot;
+ Select Case _ControlType
+ Case CTLBUTTON, CTLIMAGECONTROL
+ If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _PropertyGet = ScriptForge.SF_FileSystem._ConvertFromUrl(_ControlModel.ImageURL)
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;RowSource&quot;
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLLISTBOX
+ If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then
+ If IsArray(_ControlModel.StringItemList) Then _PropertyGet = _ControlModel.StringItemList Else _PropertyGet = Array(_ControlModel.StringItemList)
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Text&quot;
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLPATTERNFIELD, CTLTEXTFIELD
+ If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _PropertyGet = _ControlModel.Text
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;TipText&quot;
+ If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _PropertyGet = _ControlModel.HelpText
+ Case &quot;TripleState&quot;
+ Select Case _ControlType
+ Case CTLCHECKBOX
+ If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _PropertyGet = _ControlModel.TriState
+ Case Else : GoTo CatchType
+ End Select
+ Case &quot;Value&quot; &apos; Default values are set here by control type, not in the 2nd argument
+ vGet = pvDefault
+ Select Case _ControlType
+ Case CTLBUTTON &apos;Boolean, toggle buttons only
+ vGet = False
+ If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) Then
+ If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 )
+ End If
+ Case CTLCHECKBOX &apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
+ If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = _ControlModel.State Else vGet = 2
+ Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD &apos;String
+ If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then vGet = _ControlModel.Text Else vGet = &quot;&quot;
+ Case CTLCURRENCYFIELD, CTLNUMERICFIELD &apos;Numeric
+ If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then vGet = _ControlModel.Value Else vGet = 0
+ Case CTLDATEFIELD &apos;Date
+ vGet = CDate(1)
+ If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
+ If VarType(_ControlModel.Date) = ScriptForge.V_OBJECT Then &apos; com.sun.star.util.Date
+ Set vDate = _ControlModel.Date
+ vGet = DateSerial(vDate.Year, vDate.Month, vDate.Day)
+ End If
+ End If
+ Case CTLFORMATTEDFIELD &apos;String or numeric
+ If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then vGet = _ControlModel.EffectiveValue Else vGet = &quot;&quot;
+ Case CTLLISTBOX &apos;String or array of strings depending on MultiSelection
+ &apos; StringItemList is the list of the items displayed in the box
+ &apos; SelectedItems is the list of the indexes in StringItemList of the selected items
+ &apos; It can go beyond the limits of StringItemList
+ &apos; It can contain multiple values even if the listbox is not multiselect
+ If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) _
+ And oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
+ vSelection = _ControlModel.SelectedItems
+ vList = _ControlModel.StringItemList
+ If _ControlModel.MultiSelection Then vValues = Array()
+ For i = 0 To UBound(vSelection)
+ lIndex = vSelection(i)
+ If lIndex &gt;= 0 And lIndex &lt;= UBound(vList) Then
+ If Not _ControlModel.MultiSelection Then
+ vValues = vList(lIndex)
+ Exit For
+ End If
+ vValues = ScriptForge.SF_Array.Append(vValues, vList(lIndex))
+ End If
+ Next i
+ vGet = vValues
+ Else
+ vGet = &quot;&quot;
+ End If
+ Case CTLPROGRESSBAR &apos;Numeric
+ If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValue&quot;) Then vGet = _ControlModel.ProgressValue Else vGet = 0
+ Case CTLRADIOBUTTON &apos;Boolean
+ If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 ) Else vGet = False
+ Case CTLSCROLLBAR &apos;Numeric
+ If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then vGet = _ControlModel.ScrollValue Else vGet = 0
+ Case CTLTIMEFIELD
+ vGet = CDate(0)
+ If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
+ If VarType(_ControlModel.Time) = ScriptForge.V_OBJECT Then &apos; com.sun.star.Util.Time
+ Set vDate = _ControlModel.Time
+ vGet = TimeSerial(vDate.Hours, vDate.Minutes, vDate.Seconds)
+ End If
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ _PropertyGet = vGet
+ Case &quot;Visible&quot;
+ If oSession.HasUnoMethod(_ControlView, &quot;isVisible&quot;) Then _PropertyGet = CBool(_ControlView.isVisible())
+ Case &quot;XControlModel&quot;
+ Set _PropertyGet = _ControlModel
+ Case &quot;XControlView&quot;
+ Set _PropertyGet = _ControlView
+ Case Else
+ _PropertyGet = Null
+ End Select
+
+Finally:
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl._PropertyGet
+
+REM -----------------------------------------------------------------------------
+Private Function _PropertySet(Optional ByVal psProperty As String _
+ , Optional ByVal pvValue As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Set the new value of the named property
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psProperty: the name of the property
+&apos;&apos;&apos; pvValue: the new value of the given property
+
+Dim bSet As Boolean &apos; Return value
+Static oSession As Object &apos; Alias of SF_Session
+Dim vSet As Variant &apos; Value to set in UNO model or view property
+Dim vFormats As Variant &apos; Format property: output of _FormatsList()
+Dim iFormat As Integer &apos; Format property: index in vFormats
+Dim vSelection As Variant &apos; Alias of Model.SelectedItems
+Dim vList As Variant &apos; Alias of Model.StringItemList
+Dim lIndex As Long &apos; Index in StringItemList
+Dim sItem As String &apos; A single item
+Dim i As Long
+Dim cstThisSub As String
+Const cstSubArgs = &quot;Value&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bSet = False
+
+ cstThisSub = &quot;SFDialogs.DialogControl.set&quot; &amp; psProperty
+ ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
+ If Not [_Parent]._IsStillAlive() Then GoTo Finally
+
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+ bSet = True
+ Select Case UCase(psProperty)
+ Case UCase(&quot;Cancel&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Cancel&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUNOProperty(_ControlModel, &quot;PushButtonType&quot;) Then
+ If pvValue Then vSet = com.sun.star.awt.PushButtonType.CANCEL Else vSet = com.sun.star.awt.PushButtonType.STANDARD
+ _ControlModel.PushButtonType = vSet
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Caption&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _ControlModel.Label = pvValue
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Default&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Default&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _ControlModel.DefaultButton = pvValue
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Enabled&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Enabled&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _ControlModel.Enabled = pvValue
+ Case UCase(&quot;Format&quot;)
+ Select Case _ControlType
+ Case CTLDATEFIELD, CTLTIMEFIELD
+ vFormats = _FormatsList()
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Format&quot;, V_STRING, vFormats) Then GoTo Finally
+ iFormat = ScriptForge.SF_Array.IndexOf(vFormats, pvValue, CaseSensitive := False)
+ If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then
+ _ControlModel.DateFormat = iFormat
+ ElseIf oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then
+ _ControlModel.TimeFormat = iFormat
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;ListIndex&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;ListIndex&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ Select Case _ControlType
+ Case CTLCOMBOBOX
+ If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
+ _ControlModel.Text = _ControlModel.StringItemList(CInt(pvValue))
+ End If
+ Case CTLLISTBOX
+ If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) Then _ControlModel.SelectedItems = Array(CInt(pvValue))
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Locked&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLLISTBOX _
+ , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Locked&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _ControlModel.ReadOnly = pvValue
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;MultiSelect&quot;)
+ Select Case _ControlType
+ Case CTLLISTBOX
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;MultiSelect&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then _ControlModel.MultiSelection = pvValue
+ If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then _ControlModel.MultiSelectionSimpleMode = pvValue
+ If oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) Then
+ If Not pvValue And UBound(_ControlModel.SelectedItems) &gt; 0 Then &apos; Cancel selections when MultiSelect becomes False
+ lIndex = _ControlModel.SelectedItems(0)
+ _ControlModel.SelectedItems = Array(lIndex)
+ End If
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Page&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Step&quot;) Then _ControlModel.Step = CLng(pvValue)
+ Case UCase(&quot;Picture&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLIMAGECONTROL
+ If Not ScriptForge.SF_Utils._ValidateFile(pvValue, &quot;Picture&quot;) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _ControlModel.ImageURL = ScriptForge.SF_FileSystem._ConvertToUrl(pvValue)
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;RowSource&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLLISTBOX
+ If Not IsArray(pvValue) Then
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;RowSource&quot;, V_STRING) Then GoTo Finally
+ pvArray = Array(pvArray)
+ ElseIf Not ScriptForge.SF_Utils._ValidateArray(pvValue, &quot;RowSource&quot;, 1, V_STRING, True) Then
+ GoTo Finally
+ End If
+ If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then _ControlModel.StringItemList = pvValue
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;TipText&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TipText&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _ControlModel.HelpText = pvValue
+ Case UCase(&quot;TripleState&quot;)
+ Select Case _ControlType
+ Case CTLCHECKBOX
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TripleState&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _ControlModel.TriState = pvValue
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Value&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON &apos;Boolean, toggle buttons only
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
+ _ControlModel.State = Iif(pvValue, 1, 0)
+ End If
+ Case CTLCHECKBOX &apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(ScriptForge.V_BOOLEAN, ScriptForge.V_NUMERIC), Array(0, 1, 2, True, False)) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
+ If VarType(pvValue) = ScriptForge.V_BOOLEAN Then pvValue = Iif(pvValue, 1, 0)
+ _ControlModel.State = pvValue
+ End If
+ Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD &apos;String
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _ControlModel.Text = pvValue
+ Case CTLCURRENCYFIELD, CTLNUMERICFIELD &apos;Numeric
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then _ControlModel.Value = pvValue
+ Case CTLDATEFIELD &apos;Date
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
+ Set vSet = New com.sun.star.util.Date
+ vSet.Year = Year(pvValue)
+ vSet.Month = Month(pvValue)
+ vSet.Day = Day(pvValue)
+ _ControlModel.Date = vSet
+ End If
+ Case CTLFORMATTEDFIELD &apos;String or numeric
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(V_STRING, ScriptForge.V_NUMERIC)) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then _ControlModel.EffectiveValue = pvValue
+ Case CTLLISTBOX &apos;String or array of strings depending on MultiSelection
+ &apos; StringItemList is the list of the items displayed in the box
+ &apos; SelectedItems is the list of the indexes in StringItemList of the selected items
+ &apos; It can go beyond the limits of StringItemList
+ &apos; It can contain multiple values even if the listbox is not multiselect
+ If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) _
+ And oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
+ vSelection = Array()
+ If _ControlModel.MultiSelection Then
+ If Not ScriptForge.SF_Utils._ValidateArray(pvValue, &quot;Value&quot;, 1, V_STRING, True) Then GoTo Finally
+ vList = _ControlModel.StringItemList
+ For i = LBound(pvValue) To UBound(pvValue)
+ sItem = pvValue(i)
+ lIndex = ScriptForge.SF_Array.IndexOf(vList, sItem)
+ If lIndex &gt;= 0 Then vSelection = ScriptForge.SF_Array.Append(vSelection, lIndex)
+ Next i
+ Else
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
+ lIndex = ScriptForge.SF_Array.IndexOf(_ControlModel.StringItemList, pvValue)
+ If lIndex &gt;= 0 Then vSelection = Array(lIndex)
+ End If
+ _ControlModel.SelectedItems = vSelection
+ End If
+ Case CTLPROGRESSBAR &apos;Numeric
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValueMin&quot;) Then
+ If pvValue &lt; _ControlModel.ProgressValueMin Then pvValue = _ControlModel.ProgressValueMin
+ End If
+ If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValueMax&quot;) Then
+ If pvValue &gt; _ControlModel.ProgressValueMax Then pvValue = _ControlModel.ProgressValueMax
+ End If
+ If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValue&quot;) Then _ControlModel.ProgressValue = pvValue
+ Case CTLRADIOBUTTON &apos;Boolean
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then _ControlModel.State = Iif(pvValue, 1, 0)
+ Case CTLSCROLLBAR &apos;Numeric
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMin&quot;) Then
+ If pvValue &lt; _ControlModel.ScrollValueMin Then pvValue = _ControlModel.ScrollValueMin
+ End If
+ If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMax&quot;) Then
+ If pvValue &gt; _ControlModel.ScrollValueMax Then pvValue = _ControlModel.ScrollValueMax
+ End If
+ If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then _ControlModel.ScrollValue = pvValue
+ Case CTLTIMEFIELD
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
+ Set vSet = New com.sun.star.util.Time
+ vSet.Hours = Hour(pvValue)
+ vSet.Minutes = Minute(pvValue)
+ vSet.Seconds = Second(pvValue)
+ _ControlModel.Time = vSet
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Visible&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If oSession.HasUnoMethod(_ControlView, &quot;setVisible&quot;) Then
+ If pvValue Then _ControlModel.EnableVisible = True
+ _ControlView.setVisible(pvValue)
+ End If
+ Case Else
+ bSet = False
+ End Select
+
+Finally:
+ _PropertySet = bSet
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, psProperty)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl._PropertySet
+
+REM -----------------------------------------------------------------------------
+Private Function _Repr() As String
+&apos;&apos;&apos; Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Return:
+&apos;&apos;&apos; &quot;[DIALOGCONTROL]: Name, Type (dialogname)
+ _Repr = &quot;[DIALOGCONTROL]: &quot; &amp; _Name &amp; &quot;, &quot; &amp; _ControlType &amp; &quot; (&quot; &amp; _DialogName &amp; &quot;)&quot;
+
+End Function &apos; SFDialogs.SF_DialogControl._Repr
+
+REM ============================================ END OF SFDIALOGS.SF_DIALOGCONTROL
+</script:module> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/SF_Register.xba b/wizards/source/sfdialogs/SF_Register.xba
new file mode 100644
index 000000000000..dba36894abf9
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_Register.xba
@@ -0,0 +1,327 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Register" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
+REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
+REM === The SFDialogs library is one of the associated libraries. ===
+REM === Full documentation is available on https://help.libreoffice.org/ ===
+REM =======================================================================================================================
+
+Option Compatible
+Option Explicit
+
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+&apos;&apos;&apos; SF_Register
+&apos;&apos;&apos; ===========
+&apos;&apos;&apos; The ScriptForge framework includes
+&apos;&apos;&apos; the master ScriptForge library
+&apos;&apos;&apos; a number of &quot;associated&quot; libraries SF*
+&apos;&apos;&apos; any user/contributor extension wanting to fit into the framework
+&apos;&apos;&apos;
+&apos;&apos;&apos; The main methods in this module allow the current library to cling to ScriptForge
+&apos;&apos;&apos; - RegisterScriptServices
+&apos;&apos;&apos; Register the list of services implemented by the current library
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
+
+REM ================================================================= DEFINITIONS
+
+&apos;&apos;&apos; Event management of dialogs requires to being able to rebuild a Dialog object
+&apos;&apos;&apos; from its com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl UNO instance
+&apos;&apos;&apos; For that purpose, the started dialogs are buffered in a global array of _DialogCache types
+
+Type _DialogCache
+ Terminated As Boolean
+ XUnoDialog As Object
+ BasicDialog As Object
+End Type
+
+REM ================================================================== EXCEPTIONS
+
+Private Const DIALOGNOTFOUNDERROR = &quot;DIALOGNOTFOUNDERROR&quot;
+
+REM ============================================================== PUBLIC METHODS
+
+REM -----------------------------------------------------------------------------
+Public Sub RegisterScriptServices() As Variant
+&apos;&apos;&apos; Register into ScriptForge the list of the services implemented by the current library
+&apos;&apos;&apos; Each library pertaining to the framework must implement its own version of this method
+&apos;&apos;&apos;
+&apos;&apos;&apos; It consists in successive calls to the RegisterService() and RegisterEventManager() methods
+&apos;&apos;&apos; with 2 arguments:
+&apos;&apos;&apos; ServiceName: the name of the service as a case-insensitive string
+&apos;&apos;&apos; ServiceReference: the reference as an object
+&apos;&apos;&apos; If the reference refers to a module, then return the module as an object:
+&apos;&apos;&apos; GlobalScope.Library.Module
+&apos;&apos;&apos; If the reference is a class instance, then return a string referring to the method
+&apos;&apos;&apos; containing the New statement creating the instance
+&apos;&apos;&apos; &quot;libraryname.modulename.function&quot;
+
+ With GlobalScope.ScriptForge.SF_Services
+ .RegisterService(&quot;Dialog&quot;, &quot;SFDialogs.SF_Register._NewDialog&quot;) &apos; Reference to the function initializing the service
+ .RegisterEventManager(&quot;DialogEvent&quot;, &quot;SFDialogs.SF_Register._EventManager&quot;) &apos; Reference to the events manager
+ &apos;TODO
+ End With
+
+End Sub &apos; SFDialogs.SF_Register.RegisterScriptServices
+
+REM =========================================================== PRIVATE FUNCTIONS
+
+REM -----------------------------------------------------------------------------
+Private Function _AddDialogToCache(ByRef pvUnoDialog As Object _
+ , ByRef pvBasicDialog As Object _
+ ) As Long
+&apos;&apos;&apos; Add a new entry in the cache array with the references of the actual dialog
+&apos;&apos;&apos; If relevant, the last entry of the cache is reused.
+&apos;&apos;&apos; The cache is located in the global _SF_ variable
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; pvUnoDialog: the com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl of the dialog box
+&apos;&apos;&apos; pvBasicDialog: its corresponding Basic object
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The index of the new or modified entry
+
+Dim vCache As New _DialogCache &apos; Entry to be added
+Dim lIndex As Long &apos; UBound of _SF_.SFDialogs
+Dim vCacheArray As Variant &apos; Alias of _SF_.SFDialogs
+
+Try:
+ vCacheArray = _SF_.SFDialogs
+
+ If IsEmpty(vCacheArray) Then vCacheArray = Array()
+ lIndex = UBound(vCacheArray)
+ If lIndex &lt; LBound(vCacheArray) Then
+ ReDim vCacheArray(0 To 0)
+ lIndex = 0
+ ElseIf Not vCacheArray(lIndex).Terminated Then &apos; Often last entry can be reused
+ lIndex = lIndex + 1
+ ReDim Preserve vCacheArray(0 To lIndex)
+ End If
+
+ With vCache
+ .Terminated = False
+ Set .XUnoDialog = pvUnoDialog
+ Set .BasicDialog = pvBasicDialog
+ End With
+ vCacheArray(lIndex) = vCache
+
+ _SF_.SFDialogs = vCacheArray
+
+Finally:
+ _AddDialogToCache = lIndex
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog._AddDialogToCache
+
+REM -----------------------------------------------------------------------------
+Private Sub _CleanCacheEntry(ByVal plIndex As Long)
+&apos;&apos;&apos; Clean the plIndex-th entry in the dialogs cache
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; plIndex: must fit within the actual boundaries of the cache, otherwise the request is ignored
+
+Dim vCache As New _DialogCache &apos; Cleaned entry
+
+ With _SF_
+ If Not IsArray(.SFDialogs) Then Exit Sub
+ If plIndex &lt; LBound(.SFDialogs) Or plIndex &gt; UBound(.SFDialogs) Then Exit Sub
+
+ With vCache
+ .Terminated = True
+ Set .XUnoDialog = Nothing
+ Set .BasicDialog = Nothing
+ End With
+ .SFDialogs(plIndex) = vCache
+ End With
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialog._CleanCacheEntry
+
+REM -----------------------------------------------------------------------------
+Public Function _EventManager(Optional ByRef pvArgs As Variant) As Object
+&apos;&apos;&apos; Returns a Dialog or DialogControl object corresponding with the Basic dialog
+&apos;&apos;&apos; which triggered the event in argument
+&apos;&apos;&apos; This method should be triggered only thru the invocation of CreateScriptService
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; pvEvent: com.sun.star.xxx
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; the output of a Dialog or DialogControl service or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Sub TriggeredByEvent(ByRef poEvent As Object)
+&apos;&apos;&apos; Dim oDlg As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+&apos;&apos;&apos; If Not IsNull(oDlg) Then
+&apos;&apos;&apos; &apos; ... (a valid dialog or one of its controls has been identified)
+&apos;&apos;&apos; End Sub
+
+Dim oSource As Object &apos; Return value
+Dim oEventSource As Object &apos; Event UNO source
+Dim vEvent As Variant &apos; Alias of pvArgs(0)
+Dim sSourceType As String &apos; Implementation name of event source
+Dim oDialog As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+Dim bControl As Boolean &apos; True when control event
+
+ &apos; Never abort while an event is processed
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Finally
+ Set oSource = Nothing
+
+Check:
+ If IsMissing(pvArgs) Or IsEmpty(pvArgs) Then pvArgs = Array()
+ If UBound(pvArgs) &gt;= 0 Then vEvent = pvArgs(0) Else vEvent = Empty
+ If VarType(vEvent) &lt;&gt; ScriptForge.V_OBJECT Then GoTo Finally
+ If Not ScriptForge.SF_Session.HasUnoProperty(vEvent, &quot;Source&quot;) Then GoTo Finally
+
+Try:
+ Set oEventSource = vEvent.Source
+ sSourceType = ScriptForge.SF_Session.UnoObjectType(oEventSource)
+
+ Set oDialog = Nothing
+ Select Case True
+ Case sSourceType = &quot;stardiv.Toolkit.UnoDialogControl&quot; &apos; A dialog
+ &apos; Search the dialog in the cache
+ Set oDialog = _FindDialogInCache(oEventSource)
+ bControl = False
+ Case Left(sSourceType, 16) = &quot;stardiv.Toolkit.&quot; &apos; A dialog control
+ Set oDialog = _FindDialogInCache(oEventSource.Context)
+ bControl = True
+ Case Else
+ End Select
+
+ If Not IsNull(oDialog) Then
+ If bControl Then Set oSource = oDialog.Controls(oEventSource.Model.Name) Else Set oSource = oDialog
+ End If
+
+Finally:
+ Set _EventManager = oSource
+ Exit Function
+End Function &apos; SFDialogs.SF_Documents._EventManager
+
+REM -----------------------------------------------------------------------------
+Private Function _FindDialogInCache(ByRef poDialog As Object) As Object
+&apos;&apos;&apos; Find the dialog based on its XUnoDialog
+&apos;&apos;&apos; The dialog must not be terminated
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The corresponding Basic dialog part or Nothing
+
+Dim oBasicDialog As Object &apos; Return value
+Dim oCache As _DialogCache &apos; Entry in the cache
+
+ Set oBasicDialog = Nothing
+ For Each oCache In _SF_.SFDialogs
+ If EqualUnoObjects(poDialog, oCache.XUnoDialog) And Not oCache.Terminated Then
+ Set oBasicDialog = oCache.BasicDialog
+ Exit For
+ End If
+ Next oCache
+
+ Set _FindDialogInCache = oBasicDialog
+
+End Function &apos; SFDialogs.SF_Documents._FindDialogInCache
+
+REM -----------------------------------------------------------------------------
+Public Function _NewDialog(Optional ByVal pvArgs As Variant) As Object
+&apos;&apos;&apos; Create a new instance of the SF_Dialog class
+&apos; Args:
+&apos;&apos;&apos; Container: either &quot;GlobalScope&quot; or a WindowName. Default = the active window
+&apos;&apos;&apos; see the definition of WindowName in the description of the UI service
+&apos;&apos;&apos; Library: the name of the library hosting the dialog. Defailt = &quot;Standard&quot;
+&apos;&apos;&apos; DialogName: The name of the dialog
+&apos;&apos;&apos; Library and dialog names are case-sensitive
+&apos;&apos;&apos; Returns: the instance or Nothing
+
+Dim oDialog As Object &apos; Return value
+Dim vContainer As Variant &apos; Alias of pvArgs(0)
+Dim vLibrary As Variant &apos; Alias of pvArgs(1)
+Dim vDialogName As Variant &apos; Alias of pvArgs(2)
+Dim oLibraries As Object &apos; com.sun.star.comp.sfx2.DialogLibraryContainer
+Dim oLibrary As Object &apos; com.sun.star.container.XNameAccess
+Dim o_DialogProvider As Object &apos; com.sun.star.io.XInputStreamProvider
+Dim oEnum As Object &apos; com.sun.star.container.XEnumeration
+Dim oComp As Object &apos; com.sun.star.lang.XComponent
+Dim vWindow As Window &apos; A single component
+Dim oUi As Object &apos; &quot;UI&quot; service
+Dim bFound As Boolean &apos; True if WindowName is found on the desktop
+Const cstService = &quot;SFDialogs.Dialog&quot;
+Const cstGlobal = &quot;GlobalScope&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+
+Check:
+ If IsMissing(pvArgs) Or IsEmpty(pvArgs) Then pvArgs = Array()
+ If Not IsArray(pvArgs) Then pvArgs = Array(pvArgs) &apos; Needed when _NewDialog called from _EventManager
+ If UBound(pvArgs) &gt;= 0 Then vContainer = pvArgs(0) Else vContainer = &quot;&quot;
+ If UBound(pvArgs) &gt;= 1 Then vLibrary = pvArgs(1) Else vLibrary = &quot;Standard&quot;
+ If UBound(pvArgs) &gt;= 2 Then vDialogName = pvArgs(2) Else vDialogName = Empty &apos; Use Empty to force mandatory status
+ If Not ScriptForge.SF_Utils._Validate(vContainer, &quot;Container&quot;, Array(V_STRING, ScriptForge.V_OBJECT)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(vLibrary, &quot;Library&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(vDialogName, &quot;DialogName&quot;, V_STRING) Then GoTo Finally
+ Set oDialog = Nothing
+
+Try:
+ &apos; Determine the container and the library hosting the dialog
+ Set oLibraries = Nothing
+ If VarType(vContainer) = V_STRING Then
+ If UCase(vContainer) = UCase(cstGlobal) Then Set oLibraries = GlobalScope.DialogLibraries
+ End If
+ If IsNull(oLibraries) Then
+ Set oUi = ScriptForge.SF_Register.CreateScriptService(&quot;UI&quot;)
+ Select Case VarType(vContainer)
+ Case V_STRING
+ If Len(vContainer) &gt; 0 Then
+ bFound = False
+ Set oEnum = StarDesktop.Components().createEnumeration
+ Do While oEnum.hasMoreElements
+ Set oComp = oEnum.nextElement
+ vWindow = oUi._IdentifyWindow(oComp)
+ With vWindow
+ &apos; Does the current window match the argument ?
+ If (Len(.WindowFileName) &gt; 0 And .WindowFileName = ScriptForge.SF_FileSystem._ConvertToUrl(vContainer)) _
+ Or (Len(.WindowName) &gt; 0 And .WindowName = vContainer) _
+ Or (Len(.WindowTitle) &gt; 0 And .WindowTitle = vContainer) Then
+ bFound = True
+ Exit Do
+ End If
+ End With
+ Loop
+ Else
+ bFound = True
+ vWindow = oUi._IdentifyWindow(StarDesktop.CurrentComponent)
+ End If
+ Case V_OBJECT &apos; com.sun.star.lang.XComponent
+ bFound = True
+ vWindow = oUi._IdentifyWindow(vContainer)
+ End Select
+ If Not bFound Then GoTo CatchNotFound
+ If Len(vWindow.DocumentType) = 0 Then GoTo CatchNotFound
+ &apos; The library is now fully determined
+ Set oLibraries = oComp.DialogLibraries
+ End If
+
+ &apos; Load the library and get the dialog
+ With oLibraries
+ If Not .hasByName(vLibrary) Then GoTo CatchNotFound
+ If Not .isLibraryLoaded(vLibrary) Then .loadLibrary(vLibrary)
+ Set oLibrary = .getByName(vLibrary)
+ If Not oLibrary.hasByName(vDialogName) Then GoTo CatchNotFound
+ Set o_DialogProvider = oLibrary.getByName(vDialogName)
+ End With
+
+ Set oDialog = New SF_Dialog
+ With oDialog
+ Set .[Me] = oDialog
+ If VarType(vContainer) = V_STRING Then ._Container = vContainer Else ._Container = vWindow.WindowName
+ ._Library = vLibrary
+ ._Name = vDialogName
+ Set ._DialogProvider = o_DialogProvider
+ ._Initialize()
+ End With
+
+Finally:
+ Set _NewDialog = oDialog
+ Exit Function
+Catch:
+ GoTo Finally
+CatchNotFound:
+ ScriptForge.SF_Exception.RaiseFatal(DIALOGNOTFOUNDERROR, &quot;Service&quot;, cstService _
+ , &quot;Container&quot;, vContainer, &quot;Library&quot;, vLibrary, &quot;DialogName&quot;, vDialogName)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Register._NewDialog
+
+REM ============================================== END OF SFDIALOGS.SF_REGISTER
+</script:module> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/__License.xba b/wizards/source/sfdialogs/__License.xba
new file mode 100644
index 000000000000..e62965cc6ea9
--- /dev/null
+++ b/wizards/source/sfdialogs/__License.xba
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="__License" script:language="StarBasic" script:moduleType="normal">
+&apos;&apos;&apos; Copyright 2019-2020 Jean-Pierre LEDURE, Jean-François NIFENECKER, Alain ROMEDENNE
+
+REM =======================================================================================================================
+REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
+REM === The SFDialogs library is one of the associated libraries. ===
+REM === Full documentation is available on https://help.libreoffice.org/ ===
+REM =======================================================================================================================
+
+&apos;&apos;&apos; ScriptForge is distributed in the hope that it will be useful,
+&apos;&apos;&apos; but WITHOUT ANY WARRANTY; without even the implied warranty of
+&apos;&apos;&apos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+&apos;&apos;&apos; ScriptForge is free software; you can redistribute it and/or modify it under the terms of either (at your option):
+
+&apos;&apos;&apos; 1) The Mozilla Public License, v. 2.0. If a copy of the MPL was not
+&apos;&apos;&apos; distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/ .
+
+&apos;&apos;&apos; 2) The GNU Lesser General Public License as published by
+&apos;&apos;&apos; the Free Software Foundation, either version 3 of the License, or
+&apos;&apos;&apos; (at your option) any later version. If a copy of the LGPL was not
+&apos;&apos;&apos; distributed with this file, see http://www.gnu.org/licenses/ .
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/dialog.xlb b/wizards/source/sfdialogs/dialog.xlb
new file mode 100644
index 000000000000..be8e58d45a3e
--- /dev/null
+++ b/wizards/source/sfdialogs/dialog.xlb
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFDialogs" library:readonly="false" library:passwordprotected="false"/> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/script.xlb b/wizards/source/sfdialogs/script.xlb
new file mode 100644
index 000000000000..1a171c326079
--- /dev/null
+++ b/wizards/source/sfdialogs/script.xlb
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFDialogs" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="__License"/>
+ <library:element library:name="SF_Register"/>
+ <library:element library:name="SF_Dialog"/>
+ <library:element library:name="SF_DialogControl"/>
+</library:library> \ No newline at end of file