summaryrefslogtreecommitdiffstats
path: root/wizards/source/sfdialogs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /wizards/source/sfdialogs
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wizards/source/sfdialogs')
-rw-r--r--wizards/source/sfdialogs/SF_Dialog.xba3122
-rw-r--r--wizards/source/sfdialogs/SF_DialogControl.xba2514
-rw-r--r--wizards/source/sfdialogs/SF_DialogListener.xba633
-rw-r--r--wizards/source/sfdialogs/SF_DialogUtils.xba332
-rw-r--r--wizards/source/sfdialogs/SF_Register.xba454
-rw-r--r--wizards/source/sfdialogs/__License.xba26
-rw-r--r--wizards/source/sfdialogs/dialog.xlb3
-rw-r--r--wizards/source/sfdialogs/script.xlb10
8 files changed, 7094 insertions, 0 deletions
diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba
new file mode 100644
index 0000000000..bbbeddd111
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_Dialog.xba
@@ -0,0 +1,3122 @@
+<?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. They may be defined with the Basic IDE or built from scratch
+&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;
+&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;
+&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;
+&apos;&apos;&apos; 1) when the dialog exists in some dialog libraries (= pre-defined with the Basic IDE):
+&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; 2) when the dialog is fully defined by code:
+&apos;&apos;&apos; Dim myDialog As Object, oButton As Object lExec As Long
+&apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.NewDialog&quot;, DialogName, Place)
+&apos;&apos;&apos; &apos; Args:
+&apos;&apos;&apos; &apos; DialogName: a case-sensitive string designating the dialog
+&apos;&apos;&apos; Place: either
+&apos;&apos;&apos; - an array with 4 elements: (X, Y, Width, Height)
+&apos;&apos;&apos; - a com.sun.star.awt.Rectangle [X, Y, Width, Height]
+&apos;&apos;&apos; (All elements are expressed in &quot;Map AppFont&quot; units).
+&apos;&apos;&apos; &apos; ... Create controls with the CreateXXX(...) methods ..., e.g.
+&apos;&apos;&apos; Set oButton = myDialog.CreateButton(&quot;OKButton&quot;, Place := Array(100, 100, 20, 10), Push := &quot;OK&quot;)
+&apos;&apos;&apos; lExec = myDialog.Execute() &apos; Default mode = Modal
+&apos;&apos;&apos; If lExec = 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; Detailed user documentation:
+&apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_dialog.html?DbPAR=BASIC
+&apos;&apos;&apos;
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&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;
+Private Const PAGEMANAGERERROR = &quot;PAGEMANAGERERROR&quot;
+Private Const DUPLICATECONTROLERROR = &quot;DUPLICATECONTROLERROR&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 _BuiltFromScratch As Boolean &apos; When True, dialog is not stored in a library
+Private _BuiltInPython As Boolean &apos; Used only when _BuiltFromScratch = True
+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()
+
+&apos; Dialog initial position and dimensions in APPFONT units
+Private _Left As Long
+Private _Top As Long
+Private _Width As Long
+Private _Height As Long
+
+&apos; Page management
+Type _PageManager
+ ControlName As String &apos; Case-sensitive name of control involved in page management
+ PageMgtType As Integer &apos; One of the PILOTCONTROL, TABCONTROL, NEXTCONTROL, BACKCONTROL constants
+ PageNumber As Long &apos; When &gt; 0, the page to activate for tab controls
+ ListenerType As Integer &apos; One of the ITEMSTATECHANGED, ACTIONPERFORMED constants
+End Type
+
+Private _PageManagement As Variant &apos; Array of _PageManager objects, one entry by involved control
+Private _ItemListener As Object &apos; com.sun.star.awt.XItemListener
+Private _ActionListener As Object &apos; com.sun.star.awt.XActionListener
+Private _LastPage As Long &apos; When &gt; 0, the last page in a tabbed dialog
+
+&apos; Updatable events
+&apos; Next identifiers MUST be identical in both SF_Dialog and SF_DialogControl class modules
+Private _FocusListener As Object &apos; com.sun.star.awt.XFocusListener
+Private _OnFocusGained As String &apos; Script to invoke when dialog gets focus
+Private _OnFocusLost As String &apos; Script to invoke when dialog loses focus
+Private _FocusCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _KeyListener As Object &apos; com.sun.star.awt.XKeyListener
+Private _OnKeyPressed As String &apos; Script to invoke when Key clicked in dialog
+Private _OnKeyReleased As String &apos; Script to invoke when Key released in dialog
+Private _KeyCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseListener As Object &apos; com.sun.star.awt.XMouseListener
+Private _OnMouseEntered As String &apos; Script to invoke when mouse enters dialog
+Private _OnMouseExited As String &apos; Script to invoke when mouse leaves dialog
+Private _OnMousePressed As String &apos; Script to invoke when mouse clicked in dialog
+Private _OnMouseReleased As String &apos; Script to invoke when mouse released in dialog
+Private _MouseCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseMotionListener As Object &apos; com.sun.star.awt.XMouseMotionListener
+Private _OnMouseDragged As String &apos; Script to invoke when mouse is dragged from the dialog
+Private _OnMouseMoved As String &apos; Script to invoke when mouse is moved across the dialog
+Private _MouseMotionCounter As Integer &apos; Counts the number of events set on the listener
+
+&apos; Persistent storage for controls
+Private _ControlCache As Variant &apos; Array of control objects sorted like ElementNames of the Dialog model
+
+REM ============================================================ MODULE CONSTANTS
+
+&apos; Dialog usual buttons
+Private Const cstOKBUTTON = 1
+Private Const cstCANCELBUTTON = 0
+
+&apos; Page management
+Private Const PILOTCONTROL = 1
+Private Const TABCONTROL = 2
+Private Const BACKCONTROL = 3
+Private Const NEXTCONTROL = 4
+Private Const ITEMSTATECHANGED = 1
+Private Const ACTIONPERFORMED = 2
+
+REM ====================================================== CONSTRUCTOR/DESTRUCTOR
+
+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;
+ _BuiltFromScratch = False
+ _BuiltInPython = False
+ _Name = &quot;&quot;
+ _CacheIndex = -1
+ Set _DialogProvider = Nothing
+ Set _DialogControl = Nothing
+ Set _DialogModel = Nothing
+ _Displayed = False
+ _Modal = True
+
+ _Left = SF_DialogUtils.MINPOSITION
+ _Top = SF_DialogUtils.MINPOSITION
+ _Width = -1
+ _Height = -1
+
+ _PageManagement = Array()
+ Set _ItemListener = Nothing
+ Set _ActionListener = Nothing
+ _LastPage = 0
+
+ Set _FocusListener = Nothing
+ _OnFocusGained = &quot;&quot;
+ _OnFocusLost = &quot;&quot;
+ _FocusCounter = 0
+ Set _KeyListener = Nothing
+ _OnKeyPressed = &quot;&quot;
+ _OnKeyReleased = &quot;&quot;
+ _KeyCounter = 0
+ Set _MouseListener = Nothing
+ _OnMouseEntered = &quot;&quot;
+ _OnMouseExited = &quot;&quot;
+ _OnMousePressed = &quot;&quot;
+ _OnMouseReleased = &quot;&quot;
+ _MouseCounter = 0
+ Set _MouseMotionListener = Nothing
+ _OnMouseDragged = &quot;&quot;
+ _OnMouseMoved = &quot;&quot;
+ _MouseMotionCounter = 0
+ _ControlCache = Array()
+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 CANCELBUTTON() As Variant
+ CANCELBUTTON = cstCANCELBUTTON
+End Property &apos; SFDialogs.SF_Dialog.CANCELBUTTON (get)
+
+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 OKBUTTON() As Variant
+ OKBUTTON = cstOKBUTTON
+End Property &apos; SFDialogs.SF_Dialog.OKBUTTON (get)
+
+REM -----------------------------------------------------------------------------
+Property Get OnFocusGained() As Variant
+&apos;&apos;&apos; Get the script associated with the OnFocusGained event
+ OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusGained
+ _PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnFocusLost() As Variant
+&apos;&apos;&apos; Get the script associated with the OnFocusLost event
+ OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusLost
+ _PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnKeyPressed() As Variant
+&apos;&apos;&apos; Get the script associated with the OnKeyPressed event
+ OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyPressed
+ _PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnKeyReleased() As Variant
+&apos;&apos;&apos; Get the script associated with the OnKeyReleased event
+ OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyReleased
+ _PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseDragged() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseDragged event
+ OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseDragged
+ _PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseEntered() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseEntered event
+ OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseEntered
+ _PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseExited() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseExited event
+ OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseExited
+ _PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseMoved() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseMoved event
+ OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseMoved
+ _PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMousePressed() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMousePressed event
+ OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnMousePressed
+ _PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
+End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseReleased() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseReleased event
+ OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseReleased
+ _PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (let)
+
+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.
+&apos;&apos;&apos; 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
+&apos;&apos;&apos; 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 Center(Optional ByRef Parent As Variant) As Boolean
+&apos;&apos;&apos; Center the actual dialog instance in the middle of a parent window
+&apos;&apos;&apos; Without arguments, the method centers the dialog in the middle of the current window
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Parent: an object, either
+&apos;&apos;&apos; - a ScriptForge dialog object
+&apos;&apos;&apos; - a ScriptForge document (Calc, Base, ...) object
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Sub TriggerEvent(oEvent As Object)
+&apos;&apos;&apos; Dim oDialog1 As Object, oDialog2 As Object, lExec As Long
+&apos;&apos;&apos; Set oDialog1 = CreateScriptService(&quot;DialogEvent&quot;, oEvent) &apos; The dialog having caused the event
+&apos;&apos;&apos; Set oDialog2 = CreateScriptService(&quot;Dialog&quot;, ...) &apos; Open a second dialog
+&apos;&apos;&apos; oDialog2.Center(oDialog1)
+&apos;&apos;&apos; lExec = oDialog2.Execute()
+&apos;&apos;&apos; Select Case lExec
+&apos;&apos;&apos; ...
+&apos;&apos;&apos; End Sub
+
+Dim bCenter As Boolean &apos; Return value
+Dim oUi As Object &apos; ScriptForge.SF_UI
+Dim oObjDesc As Object &apos; _ObjectDescriptor type
+Dim sObjectType As String &apos; Can be uno or sf object type
+Dim oParent As Object &apos; UNO alias of parent
+Dim oParentPosSize As Object &apos; Parent com.sun.star.awt.Rectangle
+Dim lParentX As Long &apos; X position of parent dialog
+Dim lParentY As Long &apos; Y position of parent dialog
+Dim oPosSize As Object &apos; Dialog com.sun.star.awt.Rectangle
+Const cstThisSub = &quot;SFDialogs.Dialog.Center&quot;
+Const cstSubArgs = &quot;[Parent]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bCenter = False
+
+Check:
+ If IsMissing(Parent) Or IsEmpty(Parent) Then Set Parent = Nothing
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._Validate(Parent, &quot;Parent&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+ End If
+
+ Set oParentPosSize = Nothing
+ lParentX = 0 : lParentY = 0
+ If IsNull(Parent) Then
+ Set oUi = CreateScriptService(&quot;UI&quot;)
+ Set oParentPosSize = oUi._PosSize() &apos; Return the position and dimensions of the active window
+ Else
+ &apos; Determine the object type
+ Set oObjDesc = ScriptForge.SF_Utils._VarTypeObj(Parent)
+ If oObjDesc.iVarType = ScriptForge.V_SFOBJECT Then &apos; ScriptForge object
+ sObjectType = oObjDesc.sObjectType
+ &apos; Document or dialog ?
+ If Not ScriptForge.SF_Array.Contains(Array(&quot;BASE&quot;, &quot;CALC&quot;, &quot;DIALOG&quot;, &quot;DOCUMENT&quot;, &quot;WRITER&quot;), sObjectType, CaseSensitive := True) Then GoTo Finally
+ If sObjectType = &quot;DIALOG&quot; Then
+ Set oParent = Parent._DialogControl
+ Set oParentPosSize = oParent.getPosSize()
+ lParentX = oParentPosSize.X
+ lParentY = oParentPosSize.Y
+ Else
+ Set oParent = Parent._Component.getCurrentController().Frame.getComponentWindow()
+ Set oParentPosSize = oParent.getPosSize()
+ End If
+ Else
+ GoTo Finally &apos; UNO object, do nothing
+ End If
+ End If
+ If IsNull(oParentPosSize) Then GoTo Finally
+
+Try:
+ Set oPosSize = _DialogControl.getPosSize()
+ With oPosSize
+ _DialogControl.setPosSize( _
+ lParentX + CLng((oParentPosSize.Width - .Width) \ 2) _
+ , lParentY + CLng((oParentPosSize.Height - .Height) \ 2) _
+ , .Width _
+ , .Height _
+ , com.sun.star.awt.PosSize.POSSIZE)
+ End With
+ bCenter = True
+
+Finally:
+ Center = bCenter
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SF_Documents.SF_Dialog.Center
+
+REM -----------------------------------------------------------------------------
+Public Function CloneControl(Optional ByVal SourceName As Variant _
+ , Optional ByVal ControlName As Variant _
+ , Optional ByVal Left As Variant _
+ , Optional ByVal Top As Variant _
+ ) As Object
+&apos;&apos;&apos; Duplicate an existing control of any type in the actual dialog.
+&apos;&apos;&apos; The duplicated control is left unchanged. The new control can be relocated.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; SourceName: the name of the control to duplicate
+&apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
+&apos;&apos;&apos; Left, Top: the coordinates of the new control expressed in &quot;Map AppFont&quot; units
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myButton2 = dialog.CloneControl(&quot;Button1&quot;, &quot;Button2&quot;, 30, 30)
+
+Dim oControl As Object &apos; Return value
+Dim oSourceModel As Object &apos; com.sun.star.awt.XControlModel of the source
+Dim oControlModel As Object &apos; com.sun.star.awt.XControlModel of the new control
+Const cstThisSub = &quot;SFDialogs.Dialog.CloneControl&quot;
+Const cstSubArgs = &quot;SourceName, ControlName, [Left=1], [Top=1]&quot;
+
+Check:
+ Set oControl = Nothing
+
+ If IsMissing(Left) Or IsEmpty(Left) Then Left = 1
+ If IsMissing(Top) Or IsEmpty(Top) Then Top = 1
+
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place := Null) Then GoTo Finally
+
+ If Not ScriptForge.SF_Utils._Validate(SourceName, &quot;SourceName&quot;, V_String, _DialogModel.getElementNames()) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Left, &quot;Left&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Top, &quot;Top&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; All control types are presumes cloneable
+ Set oSourceModel = _DialogModel.getByName(SourceName)
+ Set oControlModel = oSourceModel.createClone()
+ oControlModel.Name = ControlName
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(oControlModel, ControlName, Array(Left, Top))
+
+Finally:
+ Set CloneControl = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CloneControl
+
+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
+Dim lIndexOfNames As Long &apos; Index in ElementNames array. Used to access _ControlCache
+Dim vControl As Variant &apos; Alias of _ControlCache entry
+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
+ lIndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
+ &apos; Reuse cache when relevant
+ vControl = _ControlCache(lIndexOfNames)
+ If IsEmpty(vControl) Then
+ &apos; Create the new dialog control class instance
+ Set oControl = New SF_DialogControl
+ With oControl
+ ._Name = ControlName
+ Set .[Me] = oControl
+ Set .[_Parent] = [Me]
+ ._IndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
+ ._DialogName = _Name
+ Set ._ControlModel = _DialogModel.getByName(ControlName)
+ Set ._ControlView = _DialogControl.getControl(ControlName)
+ ._ControlView.setModel(._ControlModel)
+ ._Initialize()
+ End With
+ Else
+ Set oControl = vControl
+ End If
+ 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
+
+&apos;&apos;&apos; CreateXXX functions:
+&apos;&apos;&apos; -------------------
+&apos;&apos;&apos; Common arguments:
+&apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet.
+&apos;&apos;&apos; Place: either
+&apos;&apos;&apos; - an array with 4 elements: (X, Y, Width, Height)
+&apos;&apos;&apos; - a com.sun.star.awt.Rectangle [X, Y, Width, Height]
+&apos;&apos;&apos; All elements are expressed in &quot;Map AppFont&quot; units.
+
+REM -----------------------------------------------------------------------------
+Public Function CreateButton(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Toggle As Variant _
+ , Optional ByVal Push As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type Button in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Toggle: when True a Toggle button is created. Default = False
+&apos;&apos;&apos; Push: &quot;OK&quot;, &quot;CANCEL&quot; or &quot;&quot; (default)
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myButton = dialog.CreateButton(&quot;Button1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return value
+Dim iPush As Integer &apos; Alias of Push
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateButton&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Toggle=False], [Push=&quot;&quot;&quot;&quot;|&quot;&quot;OK&quot;&quot;|&quot;&quot;CANCEL&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Toggle) Or IsEmpty(Toggle) Then Toggle = False
+ If IsMissing(Push) Or IsEmpty(Push) Then Push = &quot;&quot;
+ If Not ScriptForge.SF_Utils._Validate(Toggle, &quot;Toggle&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Push, &quot;Push&quot;, V_STRING, Array(&quot;&quot;, &quot;OK&quot;, &quot;CANCEL&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Handle specific arguments
+ Select Case UCase(Push)
+ Case &quot;&quot; : iPush = com.sun.star.awt.PushButtonType.STANDARD
+ Case &quot;OK&quot; : iPush = com.sun.star.awt.PushButtonType.OK
+ Case &quot;CANCEL&quot; : iPush = com.sun.star.awt.PushButtonType.CANCEL
+ End Select
+ vPropNames = Array(&quot;Toggle&quot;, &quot;PushButtonType&quot;)
+ vPropValues = Array(CBool(Toggle), iPush)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlButtonModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateButton = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateButton
+
+REM -----------------------------------------------------------------------------
+Public Function CreateCheckBox(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal MultiLine As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type CheckBox in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myCheckBox = dialog.CreateCheckBox(&quot;CheckBox1&quot;, Array(20, 20, 60, 15), MultiLine := True)
+
+Dim oControl As Object &apos; Return value
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateCheckBox&quot;
+Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
+ If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ vPropNames = Array(&quot;VisualEffect&quot;, &quot;MultiLine&quot;)
+ vPropValues = Array(1, CBool(MultiLine))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlCheckBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateCheckBox = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateCheckBox
+
+REM -----------------------------------------------------------------------------
+Public Function CreateComboBox(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal Dropdown As Variant _
+ , Optional ByVal LineCount As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type ComboBox in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Dropdown: When True (default), a drop down button is displayed
+&apos;&apos;&apos; LineCount: Specifies the maximum line count displayed in the drop down (default = 5)
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myComboBox = dialog.CreateComboBox(&quot;ComboBox1&quot;, Array(20, 20, 60, 15), Dropdown := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateComboBox&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Dropdown=True], [LineCount=5]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = True
+ If IsMissing(LineCount) Or IsEmpty(LineCount) Then LineCount = 5
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(LineCount, &quot;LineCount&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;LineCount&quot;)
+ vPropValues = Array(iBorder, CBool(Dropdown), CInt(LineCount))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlComboBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateComboBox = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateComboBox
+
+REM -----------------------------------------------------------------------------
+Public Function CreateCurrencyField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal SpinButton As Variant _
+ , Optional ByVal MinValue As Variant _
+ , Optional ByVal MaxValue As Variant _
+ , Optional ByVal Increment As Variant _
+ , Optional ByVal Accuracy As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type CurrencyField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
+&apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = -1000000
+&apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = +1000000
+&apos;&apos;&apos; Increment: the step when the spin button is pressed. Default = 1
+&apos;&apos;&apos; Accuracy: specifies the decimal accuracy. Default = 2 decimal digits
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myCurrencyField = dialog.CreateCurrencyField(&quot;CurrencyField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateCurrencyField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Dropdown=False], [SpinButton=False]&quot; _
+ &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000], [Increment=1], [Accuracy=2]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
+ If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
+ If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
+ If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1.00
+ If IsMissing(Accuracy) Or IsEmpty(Accuracy) Then Accuracy = 2
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Accuracy, &quot;Accuracy&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;Spin&quot;, &quot;ValueMin&quot;, &quot;ValueMax&quot;, &quot;ValueStep&quot;, &quot;DecimalAccuracy&quot;)
+ vPropValues = Array(iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue), CDbl(Increment), CInt(Accuracy))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlCurrencyFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateCurrencyField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateCurrencyField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateDateField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal Dropdown As Variant _
+ , Optional ByVal MinDate As Variant _
+ , Optional ByVal MaxDate As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type DateField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Dropdown:: when True (default = False), a dropdown button is shown
+&apos;&apos;&apos; MinDate: the smallest date that can be entered in the control. Default = 1900-01-01
+&apos;&apos;&apos; MaxDate: the largest Date that can be entered in the control. Default = 2200-12-31
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myDateField = dialog.CreateDateField(&quot;DateField1&quot;, Array(20, 20, 60, 15), Dropdown := True)
+
+Dim oControl As Object &apos; Return Date
+Dim iBorder As Integer &apos; Alias of border
+Dim oMinDate As New com.sun.star.util.Date
+Dim oMaxDate As New com.sun.star.util.Date
+Dim vFormats As Variant &apos; List of available date formats
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateDateField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Dropdown=False]&quot; _
+ &amp; &quot;, [MinDate=DateSerial(1900, 1, 1)], [MaxDate=DateSerial(2200, 12, 31)]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = False
+ If IsMissing(MinDate) Or IsEmpty(MinDate) Then MinDate = DateSerial(1900, 1, 1)
+ If IsMissing(MaxDate) Or IsEmpty(MaxDate) Then MaxDate = DateSerial(2200, 12, 31)
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinDate, &quot;MinDate&quot;, ScriptForge.V_DATE) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxDate, &quot;MaxDate&quot;, ScriptForge.V_DATE) Then GoTo Finally
+ vFormats = SF_DialogUtils._FormatsList(&quot;DateField&quot;)
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ With oMinDate
+ .Year = Year(MinDate) : .Month = Month(MinDate) : .Day = Day(MinDate)
+ End With
+ With oMaxDate
+ .Year = Year(MaxDate) : .Month = Month(MaxDate) : .Day = Day(MaxDate)
+ End With
+ vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;DateMin&quot;, &quot;DateMax&quot;, &quot;DateFormat&quot;)
+ vPropValues = Array(iBorder, CBool(Dropdown), oMinDate, oMaxDate, CInt(ScriptForge.SF_Array.IndexOf(vFormats(), &quot;Standard (short)&quot;)))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlDateFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateDateField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateDateField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateFileControl(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type FileControl in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myFileControl = dialog.CreateFileControl(&quot;FileControl1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateFileControl&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;)
+ vPropValues = Array(iBorder)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlFileControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateFileControl = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreateFileControl
+
+REM -----------------------------------------------------------------------------
+Public Function CreateFixedLine(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Orientation As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type FixedLine in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Orientation: &quot;H[orizontal]&quot; or &quot;V[ertical]&quot;.
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myFixedLine = dialog.CreateFixedLine(&quot;FixedLine1&quot;, Array(20, 20, 60, 15), Orientation := &quot;vertical&quot;)
+
+Dim oControl As Object &apos; Return value
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateFixedLine&quot;
+Const cstSubArgs = &quot;ControlName, Place, Orientation=&quot;&quot;H&quot;&quot;|&quot;&quot;Horizontal&quot;&quot;|&quot;&quot;V&quot;&quot;|&quot;&quot;Vertical&quot;&quot;&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If Not ScriptForge.SF_Utils._Validate(Orientation, &quot;Orientation&quot;, V_STRING, Array(&quot;H&quot;, &quot;Horizontal&quot;, &quot;V&quot;, &quot;Vertical&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ vPropNames = Array(&quot;Orientation&quot;)
+ vPropValues = Array(CLng(Iif(Left(UCase(Orientation), 1) = &quot;V&quot;, 1, 0)))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlFixedLineModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateFixedLine = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateFixedLine
+
+REM -----------------------------------------------------------------------------
+Public Function CreateFixedText(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MultiLine As Variant _
+ , Optional ByVal Align As Variant _
+ , Optional ByVal VerticalAlign As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type FixedText in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;NONE&quot; (default) or &quot;FLAT&quot; or &quot;3D&quot;
+&apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
+&apos;&apos;&apos; Align: horizontal alignment, &quot;LEFT&quot; (default) or &quot;CENTER&quot; or &quot;RIGHT&quot;
+&apos;&apos;&apos; VerticalAlign: vertical alignment, &quot;TOP&quot; (default) or &quot;MIDDLE&quot; or &quot;BOTTOM&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myFixedText = dialog.CreateFixedText(&quot;FixedText1&quot;, Array(20, 20, 60, 15), MultiLine := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim iAlign As Integer &apos; Alias of Align
+Dim iVerticalAlign As Integer &apos; Alias of VerticalAlign
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateFixedText&quot;
+Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False], [Border=&quot;&quot;NONE&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;3D&quot;&quot;]&quot; _
+ &amp; &quot;, [Align=&quot;&quot;LEFT&quot;&quot;|&quot;&quot;CENTER&quot;&quot;|&quot;&quot;RIGHT&quot;&quot;], [VerticalAlign=&quot;&quot;TOP&quot;&quot;|&quot;&quot;MIDDLE&quot;&quot;|&quot;&quot;BOTTOM&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;NONE&quot;
+ If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
+ If IsMissing(Align) Or IsEmpty(Align) Then Align = &quot;LEFT&quot;
+ If IsMissing(VerticalAlign) Or IsEmpty(VerticalAlign) Then VerticalAlign = &quot;TOP&quot;
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Align, &quot;Align&quot;, V_STRING, Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;RIGHT&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(VerticalAlign, &quot;VerticalAlign&quot;, V_STRING, Array(&quot;TOP&quot;, &quot;MIDDLE&quot;, &quot;BOTTOM&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ iAlign = ScriptForge.SF_Array.IndexOf(Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;BOTTOM&quot;), Align)
+ Select Case UCase(VerticalAlign)
+ Case &quot;TOP&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.TOP
+ Case &quot;MIDDLE&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.MIDDLE
+ Case &quot;BOTTOM&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.BOTTOM
+ End Select
+ vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;Align&quot;, &quot;VerticalAlign&quot;)
+ vPropValues = Array(iBorder, CBool(MultiLine), iAlign, iVerticalAlign)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlFixedTextModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateFixedText = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateFixedText
+
+REM -----------------------------------------------------------------------------
+Public Function CreateFormattedField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal SpinButton As Variant _
+ , Optional ByVal MinValue As Variant _
+ , Optional ByVal MaxValue As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type FormattedField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
+&apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = -1000000
+&apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = +1000000
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myFormattedField = dialog.CreateFormattedField(&quot;FormattedField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
+&apos;&apos;&apos; myFormattedField.Format = &quot;##0,00E+00&quot;
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateFormattedField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [SpinButton=False]&quot; _
+ &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
+ If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
+ If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;FormatsSupplier&quot;, &quot;Border&quot;, &quot;Spin&quot;, &quot;EffectiveMin&quot;, &quot;EffectiveMax&quot;)
+ vPropValues = Array(CreateUnoService(&quot;com.sun.star.util.NumberFormatsSupplier&quot;) _
+ , iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlFormattedFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateFormattedField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreateFormattedField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateGroupBox(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type GroupBox in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Orientation: &quot;H[orizontal]&quot; or &quot;V[ertical]&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myGroupBox = dialog.CreateGroupBox(&quot;GroupBox1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return value
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateGroupBox&quot;
+Const cstSubArgs = &quot;ControlName, Place&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ vPropNames = Array()
+ vPropValues = Array()
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlGroupBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateGroupBox = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreateGroupBox
+
+REM -----------------------------------------------------------------------------
+Public Function CreateHyperlink(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MultiLine As Variant _
+ , Optional ByVal Align As Variant _
+ , Optional ByVal VerticalAlign As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type Hyperlink in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;NONE&quot; (default) or &quot;FLAT&quot; or &quot;3D&quot;
+&apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
+&apos;&apos;&apos; Align: horizontal alignment, &quot;LEFT&quot; (default) or &quot;CENTER&quot; or &quot;RIGHT&quot;
+&apos;&apos;&apos; VerticalAlign: vertical alignment, &quot;TOP&quot; (default) or &quot;MIDDLE&quot; or &quot;BOTTOM&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myHyperlink = dialog.CreateHyperlink(&quot;Hyperlink1&quot;, Array(20, 20, 60, 15), MultiLine := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim iAlign As Integer &apos; Alias of Align
+Dim iVerticalAlign As Integer &apos; Alias of VerticalAlign
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateHyperlink&quot;
+Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False], [Border=&quot;&quot;NONE&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;3D&quot;&quot;]&quot; _
+ &amp; &quot;, [Align=&quot;&quot;LEFT&quot;&quot;|&quot;&quot;CENTER&quot;&quot;|&quot;&quot;RIGHT&quot;&quot;], [VerticalAlign=&quot;&quot;TOP&quot;&quot;|&quot;&quot;MIDDLE&quot;&quot;|&quot;&quot;BOTTOM&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;NONE&quot;
+ If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
+ If IsMissing(Align) Or IsEmpty(Align) Then Align = &quot;LEFT&quot;
+ If IsMissing(VerticalAlign) Or IsEmpty(VerticalAlign) Then VerticalAlign = &quot;TOP&quot;
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Align, &quot;Align&quot;, V_STRING, Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;RIGHT&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(VerticalAlign, &quot;VerticalAlign&quot;, V_STRING, Array(&quot;TOP&quot;, &quot;MIDDLE&quot;, &quot;BOTTOM&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ iAlign = ScriptForge.SF_Array.IndexOf(Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;BOTTOM&quot;), Align)
+ Select Case UCase(VerticalAlign)
+ Case &quot;TOP&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.TOP
+ Case &quot;MIDDLE&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.MIDDLE
+ Case &quot;BOTTOM&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.BOTTOM
+ End Select
+ vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;Align&quot;, &quot;VerticalAlign&quot;)
+ vPropValues = Array(iBorder, CBool(MultiLine), iAlign, iVerticalAlign)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlFixedHyperlinkModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateHyperlink = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateHyperlink
+
+REM -----------------------------------------------------------------------------
+Public Function CreateImageControl(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal Scale As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type ImageControl in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Scale: One of next values: &quot;FITTOSIZE&quot; (default), &quot;KEEPRATIO&quot; or &quot;NO&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myImageControl = dialog.CreateImageControl(&quot;ImageControl1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim iScale As Integer &apos; Alias of Scale
+Dim bScale As Boolean &apos; When False, no scaling
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateImageControl&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Scale=&quot;&quot;FITTOSIZE&quot;&quot;|&quot;&quot;KEEPRATIO&quot;&quot;|&quot;&quot;NO&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(Scale) Or IsEmpty(Scale) Then Scale = &quot;FITTOSIZE&quot;
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Scale, &quot;Scale&quot;, V_STRING, Array(&quot;FITTOSIZE&quot;, &quot;KEEPRATIO&quot;, &quot;NO&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ Select Case UCase(Scale)
+ Case &quot;NO&quot; : iScale = com.sun.star.awt.ImageScaleMode.NONE : bScale = False
+ Case &quot;FITTOSIZE&quot; : iScale = com.sun.star.awt.ImageScaleMode.ANISOTROPIC : bScale = True
+ Case &quot;KEEPRATIO&quot; : iScale = com.sun.star.awt.ImageScaleMode.ISOTROPIC : bScale = True
+ End Select
+ vPropNames = Array(&quot;Border&quot;, &quot;ScaleImage&quot;, &quot;ScaleMode&quot;)
+ vPropValues = Array(iBorder, bScale, iScale)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlImageControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateImageControl = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreateImageControl
+
+REM -----------------------------------------------------------------------------
+Public Function CreateListBox(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal Dropdown As Variant _
+ , Optional ByVal LineCount As Variant _
+ , Optional ByVal MultiSelect As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type ListBox in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Dropdown: When True (default), a drop down button is displayed
+&apos;&apos;&apos; LineCount: Specifies the maximum line count displayed in the drop down (default = 5)
+&apos;&apos;&apos; MultiSelect: When True, more than 1 entry may be selected. Default = False
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myListBox = dialog.CreateListBox(&quot;ListBox1&quot;, Array(20, 20, 60, 15), Dropdown := True, MultiSelect := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateListBox&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Dropdown=True], [LineCount=5], [MultiSelect=False]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = True
+ If IsMissing(LineCount) Or IsEmpty(LineCount) Then LineCount = 5
+ If IsMissing(MultiSelect) Or IsEmpty(MultiSelect) Then MultiSelect = True
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(LineCount, &quot;LineCount&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MultiSelect, &quot;MultiSelect&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;LineCount&quot;, &quot;MultiSelection&quot;)
+ vPropValues = Array(iBorder, CBool(Dropdown), CInt(LineCount), CBool(MultiSelect))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlListBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateListBox = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateListBox
+
+REM -----------------------------------------------------------------------------
+Public Function CreateNumericField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal SpinButton As Variant _
+ , Optional ByVal MinValue As Variant _
+ , Optional ByVal MaxValue As Variant _
+ , Optional ByVal Increment As Variant _
+ , Optional ByVal Accuracy As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type NumericField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
+&apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = -1000000
+&apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = +1000000
+&apos;&apos;&apos; Increment: the step when the spin button is pressed. Default = 1
+&apos;&apos;&apos; Accuracy: specifies the decimal accuracy. Default = 2 decimal digits
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myNumericField = dialog.CreateNumericField(&quot;NumericField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateNumericField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [SpinButton=False]&quot; _
+ &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000], [Increment=1], [Accuracy=2]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
+ If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
+ If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
+ If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1.00
+ If IsMissing(Accuracy) Or IsEmpty(Accuracy) Then Accuracy = 2
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Accuracy, &quot;Accuracy&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;Spin&quot;, &quot;ValueMin&quot;, &quot;ValueMax&quot;, &quot;ValueStep&quot;, &quot;DecimalAccuracy&quot;)
+ vPropValues = Array(iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue), CDbl(Increment), CInt(Accuracy))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlNumericFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateNumericField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateNumericField
+
+REM -----------------------------------------------------------------------------
+Public Function CreatePatternField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal EditMask As Variant _
+ , Optional ByVal LiteralMask As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type PatternField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Editmask: a character code that determines what the user may enter
+&apos;&apos;&apos; LiteralMask: contains the initial values that are displayed in the pattern field
+&apos;&apos;&apos; More details on https://wiki.documentfoundation.org/Documentation/DevGuide/Graphical_User_Interfaces#Pattern_Field
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myPatternField = dialog.CreatePatternField(&quot;PatternField1&quot;, Array(20, 20, 60, 15), EditMask := &quot;NNLNNLLLLL&quot;, LiteralMask := &quot;__.__.2002&quot;)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreatePatternField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [EditMask=&quot;&quot;&quot;&quot;], [LiteralMask=&quot;&quot;&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(EditMask) Or IsEmpty(EditMask) Then EditMask = &quot;&quot;
+ If IsMissing(LiteralMask) Or IsEmpty(LiteralMask) Then LiteralMask = &quot;&quot;
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(EditMask, &quot;EditMask&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(LiteralMask, &quot;LiteralMask&quot;, V_STRING) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;EditMask&quot;, &quot;LiteralMask&quot;)
+ vPropValues = Array(iBorder, EditMask, LiteralMask)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlPatternFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreatePatternField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreatePatternField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateProgressBar(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MinValue As Variant _
+ , Optional ByVal MaxValue As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type ProgressBar in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = 0
+&apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = 100
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myProgressBar = dialog.CreateProgressBar(&quot;ProgressBar1&quot;, Array(20, 20, 60, 15), MaxValue := 1000)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateProgressBar&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [MinValue=0], MaxValue=100]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = 0
+ If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = 100
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;ProgressValueMin&quot;, &quot;ProgressValueMax&quot;)
+ vPropValues = Array(iBorder, CLng(MinValue), CLng(MaxValue))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlProgressBarModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateProgressBar = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateProgressBar
+
+REM -----------------------------------------------------------------------------
+Public Function CreateRadioButton(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal MultiLine As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type RadioButton in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myRadioButton = dialog.CreateRadioButton(&quot;RadioButton1&quot;, Array(20, 20, 60, 15), MultiLine := True)
+
+Dim oControl As Object &apos; Return value
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateRadioButton&quot;
+Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
+ If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ vPropNames = Array(&quot;VisualEffect&quot;, &quot;MultiLine&quot;)
+ vPropValues = Array(1, CBool(MultiLine))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlRadioButtonModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateRadioButton = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateRadioButton
+
+REM -----------------------------------------------------------------------------
+Public Function CreateScrollBar(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Orientation As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MinValue As Variant _
+ , Optional ByVal MaxValue As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type ScrollBar in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Orientation: H[orizontal] or V[ertical]
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = 0
+&apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = 100
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myScrollBar = dialog.CreateScrollBar(&quot;ScrollBar1&quot;, Array(20, 20, 60, 15), MaxValue := 1000)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateScrollBar&quot;
+Const cstSubArgs = &quot;ControlName, Place, Orientation=&quot;&quot;H&quot;&quot;|&quot;&quot;Horizontal&quot;&quot;|&quot;&quot;V&quot;&quot;|&quot;&quot;Vertical&quot;&quot;&quot; _
+ &amp; &quot;, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [MinValue=0], MaxValue=100]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = 0
+ If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = 100
+
+ If Not ScriptForge.SF_Utils._Validate(Orientation, &quot;Orientation&quot;, V_STRING, Array(&quot;H&quot;, &quot;Horizontal&quot;, &quot;V&quot;, &quot;Vertical&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;Orientation&quot;, &quot;ScrollValueMin&quot;, &quot;ScrollValueMax&quot;)
+ vPropValues = Array(iBorder, CLng(Iif(Left(UCase(Orientation), 1) = &quot;V&quot;, 1, 0)), CLng(MinValue), CLng(MaxValue))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlScrollBarModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateScrollBar = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateScrollBar
+
+REM -----------------------------------------------------------------------------
+Public Function CreateTableControl(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal RowHeaders As Variant _
+ , Optional ByVal ColumnHeaders As Variant _
+ , Optional ByVal ScrollBars As Variant _
+ , Optional ByVal GridLines As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type TableControl in the actual dialog.
+&apos;&apos;&apos; To fill the table with data, use the SetTableData() method
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; RowHeaders: when True (default), the row headers are shown
+&apos;&apos;&apos; ColumnHeaders: when True (default), the column headers are shown
+&apos;&apos;&apos; ScrollBars: H[orizontal] or V[ertical] or B[oth] or N[one] (default)
+&apos;&apos;&apos; Note that scrollbars always appear dynamically when they are needed
+&apos;&apos;&apos; GridLines: when True (default = False) horizontal and vertical lines are painted between the grid cells
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myTableControl = dialog.CreateTableControl(&quot;TableControl1&quot;, Array(20, 20, 60, 15), ScrollBars := &quot;B&quot;)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateTableControl&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [RowHeaders=True], [ColumnHeaders=True]&quot; _
+ &amp; &quot;, [ScrollBars=&quot;&quot;N&quot;&quot;|&quot;&quot;None&quot;&quot;|&quot;&quot;B&quot;&quot;|&quot;&quot;Both&quot;&quot;|&quot;&quot;H&quot;&quot;|&quot;&quot;Horizontal&quot;&quot;|&quot;&quot;V&quot;&quot;|&quot;&quot;Vertical&quot;&quot;&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(RowHeaders) Or IsEmpty(RowHeaders) Then RowHeaders = True
+ If IsMissing(ColumnHeaders) Or IsEmpty(ColumnHeaders) Then ColumnHeaders = True
+ If IsMissing(ScrollBars) Or IsEmpty(ScrollBars) Then ScrollBars = &quot;None&quot;
+ If IsMissing(GridLines) Or IsEmpty(GridLines) Then GridLines = False
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(RowHeaders, &quot;RowHeaders&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(ColumnHeaders, &quot;ColumnHeaders&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(ScrollBars, &quot;ScrollBars&quot;, V_STRING, Array(&quot;N&quot;, &quot;None&quot;, &quot;B&quot;, &quot;Both&quot;, &quot;H&quot;, &quot;Horizontal&quot;, &quot;V&quot;, &quot;Vertical&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(GridLines, &quot;GridLines&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;ShowRowHeader&quot;, &quot;ShowColumnHeader&quot;, &quot;VScroll&quot;, &quot;HScroll&quot;, &quot;UseGridLines&quot;)
+ vPropValues = Array(iBorder, CBool(RowHeaders), CBool(ColumnHeaders) _
+ , Left(ScrollBars, 1) = &quot;B&quot; Or Left(ScrollBars, 1) = &quot;V&quot; _
+ , Left(ScrollBars, 1) = &quot;B&quot; Or Left(ScrollBars, 1) = &quot;H&quot; _
+ , CBool(GridLines) _
+ )
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;grid.UnoControlGridModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateTableControl = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateTableControl
+
+REM -----------------------------------------------------------------------------
+Public Function CreateTextField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MultiLine As Variant _
+ , Optional ByVal MaximumLength As Variant _
+ , Optional ByVal PasswordCharacter As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type TextField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
+&apos;&apos;&apos; MaximumLength: the maximum character count (default = 0 meaning unlimited)
+&apos;&apos;&apos; PasswordCharacter: a single character specifying the echo for a password text field (default = &quot;&quot;)
+&apos;&apos;&apos; MultiLine must be False to have PasswordCharacter being applied
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myTextField = dialog.CreateTextField(&quot;TextField1&quot;, Array(20, 20, 120, 50), MultiLine := True)
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim iPassword As Integer &apos; Integer alias of PasswordCharacter
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateTextField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [MultiLine=False], [MaximumLength=0, [PasswordCharacter=&quot;&quot;&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
+ If IsMissing(MaximumLength) Or IsEmpty(MaximumLength) Then MaximumLength = 0
+ If IsMissing(PasswordCharacter) Or IsEmpty(PasswordCharacter) Then PasswordCharacter = &quot;&quot;
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(MaximumLength, &quot;MaximumLength&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(PasswordCharacter, &quot;PasswordCharacter&quot;, V_STRING) Then GoTo Finally
+
+ &apos; MultiLine has precedence over Password
+ If MultiLine Then PasswordCharacter = &quot;&quot;
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ If Len(PasswordCharacter) &gt; 0 Then iPassword = Asc(Left(PasswordCharacter, 1)) Else iPassword = 0
+ vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;MaxTextLen&quot;, &quot;EchoChar&quot;, &quot;AutoVScroll&quot;) &apos; AutoHScroll not implemented ??
+ vPropValues = Array(iBorder, CBool(MultiLine), CInt(MaximumLength), iPassword, True)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlEditModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateTextField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateTextField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateTimeField(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ , Optional ByVal MinTime As Variant _
+ , Optional ByVal MaxTime As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type TimeField in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; MinTime: the smallest time that can be entered in the control. Default = 0
+&apos;&apos;&apos; MaxTime: the largest time that can be entered in the control. Default = 24h
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myTimeField = dialog.CreateTimeField(&quot;TimeField1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return Time
+Dim iBorder As Integer &apos; Alias of border
+Dim oMinTime As New com.sun.star.util.Time
+Dim oMaxTime As New com.sun.star.util.Time
+Dim vFormats As Variant &apos; List of available time formats
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateTimeField&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot; _
+ &amp; &quot;, [MinTime=TimeSerial(0, 0, 0)], [MaxTime=TimeSerial(23, 59, 59)]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If IsMissing(MinTime) Or IsEmpty(MinTime) Then MinTime = TimeSerial(0, 0, 0)
+ If IsMissing(MaxTime) Or IsEmpty(MaxTime) Then MaxTime = TimeSerial(23, 59, 59)
+
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._ValiDate(MinTime, &quot;MinTime&quot;, ScriptForge.V_DATE) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._ValiDate(MaxTime, &quot;MaxTime&quot;, ScriptForge.V_DATE) Then GoTo Finally
+ vFormats = SF_DialogUtils._FormatsList(&quot;TimeField&quot;)
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ With oMinTime
+ .Hours = Hour(MinTime) : .Minutes = Minute(MinTime) : .Seconds = Second(MinTime)
+ End With
+ With oMaxTime
+ .Hours = Hour(MaxTime) : .Minutes = Minute(MaxTime) : .Seconds = Second(MaxTime)
+ End With
+ vPropNames = Array(&quot;Border&quot;, &quot;TimeMin&quot;, &quot;TimeMax&quot;, &quot;TimeFormat&quot;)
+ vPropValues = Array(iBorder, oMinTime, oMaxTime, CInt(ScriptForge.SF_Array.IndexOf(vFormats(), &quot;24h short&quot;)))
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;UnoControlTimeFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateTimeField = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+End Function &apos; SFDialogs.SF_Dialog.CreateTimeField
+
+REM -----------------------------------------------------------------------------
+Public Function CreateTreeControl(Optional ByVal ControlName As Variant _
+ , Optional ByRef Place As Variant _
+ , Optional ByVal Border As Variant _
+ ) As Object
+&apos;&apos;&apos; Create a new control of type TreeControl in the actual dialog.
+&apos;&apos;&apos; Specific args:
+&apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Set myTreeControl = dialog.CreateTreeControl(&quot;TreeControl1&quot;, Array(20, 20, 60, 15))
+
+Dim oControl As Object &apos; Return value
+Dim iBorder As Integer &apos; Alias of border
+Dim vPropNames As Variant &apos; Array of names of specific arguments
+Dim vPropValues As Variant &apos; Array of values of specific arguments
+Const cstThisSub = &quot;SFDialogs.Dialog.CreateTreeControl&quot;
+Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot;
+
+Check:
+ Set oControl = Nothing
+ If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
+
+ If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
+ If Not ScriptForge.SF_Utils._Validate(Border, &quot;Border&quot;, V_STRING, Array(&quot;3D&quot;, &quot;FLAT&quot;, &quot;NONE&quot;)) Then GoTo Finally
+
+Try:
+ &apos; Manage specific properties
+ iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
+ vPropNames = Array(&quot;Border&quot;, &quot;SelectionType&quot;, &quot;Editable&quot;, &quot;ShowsHandles&quot;, &quot;ShowsRootHandles&quot;)
+ vPropValues = Array(iBorder, com.sun.star.view.SelectionType.SINGLE, False, True, True)
+
+ &apos; Create the control
+ Set oControl = _CreateNewControl(&quot;tree.TreeControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
+
+Finally:
+ Set CreateTreeControl = oControl
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.CreateTreeControl
+
+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
+ &apos; In dynamic dialogs, injection of sizes and positions from model to view is done with setVisible()
+ _DialogControl.setVisible(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
+ &apos; To make visible an on-the-fly designed dialog when macro triggered from Python
+ _DialogModel.DesktopAsParent = Not ( _BuiltFromScratch And _BuiltInPython )
+ _DialogControl.setVisible(True)
+ lExecute = 0
+ End If
+
+Finally:
+ Execute = lExecute
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ &apos; When an error is caused by an event error, the location is unknown
+ SF_Exception.Raise(, &quot;?&quot;)
+ 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;SFDialogs.Dialog.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 GetTextsFromL10N(Optional ByRef L10N As Variant) As Boolean
+&apos;&apos;&apos; Replace all fixed text strings of a dialog by their localized version
+&apos;&apos;&apos; Replaced texts are:
+&apos;&apos;&apos; - the title of the dialog
+&apos;&apos;&apos; - the caption associated with next control types: Button, CheckBox, FixedLine, FixedText, GroupBox and RadioButton
+&apos;&apos;&apos; - the content of list- and comboboxes
+&apos;&apos;&apos; - the tip- or helptext displayed when the mouse is hovering the control
+&apos;&apos;&apos; The current method has a twin method ScriptForge.SF_L10N.AddTextsFromDialog
+&apos;&apos;&apos; The current method is probably run before the Execute() method
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; L10N : a &quot;L10N&quot; service instance created with CreateScriptService(&quot;L10N&quot;)
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myPO As Object, oDlg As Object
+&apos;&apos;&apos; Set oDlg = CreateScriptService(&quot;Dialog&quot;, &quot;GlobalScope&quot;, &quot;XrayTool&quot;, &quot;DlgXray&quot;)
+&apos;&apos;&apos; Set myPO = CreateScriptService(&quot;L10N&quot;, &quot;C:\myPOFiles\&quot;, &quot;fr-BE&quot;)
+&apos;&apos;&apos; oDlg.GetTextsFromL10N(myPO)
+
+Dim bGet As Boolean &apos; Return value
+Dim vControls As Variant &apos; Array of control names
+Dim sControl As String &apos; A single control name
+Dim oControl As Object &apos; SFDialogs.DialogControl
+Dim sText As String &apos; The text found in the dialog
+Dim sTranslation As String &apos; The translated text got from the dictionary
+Dim vSource As Variant &apos; RowSource property of dialog control as an array
+Dim bChanged As Boolean &apos; True when at least 1 item of a RowSource is modified
+Dim i As Long
+
+Const cstThisSub = &quot;SFDialogs.Dialog.GetTextsFromL10N&quot;
+Const cstSubArgs = &quot;L10N&quot;
+
+ If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bGet = False
+
+Check:
+ If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not SF_Utils._Validate(L10N, &quot;L10N&quot;, V_OBJECT, , , &quot;L10N&quot;) Then GoTo Finally
+ End If
+
+Try:
+ &apos; Get the dialog title
+ sText = Caption
+ If Len(sText) &gt; 0 Then
+ sTranslation = L10N._(sText)
+ If sText &lt;&gt; sTranslation Then Caption = sTranslation
+ End If
+ &apos; Scan all controls
+ vControls = Controls()
+ For Each sControl In vControls
+ Set oControl = Controls(sControl)
+ With oControl
+ &apos; Extract fixed texts
+ sText = .Caption
+ If Len(sText) &gt; 0 Then
+ sTranslation = L10N._(sText)
+ If sText &lt;&gt; sTranslation Then .Caption = sTranslation
+ End If
+ vSource = .RowSource &apos; List and comboboxes only
+ If IsArray(vSource) Then
+ bChanged = False
+ For i = 0 To UBound(vSource)
+ If Len(vSource(i)) &gt; 0 Then
+ sTranslation = L10N._(vSource(i))
+ If sTranslation &lt;&gt; vSource(i) Then
+ bChanged = True
+ vSource(i) = sTranslation
+ End If
+ End If
+ Next i
+ &apos; Rewrite if at least 1 item has been modified by the translation process
+ If bChanged Then .RowSource = vSource
+ End If
+ sText = .TipText
+ If Len(sText) &gt; 0 Then
+ sTranslation = L10N._(sText)
+ If sText &lt;&gt; sTranslation Then .TipText = sTranslation
+ End If
+ End With
+ Next sControl
+
+ bGet = True
+
+Finally:
+ GetTextsFromL10N = bGet
+ SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.GetTextsFromL10N
+
+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;Center&quot; _
+ , &quot;CloneControl&quot; _
+ , &quot;Controls&quot; _
+ , &quot;CreateButton&quot; _
+ , &quot;CreateCheckBox&quot; _
+ , &quot;CreateComboBox&quot; _
+ , &quot;CreateCurrencyField&quot; _
+ , &quot;CreateDateField&quot; _
+ , &quot;CreateFileControl&quot; _
+ , &quot;CreateFixedLine&quot; _
+ , &quot;CreateFixedText&quot; _
+ , &quot;CreateFormattedField&quot; _
+ , &quot;CreateGroupBox&quot; _
+ , &quot;CreateHyperlink&quot; _
+ , &quot;CreateImageControl&quot; _
+ , &quot;CreateListBox&quot; _
+ , &quot;CreateNumericField&quot; _
+ , &quot;CreatePatternField&quot; _
+ , &quot;CreateProgressBar&quot; _
+ , &quot;CreateRadioButton&quot; _
+ , &quot;CreateScrollBar&quot; _
+ , &quot;CreateTableControl&quot; _
+ , &quot;CreateTextField&quot; _
+ , &quot;CreateTimeField&quot; _
+ , &quot;CreateTreeControl&quot; _
+ , &quot;EndExecute&quot; _
+ , &quot;Execute&quot; _
+ , &quot;GetTextsFromL10N&quot; _
+ , &quot;OrderTabs&quot; _
+ , &quot;Resize&quot; _
+ , &quot;SetPageManager&quot; _
+ , &quot;Terminate&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_Dialog.Methods
+
+REM -----------------------------------------------------------------------------
+Public Function OrderTabs(ByRef Optional TabsList As Variant _
+ , ByVal Optional Start As Variant _
+ , ByVal Optional Increment As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Set the tabulation index f a series of controls.
+&apos;&apos;&apos; The sequence of controls are given as an array of control names from the first to the last.
+&apos;&apos;&apos; Next controls will not be accessible (anymore ?) via the TAB key if &gt;=1 of next conditions is met:
+&apos;&apos;&apos; - if they are not in the given list
+&apos;&apos;&apos; - if their type is FixedLine, GroupBox or ProgressBar
+&apos;&apos;&apos; - if the control is disabled
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; TabsList: an array of valid control names in the order of tabulation
+&apos;&apos;&apos; Start: the tab index to be assigned to the 1st control in the list. Default = 1
+&apos;&apos;&apos; Increment: the difference between 2 successive tab indexes. Default = 1
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; dialog.OredrTabs(Array(&quot;myListBox&quot;, &quot;myTextField&quot;, &quot;myNumericField&quot;), Start := 10)
+
+Dim bOrder As Boolean &apos; Return value
+Dim vControlNames As Variant &apos; List of control names in the dialog
+Dim oControl As Object &apos; A SF_DialogControl instance
+Dim bValid As Boolean &apos; When True, the considered control deserves a tab stop
+Dim iTabIndex As Integer &apos; The tab index to be set
+Dim vWrongTypes As Variant &apos; List of rejected control types
+Dim i As Long
+
+Const cstThisSub = &quot;SFDialogs.Dialog.OrderTabs&quot;
+Const cstSubArgs = &quot;TabsList, [Start=1], ÃŽncrement=1]&quot;
+
+ If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bOrder = False
+
+Check:
+ If IsMissing(Start) Or IsEmpty(Start) Then Start = 1
+ If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1
+ If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._ValidateArray(TabsList, &quot;TabsList&quot;, 1, V_STRING, True) Then GoTo Finally
+ If Not SF_Utils._Validate(Start, &quot;Start&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ End If
+
+Try:
+ vWrongTypes = Array(&quot;FixedLine&quot;, &quot;GroupBox&quot;, &quot;ProgressBar&quot;)
+
+ &apos; Remove all existing tabulations
+ vControlNames = _DialogModel.getElementNames()
+ For i = 0 To UBound(vControlNames)
+ Set oControl = Controls(vControlNames(i))
+ With oControl._ControlModel
+ If Not ScriptForge.SF_Array.Contains(vWrongTypes, oControl._ControlType) Then
+ .TabStop = False
+ .TabIndex = -1
+ End If
+ End With
+ Next i
+
+ iTabIndex = Start
+
+ &apos; Go through the candidate controls for being tabulated and set tabs
+ For i = LBound(TabsList) To UBound(TabsList)
+ Set oControl = Controls(TabsList(i)) &apos; Error checking on input names happens here
+ With oControl._ControlModel
+ bValid = Not ScriptForge.SF_Array.Contains(vWrongTypes, oControl._ControlType)
+ If bValid Then bValid = .Enabled
+ If bValid Then
+ .TabStop = True
+ .TabIndex = iTabIndex
+ iTabIndex = iTabIndex + Increment
+ End If
+ End With
+ Next i
+
+ bOrder = True
+
+Finally:
+ OrderTabs = bOrder
+ SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.OrderTabls
+
+REM -----------------------------------------------------------------------------
+Public Function Properties() As Variant
+&apos;&apos;&apos; Return the list or properties of the Dialog class as an array
+
+ Properties = Array( _
+ &quot;Caption&quot; _
+ , &quot;Height&quot; _
+ , &quot;Modal&quot; _
+ , &quot;Name&quot; _
+ , &quot;OnFocusGained&quot; _
+ , &quot;OnFocusLost&quot; _
+ , &quot;OnKeyPressed&quot; _
+ , &quot;OnKeyReleased&quot; _
+ , &quot;OnMouseDragged&quot; _
+ , &quot;OnMouseEntered&quot; _
+ , &quot;OnMouseExited&quot; _
+ , &quot;OnMouseMoved&quot; _
+ , &quot;OnMousePressed&quot; _
+ , &quot;OnMouseReleased&quot; _
+ , &quot;Page&quot; _
+ , &quot;Visible&quot; _
+ , &quot;Width&quot; _
+ , &quot;XDialogModel&quot; _
+ , &quot;XDialogView&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_Dialog.Properties
+
+REM -----------------------------------------------------------------------------
+Public Function Resize(Optional ByVal Left As Variant _
+ , Optional ByVal Top As Variant _
+ , Optional ByVal Width As Variant _
+ , Optional ByVal Height As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Move the top-left corner of the dialog to new coordinates and/or modify its dimensions
+&apos;&apos;&apos; Without arguments, the method resets the initial dimensions
+&apos;&apos;&apos; Attributes denoting the position and size of a dialog are expressed in &quot;Map AppFont&quot; units.
+&apos;&apos;&apos; Map AppFont units are device and resolution independent.
+&apos;&apos;&apos; One Map AppFont unit is equal to one eighth of the average character (Systemfont) height and one quarter of the average character width.
+&apos;&apos;&apos; The dialog editor (= the Basic IDE) also uses Map AppFont units.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Left : the horizontal distance from the top-left corner. It may be negative.
+&apos;&apos;&apos; Top : the vertical distance from the top-left corner. It may be negative.
+&apos;&apos;&apos; Width : the horizontal width of the rectangle containing the Dialog. It must be positive.
+&apos;&apos;&apos; Height : the vertical height of the rectangle containing the Dialog. It must be positive.
+&apos;&apos;&apos; Missing arguments are left unchanged.
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; oDialog.Resize(100, 200, Height := 600) &apos; Width is not changed
+
+Try:
+ Resize = SF_DialogUtils._Resize([Me], Left, Top, Width, Height)
+
+End Function &apos; SFDialogss.SF_Dialog.Resize
+
+REM -----------------------------------------------------------------------------
+Public Function SetPageManager(Optional ByVal PilotControls As Variant _
+ , Optional ByVal TabControls As Variant _
+ , Optional ByVal WizardControls As Variant _
+ , Optional ByVal LastPage As variant _
+ ) As Boolean
+&apos;&apos;&apos; Define how the dialog displays pages. The page manager is an alternative to the
+&apos;&apos;&apos; direct use of the Page property of the dialog and dialogcontrol objects.
+&apos;&apos;&apos;
+&apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step.
+&apos;&apos;&apos; 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
+&apos;&apos;&apos; and all controls with a page value of 2 become visible.
+&apos;&apos;&apos;
+&apos;&apos;&apos; The arguments define which controls are involved in the orchestration of the displayed pages.
+&apos;&apos;&apos; Possible options:
+&apos;&apos;&apos; - select a value in a list- or combobox
+&apos;&apos;&apos; - select an item in a group of radio buttons
+&apos;&apos;&apos; - select a button linked to a page - placed side-by-side the buttons can simulate a tabbed interface
+&apos;&apos;&apos; - press a NEXT or BACK button like in many wizards
+&apos;&apos;&apos; Those options may be combined. The control updates will be synchronized.
+&apos;&apos;&apos; The method will set the actual page number to 1. Afterwards the Page property may be used to display any other page
+&apos;&apos;&apos;
+&apos;&apos;&apos; The SetPageManager() method is to be run only once and before the Execute() statement.
+&apos;&apos;&apos; If invoked several times, subsequent calls will be ignored.
+&apos;&apos;&apos; The method will define new listeners on the concerned controls, addressing generic routines.
+&apos;&apos;&apos; The corresponding events will be fired during the dialog execution.
+&apos;&apos;&apos; Preset events (in the Basic IDE) will be preserved and executed immediately AFTER the page change.
+&apos;&apos;&apos; The listeners will be removed at dialog termination.
+&apos;&apos;&apos;
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; PilotControls: a comma-separated list of listbox, combobox or radiobutton controls
+&apos;&apos;&apos; For radio buttons, provide the first in the group
+&apos;&apos;&apos; TabControls: a comma-separated list of button controls in ascending order
+&apos;&apos;&apos; WizardControls: a comma-separated list of 2 controls, a BACK button and a NEXT button
+&apos;&apos;&apos; LastPage: the index of the last available page. Recommended when use of WizardControls
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; dialog.SetPageManager(PilotControls := &quot;aListBox,aComboBox&quot;) &apos; 2 controls may cause page changes
+
+Dim bManager As Boolean &apos; Return value
+Dim vControls As Variant &apos; Array of involved controls
+Dim oControl As Object &apos; A DialogControl object
+Dim i As Long
+Const cstPrefix = &quot;_SFTAB_&quot; &apos; Prefix of Subs to trigger when involved controls are clicked
+Const cstComma = &quot;,&quot;
+
+Const cstThisSub = &quot;SFDialogs.Dialog.SetPageManager&quot;
+Const cstSubArgs = &quot;[PilotControls=&quot;&quot;&quot;&quot;], [TabControls=&quot;&quot;&quot;&quot;], [WizardControls=&quot;&quot;&quot;&quot;]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bManager = False
+
+Check:
+ If IsMissing(PilotControls) Or IsEmpty(PilotControls) Then PilotControls = &quot;&quot;
+ If IsMissing(TabControls) Or IsEmpty(TabControls) Then TabControls = &quot;&quot;
+ If IsMissing(WizardControls) Or IsEmpty(WizardControls) Then WizardControls = &quot;&quot;
+ If IsMissing(LastPage) Or IsEmpty(LastPage) Then LastPage = 0
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._Validate(PilotControls, &quot;PilotControls&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(TabControls, &quot;TabControls&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(WizardControls, &quot;WizardControls&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(LastPage, &quot;LastPage&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ End If
+ &apos; Ignore the call if already done before
+ If UBound(_PageManagement) &gt;= 0 Then GoTo Finally
+
+Try:
+ &apos; Common listeners to all involved controls
+ Set _ItemListener = CreateUnoListener(cstPrefix, &quot;com.sun.star.awt.XItemListener&quot;)
+ Set _ActionListener = CreateUnoListener(cstPrefix, &quot;com.sun.star.awt.XActionListener&quot;)
+
+ &apos; Register the arguments in the _PageManagement array, control by control
+ &apos; Pilot controls
+ If Len(PilotControls) &gt; 0 Then
+ vControls = Split(PilotControls, cstComma)
+ For i = 0 To UBound(vControls)
+ If Not _RegisterPageListener(Trim(vControls(i)), &quot;ListBox,ComboBox,RadioButton&quot;, PILOTCONTROL, 0, ITEMSTATECHANGED) Then GoTo Catch
+ Next i
+ End If
+ &apos; Tab controls
+ If Len(TabControls) &gt; 0 Then
+ vControls = Split(TabControls, cstComma)
+ For i = 0 To UBound(vControls)
+ If Not _RegisterPageListener(Trim(vControls(i)), &quot;Button&quot;, TABCONTROL, i + 1, ACTIONPERFORMED) Then GoTo Catch
+ Next i
+ End If
+ &apos; Wizard controls
+ If Len(WizardControls) &gt; 0 Then
+ vControls = Split(WizardControls, cstComma)
+ For i = 0 To UBound(vControls)
+ If Not _RegisterPageListener(Trim(vControls(i)), &quot;Button&quot;, Iif(i = 0, BACKCONTROL, NEXTCONTROL), 0, ACTIONPERFORMED) Then GoTo Catch
+ Next i
+ End If
+
+ &apos; Set the initial page to 1
+ Page = 1
+ _LastPage = LastPage
+
+Finally:
+ SetPageManager = bManager
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ ScriptForge.SF_Exception.RaiseFatal(PAGEMANAGERERROR, &quot;PilotControls&quot;, PilotControls, &quot;TabControls&quot;, TabControls _
+ , &quot;WizardControls&quot;, WizardControls)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog.SetPageManager
+
+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:
+ _RemoveAllListeners()
+ _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 -----------------------------------------------------------------------------
+Private Function _CheckNewControl(cstThisSub As String, cstSubArgs As String _
+ , Optional ByVal ControlName As Variant _
+ , ByRef Place As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Check the generic arguments of a CreateXXX() method for control creation.
+&apos;&apos;&apos; Called by the CreateButton, CreateCheckBox, ... specific methods
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; cstThisSub, cstSubArgs: caller routine and its arguments. Used to formulate an error message, if any.
+&apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
+&apos;&apos;&apos; Place: the size and position expressed in APPFONT units, either
+&apos;&apos;&apos; - an array (X, Y, Width, Height) or Array(x, Y)
+&apos;&apos;&apos; - a com.sun.star.awt.Rectangle structure
+&apos;&apos;&apos; Exceptions:
+&apos;&apos;&apos; DUPLICATECONTROLERROR A control with the same name exists already
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when arguments passed the check
+
+Dim bCheck As Boolean &apos; Return value
+
+ bCheck = False
+
+Check:
+ 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
+ If IsArray(Place) Then
+ If Not ScriptForge.SF_Utils._ValidateArray(Place, &quot;Place&quot;, 1, ScriptForge.V_NUMERIC, True) Then GoTo Finally
+ ElseIf Not IsNull(Place) Then
+ If Not ScriptForge.SF_Utils._Validate(Place, &quot;Place&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+ End If
+ End If
+ If _DialogModel.hasByName(ControlName) Then GoTo CatchDuplicate
+
+ bCheck = True
+
+Finally:
+ _CheckNewControl = bCheck
+ &apos; Call to _ExitFunction is done in the caller to allow handling of specific arguments
+ Exit Function
+CatchDuplicate:
+ ScriptForge.SF_Exception.RaiseFatal(DUPLICATECONTROLERROR, &quot;ControlName&quot;, ControlName, _Name)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._CheckNewControl
+
+REM -----------------------------------------------------------------------------
+Private Function _CreateNewControl(ByVal pvModel As Variant _
+ , ByVal ControlName As Variant _
+ , ByRef Place As Variant _
+ , Optional ByRef ArgNames As Variant _
+ , Optional ByRef ArgValues As Variant _
+ ) As Object
+&apos;&apos;&apos; Generic creation of a new control.
+&apos;&apos;&apos; Called by the CreateButton, CreateCheckBox, ... specific methods
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; pvModel: one of the UnoControlxxx control models (as a string)
+&apos;&apos;&apos; or such a model as a UNO class instance (cloned from an existing control)
+&apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
+&apos;&apos;&apos; Place: the size and position expressed in APPFONT units, either
+&apos;&apos;&apos; - an array (X, Y, Width, Height)
+&apos;&apos;&apos; - a com.sun.star.awt.Rectangle structure
+&apos;&apos;&apos; ArgNames: the list of the specific arguments linked to the given pvModel
+&apos;&apos;&apos; ArgValues: their values
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; A new SF_DialogControl class instance or Nothing if creation failed
+
+Dim oControl As Object &apos; Return value
+Dim oControlModel As Object &apos; com.sun.star.awt.XControlModel
+Dim vPlace As Variant &apos; Alias of Place when object to avoid &quot;Object variable not set&quot; error
+Dim lCache As Long &apos; Number of elements in the controls cache
+Static oSession As Object
+
+Check:
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ Set oControl = Nothing
+
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+
+ If IsMissing(ArgNames) Or IsEmpty(ArgNames) Then ArgNames = Array()
+ If IsMissing(ArgValues) Or IsEmpty(ArgValues) Then ArgValues = Array()
+
+Try:
+ &apos; When the model is a string, create a new (empty) model instance
+ Select Case VarType(pvModel)
+ Case V_STRING : Set oControlModel = _DialogModel.createInstance(&quot;com.sun.star.awt.&quot; &amp; pvModel)
+ Case ScriptForge.V_OBJECT : Set oControlModel = pvModel
+ End Select
+
+ oControlModel.Name = ControlName
+
+ &apos; Set dimension and position
+ With oControlModel
+ If IsArray(Place) Then
+ &apos; Ignore width and height when new control is cloned from an existing one
+ If UBound(Place) &gt;= 1 Then
+ .PositionX = Place(0)
+ .PositionY = Place(1)
+ End If
+ If UBound(Place) &gt;= 3 Then
+ .Width = Place(2)
+ .Height = Place(3)
+ End If
+ ElseIf oSession.UnoObjectType(Place) = &quot;com.sun.star.awt.Rectangle&quot; Then
+ Set vPlace = Place
+ .PositionX = vPlace.X
+ .PositionY = vPlace.Y
+ .Width = vPlace.Width
+ .Height = vPlace.Height
+ Else
+ &apos;Leave everything to zero
+ End If
+ End With
+
+ &apos; Store the specific properties in the model
+ If UBound(ArgNames) &gt;= 0 Then oControlModel.setPropertyValues(ArgNames, ArgValues)
+
+ &apos; Insert the new completed control model in the dialog
+ _DialogModel.insertByName(ControlName, oControlModel)
+
+ &apos; Update controls cache - existing cache is presumed unchanged: new control is added at the end of Model.ElementNames
+ lCache = UBound(_ControlCache)
+ If lCache &lt; 0 Then
+ ReDim _ControlCache(0 To 0)
+ Else
+ ReDim Preserve _ControlCache(0 To lCache + 1)
+ End If
+
+ &apos; Now the UNO control exists, build the SF_DialogControl instance as usual
+ Set oControl = Controls(ControlName)
+
+Finally:
+ Set _CreateNewControl = oControl
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._CreateNewControl
+
+REM -----------------------------------------------------------------------------
+Private Function _FindRadioSiblings(ByVal psRadioButton As String) As String
+&apos;&apos;&apos; Given the name of the first radio button of a group, return all the names of the group
+&apos;&apos;&apos; For dialogs, radio buttons are considered of the same group
+&apos;&apos;&apos; when their tab indexes are contiguous.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psRadioButton: the exact name of the 1st radio button of the group
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; A comma-separated list of the names of the 1st and the next radio buttons
+&apos;&apos;&apos; belonging to the same group in their tabindex order.
+&apos;&apos;&apos; The input argument when not a radio button
+
+
+Dim sList As String &apos; Return value
+Dim oRadioControl As Object &apos; DialogControl instance corresponding with the argument
+Dim oControl As Object &apos; DialogControl instance
+Dim vRadioList As Variant &apos; Array of all radio buttons having a tab index &gt; tab index of argument
+ &apos; 1st column = name of radio button, 2nd = its tab index
+Dim iRadioTabIndex As Integer &apos; Tab index of the argument
+Dim iTabIndex As Integer &apos; Any tab index
+Dim vControlNames As Variant &apos; Array of control names
+Dim sControlName As String &apos; A single item in vControlNames()
+Dim i As Long
+Const cstComma = &quot;,&quot;
+
+Check:
+ On Local Error GoTo Catch
+ sList = psRadioButton
+ vRadioList = Array()
+
+Try:
+ Set oRadioControl = Controls(psRadioButton)
+ If oRadioControl.ControlType &lt;&gt; &quot;RadioButton&quot; Then GoTo Finally
+ iRadioTabIndex = oRadioControl._ControlModel.Tabindex
+ vRadioList = ScriptForge.SF_Array.AppendRow(vRadioList, Array(psRadioButton, iRadioTabIndex))
+
+ &apos; Scan all controls. Store radio buttons having tab index &gt; 1st radio button
+ vControlNames = Controls()
+ For Each sControlName In vControlNames
+ Set oControl = Controls(sControlName)
+ With oControl
+ If .Name &lt;&gt; psRadioButton Then
+ If .ControlType = &quot;RadioButton&quot; Then
+ iTabIndex = ._ControlModel.Tabindex
+ If iTabIndex &gt; iRadioTabIndex Then
+ vRadioList = ScriptForge.SF_Array.AppendRow(vRadioList, Array(.Name, iTabIndex))
+ End If
+ End If
+ End If
+ End With
+ Next sControlName
+
+ vRadioList = ScriptForge.SF_Array.SortRows(vRadioList, 1)
+ &apos; Retain contiguous tab indexes
+ For i = 1 To UBound(vRadioList, 1) &apos; First row = argument
+ If vRadioList(i, 1) = iRadioTabIndex + i Then sList = sList &amp; cstComma &amp; vRadioList(i, 0)
+ Next i
+
+Finally:
+ _FindRadioSiblings = sList
+ Exit Function
+Catch:
+ sList = psRadioButton
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._FindRadioSiblings
+
+REM -----------------------------------------------------------------------------
+Public Function _GetEventName(ByVal psProperty As String) As String
+&apos;&apos;&apos; Return the LO internal event name derived from the SF property name
+&apos;&apos;&apos; The SF property name is not case sensitive, while the LO name is case-sensitive
+&apos; Corrects the typo on ErrorOccur(r?)ed, if necessary
+
+Dim vProperties As Variant &apos; Array of class properties
+Dim sProperty As String &apos; Correctly cased property name
+
+ vProperties = Properties()
+ sProperty = vProperties(ScriptForge.SF_Array.IndexOf(vProperties, psProperty, SortOrder := &quot;ASC&quot;))
+
+ _GetEventName = LCase(Mid(sProperty, 3, 1)) &amp; Right(sProperty, Len(sProperty) - 3)
+
+End Function &apos; SFDialogs.SF_Dialog._GetEventName
+
+REM -----------------------------------------------------------------------------
+Private Function _GetListener(ByVal psEventName As String) As String
+&apos;&apos;&apos; Getting/Setting macros triggered by events requires a Listener-EventName pair
+&apos;&apos;&apos; Return the X...Listener corresponding with the event name in argument
+
+ Select Case UCase(psEventName)
+ Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
+ _GetListener = &quot;XFocusListener&quot;
+ Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
+ _GetListener = &quot;XKeyListener&quot;
+ Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
+ _GetListener = &quot;XMouseMotionListener&quot;
+ Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ _GetListener = &quot;XMouseListener&quot;
+ Case Else
+ _GetListener = &quot;&quot;
+ End Select
+
+End Function &apos; SFDialogs.SF_Dialog._GetListener
+
+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
+&apos;&apos;&apos; - Initialisation of persistent storage for controls
+
+Dim lControls As Long &apos; Number of controls at dialog creation
+Try:
+ &apos; Keep reference to model
+ Set _DialogModel = _DialogControl.Model
+
+ &apos; Store initial position and dimensions
+ With _DialogModel
+ _Left = .PositionX
+ _Top = .PositionY
+ _Width = .Width
+ _Height = .Height
+ End With
+
+ &apos; Add dialog reference to cache
+ _CacheIndex = SF_Register._AddDialogToCache(_DialogControl, [Me])
+
+ &apos; Size the persistent storage
+ _ControlCache = Array()
+ lControls = UBound(_DialogModel.getElementNames())
+ If lControls &gt;= 0 Then ReDim _ControlCache(0 To lControls)
+
+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) Or _BuiltFromScratch )
+ If bAlive Then bAlive = 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 Sub _JumpToPage(ByVal plPage As Long)
+&apos;&apos;&apos; Called when the Page property is set to a new value
+&apos;&apos;&apos; The rules defined in the _pageManagement array are applied here
+
+Dim oPageManager As Object &apos; A single entry in _PageManagement of type _PageManager
+Dim oControl As Object &apos; DialogControl instance
+Dim lPage As Long &apos; A dialog page number
+
+Check:
+ On Local Error GoTo Finally
+&apos; ControlName As String &apos; Case-sensitive name of control involved in page management
+&apos; PageMgtType As Integer &apos; One of the PILOTCONTROL, TABCONTROL, BACKCONTROL, NEXTCONTROL constants
+&apos; PageNumber As Long &apos; When &gt; 0, the page to activate for tab controls
+&apos; ListenerType As Integer &apos; One of the ITEMSTATECHANGED, ACTIONPERFORMED constants
+
+ If plPage &lt;= 0 Or (_LastPage &gt; 0 And plPage &gt; _LastPage) Then Exit Sub
+ If UBound(_PageManagement) &lt; 0 Then Exit Sub
+
+Try:
+ &apos; Controls listed in the array must be synchronized with the page #
+ &apos; Listboxes and comboboxes must be set to the corresponding value
+ &apos; The right radio button must be selected
+ &apos; One corresponding button must be dimmed, other must be enabled
+ &apos; The Next button must be dimmed when last page otherwise enabled
+ For Each oPageManager In _PageManagement
+ With oPageManager
+ lPage = .PageNumber
+ Set oControl = Controls(.ControlName)
+ With oControl
+ Select Case .ControlType
+ Case &quot;ListBox&quot;, &quot;ComboBox&quot;
+ If plPage &lt;= .ListCount Then .ListIndex = plPage - 1 &apos; ListIndex is zero-based
+ Case &quot;RadioButton&quot;
+ .Value = ( plPage = lPage )
+ Case &quot;Button&quot;
+ Select Case oPageManager.PageMgtType
+ Case TABCONTROL
+ .Value = ( plPage = lPage )
+ Case BACKCONTROL
+ .Enabled = ( plPage &lt;&gt; 1 )
+ Case NEXTCONTROL
+ .Enabled = ( _LastPage = 0 Or plPage &lt; _LastPage )
+ Case Else
+ End Select
+ Case Else
+ End Select
+ End With
+ End With
+ Next oPageManager
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialog._JumpToPage
+
+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 oPosSize As Object &apos; com.sun.star.awt.Rectangle
+Dim oDialogEvents As Object &apos; com.sun.star.container.XNameContainer
+Dim sEventName As String &apos; Internal event name
+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 UCase(psProperty)
+ Case UCase(&quot;Caption&quot;)
+ If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _PropertyGet = _DialogModel.Title
+ Case UCase(&quot;Height&quot;)
+ If _Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_DialogControl, False).Height
+ Else
+ If oSession.HasUNOProperty(_DialogModel, &quot;Height&quot;) Then _PropertyGet = _DialogModel.Height
+ End If
+ Case UCase(&quot;Modal&quot;)
+ _PropertyGet = _Modal
+ Case UCase(&quot;Name&quot;)
+ _PropertyGet = _Name
+ Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ &apos; Check OnEvents set statically in Basic IDE
+ Set oDialogEvents = _DialogModel.getEvents()
+ sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; _GetEventName(psProperty)
+ If oDialogEvents.hasByName(sEventName) Then
+ _PropertyGet = oDialogEvents.getByName(sEventName).ScriptCode
+ Else
+ &apos; Check OnEvents set dynamically by code
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnFocusGained&quot;) : _PropertyGet = _OnFocusGained
+ Case UCase(&quot;OnFocusLost&quot;) : _PropertyGet = _OnFocusLost
+ Case UCase(&quot;OnKeyPressed&quot;) : _PropertyGet = _OnKeyPressed
+ Case UCase(&quot;OnKeyReleased&quot;) : _PropertyGet = _OnKeyReleased
+ Case UCase(&quot;OnMouseDragged&quot;) : _PropertyGet = _OnMouseDragged
+ Case UCase(&quot;OnMouseEntered&quot;) : _PropertyGet = _OnMouseEntered
+ Case UCase(&quot;OnMouseExited&quot;) : _PropertyGet = _OnMouseExited
+ Case UCase(&quot;OnMouseMoved&quot;) : _PropertyGet = _OnMouseMoved
+ Case UCase(&quot;OnMousePressed&quot;) : _PropertyGet = _OnMousePressed
+ Case UCase(&quot;OnMouseReleased&quot;) : _PropertyGet = _OnMouseReleased
+ Case Else : _PropertyGet = &quot;&quot;
+ End Select
+ End If
+ Case UCase(&quot;Page&quot;)
+ If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then _PropertyGet = _DialogModel.Step
+ Case UCase(&quot;Visible&quot;)
+ If oSession.HasUnoMethod(_DialogControl, &quot;isVisible&quot;) Then _PropertyGet = CBool(_DialogControl.isVisible())
+ Case UCase(&quot;Width&quot;)
+ If _Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_DialogControl, False).Width
+ Else
+ If oSession.HasUNOProperty(_DialogModel, &quot;Width&quot;) Then _PropertyGet = _DialogModel.Width
+ End If
+ Case UCase(&quot;XDialogModel&quot;)
+ Set _PropertyGet = _DialogModel
+ Case UCase(&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 Catch
+ 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 Catch
+ bSet = Resize(Height := pvValue)
+ Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Catch
+ bSet = SF_DialogListener._SetOnProperty([Me], psProperty, pvValue)
+ Case UCase(&quot;Page&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then
+ _DialogModel.Step = CLng(pvValue)
+ &apos; Execute the page manager instructions
+ _JumpToPage(pvValue)
+ End If
+ Case UCase(&quot;Visible&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
+ 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 Catch
+ bSet = Resize(Width := pvValue)
+ Case Else
+ bSet = False
+ End Select
+
+Finally:
+ _PropertySet = bSet
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ bSet = False
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._PropertySet
+
+REM -----------------------------------------------------------------------------
+Private Function _RegisterPageListener(ByVal psControlName As String _
+ , ByVal psControlTypes As String _
+ , ByVal piMgtType As Integer _
+ , ByVal plPageNumber As Long _
+ , ByVal piListener As Integer _
+ ) As Boolean
+&apos;&apos;&apos; Insert a new entry in the _PageManagement array when 1st argument is a listbox, a combobox or a button
+&apos;&apos;&apos; or insert a new entry in the _PageManagement array by radio button in the same group as the 1st argument
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; psControlName: name of the involved control
+&apos;&apos;&apos; psControlTypes: comma-separated list of allowed control types
+&apos;&apos;&apos; piMgtType: one of the PILOTCONTROL, TABCONTROL, BACKCONTROL, NEXTCONTROL constants
+&apos;&apos;&apos; plPageNumber: when &gt; 0 the page to jump to when control is clicked
+&apos;&apos;&apos; piListener: one of the ACTIONPERFORMED, ITEMSTATECHANGED constants
+
+Dim bRegister As Boolean &apos; Return value
+Dim oControl As Object &apos; A DialogControl object
+Dim oControl2 As Object &apos; An alternative DialogControl object for radio buttons
+Dim vControls As Variant &apos; Array of involved controls - mostly 1 item, more when radio button
+Dim oPageManager As Object &apos; Type _PageManager
+Dim bRadio As Boolean &apos; True when argument is a radio button
+Dim sName As String &apos; Control name
+Dim i As Long
+
+Check:
+ On Local Error GoTo Catch
+ bRegister = False
+
+Try:
+ Set oControl = Controls(psControlName)
+ With oControl
+ &apos; Check the type of control otherwise return False
+ If InStr(psControlTypes, .ControlType) = 0 Then GoTo Catch
+ &apos; Are there siblings ? Siblings are returned as a comma-separated list of names
+ bRadio = ( .ControlType = &quot;RadioButton&quot;)
+ If bRadio Then vControls = Split(_FindRadioSiblings(.Name), &quot;,&quot;) Else vControls = Array(.Name)
+ &apos; Several loops when radio buttons
+ For i = 0 To UBound(vControls)
+ sName = vControls(i)
+ &apos; Prepare the next entry in the _PageManagement array
+ Set oPageManager = New _PageManager
+ With oPageManager
+ .ControlName = sName
+ .PageMgtType = piMgtType
+ .PageNumber = Iif(bRadio, i + 1, plPageNumber)
+ .ListenerType = piListener
+ End With
+ _PageManagement = ScriptForge.SF_Array.Append(_PageManagement, oPageManager)
+ &apos; Activate the listener
+ &apos; Use alternative control for radio buttons &gt; first
+ If i = 0 Then Set oControl2 = oControl Else Set oControl2 = Controls(sName)
+ With oControl2
+ If piListener = ACTIONPERFORMED Then
+ ._ControlView.addActionListener(_ActionListener)
+ ElseIf piListener = ITEMSTATECHANGED Then
+ ._ControlView.addItemListener(_ItemListener)
+ End If
+ End With
+ Next i
+ End With
+
+ bRegister = True
+
+Finally:
+ _RegisterPageListener = bRegister
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialog._RegisterPageListener
+
+REM -----------------------------------------------------------------------------
+Private Sub _RemoveAllListeners()
+&apos;&apos;&apos; Executed at dialog termination to drop at once all listeners set
+&apos;&apos;&apos; either by the page manager or by an On-property setting
+
+Dim oPageManager As Object &apos; Item of _PageManagement array of _PageManager type
+Dim oControl As Object &apos; DialogControl instance
+Dim i As Long
+
+ On Local Error GoTo Finally &apos; Never interrupt
+
+Try:
+ &apos; Scan the _PageManagement array containing the actual settings of the page manager
+ For Each oPageManager In _PageManagement
+ With oPageManager
+ If .ListenerType &gt; 0 Then
+ Set oControl = Controls(.ControlName)
+ If .ListenerType = ACTIONPERFORMED Then
+ oControl._ControlView.removeActionListener(_ActionListener)
+ ElseIf .ListenerType = ITEMSTATECHANGED Then
+ oControl._ControlView.removeItemListener(_ItemListener)
+ End If
+ End If
+ End With
+ Next oPageManager
+
+ Set _ActionListener = Nothing
+ Set _ItemListener = Nothing
+
+ &apos; Clean listeners linked to On properties
+ With _DialogControl
+ If Not IsNull(_FocusListener) Then .removeFocusListener(_FocusListener)
+ If Not IsNull(_KeyListener) Then .removeKeyListener(_KeyListener)
+ If Not IsNull(_MouseListener) Then .removeMouseListener(_MouseListener)
+ If Not IsNull(_MouseMotionListener) Then .removeMouseMotionListener(_MouseMotionListener)
+ End With
+
+ Set _FocusListener = Nothing
+ Set _KeyListener = Nothing
+ Set _MouseListener = Nothing
+ Set _MouseMotionListener = Nothing
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialog._RemoveAllListeners
+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>
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
new file mode 100644
index 0000000000..a82a18e2e1
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -0,0 +1,2514 @@
+<?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; A special attention is given to controls with types TreeControl and TableControl
+&apos;&apos;&apos; It is easy with the API proposed in the current class to populate a tree, either
+&apos;&apos;&apos; - branch by branch (CreateRoot and AddSubNode), or
+&apos;&apos;&apos; - with a set of branches at once (AddSubtree)
+&apos;&apos;&apos; Additionally populating a TreeControl can be done statically or dynamically
+&apos;&apos;&apos;
+&apos;&apos;&apos; With the method SetTableData(), feed a tablecontrol with a sortable and selectable
+&apos;&apos;&apos; array of data. Columns and rows may receive a header. Column widths are adjusted manually by the user or
+&apos;&apos;&apos; with the same method. Alignments can be set as well by script.
+&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; Detailed user documentation:
+&apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_dialogcontrol.html?DbPAR=BASIC
+&apos;&apos;&apos;
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&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 _IndexOfNames As Long &apos; Index in ElementNames array. Used to access SF_Dialog._ControlCache
+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
+Private _TreeDataModel As Object &apos; com.sun.star.awt.tree.MutableTreeDataModel
+Private _GridColumnModel As Object &apos; com.sun.star.awt.grid.XGridColumnModel
+Private _GridDataModel As Object &apos; com.sun.star.awt.grid.XGridDataModel
+
+&apos; Control attributes
+Private _ImplementationName As String
+Private _ControlType As String &apos; One of the CTLxxx constants
+
+&apos; Control initial position and dimensions in APPFONT units
+Private _Left As Long
+Private _Top As Long
+Private _Width As Long
+Private _Height As Long
+
+&apos; Tree control on-select and on-expand attributes
+&apos; Tree controls may be associated with events not defined in the Basic IDE
+Private _OnNodeSelected As String &apos; Script to invoke when a node is selected
+Private _OnNodeExpanded As String &apos; Script to invoke when a node is expanded
+Private _SelectListener As Object &apos; com.sun.star.view.XSelectionChangeListener
+Private _ExpandListener As Object &apos; com.sun.star.awt.tree.XTreeExpansionListener
+
+&apos; Updatable events
+Private _ActionListener As Object &apos; com.sun.star.awt.XActionListener
+Private _OnActionPerformed As String &apos; Script to invoke when action triggered
+Private _ActionCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _AdjustmentListener As Object &apos; com.sun.star.awt.XAdjustmentListener
+Private _OnAdjustmentValueChanged As String &apos; Script to invoke when scrollbar value has changed
+Private _AdjustmentCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _FocusListener As Object &apos; com.sun.star.awt.XFocusListener
+Private _OnFocusGained As String &apos; Script to invoke when control gets focus
+Private _OnFocusLost As String &apos; Script to invoke when control loses focus
+Private _FocusCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _ItemListener As Object &apos; com.sun.star.awt.XItemListener
+Private _OnItemStateChanged As String &apos; Script to invoke when status of item changes
+Private _ItemCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _KeyListener As Object &apos; com.sun.star.awt.XKeyListener
+Private _OnKeyPressed As String &apos; Script to invoke when Key clicked in control
+Private _OnKeyReleased As String &apos; Script to invoke when Key released in control
+Private _KeyCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseListener As Object &apos; com.sun.star.awt.XMouseListener
+Private _OnMouseEntered As String &apos; Script to invoke when mouse enters control
+Private _OnMouseExited As String &apos; Script to invoke when mouse leaves control
+Private _OnMousePressed As String &apos; Script to invoke when mouse clicked in control
+Private _OnMouseReleased As String &apos; Script to invoke when mouse released in control
+Private _MouseCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseMotionListener As Object &apos; com.sun.star.awt.XMouseMotionListener
+Private _OnMouseDragged As String &apos; Script to invoke when mouse is dragged from the control
+Private _OnMouseMoved As String &apos; Script to invoke when mouse is moved across the control
+Private _MouseMotionCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _TextListener As Object &apos; com.sun.star.awt.XTextListener
+Private _OnTextChanged As String &apos; Script to invoke when textual content has changed
+Private _TextCounter As Integer &apos; Counts the number of events set on the listener
+
+&apos; Table control attributes
+Private _ColumnWidths As Variant &apos; Array of column widths
+
+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 CTLHYPERLINK = &quot;Hyperlink&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 CTLTABLECONTROL = &quot;TableControl&quot;
+Private Const CTLTEXTFIELD = &quot;TextField&quot;
+Private Const CTLTIMEFIELD = &quot;TimeField&quot;
+Private Const CTLTREECONTROL = &quot;TreeControl&quot;
+
+REM ====================================================== CONSTRUCTOR/DESTRUCTOR
+
+REM -----------------------------------------------------------------------------
+Private Sub Class_Initialize()
+ Set [Me] = Nothing
+ Set [_Parent] = Nothing
+ ObjectType = &quot;DIALOGCONTROL&quot;
+ ServiceName = &quot;SFDialogs.DialogControl&quot;
+ _Name = &quot;&quot;
+ _IndexOfNames = -1
+ _DialogName = &quot;&quot;
+ Set _ControlModel = Nothing
+ Set _ControlView = Nothing
+ Set _TreeDataModel = Nothing
+ Set _GridColumnModel = Nothing
+ Set _GridDataModel = Nothing
+ _ImplementationName = &quot;&quot;
+ _ControlType = &quot;&quot;
+
+ _Left = SF_DialogUtils.MINPOSITION
+ _Top = SF_DialogUtils.MINPOSITION
+ _Width = -1
+ _Height = -1
+
+ _OnNodeSelected = &quot;&quot;
+ _OnNodeExpanded = &quot;&quot;
+ Set _SelectListener = Nothing
+ Set _ExpandListener = Nothing
+
+ Set _ActionListener = Nothing
+ _OnActionPerformed = &quot;&quot;
+ _ActionCounter = 0
+ Set _AdjustmentListener = Nothing
+ _OnAdjustmentValueChanged = &quot;&quot;
+ _AdjustmentCounter = 0
+ Set _FocusListener = Nothing
+ _OnFocusGained = &quot;&quot;
+ _OnFocusLost = &quot;&quot;
+ _FocusCounter = 0
+ Set _KeyListener = Nothing
+ _OnKeyPressed = &quot;&quot;
+ _OnKeyReleased = &quot;&quot;
+ _KeyCounter = 0
+ Set _MouseListener = Nothing
+ _OnMouseEntered = &quot;&quot;
+ _OnMouseExited = &quot;&quot;
+ _OnMousePressed = &quot;&quot;
+ _OnMouseReleased = &quot;&quot;
+ _MouseCounter = 0
+ Set _MouseMotionListener = Nothing
+ _OnMouseDragged = &quot;&quot;
+ _OnMouseMoved = &quot;&quot;
+ _MouseMotionCounter = 0
+ Set _ItemListener = Nothing
+ _OnItemStateChanged = &quot;&quot;
+ _ItemCounter = 0
+ Set _TextListener = Nothing
+ _OnTextChanged = &quot;&quot;
+ _TextCounter = 0
+
+ _ColumnWidths = Array()
+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 Border() As Variant
+&apos;&apos;&apos; The Border property refers to the surrounding of the control: 3D, FLAT or NONE
+ Border = _PropertyGet(&quot;Border&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Border (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Border(Optional ByVal pvBorder As Variant)
+&apos;&apos;&apos; Set the updatable property Border
+ _PropertySet(&quot;Border&quot;, pvBorder)
+End Property &apos; SFDialogs.SF_DialogControl.Border (let)
+
+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 CurrentNode() As Variant
+&apos;&apos;&apos; The CurrentNode property returns the currently selected node
+&apos;&apos;&apos; It returns Empty when there is no node selected
+&apos;&apos;&apos; When there are several selections, it returns the topmost node among the selected ones
+ CurrentNode = _PropertyGet(&quot;CurrentNode&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.CurrentNode (get)
+
+REM -----------------------------------------------------------------------------
+Property Let CurrentNode(Optional ByVal pvCurrentNode As Variant)
+&apos;&apos;&apos; Set a single selection in a tree control
+ _PropertySet(&quot;CurrentNode&quot;, pvCurrentNode)
+End Property &apos; SFDialogs.SF_DialogControl.CurrentNode (let)
+
+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
+ _PropertySet(&quot;Format&quot;, pvFormat)
+End Property &apos; SFDialogs.SF_DialogControl.Format (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Height() As Variant
+&apos;&apos;&apos; The Height property refers to the height of the control
+ Height = _PropertyGet(&quot;Height&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.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_DialogControl.Height (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 OnActionPerformed() As Variant
+&apos;&apos;&apos; Get the script associated with the OnActionPerformed event
+ OnActionPerformed = _PropertyGet(&quot;OnActionPerformed&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnActionPerformed (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnActionPerformed(Optional ByVal pvActionPerformed As Variant)
+&apos;&apos;&apos; Set the updatable property OnActionPerformed
+ _PropertySet(&quot;OnActionPerformed&quot;, pvActionPerformed)
+End Property &apos; SFDialogs.SF_DialogControl.OnActionPerformed (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnAdjustmentValueChanged() As Variant
+&apos;&apos;&apos; Get the script associated with the OnAdjustmentValueChanged event
+ OnAdjustmentValueChanged = _PropertyGet(&quot;OnAdjustmentValueChanged&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnAdjustmentValueChanged(Optional ByVal pvAdjustmentValueChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnAdjustmentValueChanged
+ _PropertySet(&quot;OnAdjustmentValueChanged&quot;, pvAdjustmentValueChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnFocusGained() As Variant
+&apos;&apos;&apos; Get the script associated with the OnFocusGained event
+ OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusGained (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusGained
+ _PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusGained (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnFocusLost() As Variant
+&apos;&apos;&apos; Get the script associated with the OnFocusLost event
+ OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusLost (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusLost
+ _PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusLost (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnItemStateChanged() As Variant
+&apos;&apos;&apos; Get the script associated with the OnItemStateChanged event
+ OnItemStateChanged = _PropertyGet(&quot;OnItemStateChanged&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnItemStateChanged (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnItemStateChanged(Optional ByVal pvItemStateChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnItemStateChanged
+ _PropertySet(&quot;OnItemStateChanged&quot;, pvItemStateChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnItemStateChanged (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnKeyPressed() As Variant
+&apos;&apos;&apos; Get the script associated with the OnKeyPressed event
+ OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyPressed (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyPressed
+ _PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyPressed (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnKeyReleased() As Variant
+&apos;&apos;&apos; Get the script associated with the OnKeyReleased event
+ OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyReleased (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyReleased
+ _PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyReleased (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseDragged() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseDragged event
+ OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseDragged (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseDragged
+ _PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseDragged (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseEntered() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseEntered event
+ OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseEntered (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseEntered
+ _PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseEntered (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseExited() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseExited event
+ OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseExited (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseExited
+ _PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseExited (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseMoved() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseMoved event
+ OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseMoved (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseMoved
+ _PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseMoved (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMousePressed() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMousePressed event
+ OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMousePressed (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnMousePressed
+ _PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
+End Property &apos; SFDialogs.SF_DialogControl.OnMousePressed (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnMouseReleased() As Variant
+&apos;&apos;&apos; Get the script associated with the OnMouseReleased event
+ OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseReleased (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseReleased
+ _PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseReleased (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnNodeExpanded() As Variant
+&apos;&apos;&apos; Get the script associated with the OnNodeExpanded event
+ OnNodeExpanded = _PropertyGet(&quot;OnNodeExpanded&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnNodeExpanded (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnNodeExpanded(Optional ByVal pvOnNodeExpanded As Variant)
+&apos;&apos;&apos; Set the updatable property OnNodeExpanded
+ _PropertySet(&quot;OnNodeExpanded&quot;, pvOnNodeExpanded)
+End Property &apos; SFDialogs.SF_DialogControl.OnNodeExpanded (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnNodeSelected() As Variant
+&apos;&apos;&apos; Get the script associated with the OnNodeSelected event
+ OnNodeSelected = _PropertyGet(&quot;OnNodeSelected&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnNodeSelected (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnNodeSelected(Optional ByVal pvOnNodeSelected As Variant)
+&apos;&apos;&apos; Set the updatable property OnNodeSelected
+ _PropertySet(&quot;OnNodeSelected&quot;, pvOnNodeSelected)
+End Property &apos; SFDialogs.SF_DialogControl.OnNodeSelected (let)
+
+REM -----------------------------------------------------------------------------
+Property Get OnTextChanged() As Variant
+&apos;&apos;&apos; Get the script associated with the OnTextChanged event
+ OnTextChanged = _PropertyGet(&quot;OnTextChanged&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.OnTextChanged (get)
+
+REM -----------------------------------------------------------------------------
+Property Let OnTextChanged(Optional ByVal pvTextChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnTextChanged
+ _PropertySet(&quot;OnTextChanged&quot;, pvTextChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnTextChanged (let)
+
+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 RootNode() As Variant
+&apos;&apos;&apos; The RootNode property returns the last root node of a tree control
+ RootNode = _PropertyGet(&quot;RootNode&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.RootNode (get)
+
+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 TabIndex() As Variant
+&apos;&apos;&apos; The TabIndex property specifies a control&apos;s place in the tab order in the dialog
+&apos;&apos;&apos; Zero or negative means no tab set in the control
+ TabIndex = _PropertyGet(&quot;TabIndex&quot;, -1)
+End Property &apos; SFDialogs.SF_DialogControl.TabIndex (get)
+
+REM -----------------------------------------------------------------------------
+Property Let TabIndex(Optional ByVal pvTabIndex As Variant)
+&apos;&apos;&apos; Set the updatable property TabIndex
+ _PropertySet(&quot;TabIndex&quot;, pvTabIndex)
+End Property &apos; SFDialogs.SF_DialogControl.TabIndex (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 URL() As Variant
+&apos;&apos;&apos; The URL property refers to the URL to open when the control is clicked
+ URL = _PropertyGet(&quot;URL&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.URL (get)
+
+REM -----------------------------------------------------------------------------
+Property Let URL(Optional ByVal pvURL As Variant)
+&apos;&apos;&apos; Set the updatable property URL
+ _PropertySet(&quot;URL&quot;, pvURL)
+End Property &apos; SFDialogs.SF_DialogControl.URL (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 Width() As Variant
+&apos;&apos;&apos; The Width property refers to the Width of the control
+ Width = _PropertyGet(&quot;Width&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.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_DialogControl.Width (let)
+
+REM -----------------------------------------------------------------------------
+Property Get X() As Variant
+&apos;&apos;&apos; The X property refers to the X coordinate of the top-left corner of the control
+ X = _PropertyGet(&quot;X&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.X (get)
+
+REM -----------------------------------------------------------------------------
+Property Let X(Optional ByVal pvX As Variant)
+&apos;&apos;&apos; Set the updatable property X
+ _PropertySet(&quot;X&quot;, pvX)
+End Property &apos; SFDialogs.SF_DialogControl.X (let)
+
+REM -----------------------------------------------------------------------------
+Property Get Y() As Variant
+&apos;&apos;&apos; The Y property refers to the Y coordinate of the top-left corner of the control
+ Y = _PropertyGet(&quot;Y&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.Y (get)
+
+REM -----------------------------------------------------------------------------
+Property Let Y(Optional ByVal pvY As Variant)
+&apos;&apos;&apos; Set the updatable property Y
+ _PropertySet(&quot;Y&quot;, pvY)
+End Property &apos; SFDialogs.SF_DialogControl.Y (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 -----------------------------------------------------------------------------
+Property Get XGridColumnModel() As Object
+&apos;&apos;&apos; The XGridColumnModel property returns the mutable data model UNO object of the tree control
+ XGridColumnModel = _PropertyGet(&quot;XGridColumnModel&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.XGridColumnModel (get)
+
+REM -----------------------------------------------------------------------------
+Property Get XGridDataModel() As Object
+&apos;&apos;&apos; The XGridDataModel property returns the mutable data model UNO object of the tree control
+ XGridDataModel = _PropertyGet(&quot;XGridDataModel&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.XGridDataModel (get)
+
+REM -----------------------------------------------------------------------------
+Property Get XTreeDataModel() As Object
+&apos;&apos;&apos; The XTreeDataModel property returns the mutable data model UNO object of the tree control
+ XTreeDataModel = _PropertyGet(&quot;XTreeDataModel&quot;, Nothing)
+End Property &apos; SFDialogs.SF_DialogControl.XTreeDataModel (get)
+
+REM ===================================================================== METHODS
+
+REM -----------------------------------------------------------------------------
+Public Function AddSubNode(Optional ByRef ParentNode As Variant _
+ , Optional ByVal DisplayValue As Variant _
+ , Optional ByRef DataValue As Variant _
+ ) As Variant
+&apos;&apos;&apos; Return a new node of the tree control subordinate to a parent node
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; ParentNode: A node UNO object, of type com.sun.star.awt.tree.XMutableTreeNode
+&apos;&apos;&apos; DisplayValue: the text appearing in the control box
+&apos;&apos;&apos; DataValue: any value associated with the new node. Default = Empty
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The new node UNO object: com.sun.star.awt.tree.XMutableTreeNode
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myTree As Object, myNode As Object, theRoot As Object
+&apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
+&apos;&apos;&apos; Set theRoot = myTree.CreateRoot(&quot;Tree top&quot;)
+&apos;&apos;&apos; Set myNode = myTree.AddSubNode(theRoot, &quot;A branch ...&quot;)
+
+Dim oNode As Object &apos; Return value
+Const cstThisSub = &quot;SFDialogs.DialogControl.AddSubNode&quot;
+Const cstSubArgs = &quot;ParentNode, DisplayValue, [DataValue=Empty]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ Set oNode = Nothing
+
+Check:
+ If IsMissing(DataValue) Then DataValue = Empty
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
+ If Not ScriptForge.SF_Utils._Validate(ParentNode, &quot;ParentNode&quot;, V_OBJECT) Then GoTo Catch
+ If ScriptForge.SF_Session.UnoObjectType(ParentNode) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo Catch
+ If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
+ End If
+
+Try:
+ With _TreeDataModel
+ Set oNode = .createNode(DisplayValue, True)
+ oNode.DataValue = DataValue
+ ParentNode.appendChild(oNode)
+ End With
+
+Finally:
+ Set AddSubNode = oNode
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;AddSubNode&quot;)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.AddSubNode
+
+REM -----------------------------------------------------------------------------
+Public Function AddSubTree(Optional ByRef ParentNode As Variant _
+ , Optional ByRef FlatTree As Variant _
+ , Optional ByVal WithDataValue As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Return True when a subtree, subordinate to a parent node, could be inserted successfully in a tree control
+&apos;&apos;&apos; If the parent node had already child nodes before calling this method, the child nodes are erased
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; ParentNode: A node UNO object, of type com.sun.star.awt.tree.XMutableTreeNode
+&apos;&apos;&apos; FlatTree: a 2D array sorted on the columns containing the DisplayValues
+&apos;&apos;&apos; Flat tree &gt;&gt;&gt;&gt; Resulting subtree
+&apos;&apos;&apos; A1 B1 C1 |__ A1
+&apos;&apos;&apos; A1 B1 C2 |__ B1
+&apos;&apos;&apos; A1 B2 C3 |__ C1
+&apos;&apos;&apos; A2 B3 C4 |__ C2
+&apos;&apos;&apos; A2 B3 C5 |__ B2
+&apos;&apos;&apos; A3 B4 C6 |__ C3
+&apos;&apos;&apos; |__ A2
+&apos;&apos;&apos; |__ B3
+&apos;&apos;&apos; |__ C4
+&apos;&apos;&apos; |__ C5
+&apos;&apos;&apos; |__ A3
+&apos;&apos;&apos; |__ B4
+&apos;&apos;&apos; |__ C6
+&apos;&apos;&apos; Typically, such an array can be issued by the GetRows method applied on the SFDatabases.Database service
+&apos;&apos;&apos; when an array item containing the text to be displayed is = &quot;&quot; or is empty/null,
+&apos;&apos;&apos; no new subnode is created and the remainder of the row is skipped
+&apos;&apos;&apos; When AddSubTree() is called from a Python script, FlatTree may be an array of arrays
+&apos;&apos;&apos; WithDataValue:
+&apos;&apos;&apos; When False (default), every column of FlatTree contains the text to be displayed in the tree control
+&apos;&apos;&apos; When True, the texts to be displayed (DisplayValue) are in columns 0, 2, 4, ...
+&apos;&apos;&apos; while the DataValues are in columns 1, 3, 5, ...
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myTree As Object, theRoot As Object, oDb As Object, vData As Variant
+&apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
+&apos;&apos;&apos; Set theRoot = myTree.CreateRoot(&quot;By product category&quot;)
+&apos;&apos;&apos; Set oDb = CreateScriptService(&quot;SFDatabases.Database&quot;, &quot;/home/.../mydatabase.odb&quot;)
+&apos;&apos;&apos; vData = oDb.GetRows(&quot;SELECT [Category].[Name], [Category].[ID], [Product].[Name], [Product].[ID] &quot; _
+&apos;&apos;&apos; &amp; &quot;FROM [Category], [Product] WHERE [Product].[CategoryID] = [Category].[ID] &quot; _
+&apos;&apos;&apos; &amp; &quot;ORDER BY [Category].[Name], [Product].[Name]&quot;)
+&apos;&apos;&apos; myTree.AddSubTree(theRoot, vData, WithDataValue := True)
+
+Dim bSubTree As Boolean &apos; Return value
+Dim oNode As Object &apos; com.sun.star.awt.tree.XMutableTreeNode
+Dim oNewNode As Object &apos; com.sun.star.awt.tree.XMutableTreeNode
+Dim lChildCount As Long &apos; Number of children nodes of a parent node
+Dim iStep As Integer &apos; 1 when WithDataValue = False, 2 otherwise
+Dim iDims As Integer &apos; Number of dimensions of FlatTree
+Dim lMin1 As Long &apos; Lower bound (rows)
+Dim lMin2 As Long &apos; Lower bounds (cols)
+Dim lMax1 As Long &apos; Upper bound (rows)
+Dim lMax2 As Long &apos; Upper bounds (cols)
+Dim vFlatItem As Variant &apos; A single FlatTree item: FlatTree(i, j)
+Dim vFlatItem2 As Variant &apos; A single FlatTree item
+Dim bChange As Boolean &apos; When True, the item in FlatTree is different from the item above
+Dim sValue As String &apos; Alias for display values
+Dim i As Long, j As Long
+Const cstThisSub = &quot;SFDialogs.DialogControl.AddSubTree&quot;
+Const cstSubArgs = &quot;ParentNode, FlatTree, [WithDataValue=False]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bSubTree = False
+
+Check:
+ If IsMissing(WithDataValue) Or IsEmpty(WithDataValue) Then WithDataValue = False
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
+ If Not ScriptForge.SF_Utils._Validate(ParentNode, &quot;ParentNode&quot;, V_OBJECT) Then GoTo Catch
+ If ScriptForge.SF_Session.UnoObjectType(ParentNode) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo Catch
+ If Not ScriptForge.SF_Utils._ValidateArray(FlatTree, &quot;FlatTree&quot;) Then GoTo Catch &apos; Dimensions checked below
+ If Not ScriptForge.SF_Utils._Validate(WithDataValue, &quot;WithDataValue&quot;, V_BOOLEAN) Then GoTo Catch
+ End If
+
+Try:
+ With _TreeDataModel
+ &apos; Clean subtree
+ lChildCount = ParentNode.getChildCount()
+ For i = 1 To lChildCount
+ ParentNode.removeChildByIndex(0) &apos; This cleans all subtrees too
+ Next i
+
+ &apos; Determine bounds
+ iDims = ScriptForge.SF_Array.CountDims(FlatTree)
+ Select Case iDims
+ Case -1, 0 : GoTo Catch
+ Case 1 &apos; Called probably from Python
+ lMin1 = LBound(FlatTree, 1) : lMax1 = UBound(FlatTree, 1)
+ If Not IsArray(FlatTree(0)) Then GoTo Catch
+ If UBound(FlatTree(0)) &lt; LBound(FlatTree(0)) Then GoTo Catch &apos; No columns
+ lMin2 = LBound(FlatTree(0)) : lMax2 = UBound(FlatTree(0))
+ Case 2
+ lMin1 = LBound(FlatTree, 1) : lMax1 = UBound(FlatTree, 1)
+ lMin2 = LBound(FlatTree, 2) : lMax2 = UBound(FlatTree, 2)
+ Case Else : GoTo Catch
+ End Select
+
+ &apos; Build a new subtree
+ iStep = Iif(WithDataValue, 2, 1)
+ For i = lMin1 To lMax1
+ bChange = ( i = 0 )
+ &apos; Restart from the parent node at each i-iteration
+ Set oNode = ParentNode
+ For j = lMin2 To lMax2 Step iStep &apos; Array columns
+ If iDims = 1 Then vFlatItem = FlatTree(i)(j) Else vFlatItem = FlatTree(i, j)
+ If vFlatItem = &quot;&quot; Or IsNull(vFlatItem) Or IsEmpty(vFlatItem) Then
+ Set oNode = Nothing
+ Exit For &apos; Exit j-loop
+ End If
+ If Not bChange Then
+ If iDims = 1 Then vFlatItem2 = FlatTree(i - 1)(j) Else vFlatItem2 = FlatTree(i - 1, j)
+ bChange = ( vFlatItem &lt;&gt; vFlatItem2 )
+ End If
+ If bChange Then &apos; Create new subnode at tree depth = j
+ If VarType(vFlatItem) = V_STRING Then sValue = vFlatItem Else sValue = ScriptForge.SF_String.Represent(vFlatItem)
+ Set oNewNode = .createNode(sValue, True)
+ If WithDataValue Then
+ If iDims = 1 Then vFlatItem2 = FlatTree(i)(j + 1) Else vFlatItem2 = FlatTree(i, j + 1)
+ oNewNode.DataValue = vFlatItem2
+ End If
+ oNode.appendChild(oNewNode)
+ Set oNode = oNewNode
+ Else
+ &apos; Position next current node on last child of actual current node
+ lChildCount = oNode.getChildCount()
+ If lChildCount &gt; 0 Then Set oNode = oNode.getChildAt(lChildCount - 1) Else Set oNode = Nothing
+ End If
+ Next j
+ Next i
+ bSubTree = True
+ End With
+
+Finally:
+ AddSubTree = bSubTree
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;AddSubTree&quot;)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.AddSubTree
+
+REM -----------------------------------------------------------------------------
+Public Function CreateRoot(Optional ByVal DisplayValue As Variant _
+ , Optional ByRef DataValue As Variant _
+ ) As Variant
+&apos;&apos;&apos; Return a new root node of the tree control. The new tree root is inserted below pre-existing root nodes
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; DisplayValue: the text appearing in the control box
+&apos;&apos;&apos; DataValue: any value associated with the root node. Default = Empty
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The new root node as a UNO object of type com.sun.star.awt.tree.XMutableTreeNode
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myTree As Object, myNode As Object
+&apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
+&apos;&apos;&apos; Set myNode = myTree.CreateRoot(&quot;Tree starts here ...&quot;)
+
+Dim oRoot As Object &apos; Return value
+Const cstThisSub = &quot;SFDialogs.DialogControl.CreateRoot&quot;
+Const cstSubArgs = &quot;DisplayValue, [DataValue=Empty]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ Set oRoot = Nothing
+
+Check:
+ If IsMissing(DataValue) Then DataValue = Empty
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
+ If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
+ End If
+
+Try:
+ With _TreeDataModel
+ Set oRoot = .createNode(DisplayValue, True)
+ oRoot.DataValue = DataValue
+ .setRoot(oRoot)
+ &apos; To be visible, a root must have contained at least 1 child. Create a fictive one and erase it.
+ &apos; This behaviour does not seem related to the RootDisplayed property ??
+ oRoot.appendChild(.createNode(&quot;Something&quot;, False))
+ oRoot.removeChildByIndex(0)
+ End With
+
+Finally:
+ Set CreateRoot = oRoot
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;CreateRoot&quot;)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.CreateRoot
+
+REM -----------------------------------------------------------------------------
+Public Function FindNode(Optional ByVal DisplayValue As String _
+ , Optional ByRef DataValue As Variant _
+ , Optional ByVal CaseSensitive As Boolean _
+ ) As Object
+&apos;&apos;&apos; Traverses the tree and find recursively, starting from the root, a node meeting some criteria
+&apos;&apos;&apos; Either (1 match is enough):
+&apos;&apos;&apos; having its DisplayValue like DisplayValue
+&apos;&apos;&apos; having its DataValue = DataValue
+&apos;&apos;&apos; Comparisons may be or not case-sensitive
+&apos;&apos;&apos; The first matching occurrence is returned
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; DisplayValue: the pattern to be matched
+&apos;&apos;&apos; DataValue: a string, a numeric value or a date or Empty (if not applicable)
+&apos;&apos;&apos; CaseSensitive: applicable on both criteria. Default = False
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The found node of type com.sun.star.awt.tree.XMutableTreeNode or Nothing if not found
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myTree As Object, myNode As Object
+&apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
+&apos;&apos;&apos; Set myNode = myTree.FindNode(&quot;*Sophie*&quot;, CaseSensitive := True)
+
+
+Dim oNode As Object &apos; Return value
+Const cstThisSub = &quot;SFDialogs.DialogControl.FindNode&quot;
+Const cstSubArgs = &quot;[DisplayValue=&quot;&quot;&quot;&quot;], [DataValue=Empty], [CaseSensitive=False]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ Set oNode = Nothing
+
+Check:
+ If IsMissing(DisplayValue) Or IsEmpty(DisplayValue) Then DisplayValue = &quot;&quot;
+ If IsMissing(DataValue) Then DataValue = Empty
+ If IsMissing(CaseSensitive) Or IsEmpty(CaseSensitive) Then CaseSensitive = False
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
+ If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
+ If Not ScriptForge.SF_Utils._Validate(CaseSensitive, &quot;CaseSensitive&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
+ End If
+
+Try:
+ Set oNode = _FindNode(_TreeDataModel.getRoot(), DisplayValue, DataValue, CaseSensitive)
+
+Finally:
+ Set FindNode = oNode
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;FindNode&quot;)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.FindNode
+
+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;AddSubNode&quot; _
+ , &quot;AddSubTree&quot; _
+ , &quot;CreateRoot&quot; _
+ , &quot;FindNode&quot; _
+ , &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;Border&quot; _
+ , &quot;Cancel&quot; _
+ , &quot;Caption&quot; _
+ , &quot;ControlType&quot; _
+ , &quot;CurrentNode&quot; _
+ , &quot;Default&quot; _
+ , &quot;Enabled&quot; _
+ , &quot;Format&quot; _
+ , &quot;Height&quot; _
+ , &quot;ListCount&quot; _
+ , &quot;ListIndex&quot; _
+ , &quot;Locked&quot; _
+ , &quot;MultiSelect&quot; _
+ , &quot;Name&quot; _
+ , &quot;OnActionPerformed&quot; _
+ , &quot;OnAdjustmentValueChanged&quot; _
+ , &quot;OnFocusGained&quot; _
+ , &quot;OnFocusLost&quot; _
+ , &quot;OnItemStateChanged&quot; _
+ , &quot;OnKeyPressed&quot; _
+ , &quot;OnKeyReleased&quot; _
+ , &quot;OnMouseDragged&quot; _
+ , &quot;OnMouseEntered&quot; _
+ , &quot;OnMouseExited&quot; _
+ , &quot;OnMouseMoved&quot; _
+ , &quot;OnMousePressed&quot; _
+ , &quot;OnMouseReleased&quot; _
+ , &quot;OnNodeExpanded&quot; _
+ , &quot;OnNodeSelected&quot; _
+ , &quot;OnTextChanged&quot; _
+ , &quot;Page&quot; _
+ , &quot;Parent&quot; _
+ , &quot;Picture&quot; _
+ , &quot;RootNode&quot; _
+ , &quot;RowSource&quot; _
+ , &quot;TabIndex&quot; _
+ , &quot;Text&quot; _
+ , &quot;TipText&quot; _
+ , &quot;TripleState&quot; _
+ , &quot;URL&quot; _
+ , &quot;Value&quot; _
+ , &quot;Visible&quot; _
+ , &quot;Width&quot; _
+ , &quot;X&quot; _
+ , &quot;XControlModel&quot; _
+ , &quot;XControlView&quot; _
+ , &quot;XGridColumnModel&quot; _
+ , &quot;XGridDataModel&quot; _
+ , &quot;XTreeDataModel&quot; _
+ , &quot;Y&quot; _
+ )
+
+End Function &apos; SFDialogs.SF_DialogControl.Properties
+
+REM -----------------------------------------------------------------------------
+Public Function Resize(Optional ByVal Left As Variant _
+ , Optional ByVal Top As Variant _
+ , Optional ByVal Width As Variant _
+ , Optional ByVal Height As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Move the top-left corner of the control to new coordinates and/or modify its dimensions
+&apos;&apos;&apos; Without arguments, the method resets the initial dimensions and position
+&apos;&apos;&apos; Attributes denoting the position and size of a control are expressed in &quot;Map AppFont&quot; units.
+&apos;&apos;&apos; Map AppFont units are device and resolution independent.
+&apos;&apos;&apos; One Map AppFont unit is equal to one eighth of the average character (Systemfont) height and one quarter of the average character width.
+&apos;&apos;&apos; The dialog editor (= the Basic IDE) also uses Map AppFont units.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Left : the horizontal distance from the top-left corner. It may be negative.
+&apos;&apos;&apos; Top : the vertical distance from the top-left corner. It may be negative.
+&apos;&apos;&apos; Width : the horizontal width of the rectangle containing the Dialog. It must be positive.
+&apos;&apos;&apos; Height : the vertical height of the rectangle containing the Dialog. It must be positive.
+&apos;&apos;&apos; Missing arguments are left unchanged.
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; myControl.Resize(100, 200, Height := 600) &apos; Width is not changed
+
+Try:
+ Resize = SF_DialogUtils._Resize([Me], Left, Top, Width, Height)
+
+End Function &apos; SFDialogss.SF_Dialog.Resize
+
+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 SetTableData(Optional ByRef DataArray As Variant _
+ , Optional ByRef Widths As Variant _
+ , Optional ByRef Alignments As Variant _
+ , Optional ByVal RowHeaderWidth As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Fill a table control with the given data. Preexisting data is erased
+&apos;&apos;&apos; The Basic IDE allows to define if the control has a row and/or a column header
+&apos;&apos;&apos; When it is the case, the array in argument should contain those headers resp. in the first
+&apos;&apos;&apos; column and/or in the first row
+&apos;&apos;&apos; A column in the control shall be sortable when the data (headers excluded) in that column
+&apos;&apos;&apos; is homogeneously filled either with numbers or with strings
+&apos;&apos;&apos; Columns containing strings will be left-aligned, those with numbers will be right-aligned
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; DataArray: the set of data to display in the table control, including optional column/row headers
+&apos;&apos;&apos; Is a 2D array in Basic, is a tuple of tuples when called from Python
+&apos;&apos;&apos; Widths: the column&apos;s relative widths as a 1D array, each element corresponding with one data column
+&apos;&apos;&apos; If the array is shorter than the number of columns, the last value is kept for the next columns.
+&apos;&apos;&apos; Example:
+&apos;&apos;&apos; Widths := Array(1, 2)
+&apos;&apos;&apos; means that the first column is half as wide as all the other columns
+&apos;&apos;&apos; When the argument is absent, the columns are evenly spread over the available space in the control
+&apos;&apos;&apos; Alignments: the column&apos;s horizontal alignment as a string with length = number of columns.
+&apos;&apos;&apos; Possible characters are:
+&apos;&apos;&apos; L(EFT), C(ENTER), R(IGHT) or space (default behaviour)
+&apos;&apos;&apos; RowGeaderWidth: width of the row header column expressed in AppFont units. Default = 10.
+&apos;&apos;&apos; The argument is ignored when the TableControl has no row header.
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+&apos;&apos;&apos; Examples:
+&apos;&apos;&apos; Dim myTable As Object, bSet As Boolean, vData As Variant
+&apos;&apos;&apos; Set myTable = myDialog.Controls(&quot;myTableControl&quot;) &apos; This control has only column headers
+&apos;&apos;&apos; vData = Array(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;)
+&apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(1, 2, 3))
+&apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(4, 5, 6))
+&apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(7, 8, 9))
+&apos;&apos;&apos; bSet = myTable.SetTableData(vData, Alignments := &quot; C &quot;)
+
+Dim bData As Boolean &apos; Return value
+Dim iDims As Integer &apos; Number of dimensions of DataArray
+Dim lMin1 As Long &apos; LBound1 of input array
+Dim lMax1 As Long &apos; UBound1 of input array
+Dim lMin2 As Long &apos; LBound2 of input array
+Dim lMax2 As Long &apos; UBound2 of input array
+Dim lControlWidth As Long &apos; Width of the table control
+Dim lMinW As Long &apos; lBound of Widths
+Dim lMaxW As Long &apos; UBound of vWidths
+Dim lMinRow As Long &apos; Row index of effective data subarray
+Dim lMinCol As Long &apos; Column index of effective data subarray
+Dim vRowHeaders As Variant &apos; Array of row headers
+Dim sRowHeader As String &apos; A single row header
+Dim vColHeaders As Variant &apos; Array of column headers
+Dim oColumn As Object &apos; com.sun.star.awt.grid.XGridColumn
+Dim dWidth As Double &apos; A single item of Widths
+Dim dRelativeWidth As Double &apos; Sum of Widths up to the number of columns
+Dim dWidthFactor As Double &apos; Factor to apply to relative widths to get absolute column widths
+Dim lHeaderWidth As Long &apos; Row header width when row header present, otherwise = 0
+Dim lAverageWidth As Long &apos; Width to apply when columns spread evenly across table
+Dim vDataRow As Variant &apos; A single row content in the tablecontrol
+Dim vDataItem As Variant &apos; A single DataArray item
+Dim sAlign As String &apos; Column&apos;s horizontal alignments (single chars: L, C, R, space)
+Dim lAlign As Long &apos; com.sun.star.style.HorizontalAlignment.XXX
+Dim i As Long, j As Long, k As Long
+
+Const cstThisSub = &quot;SFDialogs.DialogControl.SetTableData&quot;
+Const cstSubArgs = &quot;DataArray, [Widths=Array(1)], [Alignments=&quot;&quot;&quot;&quot;], [RowHeaderWidth=10]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bData = False
+
+Check:
+ If IsMissing(Widths) Or IsEmpty(Widths) Then Widths = Array()
+ If IsMissing(Alignments) Or IsEmpty(Alignments) Then Alignments = &quot;&quot;
+ If IsMissing(RowHeaderWidth) Or IsEmpty(RowHeaderWidth) Then RowHeaderWidth = 10
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If _ControlType &lt;&gt; CTLTABLECONTROL Then GoTo CatchType
+ If Not ScriptForge.SF_Utils._ValidateArray(DataArray, &quot;DataArray&quot;) Then GoTo Catch &apos; Dimensions are checked below
+ If Not ScriptForge.SF_Utils._ValidateArray(Widths, &quot;Widths&quot;, 1, ScriptForge.V_NUMERIC, True) Then GoTo Catch
+ If Not ScriptForge.SF_Utils._Validate(Alignments, &quot;Alignments&quot;, V_STRING) Then GoTo Catch
+ If Not ScriptForge.SF_Utils._Validate(RowHeaderWidth, &quot;RowHeaderWidth&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ End If
+
+Try:
+ &apos; Erase any pre-existing data and columns
+ _GridDataModel.removeAllRows()
+ For i = _GridColumnModel.ColumnCount - 1 To 0 Step -1
+ _GridColumnModel.removeColumn(i)
+ Next i
+
+ &apos; LBounds, UBounds - Basic or Python
+ iDims = ScriptForge.SF_Array.CountDims(DataArray)
+ Select Case iDims
+ Case -1, 0 : GoTo Catch
+ Case 1 &apos; Called probably from Python
+ lMin1 = LBound(DataArray, 1) : lMax1 = UBound(DataArray, 1)
+ If Not IsArray(DataArray(0)) Then GoTo Catch
+ If UBound(DataArray(0)) &lt; LBound(DataArray(0)) Then GoTo Catch &apos; No columns
+ lMin2 = LBound(DataArray(0)) : lMax2 = UBound(DataArray(0))
+ Case 2
+ lMin1 = LBound(DataArray, 1) : lMax1 = UBound(DataArray, 1)
+ lMin2 = LBound(DataArray, 2) : lMax2 = UBound(DataArray, 2)
+ Case Else : GoTo Catch
+ End Select
+
+ &apos; Extract headers from data array
+ lMinW = LBound(Widths) : lMaxW = UBound(Widths)
+ With _ControlModel
+ If .ShowColumnHeader Then
+ lMinRow = lMin1 + 1
+ If iDims = 1 Then
+ vColHeaders = DataArray(lMin1)
+ Else
+ vColHeaders = ScriptForge.SF_Array.ExtractRow(DataArray, lMin1)
+ End If
+ Else
+ lMinRow = lMin1
+ vColHeaders = Array()
+ End If
+ If .ShowRowHeader Then
+ lMinCol = lMin2 + 1
+ If iDims = 1 Then
+ vRowHeaders = Array()
+ ReDim vRowHeaders(lMin1 To lMax1)
+ For i = lMin1 To lMax1
+ vRowHeaders(i) = DataArray(i)(lMin2)
+ Next i
+ Else
+ vRowHeaders = ScriptForge.SF_Array.ExtractColumn(DataArray, lMin2)
+ End If
+ Else
+ lMinCol = lMin2
+ vRowHeaders = Array()
+ End If
+ End With
+
+ &apos; Create the columns
+ For j = lMinCol To lMax2
+ Set oColumn = _GridColumnModel.createColumn()
+ If _ControlModel.ShowColumnHeader Then oColumn.Title = vColHeaders(j)
+ _GridColumnModel.addColumn(oColumn)
+ Next j
+
+ &apos; Manage row headers width
+ If _ControlModel.ShowRowHeader Then
+ lHeaderWidth = RowHeaderWidth
+ _ControlModel.RowHeaderWidth = lHeaderWidth
+ Else
+ lHeaderWidth = 0
+ End If
+
+ &apos; Size the columns. Column sizing cannot be done before all the columns are added
+ If lMaxW &gt;= lMinW Then &apos; There must be at least 1 width given as argument
+ &apos; Size the columns proportionally with their relative widths
+ dRelativeWidth = 0.0
+ i = lMinW - 1
+ &apos; Compute the sum of the relative widths
+ For j = 0 To lMax2 - lMinCol
+ i = i + 1
+ If i &gt;= lMinW And i &lt;= lMaxW Then dRelativeWidth = dRelativeWidth + Widths(i) Else dRelativeWidth = dRelativeWidth + Widths(lMaxW)
+ Next j
+
+ &apos; Set absolute column widths
+ If dRelativeWidth &gt; 0.0 Then dWidthFactor = CDbl(_ControlModel.Width - lHeaderWidth) / dRelativeWidth Else dWidthFactor = 1.0
+ i = lMinW - 1
+ For j = 0 To lMax2 - lMinCol
+ i = i + 1
+ If i &gt;= lMinW And i &lt;= lMaxW Then dWidth = CDbl(Widths(i)) Else dWidth = CDbl(Widths(lMaxW))
+ _GridColumnModel.Columns(j).ColumnWidth = CLng(dWidthFactor * dWidth)
+ Next j
+ Else
+ &apos; Size header and columns evenly
+ lAverageWidth = (_ControlModel.Width - lHeaderWidth) / (lMax2 - lMin2 + 1)
+ For j = 0 To lMax2 - lMinCol
+ _GridColumnModel.Columns(j).ColumnWidth = lAverageWidth
+ Next j
+ End If
+
+ &apos; Initialize the column alignment
+ If Len(Alignments) &gt;= lMax2 - lMinCol + 1 Then sAlign = Alignments Else sAlign = Alignments &amp; Space(lMax2 - lMinCol + 1 - Len(Alignments))
+
+ &apos; Feed the table with data and define/confirm the column alignment
+ vDataRow = Array()
+ For i = lMinRow To lMax1
+ ReDim vDataRow(0 To lMax2 - lMinCol)
+ For j = lMinCol To lMax2
+ If iDims = 1 Then vDataItem = DataArray(i)(j) Else vDataItem = DataArray(i, j)
+ If VarType(vDataItem) = V_STRING Then
+ ElseIf ScriptForge.SF_Utils._VarTypeExt(vDataItem) = ScriptForge.V_NUMERIC Then
+ Else
+ vDataItem = ScriptForge.SF_String.Represent(vDataItem)
+ End If
+ vDataRow(j - lMinCol) = vDataItem
+ &apos; Store alignment while processing the first row of the array
+ If i = lMinRow Then
+ k = j - lMinCol + 1
+ If Mid(sAlign, k, 1) = &quot; &quot; Then Mid(sAlign, k, 1) = Iif(VarType(vDataItem) = V_STRING, &quot;L&quot;, &quot;R&quot;)
+ End If
+ Next j
+ If _ControlModel.ShowRowHeader Then sRowHeader = vRowHeaders(i) Else sRowHeader = &quot;&quot;
+ _GridDataModel.addRow(sRowHeader, vDataRow)
+ Next i
+
+ &apos; Determine alignments of each column
+ For j = 0 To lMax2 - lMinCol
+ Select Case Mid(sAlign, j + 1, 1)
+ Case &quot;L&quot;, &quot; &quot; : lAlign = com.sun.star.style.HorizontalAlignment.LEFT
+ Case &quot;R&quot; : lAlign = com.sun.star.style.HorizontalAlignment.RIGHT
+ Case &quot;C&quot; : lAlign = com.sun.star.style.HorizontalAlignment.CENTER
+ Case Else
+ End Select
+ _GridColumnModel.Columns(j).HorizontalAlign = lAlign
+ Next j
+
+ bData = True
+
+Finally:
+ SetTableData = bData
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+CatchType:
+ ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;SetTableData&quot;)
+ GoTo Finally
+End Function &apos; SFDialogs.SF_DialogControl.SetTableData
+
+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 _FindNode(ByRef poNode As Object _
+ , ByVal psDisplayValue As String _
+ , ByRef pvDataValue As Variant _
+ , ByVal pbCaseSensitive As Boolean _
+ ) As Object
+&apos;&apos;&apos; Traverses the tree and find recursively, starting from the root, a node meeting some criteria
+&apos;&apos;&apos; Either (1 match is enough):
+&apos;&apos;&apos; having its DisplayValue like psDisplayValue
+&apos;&apos;&apos; having its DataValue = pvDataValue
+&apos;&apos;&apos; Comparisons may be or not case-sensitive
+&apos;&apos;&apos; The first matching occurrence is returned
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poNode: the current node, the root at 1st call
+&apos;&apos;&apos; psDisplayValue: the pattern to be matched
+&apos;&apos;&apos; pvDataValue: a string, a numeric value or a date or Empty (if not applicable)
+&apos;&apos;&apos; pbCaseSensitive: applicable on both criteria
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The found node of type com.sun.star.awt.tree.XMutableTreeNode
+
+Dim oChild As Object &apos; Child node com.sun.star.awt.tree.XMutableTreeNode
+Dim oFind As Object &apos; Found node com.sun.star.awt.tree.XMutableTreeNode
+Dim lChildCount As Long &apos; Number of children of a node
+Dim bFound As Boolean &apos; True when node found
+Dim i As Long
+
+ Set _FindNode = Nothing
+ On Local Error GoTo Finally &apos; Better not found than raise an error
+
+Check:
+ &apos; Does the actual node match the criteria ?
+ bFound = False
+ If Len(psDisplayValue) &gt; 0 Then
+ bFound = ScriptForge.SF_String.IsLike(poNode.DisplayValue, psDisplayValue, pbCaseSensitive)
+ End If
+ If Not bFound And Not IsEmpty(poNode.DataValue) Then
+ If Not IsEmpty(pvdataValue) Then bFound = ( ScriptForge.SF_Array._ValCompare(poNode.DataValue, pvDataB-Value, pbCaseSensitive) = 0 )
+ End If
+ If bFound Then
+ Set _FindNode = poNode
+ Exit Function
+ End If
+
+Try:
+ &apos; Explore sub-branches
+ lChildCount = poNode.getChildCount
+ If lChildCount &gt; 0 Then
+ For i = 0 To lChildCount - 1
+ Set oChild = poNode.getChildAt(i)
+ Set oFind = _FindNode(oChild, psDisplayValue, pvDataValue, pbCaseSensitive) &apos; Recursive call
+ If Not IsNull(oFind) Then
+ Set _FindNode = oFind
+ Exit For
+ End If
+ Next i
+ End If
+
+Finally:
+ Exit Function
+End Function &apos; SFDialogs.SF_DialogControl._FindNode
+
+REM -----------------------------------------------------------------------------
+Public Function _GetEventName(ByVal psProperty As String) As String
+&apos;&apos;&apos; Return the LO internal event name derived from the SF property name
+&apos;&apos;&apos; The SF property name is not case sensitive, while the LO name is case-sensitive
+&apos; Corrects the typo on ErrorOccur(r?)ed, if necessary
+
+Dim vProperties As Variant &apos; Array of class properties
+Dim sProperty As String &apos; Correctly cased property name
+
+ vProperties = Properties()
+ sProperty = vProperties(ScriptForge.SF_Array.IndexOf(vProperties, psProperty, SortOrder := &quot;ASC&quot;))
+
+ _GetEventName = LCase(Mid(sProperty, 3, 1)) &amp; Right(sProperty, Len(sProperty) - 3)
+
+End Function &apos; SFDialogs.SF_DialogControl._GetEventName
+
+REM -----------------------------------------------------------------------------
+Private Function _GetListener(ByVal psEventName As String) As String
+&apos;&apos;&apos; Getting/Setting macros triggered by events requires a Listener-EventName pair
+&apos;&apos;&apos; Return the X...Listener corresponding with the event name in argument
+
+ Select Case UCase(psEventName)
+ Case UCase(&quot;OnActionPerformed&quot;)
+ _GetListener = &quot;XActionListener&quot;
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;)
+ _GetListener = &quot;XAdjustmentListener&quot;
+ Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
+ _GetListener = &quot;XFocusListener&quot;
+ Case UCase(&quot;OnItemStateChanged&quot;)
+ _GetListener = &quot;XItemListener&quot;
+ Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
+ _GetListener = &quot;XKeyListener&quot;
+ Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
+ _GetListener = &quot;XMouseMotionListener&quot;
+ Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ _GetListener = &quot;XMouseListener&quot;
+ Case UCase(&quot;OnTextChanged&quot;)
+ _GetListener = &quot;XTextListener&quot;
+ Case Else
+ _GetListener = &quot;&quot;
+ End Select
+
+End Function &apos; SFDialogs.SF_DialogControl._GetListener
+
+REM -----------------------------------------------------------------------------
+Public Sub _Initialize()
+&apos;&apos;&apos; Complete the object creation process:
+&apos;&apos;&apos; - Initialization of private members
+&apos;&apos;&apos; - Collection of specific attributes
+&apos;&apos;&apos; - synchronization with parent dialog instance
+
+Dim vServiceName As Variant &apos; Split 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;
+ _ControlType = &quot;&quot; &apos; Not supported
+ Case &quot;Edit&quot; : _ControlType = CTLTEXTFIELD
+ Case &quot;UnoControlFixedHyperlinkModel&quot;
+ _ControlType = CTLHYPERLINK
+ Case &quot;TreeControlModel&quot;
+ &apos; Initialize the data model
+ _ControlType = CTLTREECONTROL
+ Set _ControlModel.DataModel = CreateUnoService(&quot;com.sun.star.awt.tree.MutableTreeDataModel&quot;)
+ Set _TreeDataModel = _ControlModel.DataModel
+ Case &quot;UnoControlGridModel&quot;
+ _ControlType = CTLTABLECONTROL
+ Set _GridColumnModel = _ControlModel.ColumnModel
+ Set _GridDataModel = _ControlModel.GridDataModel
+ Case Else : _ControlType = sType
+ End Select
+
+ &apos; Store initial position and dimensions
+ With _ControlModel
+ _Left = .PositionX
+ _Top = .PositionY
+ _Width = .Width
+ _Height = .Height
+ End With
+
+ &apos; Store the SF_DialogControl object in the parent cache
+ Set _Parent._ControlCache(_IndexOfNames) = [Me]
+
+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 or Model.Selection
+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 oPosSize As Object &apos; com.sun.star.awt.Rectangle
+Dim oControlEvents As Object &apos; com.sun.star.container.XNameContainer
+Dim sEventName As String &apos; Internal event name
+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 UCase(psProperty)
+ Case UCase(&quot;Border&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFIXEDTEXT, CTLFORMATTEDFIELD _
+ , CTLHYPERLINK, CTLIMAGECONTROL, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD, CTLPROGRESSBAR _
+ , CTLSCROLLBAR , CTLTABLECONTROL, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ If oSession.HasUNOProperty(_ControlModel, &quot;Border&quot;) Then _PropertyGet = Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;)(_ControlModel.Border)
+ Case CTLCHECKBOX, CTLRADIOBUTTON
+ If oSession.HasUNOProperty(_ControlModel, &quot;VisualEffect&quot;) Then _PropertyGet = Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;)(_ControlModel.VisualEffect)
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 UCase(&quot;Caption&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLHYPERLINK, CTLRADIOBUTTON
+ If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _PropertyGet = _ControlModel.Label
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;ControlType&quot;)
+ _PropertyGet = _ControlType
+ Case UCase(&quot;CurrentNode&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ If oSession.HasUNOMethod(_ControlView, &quot;getSelection&quot;) Then
+ _PropertyGet = Empty
+ If _ControlModel.SelectionType &lt;&gt; com.sun.star.view.SelectionType.NONE Then
+ vSelection = _ControlView.getSelection()
+ If IsArray(vSelection) Then
+ If UBound(vSelection) &gt;= 0 Then Set _PropertyGet = vSelection(0)
+ Else
+ Set _PropertyGet = vSelection
+ End If
+ End If
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 UCase(&quot;Enabled&quot;)
+ If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _PropertyGet = _ControlModel.Enabled
+ Case UCase(&quot;Format&quot;)
+ Select Case _ControlType
+ Case CTLDATEFIELD
+ If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then _PropertyGet = SF_DialogUtils._FormatsList(_ControlType)(_ControlModel.DateFormat)
+ Case CTLTIMEFIELD
+ If oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then _PropertyGet = SF_DialogUtils._FormatsList(_ControlType)(_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 UCase(&quot;Height&quot;)
+ If [_parent]._Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, False).Height
+ Else
+ If oSession.HasUNOProperty(_ControlModel, &quot;Height&quot;) Then _PropertyGet = _ControlModel.Height
+ End If
+ Case UCase(&quot;ListCount&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLLISTBOX
+ If oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then _PropertyGet = UBound(_ControlModel.StringItemList) + 1
+ Case CTLTABLECONTROL &apos; Returns zero when no table data yet
+ If oSession.HasUNOProperty(_GridDataModel, &quot;RowCount&quot;) Then _PropertyGet = _GridDataModel.RowCount
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 CTLTABLECONTROL
+ _PropertyGet = -1 &apos; No row selected, no data, multiselection
+ If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
+ And oSession.HasUNOProperty(_ControlView, &quot;CurrentRow&quot;) Then
+ &apos; Other selection types (multi, range) not supported
+ If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE Then
+ lIndex = _ControlView.CurrentRow
+ If lIndex &lt; 0 And oSession.HasUNOProperty(_ControlView, &quot;SelectedRows&quot;) Then
+ If UBound(_ControlView.SelectedRows) &gt;= 0 Then lIndex = _ControlView.SelectedRows(0)
+ End If
+ _PropertyGet = lIndex
+ End If
+ End If
+ 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 oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _PropertyGet = _ControlModel.ReadOnly
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 UCase(&quot;Name&quot;)
+ _PropertyGet = _Name
+ Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
+ , UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnTextChanged&quot;)
+ Set oControlEvents = _ControlModel.getEvents()
+ sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; _GetEventName(psProperty)
+ If oControlEvents.hasByName(sEventName) Then
+ _PropertyGet = oControlEvents.getByName(sEventName).ScriptCode
+ Else
+ &apos; Check OnEvents set dynamically by code
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;) : _PropertyGet = _OnActionPerformed
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;) : _PropertyGet = _OnAdjustmentValueChanged
+ Case UCase(&quot;OnFocusGained&quot;) : _PropertyGet = _OnFocusGained
+ Case UCase(&quot;OnFocusLost&quot;) : _PropertyGet = _OnFocusLost
+ Case UCase(&quot;OnItemStateChanged&quot;) : _PropertyGet = _OnItemStateChanged
+ Case UCase(&quot;OnKeyPressed&quot;) : _PropertyGet = _OnKeyPressed
+ Case UCase(&quot;OnKeyReleased&quot;) : _PropertyGet = _OnKeyReleased
+ Case UCase(&quot;OnMouseDragged&quot;) : _PropertyGet = _OnMouseDragged
+ Case UCase(&quot;OnMouseEntered&quot;) : _PropertyGet = _OnMouseEntered
+ Case UCase(&quot;OnMouseExited&quot;) : _PropertyGet = _OnMouseExited
+ Case UCase(&quot;OnMouseMoved&quot;) : _PropertyGet = _OnMouseMoved
+ Case UCase(&quot;OnMousePressed&quot;) : _PropertyGet = _OnMousePressed
+ Case UCase(&quot;OnMouseReleased&quot;) : _PropertyGet = _OnMouseReleased
+ Case UCase(&quot;OnTextChanged&quot;) : _PropertyGet = _OnTextChanged
+ Case Else : _PropertyGet = &quot;&quot;
+ End Select
+ End If
+ Case UCase(&quot;OnNodeExpanded&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ _PropertyGet = _OnNodeExpanded
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;OnNodeSelected&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ _PropertyGet = _OnNodeSelected
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Page&quot;)
+ If oSession.HasUnoProperty(_ControlModel, &quot;Step&quot;) Then _PropertyGet = _ControlModel.Step
+ Case UCase(&quot;Parent&quot;)
+ Set _PropertyGet = [_Parent]
+ Case UCase(&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 UCase(&quot;RootNode&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ _PropertyGet = _TreeDataModel.getRoot()
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 UCase(&quot;TabIndex&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFIXEDTEXT _
+ , CTLFORMATTEDFIELD, CTLHYPERLINK, CTLIMAGECONTROL, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD _
+ , CTLRADIOBUTTON, CTLSCROLLBAR, CTLTABLECONTROL, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ If oSession.HasUnoProperty(_ControlModel, &quot;TabIndex&quot;) Then
+ If CBool(_ControlModel.TabStop) Or IsEmpty(_ControlModel.TabStop) Then _PropertyGet = _ControlModel.TabIndex Else _PropertyGet = -1
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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 UCase(&quot;TipText&quot;)
+ If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _PropertyGet = _ControlModel.HelpText
+ Case UCase(&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;URL&quot;
+ Select Case _ControlType
+ Case CTLHYPERLINK
+ If oSession.HasUnoProperty(_ControlModel, &quot;URL&quot;) Then _PropertyGet = _ControlModel.URL
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&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;) And _ControlMOdel.Toggle 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 CTLTABLECONTROL
+ vGet = Array() &apos; Default value when no row selected, no data, multiselection
+ If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
+ And oSession.HasUNOProperty(_ControlView, &quot;CurrentRow&quot;) Then
+ &apos; Other selection types (multi, range) not supported
+ If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE Then
+ lIndex = _ControlView.CurrentRow
+ If lIndex &lt; 0 And oSession.HasUNOProperty(_ControlView, &quot;SelectedRows&quot;) Then
+ If UBound(_ControlView.SelectedRows) &gt;= 0 Then lIndex = _ControlView.SelectedRows(0)
+ End If
+ If lIndex &gt;= 0 Then vGet = _GridDataModel.getRowData(lIndex)
+ End If
+ End If
+ 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 UCase(&quot;Visible&quot;)
+ If oSession.HasUnoMethod(_ControlView, &quot;isVisible&quot;) Then _PropertyGet = CBool(_ControlView.isVisible())
+ Case UCase(&quot;Width&quot;)
+ If [_parent]._Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, False).Width
+ Else
+ If oSession.HasUNOProperty(_ControlModel, &quot;Width&quot;) Then _PropertyGet = _ControlModel.Width
+ End If
+ Case UCase(&quot;X&quot;)
+ If [_parent]._Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, True).X
+ Else
+ If oSession.HasUNOProperty(_ControlModel, &quot;PositionX&quot;) Then _PropertyGet = _ControlModel.PositionX
+ End If
+ Case UCase(&quot;Y&quot;)
+ If [_parent]._Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
+ _PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, True).Y
+ Else
+ If oSession.HasUNOProperty(_ControlModel, &quot;PositionY&quot;) Then _PropertyGet = _ControlModel.PositionY
+ End If
+ Case UCase(&quot;XControlModel&quot;)
+ Set _PropertyGet = _ControlModel
+ Case UCase(&quot;XControlView&quot;)
+ Set _PropertyGet = _ControlView
+ Case UCase(&quot;XGridColumnModel&quot;)
+ Set _PropertyGet = _GridColumnModel
+ Case UCase(&quot;XGridDataModel&quot;)
+ Set _PropertyGet = _GridDataModel
+ Case UCase(&quot;XTreeDataModel&quot;)
+ Set _PropertyGet = _TreeDataModel
+ 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 vBorders As Variant &apos; Array of allowed Border values
+Dim vFormats As Variant &apos; Format property: output of _FormatsList()
+Dim iFormat As Integer &apos; Format property: index in vFormats
+Dim oNumberFormats As Object &apos; com.sun.star.util.XNumberFormats
+Dim lFormatKey As Long &apos; Format index for formatted fields
+Dim oLocale As Object &apos; com.sun.star.lang.Locale
+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 vCtlTypes As Variant &apos; Array of allowed control types
+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;Border&quot;)
+ Select Case _ControlType
+ Case CTLCHECKBOX, CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFIXEDTEXT, CTLFORMATTEDFIELD _
+ , CTLHYPERLINK, CTLIMAGECONTROL, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD, CTLPROGRESSBAR _
+ , CTLRADIOBUTTON, CTLSCROLLBAR , CTLTABLECONTROL, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ vBorders = Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Border&quot;, V_STRING, vBorders) Then GoTo Finally
+ vSet = ScriptForge.SF_Array.IndexOf(vBorders, pvValue)
+ If oSession.HasUNOProperty(_ControlModel, &quot;Border&quot;) Then
+ _ControlModel.Border = vSet
+ ElseIf oSession.HasUNOProperty(_ControlModel, &quot;VisualEffect&quot;) Then &apos; Checkbox case
+ _ControlModel.VisualEffect = vSet
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ 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, CTLHYPERLINK, 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;CurrentNode&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Selection&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+ If oSession.UnoObjectType(pvValue) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo CatchType
+ With _ControlView
+ .clearSelection()
+ If Not IsNull(pvValue) Then
+ .addSelection(pvValue)
+ &apos; Suspending temporarily the expansion listener avoids conflicts
+ If Len(_OnNodeExpanded) &gt; 0 Then _ControlView.removeTreeExpansionListener(_ExpandListener)
+ .makeNodeVisible(pvValue) &apos; Expand parent nodes and put node in the display area
+ If Len(_OnNodeExpanded) &gt; 0 Then _ControlView.addTreeExpansionListener(_ExpandListener)
+ End If
+ End With
+ 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 = SF_DialogUtils._FormatsList(_ControlType)
+ 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 CTLFORMATTEDFIELD &apos; The format may exist already or not yet
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Format&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUNOProperty(_ControlModel, &quot;FormatsSupplier&quot;) Then
+ If Not IsNull(_ControlModel.FormatsSupplier) Then
+ Set oLocale = ScriptForge.SF_Utils._GetUnoService(&quot;FormatLocale&quot;)
+ Set oNumberFormats = _ControlModel.FormatsSupplier.getNumberFormats()
+ lFormatKey = oNumberFormats.queryKey(pvValue, oLocale, True)
+ If lFormatKey &lt; 0 Then &apos; Format not found
+ _ControlModel.FormatKey = oNumberFormats.addNew(pvValue, oLocale)
+ Else
+ _ControlModel.FormatKey = lFormatKey
+ End If
+ End If
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;Height&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ bSet = Resize(Height := pvValue)
+ 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 CTLTABLECONTROL
+ If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
+ And oSession.HasUNOMethod(_ControlView, &quot;selectRow&quot;) Then
+ &apos; Other selection types (multi, range) not supported
+ If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE _
+ And pvValue &gt;= 0 And pvValue &lt;= _GridDataModel.RowCount - 1 Then
+ _ControlView.selectRow(pvValue)
+ End If
+ End If
+ 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;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
+ , UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnTextChanged&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Catch
+ &apos; Check control type for not universal event types
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnItemStateChanged&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLHYPERLINK, CTLLISTBOX, CTLRADIOBUTTON
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;)
+ If _ControlType &lt;&gt; CTLSCROLLBAR Then GoTo CatchType
+ Case UCase(&quot;OnTextChanged&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD _
+ , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ Case Else : GoTo CatchType
+ End Select
+ Case Else
+ End Select
+ bSet = SF_DialogListener._SetOnProperty([Me], psProperty, pvValue)
+ Case UCase(&quot;OnNodeExpanded&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
+ &apos; If the listener was already set, then stop it
+ If Len(_OnNodeExpanded) &gt; 0 Then
+ _ControlView.removeTreeExpansionListener(_ExpandListener)
+ Set _ExpandListener = Nothing
+ _OnNodeExpanded = &quot;&quot;
+ End If
+ &apos; Setup a new fresh listener
+ If Len(pvValue) &gt; 0 Then
+ Set _ExpandListener = CreateUnoListener(&quot;_SFEXP_&quot;, &quot;com.sun.star.awt.tree.XTreeExpansionListener&quot;)
+ _ControlView.addTreeExpansionListener(_ExpandListener)
+ _OnNodeExpanded = pvValue
+ End If
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;OnNodeSelected&quot;)
+ Select Case _ControlType
+ Case CTLTREECONTROL
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
+ &apos; If the listener was already set, then stop it
+ If Len(_OnNodeSelected) &gt; 0 Then
+ _ControlView.removeSelectionChangeListener(_SelectListener)
+ Set _SelectListener = Nothing
+ _OnNodeSelected = &quot;&quot;
+ End If
+ &apos; Setup a new fresh listener
+ If Len(pvValue) &gt; 0 Then
+ Set _SelectListener = CreateUnoListener(&quot;_SFSEL_&quot;, &quot;com.sun.star.view.XSelectionChangeListener&quot;)
+ _ControlView.addSelectionChangeListener(_SelectListener)
+ _OnNodeSelected = pvValue
+ 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;TabIndex&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFIXEDTEXT _
+ , CTLFORMATTEDFIELD, CTLHYPERLINK, CTLIMAGECONTROL, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD _
+ , CTLRADIOBUTTON, CTLSCROLLBAR, CTLTABLECONTROL, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TabIndex&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;TabIndex&quot;) Then
+ _ControlModel.TabStop = ( pvValue &gt; 0 )
+ _ControlModel.TabIndex = Iif(pvValue &gt; 0, pvValue, -1)
+ End If
+ 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 &quot;URL&quot;
+ Select Case _ControlType
+ Case CTLHYPERLINK
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;URL&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;URL&quot;) Then _ControlModel.URL = 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
+ If _ControlModel.Toggle Then _ControlModel.State = Iif(pvValue, 1, 0) Else _ControlModel.State = 2
+ 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
+ If oSession.HasUnoProperty(_ControlModel, &quot;EnableVisible&quot;) Then _ControlModel.EnableVisible = True
+ End If
+ _ControlView.setVisible(pvValue)
+ End If
+ Case UCase(&quot;Width&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ bSet = Resize(Width := pvValue)
+ Case &quot;X&quot;
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ bSet = Resize(Left := pvValue)
+ Case &quot;Y&quot;
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
+ bSet = Resize(Top := pvValue)
+ 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_DialogListener.xba b/wizards/source/sfdialogs/SF_DialogListener.xba
new file mode 100644
index 0000000000..54dc875452
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_DialogListener.xba
@@ -0,0 +1,633 @@
+<?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_DialogListener" 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_Listener
+&apos;&apos;&apos; ===========
+&apos;&apos;&apos; The current module is dedicated to the management of dialog control events, triggered by user actions,
+&apos;&apos;&apos; which are not defined with the Basic IDE
+&apos;&apos;&apos;
+&apos;&apos;&apos; Concerned events:
+&apos;&apos;&apos; TreeControl control type, prefix = _SFEXP_
+&apos;&apos;&apos; -----------
+&apos;&apos;&apos; The OnNodeSelected event, triggered when a user selects a node
+&apos;&apos;&apos; A typical action is to display additional info about the selected item elsewhere in the dialog
+&apos;&apos;&apos; The OnNodeExpanded event, triggered when a user clicks on the expansion symbol
+&apos;&apos;&apos; A typical action is to create dynamically a subnode or a subtree below the expanded item
+&apos;&apos;&apos;
+&apos;&apos;&apos; PageManager facility, prefix = _SFTAB_
+&apos;&apos;&apos; -----------
+&apos;&apos;&apos; Depending on the piloting control(s), next event types are implemented
+&apos;&apos;&apos; XActionListener: for buttons
+&apos;&apos;&apos; XItemListener: for listboxes, comboboxes and radio buttons
+&apos;&apos;&apos;
+&apos;&apos;&apos; The described events are processed thru UNO listeners
+&apos;&apos;&apos;
+&apos;&apos;&apos; &quot;On&quot; events defined by code, prefix = _SFFOCUS_, _SFKEY_, _SFMOUSE_, _SFMOVE_, _SFITEM_, _SFADJUST_, _SFTEXT_
+&apos;&apos;&apos; -----------
+&apos;&apos;&apos; All event types applicable on dialogs and control types &lt;&gt; TreeControl
+&apos;&apos;&apos; The events MUST NOT be preset in the Basic IDE
+&apos;&apos;&apos;
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&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
+
+REM ================================================================== EXCEPTIONS
+
+REM ================================================ PUBLIC METHODS (TREECONTROL)
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFEXP_requestChildNodes(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnNodeExpanded event of a tree control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.view.XTreeExpansionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+Dim oControl As Object &apos; The SF_DialogControl object having triggered the event
+
+ On Local Error GoTo Catch &apos; Avoid stopping event scripts
+
+Check:
+ &apos; Ensure there is a node
+ If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+ If IsNull(poEvent.Node) Then Exit Sub
+
+Try:
+ Set oControl = ScriptForge.SF_Services.CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+ ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeExpanded, poEvent)
+
+Finally:
+ Exit Sub
+Catch:
+ GoTo Finally
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFEXP_requestChildNodes
+
+Sub _SFEXP_disposing(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeExpanding(Optional ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeCollapsing(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeExpanded(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeCollapsed(ByRef poEvent As Object)
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFSEL_selectionChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnNodeSelected event of a tree control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.view.XSelectionChangeListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+&apos;&apos;&apos;
+&apos;&apos;&apos; Nothing happens if there are several selected nodes or none
+
+Dim vSelection As Variant &apos; Variant, not object !!
+Dim oControl As Object &apos; The SF_DialogControl object having triggered the event
+
+ On Local Error GoTo Catch &apos; Avoid stopping event scripts
+
+Check:
+ &apos; Ensure there is a selection
+ If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+ vSelection = poEvent.Source.getSelection()
+ If IsEmpty(vSelection) Or IsArray(vSelection) Then Exit Sub
+
+Try:
+ Set oControl = ScriptForge.SF_Services.CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+ ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeSelected, poEvent)
+
+Finally:
+ Exit Sub
+Catch:
+ GoTo Finally
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFSEL_selectionChanged
+
+Sub _SFSEL_disposing(ByRef poEvent As Object)
+End Sub
+
+REM ============================================ PUBLIC METHODS (PAGE MANAGEMENT)
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTAB_actionPerformed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Event triggered by a button configured through the dialog page manager
+&apos;&apos;&apos; Buttons may be of type TABCONTROL, BACKCONTROL or NEXTCONTROL
+
+Dim oControl As Object &apos; The DialogControl instance having caused the event
+Dim sName As String &apos; Control name
+Dim oDialog As Object &apos; The parent Dialog instance
+Dim oPageManager As Object &apos; An entry in dialog._PageManagement
+Const TABCONTROL = 2
+Const BACKCONTROL = 3
+Const NEXTCONTROL = 4
+
+Check:
+ On Local Error GoTo Finally &apos; Never interrupt !!
+ Set oControl = CreateScriptService(&quot;DialogEvent&quot;, poEvent)
+ If IsNull(oControl) Then GoTo Finally
+
+Try:
+ Set oDialog = oControl.Parent
+ With oDialog
+ sName = oControl.Name
+ &apos; Find entry in page manager settings
+ For Each oPageManager In ._PageManagement
+ If oPageManager.ControlName = sName Then
+ Select Case oPageManager.PageMgtType
+ Case TABCONTROL : .Page = oPageManager.PageNumber
+ Case BACKCONTROL : .Page = .Page - 1
+ Case NEXTCONTROL : .Page = .Page + 1
+ Case Else
+ End Select
+ Exit For
+ End If
+ Next oPageManager
+ End With
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFTAB_actionPerformed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTAB_itemStateChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Event triggered by a listbox, combobox or radiobutton configured through the dialog page manager
+&apos;&apos;&apos; Buttons are of type PILOTCONTROL
+
+Dim oControl As Object &apos; The DialogControl instance having caused the event
+Dim sName As String &apos; Control name
+Dim oDialog As Object &apos; The parent Dialog instance
+Dim oPageManager As Object &apos; An entry in dialog._PageManagement
+Dim lPage As Long &apos; Actual page number
+
+Check:
+ On Local Error GoTo Finally &apos; Never interrupt !!
+ Set oControl = CreateScriptService(&quot;DialogEvent&quot;, poEvent)
+ If IsNull(oControl) Then GoTo Finally
+
+Try:
+ Set oDialog = oControl.Parent
+ With oDialog
+ sName = oControl.Name
+ &apos; Find entry in page manager settings
+ For Each oPageManager In ._PageManagement
+ If oPageManager.ControlName = sName Then
+ lPage = oPageManager.PageNumber
+ If lPage = 0 Then .Page = oControl.ListIndex + 1 Else .Page = lPage
+ Exit For
+ End If
+ Next oPageManager
+ End With
+
+Finally:
+ Exit Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFTAB_itemStateChanged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTAB_disposing(Optional ByRef poEvent As Object)
+End Sub
+
+REM ========================== PUBLIC METHODS (GENERIC DIALOG AND CONTROL EVENTS)
+
+&apos;&apos;&apos; Next methods SIMULATE the behaviour of events set on dialogs and dialog controls
+&apos;&apos;&apos; in the Events tab of a dialog editing page in the Basic IDE.
+&apos;&apos;&apos; They are not triggered by events preset in the Basic IDE.
+&apos;&apos;&apos; They are triggered ONLY when the event has been set by code with one of the OnXxxYyyy properties,
+&apos;&apos;&apos; like in:
+&apos;&apos;&apos; dialog.OnActionPerformed = &quot;vnd....&quot; &apos; URI notation
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFACTION_actionPerformed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnActionPerformed event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XActionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;actionPerformed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFACTION_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFADJUST_adjustmentValueChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnAdjustmentValueChanged event in a scrollbar
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XAdjustmentListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;adjustmentValueChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFADJUST_adjustmentValueChanged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFADJUST_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_focusGained(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnFocusGained event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XFocusListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;focusGained&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFFOCUS_focusGained
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_focusLost(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnFocusLost event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XFocusListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;focusLost&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFFOCUS_focusLost
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFITEM_itemStateChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnItemStateChanged event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XItemListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;itemStateChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFITEM_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_keyPressed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnKeyPressed event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XKeyListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;keyPressed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFKEY_keyPressed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_keyReleased(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnKeyReleased event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XKeyListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;keyReleased&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFKEY_keyReleased
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseEntered(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseEntered event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseEntered&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseEntered
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseExited(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseExited event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseExited&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseExited
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mousePressed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMousePressed event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mousePressed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mousePressed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseReleased(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseReleased event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseReleased&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseReleased
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_mouseDragged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseDragged event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseMotionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseDragged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseDragged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_mouseMoved(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseMoved event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseMotionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseMoved&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseMoved
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTEXT_textChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnTextChanged event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XTextListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;textChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFTEXT_textChanged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTEXT_disposing()
+End Sub
+
+REM ============================================================= PRIVATE METHODS
+
+REM -----------------------------------------------------------------------------
+Public Function _SetOnProperty(ByRef poInstance As Object _
+ , ByVal psProperty As String _
+ , ByVal psScript As String _
+ ) As Boolean
+&apos;&apos;&apos; Set one of the On properties related to either a SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; Such a property is typically set by next pseudo-code:
+&apos;&apos;&apos; poInstance.psProperty = psScript
+&apos;&apos;&apos; It requires a strictly identical nomenclature of internal variables in both classes.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poInstance: a SF_Dialog or a SF_DialogControl instance
+&apos;&apos;&apos; psProperty: one of the applicable On properties (&quot;OnFocusGained&quot;, &quot;OnMouseMoved&quot;, ...)
+&apos;&apos;&apos; psScript: the script to run when the event is triggered
+&apos;&apos;&apos; When the zero-length string, the trigger is deactivated
+
+Dim bSet As Boolean &apos; Return value
+Dim oModel As Object &apos; com.sun.star.awt.XControlModel
+Dim oView As Object &apos; com.sun.star.awt.XControl
+Dim oDialogEvents As Object &apos; com.sun.star.container.XNameContainer
+Dim sListener As String &apos; Applicable listener, depending on property, f.i. &quot;XMouseListener&quot;
+Dim sEventName As String &apos; Internal event name
+Dim iCounterIncrement As Integer &apos; Increment to be applied on listener counter
+Dim sPrevious As String &apos; Actual value of script before the change
+
+Const cstPrefix = &quot;com.sun.star.awt.&quot;
+
+ bSet = True
+
+Check:
+ If IsNull(poInstance) Or Len(psProperty) = 0 Then GoTo Catch
+ With poInstance
+
+ &apos; Initialize local variables depending on instance type
+ If .ObjectType = &quot;DIALOG&quot; Then
+ Set oModel = ._DialogModel
+ Set oView = ._DialogControl
+ Else &apos; DIALOGCONTROL
+ Set oModel = ._ControlModel
+ Set oView = ._ControlView
+ End If
+ If IsNull(oModel) Or IsNull(oView) Then GoTo Catch
+
+ &apos; Ignore request if an event has been statically preset (in the Basic IDE) with the same name
+ Set oDialogEvents = oModel.getEvents()
+ sListener = ._GetListener(psProperty)
+ sEventName = cstPrefix &amp; sListener &amp; &quot;::&quot; &amp; ._GetEventName(psProperty)
+ If oDialogEvents.hasByName(sEventName) Then GoTo Catch
+
+Try:
+ &apos; Note the target scripts. Compare previous and new values. Fix the increment to be applied on counter
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;)
+ sPrevious = ._OnActionPerformed
+ ._OnActionPerformed = psScript
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;)
+ sPrevious = ._OnAdjustmentValueChanged
+ ._OnAdjustmentValueChanged = psScript
+ Case UCase(&quot;OnFocusGained&quot;)
+ sPrevious = ._OnfocusGained
+ ._OnFocusGained = psScript
+ Case UCase(&quot;OnFocusLost&quot;)
+ sPrevious = ._OnFocusLost
+ ._OnFocusLost = psScript
+ Case UCase(&quot;OnItemStateChanged&quot;)
+ sPrevious = ._OnItemStateChanged
+ ._OnItemStateChanged = psScript
+ Case UCase(&quot;OnKeyPressed&quot;)
+ sPrevious = ._OnKeyPressed
+ ._OnKeyPressed = psScript
+ Case UCase(&quot;OnKeyReleased&quot;)
+ sPrevious = ._OnKeyReleased
+ ._OnKeyReleased = psScript
+ Case UCase(&quot;OnMouseDragged&quot;)
+ sPrevious = ._OnMouseDragged
+ ._OnMouseDragged = psScript
+ Case UCase(&quot;OnMouseEntered&quot;)
+ sPrevious = ._OnMouseEntered
+ ._OnMouseEntered = psScript
+ Case UCase(&quot;OnMouseExited&quot;)
+ sPrevious = ._OnMouseExited
+ ._OnMouseExited = psScript
+ Case UCase(&quot;OnMouseMoved&quot;)
+ sPrevious = ._OnMouseMoved
+ ._OnMouseMoved = psScript
+ Case UCase(&quot;OnMousePressed&quot;)
+ sPrevious = ._OnMousePressed
+ ._OnMousePressed = psScript
+ Case UCase(&quot;OnMouseReleased&quot;)
+ sPrevious = ._OnMouseReleased
+ ._OnMouseReleased = psScript
+ Case UCase(&quot;OnTextChanged&quot;)
+ sPrevious = ._OnTextChanged
+ ._OnTextChanged = psScript
+ End Select
+ &apos; Compare previous and new event to know what to do next with the listener
+ If sPrevious = psScript Then GoTo Finally &apos; No change
+ If Len(sPrevious) = 0 Then &apos; New event
+ iCounterIncrement = +1
+ ElseIf Len(psScript) = 0 Then &apos; Cancel event
+ iCounterIncrement = -1
+ Else &apos; Event replacement
+ iCounterIncrement = 0
+ End If
+
+ &apos; Setup a new fresh listener, only once by listener during dialog or control life time,
+ &apos; (re)add it to the instance view or remove the existing one if not needed anymore
+ Select Case sListener
+ Case &quot;XActionListener&quot;
+ ._ActionCounter = ._ActionCounter + iCounterIncrement
+ If ._ActionCounter = 1 Then
+ If IsNull(._ActionListener) Then Set ._ActionListener = CreateUnoListener(&quot;_SFACTION_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addActionListener(._ActionListener)
+ ElseIf ._ActionCounter &lt;= 0 Then
+ If Not IsNull(._ActionListener) Then oView.removeActionListener(._ActionListener)
+ ._ActionCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XAdjustmentListener&quot;
+ ._AdjustmentCounter = ._AdjustmentCounter + iCounterIncrement
+ If ._AdjustmentCounter = 1 Then
+ If IsNull(._AdjustmentListener) Then Set ._AdjustmentListener = CreateUnoListener(&quot;_SFADJUST_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addAdjustmentListener(._AdjustmentListener)
+ ElseIf ._AdjustmentCounter &lt;= 0 Then
+ If Not IsNull(._AdjustmentListener) Then oView.removeAdjustmentListener(._AdjustmentListener)
+ ._AdjustmentCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XFocusListener&quot;
+ ._FocusCounter = ._FocusCounter + iCounterIncrement
+ If ._FocusCounter = 1 Then
+ If IsNull(._FocusListener) Then Set ._FocusListener = CreateUnoListener(&quot;_SFFOCUS_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addFocusListener(._FocusListener)
+ ElseIf ._FocusCounter &lt;= 0 Then
+ If Not IsNull(._FocusListener) Then oView.removeFocusListener(._FocusListener)
+ ._FocusCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XItemListener&quot;
+ ._ItemCounter = ._ItemCounter + iCounterIncrement
+ If ._ItemCounter = 1 Then
+ If IsNull(._ItemListener) Then Set ._ItemListener = CreateUnoListener(&quot;_SFITEM_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addItemListener(._ItemListener)
+ ElseIf ._ItemCounter &lt;= 0 Then
+ If Not IsNull(._ItemListener) Then oView.removeItemListener(._ItemListener)
+ ._ItemCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XKeyListener&quot;
+ ._KeyCounter = ._KeyCounter + iCounterIncrement
+ If ._KeyCounter= 1 Then
+ If IsNull(._KeyListener) Then Set ._KeyListener = CreateUnoListener(&quot;_SFKEY_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addKeyListener(._KeyListener)
+ ElseIf ._KeyCounter &lt;= 0 Then
+ If Not IsNull(._KeyListener) Then oView.removeKeyListener(._KeyListener)
+ ._KeyCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XMouseListener&quot;
+ ._MouseCounter = ._MouseCounter + iCounterIncrement
+ If ._MouseCounter= 1 Then
+ If IsNull(._MouseListener) Then Set ._MouseListener = CreateUnoListener(&quot;_SFMOUSE_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addMouseListener(._MouseListener)
+ ElseIf ._MouseCounter &lt;= 0 Then
+ If Not IsNull(._MouseListener) Then oView.removeMouseListener(._MouseListener)
+ ._MouseCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XMouseMotionListener&quot;
+ ._MouseMotionCounter = ._MouseMotionCounter + iCounterIncrement
+ If ._MouseMotionCounter = 1 Then
+ If IsNull(._MouseMotionListener) Then Set ._MouseMotionListener = CreateUnoListener(&quot;_SFMOVE_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addMouseMotionListener(._MouseMotionListener)
+ ElseIf ._MouseMotionCounter &lt;= 0 Then
+ If Not IsNull(._MouseMotionListener) Then oView.removeMouseMotionListener(._MouseMotionListener)
+ ._MouseMotionCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XTextListener&quot;
+ ._TextCounter = ._TextCounter + iCounterIncrement
+ If ._TextCounter = 1 Then
+ If IsNull(._TextListener) Then Set ._TextListener = CreateUnoListener(&quot;_SFTEXT_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addTextListener(._TextListener)
+ ElseIf ._TextCounter &lt;= 0 Then
+ If Not IsNull(._TextListener) Then oView.removeTextListener(._TextListener)
+ ._TextCounter = 0 &apos; Prevent negative values
+ End If
+ End Select
+
+ End With
+
+Finally:
+ _SetOnProperty = bSet
+ Exit Function
+Catch:
+ bSet = False
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialoglistener._SetOnProperty
+
+REM -----------------------------------------------------------------------------
+Public Sub _TriggerEvent(ByVal EventType, Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the EventType event in a dialog or dialog control
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+Dim oDialog As Object &apos; The SF_Dialog or SF_DialogControl object having triggered the event
+Dim sScript As String &apos; Script to be invoked
+
+ On Local Error GoTo Catch &apos; Avoid stopping event scripts
+
+Check:
+ If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+
+Try:
+ Set oDialog = ScriptForge.SF_Services.CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+ If IsNull(oDialog) Then Exit Sub
+ With oDialog
+ Select Case EventType
+ Case &quot;actionPerformed&quot; : sScript = .OnActionPerformed
+ Case &quot;adjustmentValueChanged&quot; : sScript = .OnAdjustmentValueChanged
+ Case &quot;focusGained&quot; : sScript = .OnFocusGained
+ Case &quot;focusLost&quot; : sScript = .OnFocusLost
+ Case &quot;itemStateChanged&quot; : sScript = .OnItemStateChanged
+ Case &quot;mouseDragged&quot; : sScript = .OnMouseDragged
+ Case &quot;mouseEntered&quot; : sScript = .OnMouseEntered
+ Case &quot;mouseExited&quot; : sScript = .OnMouseExited
+ Case &quot;mouseMoved&quot; : sScript = .OnMouseMoved
+ Case &quot;mousePressed&quot; : sScript = .OnMousePressed
+ Case &quot;mouseReleased&quot; : sScript = .OnMouseReleased
+ Case &quot;textChanged&quot; : sScript = .OnTextChanged
+ Case Else : sScript = &quot;&quot; &apos; Should not happen
+ End Select
+ If Len(sScript) = 0 Then Exit Sub
+ ScriptForge.SF_Session._ExecuteScript(sScript, poEvent)
+ End With
+
+Finally:
+ Exit Sub
+Catch:
+ GoTo Finally
+End Sub &apos; SFDialogs.SF_Dialoglistener._TriggerEvent
+
+REM ============================================ END OF SFDIALOGS.SF_DIALOGLISTENER
+</script:module> \ No newline at end of file
diff --git a/wizards/source/sfdialogs/SF_DialogUtils.xba b/wizards/source/sfdialogs/SF_DialogUtils.xba
new file mode 100644
index 0000000000..e364acac46
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_DialogUtils.xba
@@ -0,0 +1,332 @@
+<?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_DialogUtils" 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 Explicit
+Option Private Module
+
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&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_DialogUtils
+&apos;&apos;&apos; ========
+&apos;&apos;&apos; FOR INTERNAL USE ONLY
+&apos;&apos;&apos; Groups private functions that are common to the SF_Dialog and SF_DialogControl class modules
+&apos;&apos;&apos;
+&apos;&apos;&apos; Topics where SF_DialogUtils matters:
+&apos;&apos;&apos; - resizing dialog and dialog controls
+&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&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
+
+REM ============================================================ MODULE CONSTANTS
+
+Public Const MINPOSITION = -99999 &apos; Conventionally indicates &quot;do not change position&quot;
+
+REM =========================================pvA================= PRIVATE METHODS
+
+REM -----------------------------------------------------------------------------
+Public Function _ConvertPointToAppFont(ByRef poView As Object _
+ , ByVal plX As Long _
+ , ByVal plY As Long _
+ ) As Object
+&apos;&apos;&apos; Convert the X, Y position expressed in pixels to a Point expressed in &quot;Map APPFONT&quot;
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poView: a com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+&apos;&apos;&apos; plX, plY : the horizontal and vertical coordinates of the top-left corner of the control
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; a com.sun.star.awt.Point object
+
+Dim oPoint As New com.sun.star.awt.Point &apos; The input Point
+Dim oReturn As Object &apos; Return value
+
+Try:
+ oPoint.X = plX
+ oPoint.Y = plY
+ Set oReturn = poView.convertPointToLogic(oPoint, com.sun.star.util.MeasureUnit.APPFONT)
+
+Finally:
+ Set _ConvertPointToAppFont = oReturn
+ Exit Function
+End Function &apos; SFDialogs.SF_DialogUtils._ConvertPointToAppFont
+
+REM -----------------------------------------------------------------------------
+Public Function _ConvertPointToPixel(ByRef poView As Object _
+ , ByVal plX As Long _
+ , ByVal plY As Long _
+ ) As Object
+&apos;&apos;&apos; Convert the X, Y coordinates expressed in &quot;Map APPFONT&quot; units to a point expressed in pixels
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poView: a com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+&apos;&apos;&apos; plX, plY : the horizontal and vertical coordinates of the top-left corner of the control
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; a com.sun.star.awt.Point object
+
+Dim oPoint As New com.sun.star.awt.Point &apos; The input point
+Dim oReturn As Object &apos; Return value
+
+Try:
+ oPoint.X = plX
+ oPoint.Y = plY
+ Set oReturn = poView.convertPointToPixel(oPoint, com.sun.star.util.MeasureUnit.APPFONT)
+
+Finally:
+ Set _ConvertPointToPixel = oReturn
+ Exit Function
+End Function &apos; SFDialogs.SF_DialogUtils._ConvertPointToPixel
+
+REM -----------------------------------------------------------------------------
+Public Function _ConvertSizeToAppFont(ByRef poView As Object _
+ , ByVal plWidth As Long _
+ , ByVal plHeight As Long _
+ ) As Object
+&apos;&apos;&apos; Convert the Width, Height dimensions expressed in pixels to a Size expressed in &quot;Map APPFONT&quot;
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poView: a com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+&apos;&apos;&apos; plWidth, plHeight : the horizontal and vertical dimensions of the control
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; a com.sun.star.awt.Size object
+
+Dim oSize As New com.sun.star.awt.Size &apos; The input size
+Dim oReturn As Object &apos; Return value
+
+Try:
+ oSize.Width = plWidth
+ oSize.Height = plHeight
+ Set oReturn = poView.convertSizeToLogic(oSize, com.sun.star.util.MeasureUnit.APPFONT)
+
+Finally:
+ Set _ConvertSizeToAppFont = oReturn
+ Exit Function
+End Function &apos; SFDialogs.SF_DialogUtils._ConvertSizeToAppFont
+
+REM -----------------------------------------------------------------------------
+Public Function _ConvertSizeToPixel(ByRef poView As Object _
+ , ByVal plWidth As Long _
+ , ByVal plHeight As Long _
+ ) As Object
+&apos;&apos;&apos; Convert the Width, Height dimensions expressed in &quot;Map APPFONT&quot; units to a Size expressed in pixels
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poView: a com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+&apos;&apos;&apos; plWidth, plHeight : the horizontal and vertical dimensions of the control
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; a com.sun.star.awt.Size object
+
+Dim oSize As New com.sun.star.awt.Size &apos; The input size
+Dim oReturn As Object &apos; Return value
+
+Try:
+ oSize.Width = plWidth
+ oSize.Height = plHeight
+ Set oReturn = poView.convertSizeToPixel(oSize, com.sun.star.util.MeasureUnit.APPFONT)
+
+Finally:
+ Set _ConvertSizeToPixel = oReturn
+ Exit Function
+End Function &apos; SFDialogs.SF_DialogUtils._ConvertSizeToPixel
+
+REM -----------------------------------------------------------------------------
+Public Function _ConvertToAppFont(ByRef poView As Object _
+ , ByVal pbPoint As Boolean _
+ ) As Object
+&apos;&apos;&apos; Switch between the _ConvertPointToAppFont and the _ConvertSizeToAppFont routines
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poView: a com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+&apos;&apos;&apos; pbPoint: when True return a Point, otherwise return a Size
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; a com.sun.star.awt.Point or a com.sun.star.awt.Size object
+
+Static oSession As Object &apos; Alias of SF_Session
+Dim oPosSize As Object &apos; com.sun.star.awt.Rectangle
+
+Try:
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
+ If oSession.HasUNOMethod(poView, &quot;getPosSize&quot;) Then
+ Set oPosSize =poView.getPosSize()
+ Else &apos; Should not happen
+ Set oPosSize = New com.sun.star.awt.Rectangle
+ End If
+
+ If pbPoint Then
+ _ConvertToAppFont = _ConvertPointToAppFont(poView, oPosSize.X, oPosSize.Y) &apos; com.sun.star.awt.Point
+ Else
+ _ConvertToAppFont = _ConvertSizeToAppFont(poView, oPosSize.Width, oPosSize.Height) &apos; com.sun.star.awt.Size
+ End If
+
+End Function &apos; SFDialogs.SF_DialogUtils._ConvertToAppFont
+
+REM -----------------------------------------------------------------------------
+Private Function _FormatsList(psControlType) As Variant
+&apos;&apos;&apos; Return the list of the allowed formats for Date and Time control types
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; DateField or TimeField control
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; The allowed format entries as a zero-based array
+
+Dim vFormats() As Variant &apos; Return value
+Const CTLDATEFIELD = &quot;DateField&quot;
+Const CTLTIMEFIELD = &quot;TimeField&quot;
+
+ Select Case psControlType
+ 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_DialogUtils._FormatsList
+
+REM -----------------------------------------------------------------------------
+Public Function _Resize(ByRef Control As Object _
+ , Optional ByVal Left As Variant _
+ , Optional ByVal Top As Variant _
+ , Optional ByVal Width As Variant _
+ , Optional ByVal Height As Variant _
+ ) As Boolean
+&apos;&apos;&apos; Move the top-left corner of a dialog or a dialog control to new coordinates and/or modify its dimensions
+&apos;&apos;&apos; Without arguments, the method either:
+&apos;&apos;&apos; leaves the position unchanged and computes best fit dimensions
+&apos;&apos;&apos; resets the initial position and dimensions (Scrollbar, ProgressBar, FixedLine, GroupBox, TreeControl&quot;, TableControl)
+&apos;&apos;&apos; Attributes denoting the position and size of a dialog are expressed in &quot;Map AppFont&quot; units.
+&apos;&apos;&apos; Map AppFont units are device and resolution independent.
+&apos;&apos;&apos; One Map AppFont unit is equal to one eighth of the average character (Systemfont) height and one quarter of the average character width.
+&apos;&apos;&apos; The dialog editor (= the Basic IDE) also uses Map AppFont units.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; Control: a SF_Dialog or SF_DialogControl class instance
+&apos;&apos;&apos; Left : the horizontal distance from the top-left corner
+&apos;&apos;&apos; Top : the vertical distance from the top-left corner
+&apos;&apos;&apos; Width : the horizontal width of the rectangle containing the Dialog[Control]
+&apos;&apos;&apos; Height : the vertical height of the rectangle containing the Dialog[Control]
+&apos;&apos;&apos; Negative or missing arguments are left unchanged.
+&apos;&apos;&apos; Returns:
+&apos;&apos;&apos; True when successful
+
+Dim bResize As Boolean &apos; Return value
+Dim oModel As Object &apos; Model of Control object
+Dim oView As Object &apos; View of Control object
+Dim Displayed As Boolean &apos; When Trs, the dialog is currently active
+Dim oSize As Object &apos; com.sun.star.awt.Size
+Dim oPoint As Object &apos; com.sun.star.awt.Point
+Dim oPreferredSize As Object &apos; com.sun.star.awt.Size
+Dim iFlags As Integer &apos; com.sun.star.awt.PosSize constants
+Static oSession As Object &apos; SF_Session alias
+Dim cstThisSub As String
+Const cstSubArgs = &quot;[Left], [Top], [Width], [Height]&quot;
+
+ If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+ bResize = False
+
+Check:
+ If IsNull(Control) Then GoTo Finally
+ If IsMissing(Left) Or IsEmpty(Left) Then Left = MINPOSITION
+ If IsMissing(Top) Or IsEmpty(Top) Then Top = MINPOSITION
+ If IsMissing(Height) Or IsEmpty(Height) Then Height = -1
+ If IsMissing(Width) Or IsEmpty(Width) Then Width = -1
+ If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+ If Not ScriptForge.SF_Utils._Validate(Left, &quot;Left&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Top, &quot;Top&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Width, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(Height, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ End If
+
+Try:
+ With Control
+ &apos; Initialize local variables depending on caller
+ Select Case .ObjectType
+ Case &quot;DIALOG&quot;
+ cstThisSub = &quot;SFDialogs.Dialog.Resize&quot;
+ Set oModel = ._DialogModel
+ Set oView = ._DialogControl
+ Displayed = ._Displayed
+ Case &quot;DIALOGCONTROL&quot;
+ cstThisSub = &quot;SFDialogs.DialogControl.Resize&quot;
+ Set oModel = ._ControlModel
+ Set oView = ._ControlView
+ Displayed = .[Parent]._Displayed
+ Case Else
+ End Select
+ &apos; Manage absence of arguments: best fit or reset
+ If Left = MINPOSITION And Top = MINPOSITION And Width = -1 And Height = -1 Then
+ If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;ScriptForge.Session&quot;)
+ If oSession.HasUnoMethod(oView, &quot;getPreferredSize&quot;) Then
+ &apos; Compute a best fit size when relevant
+ Set oPreferredSize = oView.getPreferredSize()
+ Set oSize = SF_DialogUtils._ConvertSizeToAppFont(oView, oPreferredSize.Width, oPreferredSize.Height)
+ Width = oSize.Width
+ Height = oSize.Height
+ Else
+ &apos; Reset factory settings otherwise
+ Left = ._Left
+ Top = ._Top
+ Width = ._Width
+ Height = ._Height
+ End If
+ End If
+ End With
+
+ &apos; Model sizes are in APPFONTs, View sizes are in pixels. Use view.convertSizeToPixel() to convert
+ &apos; For dynamic dialogs: convertSizeToPixel() is available only as from the dialog is made visible
+ &apos; =&gt; When the dialog is visible, positions and sizes are updated in view
+ &apos; When the dialog is not visible, positions and sizes adapted on model
+ If Displayed Then
+ With oView
+ &apos; Trace the elements to change
+ iFlags = 0
+ With com.sun.star.awt.PosSize
+ If Left &gt; MINPOSITION Then iFlags = iFlags + .X Else Left = 0
+ If Top &gt; MINPOSITION Then iFlags = iFlags + .Y Else Top = 0
+ If Width &gt; 0 Then iFlags = iFlags + .WIDTH Else Width = 0
+ If Height &gt; 0 Then iFlags = iFlags + .HEIGHT Else Height = 0
+ End With
+ &apos; Convert APPFONT units to pixels
+ Set oPoint = SF_DialogUtils._ConvertPointToPixel(oView, CLng(Left), CLng(Top))
+ Set oSize = SF_DialogUtils._ConvertSizeToPixel(oView, CLng(Width), CLng(Height))
+ &apos; Rewrite
+ If iFlags &gt; 0 Then .setPosSize(oPoint.X, oPoint.Y, oSize.Width, oSize.Height, iFlags)
+ End With
+ Else
+ With oModel
+ &apos; Store position and dimensions in APPFONT units
+ If Left &gt; MINPOSITION Then .PositionX = CLng(Left)
+ If Top &gt; MINPOSITION Then .PositionY = CLng(Top)
+ If Width &gt; 0 Then .Width = CLng(Width)
+ If Height &gt; 0 Then .Height = CLng(Height)
+ End With
+ End If
+ bResize = True
+
+Finally:
+ _Resize = bResize
+ ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogss.SF_DialogUtils._Resize
+
+REM ============================================= END OF SFDIALOGS.SF_DIALOGUTILS
+
+</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 0000000000..4639739089
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_Register.xba
@@ -0,0 +1,454 @@
+<?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
+ .RegisterEventManager(&quot;NewDialog&quot;, &quot;SFDialogs.SF_Register._NewDialogFromScratch&quot;) &apos; Reference to the function initializing the service
+ 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_Register._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_Register._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_Register._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
+
+Try:
+ 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
+
+Finally:
+ Set _FindDialogInCache = oBasicDialog
+ Exit Function
+End Function &apos; SFDialogs.SF_Register._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;&apos;&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. Default = &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; Context: When called from Python, the context must be provided : XSCRIPTCONTEXT
+&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 vContext As Variant &apos; com.sun.star.uno.XComponentContext
+Dim oDialogProvider 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 oDialogControl As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
+Dim vWindow As Window &apos; A single component
+Dim sScope As String &apos; &quot;application&quot; or &quot;document&quot;
+Dim sURI As String &apos; URI of the targeted dialog
+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)
+ If UBound(pvArgs) &gt;= 0 Then vContainer = pvArgs(0) Else vContainer = &quot;&quot;
+ If UBound(pvArgs) &gt;= 1 Then vLibrary = pvArgs(1)
+ If IsEmpty(vLibrary) Then 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
+ If UBound(pvArgs) &gt;= 3 Then vContext = pvArgs(3) Else Set vContext = Nothing
+ If Not ScriptForge.SF_Utils._Validate(vContext, &quot;Context&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+
+ Set oDialog = Nothing
+
+Try:
+ &apos; Determine the library container hosting the dialog
+ Set oUi = ScriptForge.SF_Register.CreateScriptService(&quot;UI&quot;)
+ Set oComp = Nothing
+ If VarType(vContainer) = V_STRING Then
+ bFound = ( UCase(vContainer) = UCase(cstGlobal) )
+ End If
+ If Not bFound Then
+ 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
+ Set oComp = StarDesktop.CurrentComponent
+ vWindow = oUi._IdentifyWindow(oComp)
+ End If
+ Case V_OBJECT &apos; com.sun.star.lang.XComponent
+ bFound = True
+ vWindow = oUi._IdentifyWindow(vContainer)
+ Set oComp = vContainer
+ End Select
+ If Not bFound Then GoTo CatchNotFound
+ If Len(vWindow.DocumentType) = 0 Then GoTo CatchNotFound
+ End If
+
+ &apos; Determine the dialog provider
+ Select Case True
+ Case IsNull(vContext) And IsNull(oComp) &apos; Basic and GlobalScope
+ Set oDialogProvider = GetProcessServiceManager.createInstance(&quot;com.sun.star.awt.DialogProvider&quot;)
+ Case IsNull(vContext) And Not IsNull(oComp) &apos; Basic and Document
+ Set oDialogProvider = GetProcessServiceManager.createInstanceWithArguments(&quot;com.sun.star.awt.DialogProvider&quot;, Array(oComp))
+ Case Not IsNull(vContext) And IsNull(oComp) &apos; Python and GlobalScope
+ Set oDialogProvider = vContext.getServiceManager().createInstanceWithContext(&quot;com.sun.star.awt.DialogProvider&quot;, vContext)
+ Case Not IsNull(vContext) And Not IsNull(oComp) &apos; Python and Document
+ Set oDialogProvider = vContext.getServiceManager().createInstanceWithArguments(&quot;com.sun.star.awt.DialogProvider&quot;, Array(oComp))
+ End Select
+
+ &apos; Create the graphical interface
+ sScope = Iif(IsNull(oComp), &quot;application&quot;, &quot;document&quot;)
+ sURI = &quot;vnd.sun.star.script:&quot; &amp; vLibrary &amp; &quot;.&quot; &amp; vDialogName &amp; &quot;?location=&quot; &amp; sScope
+ On Local Error GoTo CatchNotFound
+ Set oDialogControl = oDialogProvider.createDialog(sURI)
+
+ &apos; Initialize the basic SF_Dialog instance to return to the user script
+ 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 = oDialogProvider
+ Set ._DialogControl = oDialogControl
+ ._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 -----------------------------------------------------------------------------
+Private Function _NewDialogFromScratch(Optional ByVal pvArgs As Variant) As Object
+&apos;&apos;&apos; Create a new instance of the SF_Dialog class describing a dynamically defined dialog box
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; DialogName: a symbolic name of the dialog to create, for information only. Not checked for unicity.
+&apos;&apos;&apos; Place: either
+&apos;&apos;&apos; - an array with 4 elements: (X, Y, Width, Height)
+&apos;&apos;&apos; - a com.sun.star.awt.Rectangle [X, Y, Width, Height]
+&apos;&apos;&apos; All elements are expressed in &quot;Map AppFont&quot; units.
+&apos;&apos;&apos; Context: When called from Python, the context must be provided : XSCRIPTCONTEXT
+&apos;&apos;&apos; Returns: the instance or Nothing
+
+Dim oDialog As Object &apos; Return value
+Dim vDialogName As Variant &apos; The name is for information only
+Dim vPlace As variant &apos; com.sun.star.awt.rectangle or array(X, Y, Width, Height)
+Dim oPlace As Object &apos; com.sun.star.awt.rectangle
+Dim oProcessManager As Object &apos; com.sun.star.lang.XMultiServiceFactory
+Dim bBuiltInPython As Boolean &apos; True when context is present
+Dim oModel As Object &apos; com.sun.star.awt.UnoControlDialogModel
+Dim oView As Object &apos; com.sun.star.awt.UnoControlDialog
+Dim vContext As Variant &apos; com.sun.star.uno.XComponentContext
+
+Const cstDialogModel = &quot;com.sun.star.awt.UnoControlDialogModel&quot;
+Const cstDialogView = &quot;com.sun.star.awt.UnoControlDialog&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)
+ If UBound(pvArgs) &gt;= 0 Then vDialogName = pvArgs(0) Else vDialogName = Empty
+ If UBound(pvArgs) &gt;= 1 Then vPlace = pvArgs(1) Else vPlace = Empty &apos; Use Empty to force the mandatory status
+ If IsMissing(vDialogName) Or IsEmpty(vDialogName) Then vDialogName = &quot;DYNDIALOG&quot;
+ If UBound(pvArgs) &gt;= 2 Then vContext = pvArgs(2) Else Set vContext = Nothing
+
+ If Not ScriptForge.SF_Utils._Validate(vDialogName, &quot;DialogName&quot;, V_STRING) Then GoTo Finally
+ If IsArray(vPlace) Then
+ If Not ScriptForge.SF_Utils._ValidateArray(vPlace, &quot;Place&quot;, 1, ScriptForge.V_NUMERIC, True) Then GoTo Finally
+ Else
+ If Not ScriptForge.SF_Utils._Validate(vPlace, &quot;Place&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+ End If
+ If Not ScriptForge.SF_Utils._Validate(vContext, &quot;Context&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
+
+ Set oDialog = Nothing
+
+Try:
+ &apos; Determine the process service manager and create the dialog model
+ If IsNull(vContext) Then &apos; Basic
+ Set oprocessManager = GetProcessServiceManager()
+ Set oModel = oProcessManager.createInstance(cstDialogModel)
+ bBuiltInPython = False
+ Else &apos; Python
+ Set oprocessManager = vContext.getServiceManager()
+ Set oModel = oProcessManager.createInstanceWithContext(cstDialogModel, vContext)
+ bBuiltInPython = True
+ End If
+
+ oModel.Name = vDialogName
+
+ &apos; Set dimension and position
+ With oModel
+ If IsArray(vPlace) Then
+ If UBound(vPlace) = 3 Then
+ .PositionX = vPlace(0)
+ .PositionY = vPlace(1)
+ .Width = vPlace(2)
+ .Height = vPlace(3)
+ End If
+ ElseIf ScriptForge.SF_Session.UnoObjectType(vPlace) = &quot;com.sun.star.awt.Rectangle&quot; Then
+ Set oPlace = vPlace
+ .PositionX = oPlace.X
+ .PositionY = oPlace.Y
+ .Width = oPlace.Width
+ .Height = oPlace.Height
+ Else
+ &apos;Leave everything to zero
+ End If
+ End With
+
+ &apos; Create the view and associate model and view
+ Set oView = oProcessManager.createInstance(cstDialogView)
+ oView.setModel(oModel)
+
+ &apos; Initialize the basic SF_Dialog instance to return to the user script
+ Set oDialog = New SF_Dialog
+ With oDialog
+ Set .[Me] = oDialog
+ ._Container = &quot;&quot;
+ ._Library = &quot;&quot;
+ ._BuiltFromScratch = True
+ ._BuiltInPython = bBuiltInPython
+ ._Name = vDialogName
+ Set ._DialogProvider = Nothing
+ Set ._DialogControl = oView
+ ._Initialize()
+ End With
+
+Finally:
+ Set _NewDialogFromScratch = oDialog
+ Exit Function
+Catch:
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Register._NewDialogFromScratch
+
+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 0000000000..e98be710ea
--- /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-2022 Jean-Pierre LEDURE, Rafael LIMA, 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 0000000000..be8e58d45a
--- /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 0000000000..59263472b3
--- /dev/null
+++ b/wizards/source/sfdialogs/script.xlb
@@ -0,0 +1,10 @@
+<?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:element library:name="SF_DialogListener"/>
+ <library:element library:name="SF_DialogUtils"/>
+</library:library> \ No newline at end of file