Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / wizards / source / sfdialogs / SF_Dialog.xba
blobf08a6ad7b45d46a72e63a9d8fe444e60670ca0b8
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Dialog" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
4 REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
5 REM === The SFDialogs library is one of the associated libraries. ===
6 REM === Full documentation is available on https://help.libreoffice.org/ ===
7 REM =======================================================================================================================
9 Option Compatible
10 Option ClassModule
12 Option Explicit
14 &apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
15 &apos;&apos;&apos; SF_Dialog
16 &apos;&apos;&apos; =========
17 &apos;&apos;&apos; Management of dialogs. They may be defined with the Basic IDE or built from scratch
18 &apos;&apos;&apos; Each instance of the current class represents a single dialog box displayed to the user
19 &apos;&apos;&apos;
20 &apos;&apos;&apos; A dialog box can be displayed in modal or in non-modal modes
21 &apos;&apos;&apos;
22 &apos;&apos;&apos; In modal mode, the box is displayed and the execution of the macro process is suspended
23 &apos;&apos;&apos; until one of the OK or Cancel buttons is pressed. In the meantime, other user actions
24 &apos;&apos;&apos; executed on the box can trigger specific actions.
25 &apos;&apos;&apos;
26 &apos;&apos;&apos; In non-modal mode, the dialog box is &quot;floating&quot; on the user desktop and the execution
27 &apos;&apos;&apos; of the macro process continues normally
28 &apos;&apos;&apos; A dialog box disappears from memory after its explicit termination.
29 &apos;&apos;&apos;
30 &apos;&apos;&apos; Service invocation and usage:
31 &apos;&apos;&apos;
32 &apos;&apos;&apos; 1) when the dialog exists in some dialog libraries (= pre-defined with the Basic IDE):
33 &apos;&apos;&apos; Dim myDialog As Object, lButton As Long
34 &apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, Container, Library, DialogName)
35 &apos;&apos;&apos; &apos; Args:
36 &apos;&apos;&apos; &apos; Container: &quot;GlobalScope&quot; for preinstalled libraries
37 &apos;&apos;&apos; &apos; A window name (see its definition in the ScriptForge.UI service)
38 &apos;&apos;&apos; &apos; &quot;&quot; (default) = the current document
39 &apos;&apos;&apos; &apos; Library: The (case-sensitive) name of a library contained in the container
40 &apos;&apos;&apos; &apos; Default = &quot;Standard&quot;
41 &apos;&apos;&apos; &apos; DialogName: a case-sensitive string designating the dialog where it is about
42 &apos;&apos;&apos; &apos; ... Initialize controls ...
43 &apos;&apos;&apos; lButton = myDialog.Execute() &apos; Default mode = Modal
44 &apos;&apos;&apos; If lButton = myDialog.OKBUTTON Then
45 &apos;&apos;&apos; &apos; ... Process controls and do what is needed
46 &apos;&apos;&apos; End If
47 &apos;&apos;&apos; myDialog.Terminate()
48 &apos;&apos;&apos;
49 &apos;&apos;&apos; 2) when the dialog is fully defined by code:
50 &apos;&apos;&apos; Dim myDialog As Object, oButton As Object lExec As Long
51 &apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.NewDialog&quot;, DialogName, Place)
52 &apos;&apos;&apos; &apos; Args:
53 &apos;&apos;&apos; &apos; DialogName: a case-sensitive string designating the dialog
54 &apos;&apos;&apos; Place: either
55 &apos;&apos;&apos; - an array with 4 elements: (X, Y, Width, Height)
56 &apos;&apos;&apos; - a com.sun.star.awt.Rectangle [X, Y, Width, Height]
57 &apos;&apos;&apos; (All elements are expressed in &quot;Map AppFont&quot; units).
58 &apos;&apos;&apos; &apos; ... Create controls with the CreateXXX(...) methods ..., e.g.
59 &apos;&apos;&apos; Set oButton = myDialog.CreateButton(&quot;OKButton&quot;, Place := Array(100, 100, 20, 10), Push := &quot;OK&quot;)
60 &apos;&apos;&apos; lExec = myDialog.Execute() &apos; Default mode = Modal
61 &apos;&apos;&apos; If lExec = myDialog.OKBUTTON Then
62 &apos;&apos;&apos; &apos; ... Process controls and do what is needed
63 &apos;&apos;&apos; End If
64 &apos;&apos;&apos; myDialog.Terminate()
65 &apos;&apos;&apos;
66 &apos;&apos;&apos;
67 &apos;&apos;&apos; Detailed user documentation:
68 &apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_dialog.html?DbPAR=BASIC
69 &apos;&apos;&apos;
70 &apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
72 REM ================================================================== EXCEPTIONS
74 Private Const DIALOGDEADERROR = &quot;DIALOGDEADERROR&quot;
75 Private Const PAGEMANAGERERROR = &quot;PAGEMANAGERERROR&quot;
76 Private Const DUPLICATECONTROLERROR = &quot;DUPLICATECONTROLERROR&quot;
78 REM ============================================================= PRIVATE MEMBERS
80 Private [Me] As Object
81 Private [_Parent] As Object
82 Private ObjectType As String &apos; Must be DIALOG
83 Private ServiceName As String
85 &apos; Dialog location
86 Private _Container As String
87 Private _Library As String
88 Private _BuiltFromScratch As Boolean &apos; When True, dialog is not stored in a library
89 Private _BuiltInPython As Boolean &apos; Used only when _BuiltFromScratch = True
90 Private _Name As String
91 Private _CacheIndex As Long &apos; Index in cache storage
93 &apos; Dialog UNO references
94 Private _DialogProvider As Object &apos; com.sun.star.io.XInputStreamProvider
95 Private _DialogControl As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
96 Private _DialogModel As Object &apos; com.sun.star.awt.XControlModel - stardiv.Toolkit.UnoControlDialogModel
98 &apos; Dialog attributes
99 Private _Displayed As Boolean &apos; True after Execute()
100 Private _Modal As Boolean &apos; Set by Execute()
102 &apos; Dialog initial position and dimensions in APPFONT units
103 Private _Left As Long
104 Private _Top As Long
105 Private _Width As Long
106 Private _Height As Long
108 &apos; Page management
109 Type _PageManager
110 ControlName As String &apos; Case-sensitive name of control involved in page management
111 PageMgtType As Integer &apos; One of the PILOTCONTROL, TABCONTROL, NEXTCONTROL, BACKCONTROL constants
112 PageNumber As Long &apos; When &gt; 0, the page to activate for tab controls
113 ListenerType As Integer &apos; One of the ITEMSTATECHANGED, ACTIONPERFORMED constants
114 End Type
116 Private _PageManagement As Variant &apos; Array of _PageManager objects, one entry by involved control
117 Private _ItemListener As Object &apos; com.sun.star.awt.XItemListener
118 Private _ActionListener As Object &apos; com.sun.star.awt.XActionListener
119 Private _LastPage As Long &apos; When &gt; 0, the last page in a tabbed dialog
121 &apos; Updatable events
122 &apos; Next identifiers MUST be identical in both SF_Dialog and SF_DialogControl class modules
123 Private _FocusListener As Object &apos; com.sun.star.awt.XFocusListener
124 Private _OnFocusGained As String &apos; Script to invoke when dialog gets focus
125 Private _OnFocusLost As String &apos; Script to invoke when dialog loses focus
126 Private _FocusCounter As Integer &apos; Counts the number of events set on the listener
127 &apos; ---
128 Private _KeyListener As Object &apos; com.sun.star.awt.XKeyListener
129 Private _OnKeyPressed As String &apos; Script to invoke when Key clicked in dialog
130 Private _OnKeyReleased As String &apos; Script to invoke when Key released in dialog
131 Private _KeyCounter As Integer &apos; Counts the number of events set on the listener
132 &apos; ---
133 Private _MouseListener As Object &apos; com.sun.star.awt.XMouseListener
134 Private _OnMouseEntered As String &apos; Script to invoke when mouse enters dialog
135 Private _OnMouseExited As String &apos; Script to invoke when mouse leaves dialog
136 Private _OnMousePressed As String &apos; Script to invoke when mouse clicked in dialog
137 Private _OnMouseReleased As String &apos; Script to invoke when mouse released in dialog
138 Private _MouseCounter As Integer &apos; Counts the number of events set on the listener
139 &apos; ---
140 Private _MouseMotionListener As Object &apos; com.sun.star.awt.XMouseMotionListener
141 Private _OnMouseDragged As String &apos; Script to invoke when mouse is dragged from the dialog
142 Private _OnMouseMoved As String &apos; Script to invoke when mouse is moved across the dialog
143 Private _MouseMotionCounter As Integer &apos; Counts the number of events set on the listener
145 &apos; Persistent storage for controls
146 Private _ControlCache As Variant &apos; Array of control objects sorted like ElementNames of the Dialog model
148 REM ============================================================ MODULE CONSTANTS
150 &apos; Dialog usual buttons
151 Private Const cstOKBUTTON = 1
152 Private Const cstCANCELBUTTON = 0
154 &apos; Page management
155 Private Const PILOTCONTROL = 1
156 Private Const TABCONTROL = 2
157 Private Const BACKCONTROL = 3
158 Private Const NEXTCONTROL = 4
159 Private Const ITEMSTATECHANGED = 1
160 Private Const ACTIONPERFORMED = 2
162 REM ====================================================== CONSTRUCTOR/DESTRUCTOR
164 REM -----------------------------------------------------------------------------
165 Private Sub Class_Initialize()
166 Set [Me] = Nothing
167 Set [_Parent] = Nothing
168 ObjectType = &quot;DIALOG&quot;
169 ServiceName = &quot;SFDialogs.Dialog&quot;
170 _Container = &quot;&quot;
171 _Library = &quot;&quot;
172 _BuiltFromScratch = False
173 _BuiltInPython = False
174 _Name = &quot;&quot;
175 _CacheIndex = -1
176 Set _DialogProvider = Nothing
177 Set _DialogControl = Nothing
178 Set _DialogModel = Nothing
179 _Displayed = False
180 _Modal = True
182 _Left = SF_DialogUtils.MINPOSITION
183 _Top = SF_DialogUtils.MINPOSITION
184 _Width = -1
185 _Height = -1
187 _PageManagement = Array()
188 Set _ItemListener = Nothing
189 Set _ActionListener = Nothing
190 _LastPage = 0
192 Set _FocusListener = Nothing
193 _OnFocusGained = &quot;&quot;
194 _OnFocusLost = &quot;&quot;
195 _FocusCounter = 0
196 Set _KeyListener = Nothing
197 _OnKeyPressed = &quot;&quot;
198 _OnKeyReleased = &quot;&quot;
199 _KeyCounter = 0
200 Set _MouseListener = Nothing
201 _OnMouseEntered = &quot;&quot;
202 _OnMouseExited = &quot;&quot;
203 _OnMousePressed = &quot;&quot;
204 _OnMouseReleased = &quot;&quot;
205 _MouseCounter = 0
206 Set _MouseMotionListener = Nothing
207 _OnMouseDragged = &quot;&quot;
208 _OnMouseMoved = &quot;&quot;
209 _MouseMotionCounter = 0
210 _ControlCache = Array()
211 End Sub &apos; SFDialogs.SF_Dialog Constructor
213 REM -----------------------------------------------------------------------------
214 Private Sub Class_Terminate()
215 Call Class_Initialize()
216 End Sub &apos; SFDialogs.SF_Dialog Destructor
218 REM -----------------------------------------------------------------------------
219 Public Function Dispose() As Variant
220 If _CacheIndex &gt;= 0 Then Terminate()
221 Call Class_Terminate()
222 Set Dispose = Nothing
223 End Function &apos; SFDialogs.SF_Dialog Explicit Destructor
225 REM ================================================================== PROPERTIES
227 REM -----------------------------------------------------------------------------
228 Property Get CANCELBUTTON() As Variant
229 CANCELBUTTON = cstCANCELBUTTON
230 End Property &apos; SFDialogs.SF_Dialog.CANCELBUTTON (get)
232 REM -----------------------------------------------------------------------------
233 Property Get Caption() As Variant
234 &apos;&apos;&apos; The Caption property refers to the title of the dialog
235 Caption = _PropertyGet(&quot;Caption&quot;)
236 End Property &apos; SFDialogs.SF_Dialog.Caption (get)
238 REM -----------------------------------------------------------------------------
239 Property Let Caption(Optional ByVal pvCaption As Variant)
240 &apos;&apos;&apos; Set the updatable property Caption
241 _PropertySet(&quot;Caption&quot;, pvCaption)
242 End Property &apos; SFDialogs.SF_Dialog.Caption (let)
244 REM -----------------------------------------------------------------------------
245 Property Get Height() As Variant
246 &apos;&apos;&apos; The Height property refers to the height of the dialog box
247 Height = _PropertyGet(&quot;Height&quot;)
248 End Property &apos; SFDialogs.SF_Dialog.Height (get)
250 REM -----------------------------------------------------------------------------
251 Property Let Height(Optional ByVal pvHeight As Variant)
252 &apos;&apos;&apos; Set the updatable property Height
253 _PropertySet(&quot;Height&quot;, pvHeight)
254 End Property &apos; SFDialogs.SF_Dialog.Height (let)
256 REM -----------------------------------------------------------------------------
257 Property Get Modal() As Boolean
258 &apos;&apos;&apos; The Modal property specifies if the dialog box has been executed in modal mode
259 Modal = _PropertyGet(&quot;Modal&quot;)
260 End Property &apos; SFDialogs.SF_Dialog.Modal (get)
262 REM -----------------------------------------------------------------------------
263 Property Get Name() As String
264 &apos;&apos;&apos; Return the name of the actual dialog
265 Name = _PropertyGet(&quot;Name&quot;)
266 End Property &apos; SFDialogs.SF_Dialog.Name
268 REM -----------------------------------------------------------------------------
269 Property Get OKBUTTON() As Variant
270 OKBUTTON = cstOKBUTTON
271 End Property &apos; SFDialogs.SF_Dialog.OKBUTTON (get)
273 REM -----------------------------------------------------------------------------
274 Property Get OnFocusGained() As Variant
275 &apos;&apos;&apos; Get the script associated with the OnFocusGained event
276 OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
277 End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (get)
279 REM -----------------------------------------------------------------------------
280 Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
281 &apos;&apos;&apos; Set the updatable property OnFocusGained
282 _PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
283 End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (let)
285 REM -----------------------------------------------------------------------------
286 Property Get OnFocusLost() As Variant
287 &apos;&apos;&apos; Get the script associated with the OnFocusLost event
288 OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
289 End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (get)
291 REM -----------------------------------------------------------------------------
292 Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
293 &apos;&apos;&apos; Set the updatable property OnFocusLost
294 _PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
295 End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (let)
297 REM -----------------------------------------------------------------------------
298 Property Get OnKeyPressed() As Variant
299 &apos;&apos;&apos; Get the script associated with the OnKeyPressed event
300 OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
301 End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (get)
303 REM -----------------------------------------------------------------------------
304 Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
305 &apos;&apos;&apos; Set the updatable property OnKeyPressed
306 _PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
307 End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (let)
309 REM -----------------------------------------------------------------------------
310 Property Get OnKeyReleased() As Variant
311 &apos;&apos;&apos; Get the script associated with the OnKeyReleased event
312 OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
313 End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (get)
315 REM -----------------------------------------------------------------------------
316 Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
317 &apos;&apos;&apos; Set the updatable property OnKeyReleased
318 _PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
319 End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (let)
321 REM -----------------------------------------------------------------------------
322 Property Get OnMouseDragged() As Variant
323 &apos;&apos;&apos; Get the script associated with the OnMouseDragged event
324 OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
325 End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (get)
327 REM -----------------------------------------------------------------------------
328 Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
329 &apos;&apos;&apos; Set the updatable property OnMouseDragged
330 _PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
331 End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (let)
333 REM -----------------------------------------------------------------------------
334 Property Get OnMouseEntered() As Variant
335 &apos;&apos;&apos; Get the script associated with the OnMouseEntered event
336 OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
337 End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (get)
339 REM -----------------------------------------------------------------------------
340 Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
341 &apos;&apos;&apos; Set the updatable property OnMouseEntered
342 _PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
343 End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (let)
345 REM -----------------------------------------------------------------------------
346 Property Get OnMouseExited() As Variant
347 &apos;&apos;&apos; Get the script associated with the OnMouseExited event
348 OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
349 End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (get)
351 REM -----------------------------------------------------------------------------
352 Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
353 &apos;&apos;&apos; Set the updatable property OnMouseExited
354 _PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
355 End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (let)
357 REM -----------------------------------------------------------------------------
358 Property Get OnMouseMoved() As Variant
359 &apos;&apos;&apos; Get the script associated with the OnMouseMoved event
360 OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
361 End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (get)
363 REM -----------------------------------------------------------------------------
364 Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
365 &apos;&apos;&apos; Set the updatable property OnMouseMoved
366 _PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
367 End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (let)
369 REM -----------------------------------------------------------------------------
370 Property Get OnMousePressed() As Variant
371 &apos;&apos;&apos; Get the script associated with the OnMousePressed event
372 OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
373 End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (get)
375 REM -----------------------------------------------------------------------------
376 Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
377 &apos;&apos;&apos; Set the updatable property OnMousePressed
378 _PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
379 End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (let)
381 REM -----------------------------------------------------------------------------
382 Property Get OnMouseReleased() As Variant
383 &apos;&apos;&apos; Get the script associated with the OnMouseReleased event
384 OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
385 End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (get)
387 REM -----------------------------------------------------------------------------
388 Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
389 &apos;&apos;&apos; Set the updatable property OnMouseReleased
390 _PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
391 End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (let)
393 REM -----------------------------------------------------------------------------
394 Property Get Page() As Variant
395 &apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step.
396 &apos;&apos;&apos; The Page property of the Dialog object defines which page of the dialog is active.
397 &apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
398 &apos;&apos;&apos; For example, if a control has a page value of 1, it is only visible on page 1 of the dialog.
399 &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
400 &apos;&apos;&apos; and all controls with a page value of 2 become visible.
401 Page = _PropertyGet(&quot;Page&quot;)
402 End Property &apos; SFDialogs.SF_Dialog.Page (get)
404 REM -----------------------------------------------------------------------------
405 Property Let Page(Optional ByVal pvPage As Variant)
406 &apos;&apos;&apos; Set the updatable property Page
407 _PropertySet(&quot;Page&quot;, pvPage)
408 End Property &apos; SFDialogs.SF_Dialog.Page (let)
410 REM -----------------------------------------------------------------------------
411 Property Get Visible() As Variant
412 &apos;&apos;&apos; The Visible property is False before the Execute() statement
413 Visible = _PropertyGet(&quot;Visible&quot;)
414 End Property &apos; SFDialogs.SF_Dialog.Visible (get)
416 REM -----------------------------------------------------------------------------
417 Property Let Visible(Optional ByVal pvVisible As Variant)
418 &apos;&apos;&apos; Set the updatable property Visible
419 _PropertySet(&quot;Visible&quot;, pvVisible)
420 End Property &apos; SFDialogs.SF_Dialog.Visible (let)
422 REM -----------------------------------------------------------------------------
423 Property Get Width() As Variant
424 &apos;&apos;&apos; The Width property refers to the Width of the dialog box
425 Width = _PropertyGet(&quot;Width&quot;)
426 End Property &apos; SFDialogs.SF_Dialog.Width (get)
428 REM -----------------------------------------------------------------------------
429 Property Let Width(Optional ByVal pvWidth As Variant)
430 &apos;&apos;&apos; Set the updatable property Width
431 _PropertySet(&quot;Width&quot;, pvWidth)
432 End Property &apos; SFDialogs.SF_Dialog.Width (let)
434 REM -----------------------------------------------------------------------------
435 Property Get XDialogModel() As Object
436 &apos;&apos;&apos; The XDialogModel property returns the model UNO object of the dialog
437 XDialogModel = _PropertyGet(&quot;XDialogModel&quot;)
438 End Property &apos; SFDialogs.SF_Dialog.XDialogModel (get)
440 REM -----------------------------------------------------------------------------
441 Property Get XDialogView() As Object
442 &apos;&apos;&apos; The XDialogView property returns the view UNO object of the dialog
443 XDialogView = _PropertyGet(&quot;XDialogView&quot;)
444 End Property &apos; SFDialogs.SF_Dialog.XDialogView (get)
446 REM ===================================================================== METHODS
448 REM -----------------------------------------------------------------------------
449 Public Function Activate() As Boolean
450 &apos;&apos;&apos; Set the focus on the current dialog instance
451 &apos;&apos;&apos; Probably called from after an event occurrence or to focus on a non-modal dialog
452 &apos;&apos;&apos; Args:
453 &apos;&apos;&apos; Returns:
454 &apos;&apos;&apos; True if focusing is successful
455 &apos;&apos;&apos; Example:
456 &apos;&apos;&apos; Dim oDlg As Object
457 &apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
458 &apos;&apos;&apos; oDlg.Activate()
460 Dim bActivate As Boolean &apos; Return value
461 Const cstThisSub = &quot;SFDialogs.Dialog.Activate&quot;
462 Const cstSubArgs = &quot;&quot;
464 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
465 bActivate = False
467 Check:
468 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
469 If Not _IsStillAlive() Then GoTo Finally
470 End If
471 Try:
472 If Not IsNull(_DialogControl) Then
473 _DialogControl.setFocus()
474 bActivate = True
475 End If
477 Finally:
478 Activate = bActivate
479 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
480 Exit Function
481 Catch:
482 GoTo Finally
483 End Function &apos; SFDialogs.SF_Dialog.Activate
485 REM -----------------------------------------------------------------------------
486 Public Function Center(Optional ByRef Parent As Variant) As Boolean
487 &apos;&apos;&apos; Center the actual dialog instance in the middle of a parent window
488 &apos;&apos;&apos; Without arguments, the method centers the dialog in the middle of the current window
489 &apos;&apos;&apos; Args:
490 &apos;&apos;&apos; Parent: an object, either
491 &apos;&apos;&apos; - a ScriptForge dialog object
492 &apos;&apos;&apos; - a ScriptForge document (Calc, Base, ...) object
493 &apos;&apos;&apos; Returns:
494 &apos;&apos;&apos; True when successful
495 &apos;&apos;&apos; Examples:
496 &apos;&apos;&apos; Sub TriggerEvent(oEvent As Object)
497 &apos;&apos;&apos; Dim oDialog1 As Object, oDialog2 As Object, lExec As Long
498 &apos;&apos;&apos; Set oDialog1 = CreateScriptService(&quot;DialogEvent&quot;, oEvent) &apos; The dialog having caused the event
499 &apos;&apos;&apos; Set oDialog2 = CreateScriptService(&quot;Dialog&quot;, ...) &apos; Open a second dialog
500 &apos;&apos;&apos; oDialog2.Center(oDialog1)
501 &apos;&apos;&apos; lExec = oDialog2.Execute()
502 &apos;&apos;&apos; Select Case lExec
503 &apos;&apos;&apos; ...
504 &apos;&apos;&apos; End Sub
506 Dim bCenter As Boolean &apos; Return value
507 Dim oUi As Object &apos; ScriptForge.SF_UI
508 Dim oObjDesc As Object &apos; _ObjectDescriptor type
509 Dim sObjectType As String &apos; Can be uno or sf object type
510 Dim oParent As Object &apos; UNO alias of parent
511 Dim oParentPosSize As Object &apos; Parent com.sun.star.awt.Rectangle
512 Dim lParentX As Long &apos; X position of parent dialog
513 Dim lParentY As Long &apos; Y position of parent dialog
514 Dim oPosSize As Object &apos; Dialog com.sun.star.awt.Rectangle
515 Const cstThisSub = &quot;SFDialogs.Dialog.Center&quot;
516 Const cstSubArgs = &quot;[Parent]&quot;
518 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
519 bCenter = False
521 Check:
522 If IsMissing(Parent) Or IsEmpty(Parent) Then Set Parent = Nothing
523 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
524 If Not ScriptForge.SF_Utils._Validate(Parent, &quot;Parent&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
525 End If
527 Set oParentPosSize = Nothing
528 lParentX = 0 : lParentY = 0
529 If IsNull(Parent) Then
530 Set oUi = CreateScriptService(&quot;UI&quot;)
531 Set oParentPosSize = oUi._PosSize() &apos; Return the position and dimensions of the active window
532 Else
533 &apos; Determine the object type
534 Set oObjDesc = ScriptForge.SF_Utils._VarTypeObj(Parent)
535 If oObjDesc.iVarType = ScriptForge.V_SFOBJECT Then &apos; ScriptForge object
536 sObjectType = oObjDesc.sObjectType
537 &apos; Document or dialog ?
538 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
539 If sObjectType = &quot;DIALOG&quot; Then
540 Set oParent = Parent._DialogControl
541 Set oParentPosSize = oParent.getPosSize()
542 lParentX = oParentPosSize.X
543 lParentY = oParentPosSize.Y
544 Else
545 Set oParent = Parent._Component.getCurrentController().Frame.getComponentWindow()
546 Set oParentPosSize = oParent.getPosSize()
547 End If
548 Else
549 GoTo Finally &apos; UNO object, do nothing
550 End If
551 End If
552 If IsNull(oParentPosSize) Then GoTo Finally
554 Try:
555 Set oPosSize = _DialogControl.getPosSize()
556 With oPosSize
557 _DialogControl.setPosSize( _
558 lParentX + CLng((oParentPosSize.Width - .Width) \ 2) _
559 , lParentY + CLng((oParentPosSize.Height - .Height) \ 2) _
560 , .Width _
561 , .Height _
562 , com.sun.star.awt.PosSize.POSSIZE)
563 End With
564 bCenter = True
566 Finally:
567 Center = bCenter
568 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
569 Exit Function
570 Catch:
571 GoTo Finally
572 End Function &apos; SF_Documents.SF_Dialog.Center
574 REM -----------------------------------------------------------------------------
575 Public Function CloneControl(Optional ByVal SourceName As Variant _
576 , Optional ByVal ControlName As Variant _
577 , Optional ByVal Left As Variant _
578 , Optional ByVal Top As Variant _
579 ) As Object
580 &apos;&apos;&apos; Duplicate an existing control of any type in the actual dialog.
581 &apos;&apos;&apos; The duplicated control is left unchanged. The new control can be relocated.
582 &apos;&apos;&apos; Specific args:
583 &apos;&apos;&apos; SourceName: the name of the control to duplicate
584 &apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
585 &apos;&apos;&apos; Left, Top: the coordinates of the new control expressed in &quot;Map AppFont&quot; units
586 &apos;&apos;&apos; Returns:
587 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
588 &apos;&apos;&apos; Example:
589 &apos;&apos;&apos; Set myButton2 = dialog.CloneControl(&quot;Button1&quot;, &quot;Button2&quot;, 30, 30)
591 Dim oControl As Object &apos; Return value
592 Dim oSourceModel As Object &apos; com.sun.star.awt.XControlModel of the source
593 Dim oControlModel As Object &apos; com.sun.star.awt.XControlModel of the new control
594 Const cstThisSub = &quot;SFDialogs.Dialog.CloneControl&quot;
595 Const cstSubArgs = &quot;SourceName, ControlName, [Left=1], [Top=1]&quot;
597 Check:
598 Set oControl = Nothing
600 If IsMissing(Left) Or IsEmpty(Left) Then Left = 1
601 If IsMissing(Top) Or IsEmpty(Top) Then Top = 1
603 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place := Null) Then GoTo Finally
605 If Not ScriptForge.SF_Utils._Validate(SourceName, &quot;SourceName&quot;, V_String, _DialogModel.getElementNames()) Then GoTo Finally
606 If Not ScriptForge.SF_Utils._Validate(Left, &quot;Left&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
607 If Not ScriptForge.SF_Utils._Validate(Top, &quot;Top&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
609 Try:
610 &apos; All control types are presumes cloneable
611 Set oSourceModel = _DialogModel.getByName(SourceName)
612 Set oControlModel = oSourceModel.createClone()
613 oControlModel.Name = ControlName
615 &apos; Create the control
616 Set oControl = _CreateNewControl(oControlModel, ControlName, Array(Left, Top))
618 Finally:
619 Set CloneControl = oControl
620 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
621 Exit Function
622 Catch:
623 GoTo Finally
624 End Function &apos; SFDialogs.SF_Dialog.CloneControl
626 REM -----------------------------------------------------------------------------
627 Public Function Controls(Optional ByVal ControlName As Variant) As Variant
628 &apos;&apos;&apos; Return either
629 &apos;&apos;&apos; - the list of the controls contained in the dialog
630 &apos;&apos;&apos; - a dialog control object based on its name
631 &apos;&apos;&apos; Args:
632 &apos;&apos;&apos; ControlName: a valid control name as a case-sensitive string. If absent the list is returned
633 &apos;&apos;&apos; Returns:
634 &apos;&apos;&apos; A zero-base array of strings if ControlName is absent
635 &apos;&apos;&apos; An instance of the SF_DialogControl class if ControlName exists
636 &apos;&apos;&apos; Exceptions:
637 &apos;&apos;&apos; ControlName is invalid
638 &apos;&apos;&apos; Example:
639 &apos;&apos;&apos; Dim myDialog As Object, myList As Variant, myControl As Object
640 &apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, Container, Library, DialogName)
641 &apos;&apos;&apos; myList = myDialog.Controls()
642 &apos;&apos;&apos; Set myControl = myDialog.Controls(&quot;myTextBox&quot;)
644 Dim oControl As Object &apos; The new control class instance
645 Dim lIndexOfNames As Long &apos; Index in ElementNames array. Used to access _ControlCache
646 Dim vControl As Variant &apos; Alias of _ControlCache entry
647 Const cstThisSub = &quot;SFDialogs.Dialog.Controls&quot;
648 Const cstSubArgs = &quot;[ControlName]&quot;
650 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
652 Check:
653 If IsMissing(ControlName) Or IsEmpty(ControlName) Then ControlName = &quot;&quot;
654 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
655 If Not _IsStillAlive() Then GoTo Finally
656 If Not ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING) Then GoTo Finally
657 End If
659 Try:
660 If Len(ControlName) = 0 Then
661 Controls = _DialogModel.getElementNames()
662 Else
663 If Not _DialogModel.hasByName(ControlName) Then GoTo CatchNotFound
664 lIndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
665 &apos; Reuse cache when relevant
666 vControl = _ControlCache(lIndexOfNames)
667 If IsEmpty(vControl) Then
668 &apos; Create the new dialog control class instance
669 Set oControl = New SF_DialogControl
670 With oControl
671 ._Name = ControlName
672 Set .[Me] = oControl
673 Set .[_Parent] = [Me]
674 ._IndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
675 ._DialogName = _Name
676 Set ._ControlModel = _DialogModel.getByName(ControlName)
677 Set ._ControlView = _DialogControl.getControl(ControlName)
678 ._ControlView.setModel(._ControlModel)
679 ._Initialize()
680 End With
681 Else
682 Set oControl = vControl
683 End If
684 Set Controls = oControl
685 End If
687 Finally:
688 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
689 Exit Function
690 Catch:
691 GoTo Finally
692 CatchNotFound:
693 ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING, _DialogModel.getElementNames())
694 GoTo Finally
695 End Function &apos; SFDialogs.SF_Dialog.Controls
697 &apos;&apos;&apos; CreateXXX functions:
698 &apos;&apos;&apos; -------------------
699 &apos;&apos;&apos; Common arguments:
700 &apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet.
701 &apos;&apos;&apos; Place: either
702 &apos;&apos;&apos; - an array with 4 elements: (X, Y, Width, Height)
703 &apos;&apos;&apos; - a com.sun.star.awt.Rectangle [X, Y, Width, Height]
704 &apos;&apos;&apos; All elements are expressed in &quot;Map AppFont&quot; units.
706 REM -----------------------------------------------------------------------------
707 Public Function CreateButton(Optional ByVal ControlName As Variant _
708 , Optional ByRef Place As Variant _
709 , Optional ByVal Toggle As Variant _
710 , Optional ByVal Push As Variant _
711 ) As Object
712 &apos;&apos;&apos; Create a new control of type Button in the actual dialog.
713 &apos;&apos;&apos; Specific args:
714 &apos;&apos;&apos; Toggle: when True a Toggle button is created. Default = False
715 &apos;&apos;&apos; Push: &quot;OK&quot;, &quot;CANCEL&quot; or &quot;&quot; (default)
716 &apos;&apos;&apos; Returns:
717 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
718 &apos;&apos;&apos; Example:
719 &apos;&apos;&apos; Set myButton = dialog.CreateButton(&quot;Button1&quot;, Array(20, 20, 60, 15))
721 Dim oControl As Object &apos; Return value
722 Dim iPush As Integer &apos; Alias of Push
723 Dim vPropNames As Variant &apos; Array of names of specific arguments
724 Dim vPropValues As Variant &apos; Array of values of specific arguments
725 Const cstThisSub = &quot;SFDialogs.Dialog.CreateButton&quot;
726 Const cstSubArgs = &quot;ControlName, Place, [Toggle=False], [Push=&quot;&quot;&quot;&quot;|&quot;&quot;OK&quot;&quot;|&quot;&quot;CANCEL&quot;&quot;]&quot;
728 Check:
729 Set oControl = Nothing
730 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
732 If IsMissing(Toggle) Or IsEmpty(Toggle) Then Toggle = False
733 If IsMissing(Push) Or IsEmpty(Push) Then Push = &quot;&quot;
734 If Not ScriptForge.SF_Utils._Validate(Toggle, &quot;Toggle&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
735 If Not ScriptForge.SF_Utils._Validate(Push, &quot;Push&quot;, V_STRING, Array(&quot;&quot;, &quot;OK&quot;, &quot;CANCEL&quot;)) Then GoTo Finally
737 Try:
738 &apos; Handle specific arguments
739 Select Case UCase(Push)
740 Case &quot;&quot; : iPush = com.sun.star.awt.PushButtonType.STANDARD
741 Case &quot;OK&quot; : iPush = com.sun.star.awt.PushButtonType.OK
742 Case &quot;CANCEL&quot; : iPush = com.sun.star.awt.PushButtonType.CANCEL
743 End Select
744 vPropNames = Array(&quot;Toggle&quot;, &quot;PushButtonType&quot;)
745 vPropValues = Array(CBool(Toggle), iPush)
747 &apos; Create the control
748 Set oControl = _CreateNewControl(&quot;UnoControlButtonModel&quot;, ControlName, Place, vPropNames, vPropValues)
750 Finally:
751 Set CreateButton = oControl
752 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
753 Exit Function
754 End Function &apos; SFDialogs.SF_Dialog.CreateButton
756 REM -----------------------------------------------------------------------------
757 Public Function CreateCheckBox(Optional ByVal ControlName As Variant _
758 , Optional ByRef Place As Variant _
759 , Optional ByVal MultiLine As Variant _
760 ) As Object
761 &apos;&apos;&apos; Create a new control of type CheckBox in the actual dialog.
762 &apos;&apos;&apos; Specific args:
763 &apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
764 &apos;&apos;&apos; Returns:
765 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
766 &apos;&apos;&apos; Example:
767 &apos;&apos;&apos; Set myCheckBox = dialog.CreateCheckBox(&quot;CheckBox1&quot;, Array(20, 20, 60, 15), MultiLine := True)
769 Dim oControl As Object &apos; Return value
770 Dim vPropNames As Variant &apos; Array of names of specific arguments
771 Dim vPropValues As Variant &apos; Array of values of specific arguments
772 Const cstThisSub = &quot;SFDialogs.Dialog.CreateCheckBox&quot;
773 Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False]&quot;
775 Check:
776 Set oControl = Nothing
777 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
779 If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
780 If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
782 Try:
783 &apos; Manage specific properties
784 vPropNames = Array(&quot;VisualEffect&quot;, &quot;MultiLine&quot;)
785 vPropValues = Array(1, CBool(MultiLine))
787 &apos; Create the control
788 Set oControl = _CreateNewControl(&quot;UnoControlCheckBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
790 Finally:
791 Set CreateCheckBox = oControl
792 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
793 Exit Function
794 End Function &apos; SFDialogs.SF_Dialog.CreateCheckBox
796 REM -----------------------------------------------------------------------------
797 Public Function CreateComboBox(Optional ByVal ControlName As Variant _
798 , Optional ByRef Place As Variant _
799 , Optional ByVal Border As Variant _
800 , Optional ByVal Dropdown As Variant _
801 , Optional ByVal LineCount As Variant _
802 ) As Object
803 &apos;&apos;&apos; Create a new control of type ComboBox in the actual dialog.
804 &apos;&apos;&apos; Specific args:
805 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
806 &apos;&apos;&apos; Dropdown: When True (default), a drop down button is displayed
807 &apos;&apos;&apos; LineCount: Specifies the maximum line count displayed in the drop down (default = 5)
808 &apos;&apos;&apos; Returns:
809 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
810 &apos;&apos;&apos; Example:
811 &apos;&apos;&apos; Set myComboBox = dialog.CreateComboBox(&quot;ComboBox1&quot;, Array(20, 20, 60, 15), Dropdown := True)
813 Dim oControl As Object &apos; Return value
814 Dim iBorder As Integer &apos; Alias of border
815 Dim vPropNames As Variant &apos; Array of names of specific arguments
816 Dim vPropValues As Variant &apos; Array of values of specific arguments
817 Const cstThisSub = &quot;SFDialogs.Dialog.CreateComboBox&quot;
818 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;
820 Check:
821 Set oControl = Nothing
822 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
824 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
825 If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = True
826 If IsMissing(LineCount) Or IsEmpty(LineCount) Then LineCount = 5
828 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
829 If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
830 If Not ScriptForge.SF_Utils._Validate(LineCount, &quot;LineCount&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
832 Try:
833 &apos; Manage specific properties
834 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
835 vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;LineCount&quot;)
836 vPropValues = Array(iBorder, CBool(Dropdown), CInt(LineCount))
838 &apos; Create the control
839 Set oControl = _CreateNewControl(&quot;UnoControlComboBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
841 Finally:
842 Set CreateComboBox = oControl
843 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
844 Exit Function
845 End Function &apos; SFDialogs.SF_Dialog.CreateComboBox
847 REM -----------------------------------------------------------------------------
848 Public Function CreateCurrencyField(Optional ByVal ControlName As Variant _
849 , Optional ByRef Place As Variant _
850 , Optional ByVal Border As Variant _
851 , Optional ByVal SpinButton As Variant _
852 , Optional ByVal MinValue As Variant _
853 , Optional ByVal MaxValue As Variant _
854 , Optional ByVal Increment As Variant _
855 , Optional ByVal Accuracy As Variant _
856 ) As Object
857 &apos;&apos;&apos; Create a new control of type CurrencyField in the actual dialog.
858 &apos;&apos;&apos; Specific args:
859 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
860 &apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
861 &apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Dafault = -1000000
862 &apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Dafault = +1000000
863 &apos;&apos;&apos; Increment: the step when the spin button is pressed. Default = 1
864 &apos;&apos;&apos; Accuracy: specifies the decimal accuracy. Default = 2 decimal digits
865 &apos;&apos;&apos; Returns:
866 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
867 &apos;&apos;&apos; Example:
868 &apos;&apos;&apos; Set myCurrencyField = dialog.CreateCurrencyField(&quot;CurrencyField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
870 Dim oControl As Object &apos; Return value
871 Dim iBorder As Integer &apos; Alias of border
872 Dim vPropNames As Variant &apos; Array of names of specific arguments
873 Dim vPropValues As Variant &apos; Array of values of specific arguments
874 Const cstThisSub = &quot;SFDialogs.Dialog.CreateCurrencyField&quot;
875 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; _
876 &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000], [Increment=1], [Accuracy=2]&quot;
878 Check:
879 Set oControl = Nothing
880 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
882 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
883 If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
884 If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
885 If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
886 If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1.00
887 If IsMissing(Accuracy) Or IsEmpty(Accuracy) Then Accuracy = 2
889 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
890 If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
891 If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
892 If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
893 If Not ScriptForge.SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
894 If Not ScriptForge.SF_Utils._Validate(Accuracy, &quot;Accuracy&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
896 Try:
897 &apos; Manage specific properties
898 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
899 vPropNames = Array(&quot;Border&quot;, &quot;Spin&quot;, &quot;ValueMin&quot;, &quot;ValueMax&quot;, &quot;ValueStep&quot;, &quot;DecimalAccuracy&quot;)
900 vPropValues = Array(iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue), CDbl(Increment), CInt(Accuracy))
902 &apos; Create the control
903 Set oControl = _CreateNewControl(&quot;UnoControlCurrencyFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
905 Finally:
906 Set CreateCurrencyField = oControl
907 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
908 Exit Function
909 End Function &apos; SFDialogs.SF_Dialog.CreateCurrencyField
911 REM -----------------------------------------------------------------------------
912 Public Function CreateDateField(Optional ByVal ControlName As Variant _
913 , Optional ByRef Place As Variant _
914 , Optional ByVal Border As Variant _
915 , Optional ByVal Dropdown As Variant _
916 , Optional ByVal MinDate As Variant _
917 , Optional ByVal MaxDate As Variant _
918 ) As Object
919 &apos;&apos;&apos; Create a new control of type DateField in the actual dialog.
920 &apos;&apos;&apos; Specific args:
921 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
922 &apos;&apos;&apos; Dropdown:: when True (default = False), a dropdown button is shown
923 &apos;&apos;&apos; MinDate: the smallest date that can be entered in the control. Dafault = 1900-01-01
924 &apos;&apos;&apos; MaxDate: the largest Date that can be entered in the control. Dafault = 2200-12-31
925 &apos;&apos;&apos; Returns:
926 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
927 &apos;&apos;&apos; Example:
928 &apos;&apos;&apos; Set myDateField = dialog.CreateDateField(&quot;DateField1&quot;, Array(20, 20, 60, 15), Dropdown := True)
930 Dim oControl As Object &apos; Return Date
931 Dim iBorder As Integer &apos; Alias of border
932 Dim oMinDate As New com.sun.star.util.Date
933 Dim oMaxDate As New com.sun.star.util.Date
934 Dim vFormats As Variant &apos; List of available date formats
935 Dim vPropNames As Variant &apos; Array of names of specific arguments
936 Dim vPropValues As Variant &apos; Array of values of specific arguments
937 Const cstThisSub = &quot;SFDialogs.Dialog.CreateDateField&quot;
938 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [Dropdown=False]&quot; _
939 &amp; &quot;, [MinDate=DateSerial(1900, 1, 1)], [MaxDate=DateSerial(2200, 12, 31)]&quot;
941 Check:
942 Set oControl = Nothing
943 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
945 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
946 If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = False
947 If IsMissing(MinDate) Or IsEmpty(MinDate) Then MinDate = DateSerial(1900, 1, 1)
948 If IsMissing(MaxDate) Or IsEmpty(MaxDate) Then MaxDate = DateSerial(2200, 12, 31)
950 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
951 If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
952 If Not ScriptForge.SF_Utils._Validate(MinDate, &quot;MinDate&quot;, ScriptForge.V_DATE) Then GoTo Finally
953 If Not ScriptForge.SF_Utils._Validate(MaxDate, &quot;MaxDate&quot;, ScriptForge.V_DATE) Then GoTo Finally
954 vFormats = SF_DialogUtils._FormatsList(&quot;DateField&quot;)
956 Try:
957 &apos; Manage specific properties
958 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
959 With oMinDate
960 .Year = Year(MinDate) : .Month = Month(MinDate) : .Day = Day(MinDate)
961 End With
962 With oMaxDate
963 .Year = Year(MaxDate) : .Month = Month(MaxDate) : .Day = Day(MaxDate)
964 End With
965 vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;DateMin&quot;, &quot;DateMax&quot;, &quot;DateFormat&quot;)
966 vPropValues = Array(iBorder, CBool(Dropdown), oMinDate, oMaxDate, CInt(ScriptForge.SF_Array.IndexOf(vFormats(), &quot;Standard (short)&quot;)))
968 &apos; Create the control
969 Set oControl = _CreateNewControl(&quot;UnoControlDateFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
971 Finally:
972 Set CreateDateField = oControl
973 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
974 Exit Function
975 End Function &apos; SFDialogs.SF_Dialog.CreateDateField
977 REM -----------------------------------------------------------------------------
978 Public Function CreateFileControl(Optional ByVal ControlName As Variant _
979 , Optional ByRef Place As Variant _
980 , Optional ByVal Border As Variant _
981 ) As Object
982 &apos;&apos;&apos; Create a new control of type FileControl in the actual dialog.
983 &apos;&apos;&apos; Specific args:
984 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
985 &apos;&apos;&apos; Returns:
986 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
987 &apos;&apos;&apos; Example:
988 &apos;&apos;&apos; Set myFileControl = dialog.CreateFileControl(&quot;FileControl1&quot;, Array(20, 20, 60, 15))
990 Dim oControl As Object &apos; Return value
991 Dim iBorder As Integer &apos; Alias of border
992 Dim vPropNames As Variant &apos; Array of names of specific arguments
993 Dim vPropValues As Variant &apos; Array of values of specific arguments
994 Const cstThisSub = &quot;SFDialogs.Dialog.CreateFileControl&quot;
995 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot;
997 Check:
998 Set oControl = Nothing
999 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1001 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1002 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
1004 Try:
1005 &apos; Manage specific properties
1006 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1007 vPropNames = Array(&quot;Border&quot;)
1008 vPropValues = Array(iBorder)
1010 &apos; Create the control
1011 Set oControl = _CreateNewControl(&quot;UnoControlFileControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
1013 Finally:
1014 Set CreateFileControl = oControl
1015 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1016 Exit Function
1017 Catch:
1018 GoTo Finally
1019 End Function &apos; SFDialogs.SF_Dialog.CreateFileControl
1021 REM -----------------------------------------------------------------------------
1022 Public Function CreateFixedLine(Optional ByVal ControlName As Variant _
1023 , Optional ByRef Place As Variant _
1024 , Optional ByVal Orientation As Variant _
1025 ) As Object
1026 &apos;&apos;&apos; Create a new control of type FixedLine in the actual dialog.
1027 &apos;&apos;&apos; Specific args:
1028 &apos;&apos;&apos; Orientation: &quot;H[orizontal]&quot; or &quot;V[ertical]&quot;.
1029 &apos;&apos;&apos; Returns:
1030 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1031 &apos;&apos;&apos; Example:
1032 &apos;&apos;&apos; Set myFixedLine = dialog.CreateFixedLine(&quot;FixedLine1&quot;, Array(20, 20, 60, 15), Orientation := &quot;vertical&quot;)
1034 Dim oControl As Object &apos; Return value
1035 Dim vPropNames As Variant &apos; Array of names of specific arguments
1036 Dim vPropValues As Variant &apos; Array of values of specific arguments
1037 Const cstThisSub = &quot;SFDialogs.Dialog.CreateFixedLine&quot;
1038 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;
1040 Check:
1041 Set oControl = Nothing
1042 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1044 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
1046 Try:
1047 &apos; Manage specific properties
1048 vPropNames = Array(&quot;Orientation&quot;)
1049 vPropValues = Array(CLng(Iif(Left(UCase(Orientation), 1) = &quot;V&quot;, 1, 0)))
1051 &apos; Create the control
1052 Set oControl = _CreateNewControl(&quot;UnoControlFixedLineModel&quot;, ControlName, Place, vPropNames, vPropValues)
1054 Finally:
1055 Set CreateFixedLine = oControl
1056 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1057 Exit Function
1058 End Function &apos; SFDialogs.SF_Dialog.CreateFixedLine
1060 REM -----------------------------------------------------------------------------
1061 Public Function CreateFixedText(Optional ByVal ControlName As Variant _
1062 , Optional ByRef Place As Variant _
1063 , Optional ByVal Border As Variant _
1064 , Optional ByVal MultiLine As Variant _
1065 , Optional ByVal Align As Variant _
1066 , Optional ByVal VerticalAlign As Variant _
1067 ) As Object
1068 &apos;&apos;&apos; Create a new control of type FixedText in the actual dialog.
1069 &apos;&apos;&apos; Specific args:
1070 &apos;&apos;&apos; Border: &quot;NONE&quot; (default) or &quot;FLAT&quot; or &quot;3D&quot;
1071 &apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
1072 &apos;&apos;&apos; Align: horizontal alignment, &quot;LEFT&quot; (default) or &quot;CENTER&quot; or &quot;RIGHT&quot;
1073 &apos;&apos;&apos; VerticalAlign: vertical alignment, &quot;TOP&quot; (default) or &quot;MIDDLE&quot; or &quot;BOTTOM&quot;
1074 &apos;&apos;&apos; Returns:
1075 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1076 &apos;&apos;&apos; Example:
1077 &apos;&apos;&apos; Set myFixedText = dialog.CreateFixedText(&quot;FixedText1&quot;, Array(20, 20, 60, 15), MultiLine := True)
1079 Dim oControl As Object &apos; Return value
1080 Dim iBorder As Integer &apos; Alias of border
1081 Dim iAlign As Integer &apos; Alias of Align
1082 Dim iVerticalAlign As Integer &apos; Alias of VerticalAlign
1083 Dim vPropNames As Variant &apos; Array of names of specific arguments
1084 Dim vPropValues As Variant &apos; Array of values of specific arguments
1085 Const cstThisSub = &quot;SFDialogs.Dialog.CreateFixedText&quot;
1086 Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False], [Border=&quot;&quot;NONE&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;3D&quot;&quot;]&quot; _
1087 &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;
1089 Check:
1090 Set oControl = Nothing
1091 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1093 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;NONE&quot;
1094 If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
1095 If IsMissing(Align) Or IsEmpty(Align) Then Align = &quot;LEFT&quot;
1096 If IsMissing(VerticalAlign) Or IsEmpty(VerticalAlign) Then VerticalAlign = &quot;TOP&quot;
1098 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
1099 If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1100 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
1101 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
1103 Try:
1104 &apos; Manage specific properties
1105 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1106 iAlign = ScriptForge.SF_Array.IndexOf(Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;BOTTOM&quot;), Align)
1107 Select Case UCase(VerticalAlign)
1108 Case &quot;TOP&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.TOP
1109 Case &quot;MIDDLE&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.MIDDLE
1110 Case &quot;BOTTOM&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.BOTTOM
1111 End Select
1112 vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;Align&quot;, &quot;VerticalAlign&quot;)
1113 vPropValues = Array(iBorder, CBool(MultiLine), iAlign, iVerticalAlign)
1115 &apos; Create the control
1116 Set oControl = _CreateNewControl(&quot;UnoControlFixedTextModel&quot;, ControlName, Place, vPropNames, vPropValues)
1118 Finally:
1119 Set CreateFixedText = oControl
1120 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1121 Exit Function
1122 End Function &apos; SFDialogs.SF_Dialog.CreateFixedText
1124 REM -----------------------------------------------------------------------------
1125 Public Function CreateFormattedField(Optional ByVal ControlName As Variant _
1126 , Optional ByRef Place As Variant _
1127 , Optional ByVal Border As Variant _
1128 , Optional ByVal SpinButton As Variant _
1129 , Optional ByVal MinValue As Variant _
1130 , Optional ByVal MaxValue As Variant _
1131 ) As Object
1132 &apos;&apos;&apos; Create a new control of type FormattedField in the actual dialog.
1133 &apos;&apos;&apos; Specific args:
1134 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1135 &apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
1136 &apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Dafault = -1000000
1137 &apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Dafault = +1000000
1138 &apos;&apos;&apos; Returns:
1139 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1140 &apos;&apos;&apos; Example:
1141 &apos;&apos;&apos; Set myFormattedField = dialog.CreateFormattedField(&quot;FormattedField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
1142 &apos;&apos;&apos; myFormattedField.Format = &quot;##0,00E+00&quot;
1144 Dim oControl As Object &apos; Return value
1145 Dim iBorder As Integer &apos; Alias of border
1146 Dim vPropNames As Variant &apos; Array of names of specific arguments
1147 Dim vPropValues As Variant &apos; Array of values of specific arguments
1148 Const cstThisSub = &quot;SFDialogs.Dialog.CreateFormattedField&quot;
1149 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [SpinButton=False]&quot; _
1150 &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000]&quot;
1152 Check:
1153 Set oControl = Nothing
1154 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1156 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1157 If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
1158 If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
1159 If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
1161 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
1162 If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1163 If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1164 If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1166 Try:
1167 &apos; Manage specific properties
1168 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1169 vPropNames = Array(&quot;FormatsSupplier&quot;, &quot;Border&quot;, &quot;Spin&quot;, &quot;EffectiveMin&quot;, &quot;EffectiveMax&quot;)
1170 vPropValues = Array(CreateUnoService(&quot;com.sun.star.util.NumberFormatsSupplier&quot;) _
1171 , iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue))
1173 &apos; Create the control
1174 Set oControl = _CreateNewControl(&quot;UnoControlFormattedFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
1176 Finally:
1177 Set CreateFormattedField = oControl
1178 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1179 Exit Function
1180 Catch:
1181 GoTo Finally
1182 End Function &apos; SFDialogs.SF_Dialog.CreateFormattedField
1184 REM -----------------------------------------------------------------------------
1185 Public Function CreateGroupBox(Optional ByVal ControlName As Variant _
1186 , Optional ByRef Place As Variant _
1187 ) As Object
1188 &apos;&apos;&apos; Create a new control of type GroupBox in the actual dialog.
1189 &apos;&apos;&apos; Specific args:
1190 &apos;&apos;&apos; Orientation: &quot;H[orizontal]&quot; or &quot;V[ertical]&quot;
1191 &apos;&apos;&apos; Returns:
1192 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1193 &apos;&apos;&apos; Example:
1194 &apos;&apos;&apos; Set myGroupBox = dialog.CreateGroupBox(&quot;GroupBox1&quot;, Array(20, 20, 60, 15))
1196 Dim oControl As Object &apos; Return value
1197 Dim vPropNames As Variant &apos; Array of names of specific arguments
1198 Dim vPropValues As Variant &apos; Array of values of specific arguments
1199 Const cstThisSub = &quot;SFDialogs.Dialog.CreateGroupBox&quot;
1200 Const cstSubArgs = &quot;ControlName, Place&quot;
1202 Check:
1203 Set oControl = Nothing
1204 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1206 Try:
1207 &apos; Manage specific properties
1208 vPropNames = Array()
1209 vPropValues = Array()
1211 &apos; Create the control
1212 Set oControl = _CreateNewControl(&quot;UnoControlGroupBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
1214 Finally:
1215 Set CreateGroupBox = oControl
1216 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1217 Exit Function
1218 Catch:
1219 GoTo Finally
1220 End Function &apos; SFDialogs.SF_Dialog.CreateGroupBox
1222 REM -----------------------------------------------------------------------------
1223 Public Function CreateHyperlink(Optional ByVal ControlName As Variant _
1224 , Optional ByRef Place As Variant _
1225 , Optional ByVal Border As Variant _
1226 , Optional ByVal MultiLine As Variant _
1227 , Optional ByVal Align As Variant _
1228 , Optional ByVal VerticalAlign As Variant _
1229 ) As Object
1230 &apos;&apos;&apos; Create a new control of type Hyperlink in the actual dialog.
1231 &apos;&apos;&apos; Specific args:
1232 &apos;&apos;&apos; Border: &quot;NONE&quot; (default) or &quot;FLAT&quot; or &quot;3D&quot;
1233 &apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
1234 &apos;&apos;&apos; Align: horizontal alignment, &quot;LEFT&quot; (default) or &quot;CENTER&quot; or &quot;RIGHT&quot;
1235 &apos;&apos;&apos; VerticalAlign: vertical alignment, &quot;TOP&quot; (default) or &quot;MIDDLE&quot; or &quot;BOTTOM&quot;
1236 &apos;&apos;&apos; Returns:
1237 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1238 &apos;&apos;&apos; Example:
1239 &apos;&apos;&apos; Set myHyperlink = dialog.CreateHyperlink(&quot;Hyperlink1&quot;, Array(20, 20, 60, 15), MultiLine := True)
1241 Dim oControl As Object &apos; Return value
1242 Dim iBorder As Integer &apos; Alias of border
1243 Dim iAlign As Integer &apos; Alias of Align
1244 Dim iVerticalAlign As Integer &apos; Alias of VerticalAlign
1245 Dim vPropNames As Variant &apos; Array of names of specific arguments
1246 Dim vPropValues As Variant &apos; Array of values of specific arguments
1247 Const cstThisSub = &quot;SFDialogs.Dialog.CreateHyperlink&quot;
1248 Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False], [Border=&quot;&quot;NONE&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;3D&quot;&quot;]&quot; _
1249 &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;
1251 Check:
1252 Set oControl = Nothing
1253 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1255 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;NONE&quot;
1256 If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
1257 If IsMissing(Align) Or IsEmpty(Align) Then Align = &quot;LEFT&quot;
1258 If IsMissing(VerticalAlign) Or IsEmpty(VerticalAlign) Then VerticalAlign = &quot;TOP&quot;
1260 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
1261 If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1262 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
1263 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
1265 Try:
1266 &apos; Manage specific properties
1267 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1268 iAlign = ScriptForge.SF_Array.IndexOf(Array(&quot;LEFT&quot;, &quot;CENTER&quot;, &quot;BOTTOM&quot;), Align)
1269 Select Case UCase(VerticalAlign)
1270 Case &quot;TOP&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.TOP
1271 Case &quot;MIDDLE&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.MIDDLE
1272 Case &quot;BOTTOM&quot; : iVerticalAlign = com.sun.star.style.VerticalAlignment.BOTTOM
1273 End Select
1274 vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;Align&quot;, &quot;VerticalAlign&quot;)
1275 vPropValues = Array(iBorder, CBool(MultiLine), iAlign, iVerticalAlign)
1277 &apos; Create the control
1278 Set oControl = _CreateNewControl(&quot;UnoControlFixedHyperlinkModel&quot;, ControlName, Place, vPropNames, vPropValues)
1280 Finally:
1281 Set CreateHyperlink = oControl
1282 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1283 Exit Function
1284 End Function &apos; SFDialogs.SF_Dialog.CreateHyperlink
1286 REM -----------------------------------------------------------------------------
1287 Public Function CreateImageControl(Optional ByVal ControlName As Variant _
1288 , Optional ByRef Place As Variant _
1289 , Optional ByVal Border As Variant _
1290 , Optional ByVal Scale As Variant _
1291 ) As Object
1292 &apos;&apos;&apos; Create a new control of type ImageControl in the actual dialog.
1293 &apos;&apos;&apos; Specific args:
1294 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1295 &apos;&apos;&apos; Scale: One of next values: &quot;FITTOSIZE&quot; (default), &quot;KEEPRATIO&quot; or &quot;NO&quot;
1296 &apos;&apos;&apos; Returns:
1297 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1298 &apos;&apos;&apos; Example:
1299 &apos;&apos;&apos; Set myImageControl = dialog.CreateImageControl(&quot;ImageControl1&quot;, Array(20, 20, 60, 15))
1301 Dim oControl As Object &apos; Return value
1302 Dim iBorder As Integer &apos; Alias of border
1303 Dim iScale As Integer &apos; Alias of Scale
1304 Dim bScale As Boolean &apos; When False, no scaling
1305 Dim vPropNames As Variant &apos; Array of names of specific arguments
1306 Dim vPropValues As Variant &apos; Array of values of specific arguments
1307 Const cstThisSub = &quot;SFDialogs.Dialog.CreateImageControl&quot;
1308 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;
1310 Check:
1311 Set oControl = Nothing
1312 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1314 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1315 If IsMissing(Scale) Or IsEmpty(Scale) Then Scale = &quot;FITTOSIZE&quot;
1316 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
1317 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
1319 Try:
1320 &apos; Manage specific properties
1321 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1322 Select Case UCase(Scale)
1323 Case &quot;NO&quot; : iScale = com.sun.star.awt.ImageScaleMode.NONE : bScale = False
1324 Case &quot;FITTOSIZE&quot; : iScale = com.sun.star.awt.ImageScaleMode.ANISOTROPIC : bScale = True
1325 Case &quot;KEEPRATIO&quot; : iScale = com.sun.star.awt.ImageScaleMode.ISOTROPIC : bScale = True
1326 End Select
1327 vPropNames = Array(&quot;Border&quot;, &quot;ScaleImage&quot;, &quot;ScaleMode&quot;)
1328 vPropValues = Array(iBorder, bScale, iScale)
1330 &apos; Create the control
1331 Set oControl = _CreateNewControl(&quot;UnoControlImageControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
1333 Finally:
1334 Set CreateImageControl = oControl
1335 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1336 Exit Function
1337 Catch:
1338 GoTo Finally
1339 End Function &apos; SFDialogs.SF_Dialog.CreateImageControl
1341 REM -----------------------------------------------------------------------------
1342 Public Function CreateListBox(Optional ByVal ControlName As Variant _
1343 , Optional ByRef Place As Variant _
1344 , Optional ByVal Border As Variant _
1345 , Optional ByVal Dropdown As Variant _
1346 , Optional ByVal LineCount As Variant _
1347 , Optional ByVal MultiSelect As Variant _
1348 ) As Object
1349 &apos;&apos;&apos; Create a new control of type ListBox in the actual dialog.
1350 &apos;&apos;&apos; Specific args:
1351 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1352 &apos;&apos;&apos; Dropdown: When True (default), a drop down button is displayed
1353 &apos;&apos;&apos; LineCount: Specifies the maximum line count displayed in the drop down (default = 5)
1354 &apos;&apos;&apos; MultiSelect: When True, more than 1 entry may be selected. Default = False
1355 &apos;&apos;&apos; Returns:
1356 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1357 &apos;&apos;&apos; Example:
1358 &apos;&apos;&apos; Set myListBox = dialog.CreateListBox(&quot;ListBox1&quot;, Array(20, 20, 60, 15), Dropdown := True, MultiSelect := True)
1360 Dim oControl As Object &apos; Return value
1361 Dim iBorder As Integer &apos; Alias of border
1362 Dim vPropNames As Variant &apos; Array of names of specific arguments
1363 Dim vPropValues As Variant &apos; Array of values of specific arguments
1364 Const cstThisSub = &quot;SFDialogs.Dialog.CreateListBox&quot;
1365 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;
1367 Check:
1368 Set oControl = Nothing
1369 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1371 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1372 If IsMissing(Dropdown) Or IsEmpty(Dropdown) Then Dropdown = True
1373 If IsMissing(LineCount) Or IsEmpty(LineCount) Then LineCount = 5
1374 If IsMissing(MultiSelect) Or IsEmpty(MultiSelect) Then MultiSelect = True
1376 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
1377 If Not ScriptForge.SF_Utils._Validate(Dropdown, &quot;Dropdown&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1378 If Not ScriptForge.SF_Utils._Validate(LineCount, &quot;LineCount&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1379 If Not ScriptForge.SF_Utils._Validate(MultiSelect, &quot;MultiSelect&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1381 Try:
1382 &apos; Manage specific properties
1383 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1384 vPropNames = Array(&quot;Border&quot;, &quot;Dropdown&quot;, &quot;LineCount&quot;, &quot;MultiSelection&quot;)
1385 vPropValues = Array(iBorder, CBool(Dropdown), CInt(LineCount), CBool(MultiSelect))
1387 &apos; Create the control
1388 Set oControl = _CreateNewControl(&quot;UnoControlListBoxModel&quot;, ControlName, Place, vPropNames, vPropValues)
1390 Finally:
1391 Set CreateListBox = oControl
1392 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1393 Exit Function
1394 End Function &apos; SFDialogs.SF_Dialog.CreateListBox
1396 REM -----------------------------------------------------------------------------
1397 Public Function CreateNumericField(Optional ByVal ControlName As Variant _
1398 , Optional ByRef Place As Variant _
1399 , Optional ByVal Border As Variant _
1400 , Optional ByVal SpinButton As Variant _
1401 , Optional ByVal MinValue As Variant _
1402 , Optional ByVal MaxValue As Variant _
1403 , Optional ByVal Increment As Variant _
1404 , Optional ByVal Accuracy As Variant _
1405 ) As Object
1406 &apos;&apos;&apos; Create a new control of type NumericField in the actual dialog.
1407 &apos;&apos;&apos; Specific args:
1408 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1409 &apos;&apos;&apos; SpinButton:: when True (default = False), a spin button is present
1410 &apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Dafault = -1000000
1411 &apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Dafault = +1000000
1412 &apos;&apos;&apos; Increment: the step when the spin button is pressed. Default = 1
1413 &apos;&apos;&apos; Accuracy: specifies the decimal accuracy. Default = 2 decimal digits
1414 &apos;&apos;&apos; Returns:
1415 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1416 &apos;&apos;&apos; Example:
1417 &apos;&apos;&apos; Set myNumericField = dialog.CreateNumericField(&quot;NumericField1&quot;, Array(20, 20, 60, 15), SpinButton := True)
1419 Dim oControl As Object &apos; Return value
1420 Dim iBorder As Integer &apos; Alias of border
1421 Dim vPropNames As Variant &apos; Array of names of specific arguments
1422 Dim vPropValues As Variant &apos; Array of values of specific arguments
1423 Const cstThisSub = &quot;SFDialogs.Dialog.CreateNumericField&quot;
1424 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [SpinButton=False]&quot; _
1425 &amp; &quot;, [MinValue=-1000000], MaxValue=+1000000], [Increment=1], [Accuracy=2]&quot;
1427 Check:
1428 Set oControl = Nothing
1429 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1431 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1432 If IsMissing(SpinButton) Or IsEmpty(SpinButton) Then SpinButton = False
1433 If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = -1000000.00
1434 If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = +1000000.00
1435 If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1.00
1436 If IsMissing(Accuracy) Or IsEmpty(Accuracy) Then Accuracy = 2
1438 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
1439 If Not ScriptForge.SF_Utils._Validate(SpinButton, &quot;SpinButton&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1440 If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1441 If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1442 If Not ScriptForge.SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1443 If Not ScriptForge.SF_Utils._Validate(Accuracy, &quot;Accuracy&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1445 Try:
1446 &apos; Manage specific properties
1447 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1448 vPropNames = Array(&quot;Border&quot;, &quot;Spin&quot;, &quot;ValueMin&quot;, &quot;ValueMax&quot;, &quot;ValueStep&quot;, &quot;DecimalAccuracy&quot;)
1449 vPropValues = Array(iBorder, CBool(SpinButton), CDbl(MinValue), CDbl(MaxValue), CDbl(Increment), CInt(Accuracy))
1451 &apos; Create the control
1452 Set oControl = _CreateNewControl(&quot;UnoControlNumericFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
1454 Finally:
1455 Set CreateNumericField = oControl
1456 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1457 Exit Function
1458 End Function &apos; SFDialogs.SF_Dialog.CreateNumericField
1460 REM -----------------------------------------------------------------------------
1461 Public Function CreatePatternField(Optional ByVal ControlName As Variant _
1462 , Optional ByRef Place As Variant _
1463 , Optional ByVal Border As Variant _
1464 , Optional ByVal EditMask As Variant _
1465 , Optional ByVal LiteralMask As Variant _
1466 ) As Object
1467 &apos;&apos;&apos; Create a new control of type PatternField in the actual dialog.
1468 &apos;&apos;&apos; Specific args:
1469 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1470 &apos;&apos;&apos; Editmask: a character code that determines what the user may enter
1471 &apos;&apos;&apos; LiteralMask: contains the initial values that are displayed in the pattern field
1472 &apos;&apos;&apos; More details on https://wiki.documentfoundation.org/Documentation/DevGuide/Graphical_User_Interfaces#Pattern_Field
1473 &apos;&apos;&apos; Returns:
1474 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1475 &apos;&apos;&apos; Example:
1476 &apos;&apos;&apos; Set myPatternField = dialog.CreatePatternField(&quot;PatternField1&quot;, Array(20, 20, 60, 15), EditMask := &quot;NNLNNLLLLL&quot;, LiteralMask := &quot;__.__.2002&quot;)
1478 Dim oControl As Object &apos; Return value
1479 Dim iBorder As Integer &apos; Alias of border
1480 Dim vPropNames As Variant &apos; Array of names of specific arguments
1481 Dim vPropValues As Variant &apos; Array of values of specific arguments
1482 Const cstThisSub = &quot;SFDialogs.Dialog.CreatePatternField&quot;
1483 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;
1485 Check:
1486 Set oControl = Nothing
1487 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1489 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1490 If IsMissing(EditMask) Or IsEmpty(EditMask) Then EditMask = &quot;&quot;
1491 If IsMissing(LiteralMask) Or IsEmpty(LiteralMask) Then LiteralMask = &quot;&quot;
1493 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
1494 If Not ScriptForge.SF_Utils._Validate(EditMask, &quot;EditMask&quot;, V_STRING) Then GoTo Finally
1495 If Not ScriptForge.SF_Utils._Validate(LiteralMask, &quot;LiteralMask&quot;, V_STRING) Then GoTo Finally
1497 Try:
1498 &apos; Manage specific properties
1499 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1500 vPropNames = Array(&quot;Border&quot;, &quot;EditMask&quot;, &quot;LiteralMask&quot;)
1501 vPropValues = Array(iBorder, EditMask, LiteralMask)
1503 &apos; Create the control
1504 Set oControl = _CreateNewControl(&quot;UnoControlPatternFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
1506 Finally:
1507 Set CreatePatternField = oControl
1508 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1509 Exit Function
1510 Catch:
1511 GoTo Finally
1512 End Function &apos; SFDialogs.SF_Dialog.CreatePatternField
1514 REM -----------------------------------------------------------------------------
1515 Public Function CreateProgressBar(Optional ByVal ControlName As Variant _
1516 , Optional ByRef Place As Variant _
1517 , Optional ByVal Border As Variant _
1518 , Optional ByVal MinValue As Variant _
1519 , Optional ByVal MaxValue As Variant _
1520 ) As Object
1521 &apos;&apos;&apos; Create a new control of type ProgressBar in the actual dialog.
1522 &apos;&apos;&apos; Specific args:
1523 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1524 &apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Default = 0
1525 &apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Default = 100
1526 &apos;&apos;&apos; Returns:
1527 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1528 &apos;&apos;&apos; Example:
1529 &apos;&apos;&apos; Set myProgressBar = dialog.CreateProgressBar(&quot;ProgressBar1&quot;, Array(20, 20, 60, 15), MaxValue := 1000)
1531 Dim oControl As Object &apos; Return value
1532 Dim iBorder As Integer &apos; Alias of border
1533 Dim vPropNames As Variant &apos; Array of names of specific arguments
1534 Dim vPropValues As Variant &apos; Array of values of specific arguments
1535 Const cstThisSub = &quot;SFDialogs.Dialog.CreateProgressBar&quot;
1536 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;
1538 Check:
1539 Set oControl = Nothing
1540 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1542 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1543 If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = 0
1544 If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = 100
1546 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
1547 If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1548 If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1550 Try:
1551 &apos; Manage specific properties
1552 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1553 vPropNames = Array(&quot;Border&quot;, &quot;ProgressValueMin&quot;, &quot;ProgressValueMax&quot;)
1554 vPropValues = Array(iBorder, CLng(MinValue), CLng(MaxValue))
1556 &apos; Create the control
1557 Set oControl = _CreateNewControl(&quot;UnoControlProgressBarModel&quot;, ControlName, Place, vPropNames, vPropValues)
1559 Finally:
1560 Set CreateProgressBar = oControl
1561 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1562 Exit Function
1563 End Function &apos; SFDialogs.SF_Dialog.CreateProgressBar
1565 REM -----------------------------------------------------------------------------
1566 Public Function CreateRadioButton(Optional ByVal ControlName As Variant _
1567 , Optional ByRef Place As Variant _
1568 , Optional ByVal MultiLine As Variant _
1569 ) As Object
1570 &apos;&apos;&apos; Create a new control of type RadioButton in the actual dialog.
1571 &apos;&apos;&apos; Specific args:
1572 &apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
1573 &apos;&apos;&apos; Returns:
1574 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1575 &apos;&apos;&apos; Example:
1576 &apos;&apos;&apos; Set myRadioButton = dialog.CreateRadioButton(&quot;RadioButton1&quot;, Array(20, 20, 60, 15), MultiLine := True)
1578 Dim oControl As Object &apos; Return value
1579 Dim vPropNames As Variant &apos; Array of names of specific arguments
1580 Dim vPropValues As Variant &apos; Array of values of specific arguments
1581 Const cstThisSub = &quot;SFDialogs.Dialog.CreateRadioButton&quot;
1582 Const cstSubArgs = &quot;ControlName, Place, [MultiLine=False]&quot;
1584 Check:
1585 Set oControl = Nothing
1586 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1588 If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
1589 If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1591 Try:
1592 &apos; Manage specific properties
1593 vPropNames = Array(&quot;VisualEffect&quot;, &quot;MultiLine&quot;)
1594 vPropValues = Array(1, CBool(MultiLine))
1596 &apos; Create the control
1597 Set oControl = _CreateNewControl(&quot;UnoControlRadioButtonModel&quot;, ControlName, Place, vPropNames, vPropValues)
1599 Finally:
1600 Set CreateRadioButton = oControl
1601 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1602 Exit Function
1603 End Function &apos; SFDialogs.SF_Dialog.CreateRadioButton
1605 REM -----------------------------------------------------------------------------
1606 Public Function CreateScrollBar(Optional ByVal ControlName As Variant _
1607 , Optional ByRef Place As Variant _
1608 , Optional ByVal Orientation As Variant _
1609 , Optional ByVal Border As Variant _
1610 , Optional ByVal MinValue As Variant _
1611 , Optional ByVal MaxValue As Variant _
1612 ) As Object
1613 &apos;&apos;&apos; Create a new control of type ScrollBar in the actual dialog.
1614 &apos;&apos;&apos; Specific args:
1615 &apos;&apos;&apos; Orientation: H[orizontal] or V[ertical]
1616 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1617 &apos;&apos;&apos; MinValue: the smallest value that can be entered in the control. Dafault = 0
1618 &apos;&apos;&apos; MaxValue: the largest value that can be entered in the control. Dafault = 100
1619 &apos;&apos;&apos; Returns:
1620 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1621 &apos;&apos;&apos; Example:
1622 &apos;&apos;&apos; Set myScrollBar = dialog.CreateScrollBar(&quot;ScrollBar1&quot;, Array(20, 20, 60, 15), MaxValue := 1000)
1624 Dim oControl As Object &apos; Return value
1625 Dim iBorder As Integer &apos; Alias of border
1626 Dim vPropNames As Variant &apos; Array of names of specific arguments
1627 Dim vPropValues As Variant &apos; Array of values of specific arguments
1628 Const cstThisSub = &quot;SFDialogs.Dialog.CreateScrollBar&quot;
1629 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; _
1630 &amp; &quot;, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;], [MinValue=0], MaxValue=100]&quot;
1632 Check:
1633 Set oControl = Nothing
1634 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1636 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1637 If IsMissing(MinValue) Or IsEmpty(MinValue) Then MinValue = 0
1638 If IsMissing(MaxValue) Or IsEmpty(MaxValue) Then MaxValue = 100
1640 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
1641 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
1642 If Not ScriptForge.SF_Utils._Validate(MinValue, &quot;MinValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1643 If Not ScriptForge.SF_Utils._Validate(MaxValue, &quot;MaxValue&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1645 Try:
1646 &apos; Manage specific properties
1647 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1648 vPropNames = Array(&quot;Border&quot;, &quot;Orientation&quot;, &quot;ScrollValueMin&quot;, &quot;ScrollValueMax&quot;)
1649 vPropValues = Array(iBorder, CLng(Iif(Left(UCase(Orientation), 1) = &quot;V&quot;, 1, 0)), CLng(MinValue), CLng(MaxValue))
1651 &apos; Create the control
1652 Set oControl = _CreateNewControl(&quot;UnoControlScrollBarModel&quot;, ControlName, Place, vPropNames, vPropValues)
1654 Finally:
1655 Set CreateScrollBar = oControl
1656 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1657 Exit Function
1658 End Function &apos; SFDialogs.SF_Dialog.CreateScrollBar
1660 REM -----------------------------------------------------------------------------
1661 Public Function CreateTableControl(Optional ByVal ControlName As Variant _
1662 , Optional ByRef Place As Variant _
1663 , Optional ByVal Border As Variant _
1664 , Optional ByVal RowHeaders As Variant _
1665 , Optional ByVal ColumnHeaders As Variant _
1666 , Optional ByVal ScrollBars As Variant _
1667 , Optional ByVal GridLines As Variant _
1668 ) As Object
1669 &apos;&apos;&apos; Create a new control of type TableControl in the actual dialog.
1670 &apos;&apos;&apos; To fill the table with data, use the SetTableData() method
1671 &apos;&apos;&apos; Specific args:
1672 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1673 &apos;&apos;&apos; RowHeaders: when True (default), the row headers are shown
1674 &apos;&apos;&apos; ColumnHeaders: when True (default), the column headers are shown
1675 &apos;&apos;&apos; ScrollBars: H[orizontal] or V[ertical] or B[oth] or N[one] (default)
1676 &apos;&apos;&apos; Note that scrollbars always appear dynamically when they are needed
1677 &apos;&apos;&apos; GridLines: when True (default = False) horizontal and vertical lines are painted between the grid cells
1678 &apos;&apos;&apos; Returns:
1679 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1680 &apos;&apos;&apos; Example:
1681 &apos;&apos;&apos; Set myTableControl = dialog.CreateTableControl(&quot;TableControl1&quot;, Array(20, 20, 60, 15), ScrollBars := &quot;B&quot;)
1683 Dim oControl As Object &apos; Return value
1684 Dim iBorder As Integer &apos; Alias of border
1685 Dim vPropNames As Variant &apos; Array of names of specific arguments
1686 Dim vPropValues As Variant &apos; Array of values of specific arguments
1687 Const cstThisSub = &quot;SFDialogs.Dialog.CreateTableControl&quot;
1688 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; _
1689 &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;
1691 Check:
1692 Set oControl = Nothing
1693 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1695 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1696 If IsMissing(RowHeaders) Or IsEmpty(RowHeaders) Then RowHeaders = True
1697 If IsMissing(ColumnHeaders) Or IsEmpty(ColumnHeaders) Then ColumnHeaders = True
1698 If IsMissing(ScrollBars) Or IsEmpty(ScrollBars) Then ScrollBars = &quot;None&quot;
1699 If IsMissing(GridLines) Or IsEmpty(GridLines) Then GridLines = False
1701 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
1702 If Not ScriptForge.SF_Utils._Validate(RowHeaders, &quot;RowHeaders&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1703 If Not ScriptForge.SF_Utils._Validate(ColumnHeaders, &quot;ColumnHeaders&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1704 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
1705 If Not ScriptForge.SF_Utils._Validate(GridLines, &quot;GridLines&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1707 Try:
1708 &apos; Manage specific properties
1709 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1710 vPropNames = Array(&quot;Border&quot;, &quot;ShowRowHeader&quot;, &quot;ShowColumnHeader&quot;, &quot;VScroll&quot;, &quot;HScroll&quot;, &quot;UseGridLines&quot;)
1711 vPropValues = Array(iBorder, CBool(RowHeaders), CBool(ColumnHeaders) _
1712 , Left(ScrollBars, 1) = &quot;B&quot; Or Left(ScrollBars, 1) = &quot;V&quot; _
1713 , Left(ScrollBars, 1) = &quot;B&quot; Or Left(ScrollBars, 1) = &quot;H&quot; _
1714 , CBool(GridLines) _
1717 &apos; Create the control
1718 Set oControl = _CreateNewControl(&quot;grid.UnoControlGridModel&quot;, ControlName, Place, vPropNames, vPropValues)
1720 Finally:
1721 Set CreateTableControl = oControl
1722 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1723 Exit Function
1724 End Function &apos; SFDialogs.SF_Dialog.CreateTableControl
1726 REM -----------------------------------------------------------------------------
1727 Public Function CreateTextField(Optional ByVal ControlName As Variant _
1728 , Optional ByRef Place As Variant _
1729 , Optional ByVal Border As Variant _
1730 , Optional ByVal MultiLine As Variant _
1731 , Optional ByVal MaximumLength As Variant _
1732 , Optional ByVal PasswordCharacter As Variant _
1733 ) As Object
1734 &apos;&apos;&apos; Create a new control of type TextField in the actual dialog.
1735 &apos;&apos;&apos; Specific args:
1736 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1737 &apos;&apos;&apos; MultiLine: When True (default = False), the caption may be displayed on more than one line
1738 &apos;&apos;&apos; MaximumLength: the maximum character count (default = 0 meaning unlimited)
1739 &apos;&apos;&apos; PasswordCharacter: a single character specifying the echo for a password text field (default = &quot;&quot;)
1740 &apos;&apos;&apos; MultiLine must be False to have PasswordCharacter being applied
1741 &apos;&apos;&apos; Returns:
1742 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1743 &apos;&apos;&apos; Example:
1744 &apos;&apos;&apos; Set myTextField = dialog.CreateTextField(&quot;TextField1&quot;, Array(20, 20, 120, 50), MultiLine := True)
1746 Dim oControl As Object &apos; Return value
1747 Dim iBorder As Integer &apos; Alias of border
1748 Dim iPassword As Integer &apos; Integer alias of PasswordCharacter
1749 Dim vPropNames As Variant &apos; Array of names of specific arguments
1750 Dim vPropValues As Variant &apos; Array of values of specific arguments
1751 Const cstThisSub = &quot;SFDialogs.Dialog.CreateTextField&quot;
1752 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;
1754 Check:
1755 Set oControl = Nothing
1756 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1758 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1759 If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False
1760 If IsMissing(MaximumLength) Or IsEmpty(MaximumLength) Then MaximumLength = 0
1761 If IsMissing(PasswordCharacter) Or IsEmpty(PasswordCharacter) Then PasswordCharacter = &quot;&quot;
1763 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
1764 If Not ScriptForge.SF_Utils._Validate(MultiLine, &quot;MultiLine&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1765 If Not ScriptForge.SF_Utils._Validate(MaximumLength, &quot;MaximumLength&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1766 If Not ScriptForge.SF_Utils._Validate(PasswordCharacter, &quot;PasswordCharacter&quot;, V_STRING) Then GoTo Finally
1768 &apos; MultiLine has precedence over Password
1769 If MultiLine Then PasswordCharacter = &quot;&quot;
1771 Try:
1772 &apos; Manage specific properties
1773 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1774 If Len(PasswordCharacter) &gt; 0 Then iPassword = Asc(Left(PasswordCharacter, 1)) Else iPassword = 0
1775 vPropNames = Array(&quot;Border&quot;, &quot;MultiLine&quot;, &quot;MaxTextLen&quot;, &quot;EchoChar&quot;, &quot;AutoVScroll&quot;) &apos; AutoHScroll not implemented ??
1776 vPropValues = Array(iBorder, CBool(MultiLine), CInt(MaximumLength), iPassword, True)
1778 &apos; Create the control
1779 Set oControl = _CreateNewControl(&quot;UnoControlEditModel&quot;, ControlName, Place, vPropNames, vPropValues)
1781 Finally:
1782 Set CreateTextField = oControl
1783 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1784 Exit Function
1785 End Function &apos; SFDialogs.SF_Dialog.CreateTextField
1787 REM -----------------------------------------------------------------------------
1788 Public Function CreateTimeField(Optional ByVal ControlName As Variant _
1789 , Optional ByRef Place As Variant _
1790 , Optional ByVal Border As Variant _
1791 , Optional ByVal MinTime As Variant _
1792 , Optional ByVal MaxTime As Variant _
1793 ) As Object
1794 &apos;&apos;&apos; Create a new control of type TimeField in the actual dialog.
1795 &apos;&apos;&apos; Specific args:
1796 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1797 &apos;&apos;&apos; MinTime: the smallest time that can be entered in the control. Dafault = 0
1798 &apos;&apos;&apos; MaxTime: the largest time that can be entered in the control. Dafault = 24h
1799 &apos;&apos;&apos; Returns:
1800 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1801 &apos;&apos;&apos; Example:
1802 &apos;&apos;&apos; Set myTimeField = dialog.CreateTimeField(&quot;TimeField1&quot;, Array(20, 20, 60, 15))
1804 Dim oControl As Object &apos; Return Time
1805 Dim iBorder As Integer &apos; Alias of border
1806 Dim oMinTime As New com.sun.star.util.Time
1807 Dim oMaxTime As New com.sun.star.util.Time
1808 Dim vFormats As Variant &apos; List of available time formats
1809 Dim vPropNames As Variant &apos; Array of names of specific arguments
1810 Dim vPropValues As Variant &apos; Array of values of specific arguments
1811 Const cstThisSub = &quot;SFDialogs.Dialog.CreateTimeField&quot;
1812 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot; _
1813 &amp; &quot;, [MinTime=TimeSerial(0, 0, 0)], [MaxTime=TimeSerial(23, 59, 59)]&quot;
1815 Check:
1816 Set oControl = Nothing
1817 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1819 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1820 If IsMissing(MinTime) Or IsEmpty(MinTime) Then MinTime = TimeSerial(0, 0, 0)
1821 If IsMissing(MaxTime) Or IsEmpty(MaxTime) Then MaxTime = TimeSerial(23, 59, 59)
1823 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
1824 If Not ScriptForge.SF_Utils._ValiDate(MinTime, &quot;MinTime&quot;, ScriptForge.V_DATE) Then GoTo Finally
1825 If Not ScriptForge.SF_Utils._ValiDate(MaxTime, &quot;MaxTime&quot;, ScriptForge.V_DATE) Then GoTo Finally
1826 vFormats = SF_DialogUtils._FormatsList(&quot;TimeField&quot;)
1828 Try:
1829 &apos; Manage specific properties
1830 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1831 With oMinTime
1832 .Hours = Hour(MinTime) : .Minutes = Minute(MinTime) : .Seconds = Second(MinTime)
1833 End With
1834 With oMaxTime
1835 .Hours = Hour(MaxTime) : .Minutes = Minute(MaxTime) : .Seconds = Second(MaxTime)
1836 End With
1837 vPropNames = Array(&quot;Border&quot;, &quot;TimeMin&quot;, &quot;TimeMax&quot;, &quot;TimeFormat&quot;)
1838 vPropValues = Array(iBorder, oMinTime, oMaxTime, CInt(ScriptForge.SF_Array.IndexOf(vFormats(), &quot;24h short&quot;)))
1840 &apos; Create the control
1841 Set oControl = _CreateNewControl(&quot;UnoControlTimeFieldModel&quot;, ControlName, Place, vPropNames, vPropValues)
1843 Finally:
1844 Set CreateTimeField = oControl
1845 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1846 Exit Function
1847 End Function &apos; SFDialogs.SF_Dialog.CreateTimeField
1849 REM -----------------------------------------------------------------------------
1850 Public Function CreateTreeControl(Optional ByVal ControlName As Variant _
1851 , Optional ByRef Place As Variant _
1852 , Optional ByVal Border As Variant _
1853 ) As Object
1854 &apos;&apos;&apos; Create a new control of type TreeControl in the actual dialog.
1855 &apos;&apos;&apos; Specific args:
1856 &apos;&apos;&apos; Border: &quot;3D&quot; (default) or &quot;FLAT&quot; or &quot;NONE&quot;
1857 &apos;&apos;&apos; Returns:
1858 &apos;&apos;&apos; an instance of the SF_DialogControl class or Nothing
1859 &apos;&apos;&apos; Example:
1860 &apos;&apos;&apos; Set myTreeControl = dialog.CreateTreeControl(&quot;TreeControl1&quot;, Array(20, 20, 60, 15))
1862 Dim oControl As Object &apos; Return value
1863 Dim iBorder As Integer &apos; Alias of border
1864 Dim vPropNames As Variant &apos; Array of names of specific arguments
1865 Dim vPropValues As Variant &apos; Array of values of specific arguments
1866 Const cstThisSub = &quot;SFDialogs.Dialog.CreateTreeControl&quot;
1867 Const cstSubArgs = &quot;ControlName, Place, [Border=&quot;&quot;3D&quot;&quot;|&quot;&quot;FLAT&quot;&quot;|&quot;&quot;NONE&quot;&quot;]&quot;
1869 Check:
1870 Set oControl = Nothing
1871 If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally
1873 If IsMissing(Border) Or IsEmpty(Border) Then Border = &quot;3D&quot;
1874 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
1876 Try:
1877 &apos; Manage specific properties
1878 iBorder = ScriptForge.SF_Array.IndexOf(Array(&quot;NONE&quot;, &quot;3D&quot;, &quot;FLAT&quot;), Border)
1879 vPropNames = Array(&quot;Border&quot;, &quot;SelectionType&quot;, &quot;Editable&quot;, &quot;ShowsHandles&quot;, &quot;ShowsRootHandles&quot;)
1880 vPropValues = Array(iBorder, com.sun.star.view.SelectionType.SINGLE, False, True, True)
1882 &apos; Create the control
1883 Set oControl = _CreateNewControl(&quot;tree.TreeControlModel&quot;, ControlName, Place, vPropNames, vPropValues)
1885 Finally:
1886 Set CreateTreeControl = oControl
1887 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1888 Exit Function
1889 Catch:
1890 GoTo Finally
1891 End Function &apos; SFDialogs.SF_Dialog.CreateTreeControl
1893 REM -----------------------------------------------------------------------------
1894 Public Sub EndExecute(Optional ByVal ReturnValue As Variant)
1895 &apos;&apos;&apos; Ends the display of a modal dialog and gives back the argument
1896 &apos;&apos;&apos; as return value for the current Execute() action
1897 &apos;&apos;&apos; EndExecute is usually contained in the processing of a macro
1898 &apos;&apos;&apos; triggered by a dialog or control event
1899 &apos;&apos;&apos; Args:
1900 &apos;&apos;&apos; ReturnValue: must be numeric. The value passed to the running Execute() method
1901 &apos;&apos;&apos; Example:
1902 &apos;&apos;&apos; Sub OnEvent(poEvent As Variant)
1903 &apos;&apos;&apos; Dim oDlg As Object
1904 &apos;&apos;&apos; Set oDlg = CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
1905 &apos;&apos;&apos; oDlg.EndExecute(25)
1906 &apos;&apos;&apos; End Sub
1908 Dim lExecute As Long &apos; Alias of ReturnValue
1909 Const cstThisSub = &quot;SFDialogs.Dialog.EndExecute&quot;
1910 Const cstSubArgs = &quot;ReturnValue&quot;
1912 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1914 Check:
1915 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
1916 If Not _IsStillAlive() Then GoTo Finally
1917 If Not ScriptForge.SF_Utils._Validate(ReturnValue, &quot;ReturnValue&quot;, V_NUMERIC) Then GoTo Finally
1918 End If
1920 Try:
1921 lExecute = CLng(ReturnValue)
1922 Call _DialogControl.endDialog(lExecute)
1924 Finally:
1925 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1926 Exit Sub
1927 Catch:
1928 GoTo Finally
1929 End Sub &apos; SFDialogs.SF_Dialog.EndExecute
1931 REM -----------------------------------------------------------------------------
1932 Public Function Execute(Optional ByVal Modal As Variant) As Long
1933 &apos;&apos;&apos; Display the dialog and wait for its termination by the user
1934 &apos;&apos;&apos; Args:
1935 &apos;&apos;&apos; Modal: False when non-modal dialog. Default = True
1936 &apos;&apos;&apos; Returns:
1937 &apos;&apos;&apos; 0 = Cancel button pressed
1938 &apos;&apos;&apos; 1 = OK button pressed
1939 &apos;&apos;&apos; Otherwise: the dialog stopped with an EndExecute statement executed from a dialog or control event
1940 &apos;&apos;&apos; Example:
1941 &apos;&apos;&apos; Dim oDlg As Object, lReturn As Long
1942 &apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
1943 &apos;&apos;&apos; lReturn = oDlg.Execute()
1944 &apos;&apos;&apos; Select Case lReturn
1946 Dim lExecute As Long &apos; Return value
1947 Const cstThisSub = &quot;SFDialogs.Dialog.Execute&quot;
1948 Const cstSubArgs = &quot;[Modal=True]&quot;
1950 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1951 lExecute = -1
1953 Check:
1954 If IsMissing(Modal) Or IsEmpty(Modal) Then Modal = True
1955 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
1956 If Not _IsStillAlive() Then GoTo Finally
1957 If Not ScriptForge.SF_Utils._Validate(Modal, &quot;Modal&quot;, V_BOOLEAN) Then GoTo Finally
1958 End If
1960 Try:
1961 If Modal Then
1962 _Modal = True
1963 _Displayed = True
1964 &apos; In dynamic dialogs, injection of sizes and positions from model to view is done with setVisible()
1965 _DialogControl.setVisible(True)
1966 lExecute = _DialogControl.execute()
1967 Select Case lExecute
1968 Case 1 : lExecute = OKBUTTON
1969 Case 0 : lExecute = CANCELBUTTON
1970 Case Else
1971 End Select
1972 _Displayed = False
1973 Else
1974 _Modal = False
1975 _Displayed = True
1976 &apos; To make visible an on-the-fly designed dialog when macro triggered from Python
1977 _DialogModel.DesktopAsParent = Not ( _BuiltFromScratch And _BuiltInPython )
1978 _DialogControl.setVisible(True)
1979 lExecute = 0
1980 End If
1982 Finally:
1983 Execute = lExecute
1984 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1985 Exit Function
1986 Catch:
1987 &apos; When an error is caused by an event error, the location is unknown
1988 SF_Exception.Raise(, &quot;?&quot;)
1989 GoTo Finally
1990 End Function &apos; SFDialogs.SF_Dialog.Execute
1992 REM -----------------------------------------------------------------------------
1993 Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
1994 &apos;&apos;&apos; Return the actual value of the given property
1995 &apos;&apos;&apos; Args:
1996 &apos;&apos;&apos; PropertyName: the name of the property as a string
1997 &apos;&apos;&apos; Returns:
1998 &apos;&apos;&apos; The actual value of the property
1999 &apos;&apos;&apos; Exceptions:
2000 &apos;&apos;&apos; ARGUMENTERROR The property does not exist
2001 &apos;&apos;&apos; Examples:
2002 &apos;&apos;&apos; oDlg.GetProperty(&quot;Caption&quot;)
2004 Const cstThisSub = &quot;SFDialogs.Dialog.GetProperty&quot;
2005 Const cstSubArgs = &quot;&quot;
2007 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2008 GetProperty = Null
2010 Check:
2011 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2012 If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
2013 End If
2015 Try:
2016 GetProperty = _PropertyGet(PropertyName)
2018 Finally:
2019 SF_Utils._ExitFunction(cstThisSub)
2020 Exit Function
2021 Catch:
2022 GoTo Finally
2023 End Function &apos; SFDialogs.SF_Dialog.GetProperty
2025 REM -----------------------------------------------------------------------------
2026 Public Function GetTextsFromL10N(Optional ByRef L10N As Variant) As Boolean
2027 &apos;&apos;&apos; Replace all fixed text strings of a dialog by their localized version
2028 &apos;&apos;&apos; Replaced texts are:
2029 &apos;&apos;&apos; - the title of the dialog
2030 &apos;&apos;&apos; - the caption associated with next control types: Button, CheckBox, FixedLine, FixedText, GroupBox and RadioButton
2031 &apos;&apos;&apos; - the content of list- and comboboxes
2032 &apos;&apos;&apos; - the tip- or helptext displayed when the mouse is hovering the control
2033 &apos;&apos;&apos; The current method has a twin method ScriptForge.SF_L10N.AddTextsFromDialog
2034 &apos;&apos;&apos; The current method is probably run before the Execute() method
2035 &apos;&apos;&apos; Args:
2036 &apos;&apos;&apos; L10N : a &quot;L10N&quot; service instance created with CreateScriptService(&quot;L10N&quot;)
2037 &apos;&apos;&apos; Returns:
2038 &apos;&apos;&apos; True when successful
2039 &apos;&apos;&apos; Examples:
2040 &apos;&apos;&apos; Dim myPO As Object, oDlg As Object
2041 &apos;&apos;&apos; Set oDlg = CreateScriptService(&quot;Dialog&quot;, &quot;GlobalScope&quot;, &quot;XrayTool&quot;, &quot;DlgXray&quot;)
2042 &apos;&apos;&apos; Set myPO = CreateScriptService(&quot;L10N&quot;, &quot;C:\myPOFiles\&quot;, &quot;fr-BE&quot;)
2043 &apos;&apos;&apos; oDlg.GetTextsFromL10N(myPO)
2045 Dim bGet As Boolean &apos; Return value
2046 Dim vControls As Variant &apos; Array of control names
2047 Dim sControl As String &apos; A single control name
2048 Dim oControl As Object &apos; SFDialogs.DialogControl
2049 Dim sText As String &apos; The text found in the dialog
2050 Dim sTranslation As String &apos; The translated text got from the dictionary
2051 Dim vSource As Variant &apos; RowSource property of dialog control as an array
2052 Dim bChanged As Boolean &apos; True when at least 1 item of a RowSource is modified
2053 Dim i As Long
2055 Const cstThisSub = &quot;SFDialogs.Dialog.GetTextsFromL10N&quot;
2056 Const cstSubArgs = &quot;L10N&quot;
2058 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2059 bGet = False
2061 Check:
2062 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2063 If Not SF_Utils._Validate(L10N, &quot;L10N&quot;, V_OBJECT, , , &quot;L10N&quot;) Then GoTo Finally
2064 End If
2066 Try:
2067 &apos; Get the dialog title
2068 sText = Caption
2069 If Len(sText) &gt; 0 Then
2070 sTranslation = L10N._(sText)
2071 If sText &lt;&gt; sTranslation Then Caption = sTranslation
2072 End If
2073 &apos; Scan all controls
2074 vControls = Controls()
2075 For Each sControl In vControls
2076 Set oControl = Controls(sControl)
2077 With oControl
2078 &apos; Extract fixed texts
2079 sText = .Caption
2080 If Len(sText) &gt; 0 Then
2081 sTranslation = L10N._(sText)
2082 If sText &lt;&gt; sTranslation Then .Caption = sTranslation
2083 End If
2084 vSource = .RowSource &apos; List and comboboxes only
2085 If IsArray(vSource) Then
2086 bChanged = False
2087 For i = 0 To UBound(vSource)
2088 If Len(vSource(i)) &gt; 0 Then
2089 sTranslation = L10N._(vSource(i))
2090 If sTranslation &lt;&gt; vSource(i) Then
2091 bChanged = True
2092 vSource(i) = sTranslation
2093 End If
2094 End If
2095 Next i
2096 &apos; Rewrite if at least 1 item has been modified by the translation process
2097 If bChanged Then .RowSource = vSource
2098 End If
2099 sText = .TipText
2100 If Len(sText) &gt; 0 Then
2101 sTranslation = L10N._(sText)
2102 If sText &lt;&gt; sTranslation Then .TipText = sTranslation
2103 End If
2104 End With
2105 Next sControl
2107 bGet = True
2109 Finally:
2110 GetTextsFromL10N = bGet
2111 SF_Utils._ExitFunction(cstThisSub)
2112 Exit Function
2113 Catch:
2114 GoTo Finally
2115 End Function &apos; SFDialogs.SF_Dialog.GetTextsFromL10N
2117 REM -----------------------------------------------------------------------------
2118 Public Function Methods() As Variant
2119 &apos;&apos;&apos; Return the list of public methods of the Model service as an array
2121 Methods = Array( _
2122 &quot;Activate&quot; _
2123 , &quot;Center&quot; _
2124 , &quot;CloneControl&quot; _
2125 , &quot;Controls&quot; _
2126 , &quot;CreateButton&quot; _
2127 , &quot;CreateCheckBox&quot; _
2128 , &quot;CreateComboBox&quot; _
2129 , &quot;CreateCurrencyField&quot; _
2130 , &quot;CreateDateField&quot; _
2131 , &quot;CreateFileControl&quot; _
2132 , &quot;CreateFixedLine&quot; _
2133 , &quot;CreateFixedText&quot; _
2134 , &quot;CreateFormattedField&quot; _
2135 , &quot;CreateGroupBox&quot; _
2136 , &quot;CreateHyperlink&quot; _
2137 , &quot;CreateImageControl&quot; _
2138 , &quot;CreateListBox&quot; _
2139 , &quot;CreateNumericField&quot; _
2140 , &quot;CreatePatternField&quot; _
2141 , &quot;CreateProgressBar&quot; _
2142 , &quot;CreateRadioButton&quot; _
2143 , &quot;CreateScrollBar&quot; _
2144 , &quot;CreateTableControl&quot; _
2145 , &quot;CreateTextField&quot; _
2146 , &quot;CreateTimeField&quot; _
2147 , &quot;CreateTreeControl&quot; _
2148 , &quot;EndExecute&quot; _
2149 , &quot;Execute&quot; _
2150 , &quot;GetTextsFromL10N&quot; _
2151 , &quot;OrderTabs&quot; _
2152 , &quot;Resize&quot; _
2153 , &quot;SetPageManager&quot; _
2154 , &quot;Terminate&quot; _
2157 End Function &apos; SFDialogs.SF_Dialog.Methods
2159 REM -----------------------------------------------------------------------------
2160 Public Function OrderTabs(ByRef Optional TabsList As Variant _
2161 , ByVal Optional Start As Variant _
2162 , ByVal Optional Increment As Variant _
2163 ) As Boolean
2164 &apos;&apos;&apos; Set the tabulation index f a series of controls.
2165 &apos;&apos;&apos; The sequence of controls are given as an array of control names from the first to the last.
2166 &apos;&apos;&apos; Next controls will not be accessible (anymore ?) via the TAB key if &gt;=1 of next conditions is met:
2167 &apos;&apos;&apos; - if they are not in the given list
2168 &apos;&apos;&apos; - if their type is FixedLine, GroupBox or ProgressBar
2169 &apos;&apos;&apos; - if the control is disabled
2170 &apos;&apos;&apos; Args:
2171 &apos;&apos;&apos; TabsList: an array of valid control names in the order of tabulation
2172 &apos;&apos;&apos; Start: the tab index to be assigned to the 1st control in the list. Default = 1
2173 &apos;&apos;&apos; Increment: the difference between 2 successive tab indexes. Default = 1
2174 &apos;&apos;&apos; Returns:
2175 &apos;&apos;&apos; True when successful
2176 &apos;&apos;&apos; Example:
2177 &apos;&apos;&apos; dialog.OredrTabs(Array(&quot;myListBox&quot;, &quot;myTextField&quot;, &quot;myNumericField&quot;), Start := 10)
2179 Dim bOrder As Boolean &apos; Return value
2180 Dim vControlNames As Variant &apos; List of control names in the dialog
2181 Dim oControl As Object &apos; A SF_DialogControl instance
2182 Dim bValid As Boolean &apos; When True, the considered control deserves a tab stop
2183 Dim iTabIndex As Integer &apos; The tab index to be set
2184 Dim vWrongTypes As Variant &apos; List of rejected control types
2185 Dim i As Long
2187 Const cstThisSub = &quot;SFDialogs.Dialog.OrderTabs&quot;
2188 Const cstSubArgs = &quot;TabsList, [Start=1], ÃŽncrement=1]&quot;
2190 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2191 bOrder = False
2193 Check:
2194 If IsMissing(Start) Or IsEmpty(Start) Then Start = 1
2195 If IsMissing(Increment) Or IsEmpty(Increment) Then Increment = 1
2196 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2197 If Not ScriptForge.SF_Utils._ValidateArray(TabsList, &quot;TabsList&quot;, 1, V_STRING, True) Then GoTo Finally
2198 If Not SF_Utils._Validate(Start, &quot;Start&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
2199 If Not SF_Utils._Validate(Increment, &quot;Increment&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
2200 End If
2202 Try:
2203 vWrongTypes = Array(&quot;FixedLine&quot;, &quot;GroupBox&quot;, &quot;ProgressBar&quot;)
2205 &apos; Remove all existing tabulations
2206 vControlNames = _DialogModel.getElementNames()
2207 For i = 0 To UBound(vControlNames)
2208 Set oControl = Controls(vControlNames(i))
2209 With oControl._ControlModel
2210 If Not ScriptForge.SF_Array.Contains(vWrongTypes, oControl._ControlType) Then
2211 .TabStop = False
2212 .TabIndex = -1
2213 End If
2214 End With
2215 Next i
2217 iTabIndex = Start
2219 &apos; Go through the candidate controls for being tabulated and set tabs
2220 For i = LBound(TabsList) To UBound(TabsList)
2221 Set oControl = Controls(TabsList(i)) &apos; Error checking on input names happens here
2222 With oControl._ControlModel
2223 bValid = Not ScriptForge.SF_Array.Contains(vWrongTypes, oControl._ControlType)
2224 If bValid Then bValid = .Enabled
2225 If bValid Then
2226 .TabStop = True
2227 .TabIndex = iTabIndex
2228 iTabIndex = iTabIndex + Increment
2229 End If
2230 End With
2231 Next i
2233 bOrder = True
2235 Finally:
2236 OrderTabs = bOrder
2237 SF_Utils._ExitFunction(cstThisSub)
2238 Exit Function
2239 Catch:
2240 GoTo Finally
2241 End Function &apos; SFDialogs.SF_Dialog.OrderTabls
2243 REM -----------------------------------------------------------------------------
2244 Public Function Properties() As Variant
2245 &apos;&apos;&apos; Return the list or properties of the Dialog class as an array
2247 Properties = Array( _
2248 &quot;Caption&quot; _
2249 , &quot;Height&quot; _
2250 , &quot;Modal&quot; _
2251 , &quot;Name&quot; _
2252 , &quot;OnFocusGained&quot; _
2253 , &quot;OnFocusLost&quot; _
2254 , &quot;OnKeyPressed&quot; _
2255 , &quot;OnKeyReleased&quot; _
2256 , &quot;OnMouseDragged&quot; _
2257 , &quot;OnMouseEntered&quot; _
2258 , &quot;OnMouseExited&quot; _
2259 , &quot;OnMouseMoved&quot; _
2260 , &quot;OnMousePressed&quot; _
2261 , &quot;OnMouseReleased&quot; _
2262 , &quot;Page&quot; _
2263 , &quot;Visible&quot; _
2264 , &quot;Width&quot; _
2265 , &quot;XDialogModel&quot; _
2266 , &quot;XDialogView&quot; _
2269 End Function &apos; SFDialogs.SF_Dialog.Properties
2271 REM -----------------------------------------------------------------------------
2272 Public Function Resize(Optional ByVal Left As Variant _
2273 , Optional ByVal Top As Variant _
2274 , Optional ByVal Width As Variant _
2275 , Optional ByVal Height As Variant _
2276 ) As Boolean
2277 &apos;&apos;&apos; Move the top-left corner of the dialog to new coordinates and/or modify its dimensions
2278 &apos;&apos;&apos; Without arguments, the method resets the initial dimensions
2279 &apos;&apos;&apos; Attributes denoting the position and size of a dialog are expressed in &quot;Map AppFont&quot; units.
2280 &apos;&apos;&apos; Map AppFont units are device and resolution independent.
2281 &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.
2282 &apos;&apos;&apos; The dialog editor (= the Basic IDE) also uses Map AppFont units.
2283 &apos;&apos;&apos; Args:
2284 &apos;&apos;&apos; Left : the horizontal distance from the top-left corner. It may be negative.
2285 &apos;&apos;&apos; Top : the vertical distance from the top-left corner. It may be negative.
2286 &apos;&apos;&apos; Width : the horizontal width of the rectangle containing the Dialog. It must be positive.
2287 &apos;&apos;&apos; Height : the vertical height of the rectangle containing the Dialog. It must be positive.
2288 &apos;&apos;&apos; Missing arguments are left unchanged.
2289 &apos;&apos;&apos; Returns:
2290 &apos;&apos;&apos; True when successful
2291 &apos;&apos;&apos; Examples:
2292 &apos;&apos;&apos; oDialog.Resize(100, 200, Height := 600) &apos; Width is not changed
2294 Try:
2295 Resize = SF_DialogUtils._Resize([Me], Left, Top, Width, Height)
2297 End Function &apos; SFDialogss.SF_Dialog.Resize
2299 REM -----------------------------------------------------------------------------
2300 Public Function SetPageManager(Optional ByVal PilotControls As Variant _
2301 , Optional ByVal TabControls As Variant _
2302 , Optional ByVal WizardControls As Variant _
2303 , Optional ByVal LastPage As variant _
2304 ) As Boolean
2305 &apos;&apos;&apos; Define how the dialog displays pages. The page manager is an alternative to the
2306 &apos;&apos;&apos; direct use of the Page property of the dialog and dialogcontrol objects.
2307 &apos;&apos;&apos;
2308 &apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step.
2309 &apos;&apos;&apos; The Page property of the Dialog object defines which page of the dialog is active.
2310 &apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
2311 &apos;&apos;&apos; For example, if a control has a page value of 1, it is only visible on page 1 of the dialog.
2312 &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
2313 &apos;&apos;&apos; and all controls with a page value of 2 become visible.
2314 &apos;&apos;&apos;
2315 &apos;&apos;&apos; The arguments define which controls are involved in the orchestration of the displayed pages.
2316 &apos;&apos;&apos; Possible options:
2317 &apos;&apos;&apos; - select a value in a list- or combobox
2318 &apos;&apos;&apos; - select an item in a group of radio buttons
2319 &apos;&apos;&apos; - select a button linked to a page - placed side-by-side the buttons can simulate a tabbed interface
2320 &apos;&apos;&apos; - press a NEXT or BACK button like in many wizards
2321 &apos;&apos;&apos; Those options may be combined. The control updates will be synchronized.
2322 &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
2323 &apos;&apos;&apos;
2324 &apos;&apos;&apos; The SetPageManager() method is to be run only once and before the Execute() statement.
2325 &apos;&apos;&apos; If invoked several times, subsequent calls will be ignored.
2326 &apos;&apos;&apos; The method will define new listeners on the concerned controls, addressing generic routines.
2327 &apos;&apos;&apos; The corresponding events will be fired during the dialog execution.
2328 &apos;&apos;&apos; Preset events (in the Basic IDE) will be preserved and executed immediately AFTER the page change.
2329 &apos;&apos;&apos; The listeners will be removed at dialog termination.
2330 &apos;&apos;&apos;
2331 &apos;&apos;&apos; Args:
2332 &apos;&apos;&apos; PilotControls: a comma-separated list of listbox, combobox or radiobutton controls
2333 &apos;&apos;&apos; For radio buttons, provide the first in the group
2334 &apos;&apos;&apos; TabControls: a comma-separated list of button controls in ascending order
2335 &apos;&apos;&apos; WizardControls: a comma-separated list of 2 controls, a BACK button and a NEXT button
2336 &apos;&apos;&apos; LastPage: the index of the last available page. Recommended when use of WizardControls
2337 &apos;&apos;&apos; Returns:
2338 &apos;&apos;&apos; True when successful
2339 &apos;&apos;&apos; Examples:
2340 &apos;&apos;&apos; dialog.SetPageManager(PilotControls := &quot;aListBox,aComboBox&quot;) &apos; 2 controls may cause page changes
2342 Dim bManager As Boolean &apos; Return value
2343 Dim vControls As Variant &apos; Array of involved controls
2344 Dim oControl As Object &apos; A DialogControl object
2345 Dim i As Long
2346 Const cstPrefix = &quot;_SFTAB_&quot; &apos; Prefix of Subs to trigger when involved controls are clicked
2347 Const cstComma = &quot;,&quot;
2349 Const cstThisSub = &quot;SFDialogs.Dialog.SetPageManager&quot;
2350 Const cstSubArgs = &quot;[PilotControls=&quot;&quot;&quot;&quot;], [TabControls=&quot;&quot;&quot;&quot;], [WizardControls=&quot;&quot;&quot;&quot;]&quot;
2352 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2353 bManager = False
2355 Check:
2356 If IsMissing(PilotControls) Or IsEmpty(PilotControls) Then PilotControls = &quot;&quot;
2357 If IsMissing(TabControls) Or IsEmpty(TabControls) Then TabControls = &quot;&quot;
2358 If IsMissing(WizardControls) Or IsEmpty(WizardControls) Then WizardControls = &quot;&quot;
2359 If IsMissing(LastPage) Or IsEmpty(LastPage) Then LastPage = 0
2360 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2361 If Not ScriptForge.SF_Utils._Validate(PilotControls, &quot;PilotControls&quot;, V_STRING) Then GoTo Finally
2362 If Not ScriptForge.SF_Utils._Validate(TabControls, &quot;TabControls&quot;, V_STRING) Then GoTo Finally
2363 If Not ScriptForge.SF_Utils._Validate(WizardControls, &quot;WizardControls&quot;, V_STRING) Then GoTo Finally
2364 If Not ScriptForge.SF_Utils._Validate(LastPage, &quot;LastPage&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
2365 End If
2366 &apos; Ignore the call if already done before
2367 If UBound(_PageManagement) &gt;= 0 Then GoTo Finally
2369 Try:
2370 &apos; Common listeners to all involved controls
2371 Set _ItemListener = CreateUnoListener(cstPrefix, &quot;com.sun.star.awt.XItemListener&quot;)
2372 Set _ActionListener = CreateUnoListener(cstPrefix, &quot;com.sun.star.awt.XActionListener&quot;)
2374 &apos; Register the arguments in the _PageManagement array, control by control
2375 &apos; Pilot controls
2376 If Len(PilotControls) &gt; 0 Then
2377 vControls = Split(PilotControls, cstComma)
2378 For i = 0 To UBound(vControls)
2379 If Not _RegisterPageListener(Trim(vControls(i)), &quot;ListBox,ComboBox,RadioButton&quot;, PILOTCONTROL, 0, ITEMSTATECHANGED) Then GoTo Catch
2380 Next i
2381 End If
2382 &apos; Tab controls
2383 If Len(TabControls) &gt; 0 Then
2384 vControls = Split(TabControls, cstComma)
2385 For i = 0 To UBound(vControls)
2386 If Not _RegisterPageListener(Trim(vControls(i)), &quot;Button&quot;, TABCONTROL, i + 1, ACTIONPERFORMED) Then GoTo Catch
2387 Next i
2388 End If
2389 &apos; Wizard controls
2390 If Len(WizardControls) &gt; 0 Then
2391 vControls = Split(WizardControls, cstComma)
2392 For i = 0 To UBound(vControls)
2393 If Not _RegisterPageListener(Trim(vControls(i)), &quot;Button&quot;, Iif(i = 0, BACKCONTROL, NEXTCONTROL), 0, ACTIONPERFORMED) Then GoTo Catch
2394 Next i
2395 End If
2397 &apos; Set the initial page to 1
2398 Page = 1
2399 _LastPage = LastPage
2401 Finally:
2402 SetPageManager = bManager
2403 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
2404 Exit Function
2405 Catch:
2406 ScriptForge.SF_Exception.RaiseFatal(PAGEMANAGERERROR, &quot;PilotControls&quot;, PilotControls, &quot;TabControls&quot;, TabControls _
2407 , &quot;WizardControls&quot;, WizardControls)
2408 GoTo Finally
2409 End Function &apos; SFDialogs.SF_Dialog.SetPageManager
2411 REM -----------------------------------------------------------------------------
2412 Public Function SetProperty(Optional ByVal PropertyName As Variant _
2413 , Optional ByRef Value As Variant _
2414 ) As Boolean
2415 &apos;&apos;&apos; Set a new value to the given property
2416 &apos;&apos;&apos; Args:
2417 &apos;&apos;&apos; PropertyName: the name of the property as a string
2418 &apos;&apos;&apos; Value: its new value
2419 &apos;&apos;&apos; Exceptions
2420 &apos;&apos;&apos; ARGUMENTERROR The property does not exist
2422 Const cstThisSub = &quot;SFDialogs.Dialog.SetProperty&quot;
2423 Const cstSubArgs = &quot;PropertyName, Value&quot;
2425 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2426 SetProperty = False
2428 Check:
2429 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2430 If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
2431 End If
2433 Try:
2434 SetProperty = _PropertySet(PropertyName, Value)
2436 Finally:
2437 SF_Utils._ExitFunction(cstThisSub)
2438 Exit Function
2439 Catch:
2440 GoTo Finally
2441 End Function &apos; SFDialogs.SF_Dialog.SetProperty
2443 REM -----------------------------------------------------------------------------
2444 Public Function Terminate() As Boolean
2445 &apos;&apos;&apos; Terminate the dialog service for the current dialog instance
2446 &apos;&apos;&apos; After termination any action on the current instance will be ignored
2447 &apos;&apos;&apos; Args:
2448 &apos;&apos;&apos; Returns:
2449 &apos;&apos;&apos; True if termination is successful
2450 &apos;&apos;&apos; Example:
2451 &apos;&apos;&apos; Dim oDlg As Object, lReturn As Long
2452 &apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myDialog&quot;) &apos; Dialog stored in current document&apos;s standard library
2453 &apos;&apos;&apos; lreturn = oDlg.Execute()
2454 &apos;&apos;&apos; Select Case lReturn
2455 &apos;&apos;&apos; &apos; ...
2456 &apos;&apos;&apos; End Select
2457 &apos;&apos;&apos; oDlg.Terminate()
2459 Dim bTerminate As Boolean &apos; Return value
2460 Const cstThisSub = &quot;SFDialogs.Dialog.Terminate&quot;
2461 Const cstSubArgs = &quot;&quot;
2463 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2464 bTerminate = False
2466 Check:
2467 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2468 If Not _IsStillAlive() Then GoTo Finally
2469 End If
2471 Try:
2472 _RemoveAllListeners()
2473 _DialogControl.dispose()
2474 Set _DialogControl = Nothing
2475 SF_Register._CleanCacheEntry(_CacheIndex)
2476 _CacheIndex = -1
2477 Dispose()
2479 bTerminate = True
2481 Finally:
2482 Terminate = bTerminate
2483 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
2484 Exit Function
2485 Catch:
2486 GoTo Finally
2487 End Function &apos; SFDialogs.SF_Dialog.Terminate
2489 REM =========================================================== PRIVATE FUNCTIONS
2491 REM -----------------------------------------------------------------------------
2492 Private Function _CheckNewControl(cstThisSub As String, cstSubArgs As String _
2493 , Optional ByVal ControlName As Variant _
2494 , ByRef Place As Variant _
2495 ) As Boolean
2496 &apos;&apos;&apos; Check the generic arguments of a CreateXXX() method for control creation.
2497 &apos;&apos;&apos; Called by the CreateButton, CreateCheckBox, ... specific methods
2498 &apos;&apos;&apos; Args:
2499 &apos;&apos;&apos; cstThisSub, cstSubArgs: caller routine and its arguments. Used to formulate an error message, if any.
2500 &apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
2501 &apos;&apos;&apos; Place: the size and position expressed in APPFONT units, either
2502 &apos;&apos;&apos; - an array (X, Y, Width, Height) or Array(x, Y)
2503 &apos;&apos;&apos; - a com.sun.star.awt.Rectangle structure
2504 &apos;&apos;&apos; Exceptions:
2505 &apos;&apos;&apos; DUPLICATECONTROLERROR A control with the same name exists already
2506 &apos;&apos;&apos; Returns:
2507 &apos;&apos;&apos; True when arguments passed the check
2509 Dim bCheck As Boolean &apos; Return value
2511 bCheck = False
2513 Check:
2514 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
2515 If Not _IsStillAlive() Then GoTo Finally
2516 If Not ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING) Then GoTo Finally
2517 If IsArray(Place) Then
2518 If Not ScriptForge.SF_Utils._ValidateArray(Place, &quot;Place&quot;, 1, ScriptForge.V_NUMERIC, True) Then GoTo Finally
2519 ElseIf Not IsNull(Place) Then
2520 If Not ScriptForge.SF_Utils._Validate(Place, &quot;Place&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
2521 End If
2522 End If
2523 If _DialogModel.hasByName(ControlName) Then GoTo CatchDuplicate
2525 bCheck = True
2527 Finally:
2528 _CheckNewControl = bCheck
2529 &apos; Call to _ExitFunction is done in the caller to allow handling of specific arguments
2530 Exit Function
2531 CatchDuplicate:
2532 ScriptForge.SF_Exception.RaiseFatal(DUPLICATECONTROLERROR, &quot;ControlName&quot;, ControlName, _Name)
2533 GoTo Finally
2534 End Function &apos; SFDialogs.SF_Dialog._CheckNewControl
2536 REM -----------------------------------------------------------------------------
2537 Private Function _CreateNewControl(ByVal pvModel As Variant _
2538 , ByVal ControlName As Variant _
2539 , ByRef Place As Variant _
2540 , Optional ByRef ArgNames As Variant _
2541 , Optional ByRef ArgValues As Variant _
2542 ) As Object
2543 &apos;&apos;&apos; Generic creation of a new control.
2544 &apos;&apos;&apos; Called by the CreateButton, CreateCheckBox, ... specific methods
2545 &apos;&apos;&apos; Args:
2546 &apos;&apos;&apos; pvModel: one of the UnoControlxxx control models (as a string)
2547 &apos;&apos;&apos; or such a model as a UNO class instance (cloned from an existing control)
2548 &apos;&apos;&apos; ControlName: the name of the new control. It must not exist yet
2549 &apos;&apos;&apos; Place: the size and position expressed in APPFONT units, either
2550 &apos;&apos;&apos; - an array (X, Y, Width, Height)
2551 &apos;&apos;&apos; - a com.sun.star.awt.Rectangle structure
2552 &apos;&apos;&apos; ArgNames: the list of the specific arguments linked to the given pvModel
2553 &apos;&apos;&apos; ArgValues: their values
2554 &apos;&apos;&apos; Returns:
2555 &apos;&apos;&apos; A new SF_DialogControl class instance or Nothing if creation failed
2557 Dim oControl As Object &apos; Return value
2558 Dim oControlModel As Object &apos; com.sun.star.awt.XControlModel
2559 Dim vPlace As Variant &apos; Alias of Place when object to avoid &quot;Object variable not set&quot; error
2560 Dim lCache As Long &apos; Number of elements in the controls cache
2561 Static oSession As Object
2563 Check:
2564 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2565 Set oControl = Nothing
2567 If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
2569 If IsMissing(ArgNames) Or IsEmpty(ArgNames) Then ArgNames = Array()
2570 If IsMissing(ArgValues) Or IsEmpty(ArgValues) Then ArgValues = Array()
2572 Try:
2573 &apos; When the model is a string, create a new (empty) model instance
2574 Select Case VarType(pvModel)
2575 Case V_STRING : Set oControlModel = _DialogModel.createInstance(&quot;com.sun.star.awt.&quot; &amp; pvModel)
2576 Case ScriptForge.V_OBJECT : Set oControlModel = pvModel
2577 End Select
2579 oControlModel.Name = ControlName
2581 &apos; Set dimension and position
2582 With oControlModel
2583 If IsArray(Place) Then
2584 &apos; Ignore width and height when new control is cloned from an existing one
2585 If UBound(Place) &gt;= 1 Then
2586 .PositionX = Place(0)
2587 .PositionY = Place(1)
2588 End If
2589 If UBound(Place) &gt;= 3 Then
2590 .Width = Place(2)
2591 .Height = Place(3)
2592 End If
2593 ElseIf oSession.UnoObjectType(Place) = &quot;com.sun.star.awt.Rectangle&quot; Then
2594 Set vPlace = Place
2595 .PositionX = vPlace.X
2596 .PositionY = vPlace.Y
2597 .Width = vPlace.Width
2598 .Height = vPlace.Height
2599 Else
2600 &apos;Leave everything to zero
2601 End If
2602 End With
2604 &apos; Store the specific properties in the model
2605 If UBound(ArgNames) &gt;= 0 Then oControlModel.setPropertyValues(ArgNames, ArgValues)
2607 &apos; Insert the new completed control model in the dialog
2608 _DialogModel.insertByName(ControlName, oControlModel)
2610 &apos; Update controls cache - existing cache is presumed unchanged: new control is added at the end of Model.ElementNames
2611 lCache = UBound(_ControlCache)
2612 If lCache &lt; 0 Then
2613 ReDim _ControlCache(0 To 0)
2614 Else
2615 ReDim Preserve _ControlCache(0 To lCache + 1)
2616 End If
2618 &apos; Now the UNO control exists, build the SF_DialogControl instance as usual
2619 Set oControl = Controls(ControlName)
2621 Finally:
2622 Set _CreateNewControl = oControl
2623 Exit Function
2624 Catch:
2625 GoTo Finally
2626 End Function &apos; SFDialogs.SF_Dialog._CreateNewControl
2628 REM -----------------------------------------------------------------------------
2629 Private Function _FindRadioSiblings(ByVal psRadioButton As String) As String
2630 &apos;&apos;&apos; Given the name of the first radio button of a group, return all the names of the group
2631 &apos;&apos;&apos; For dialogs, radio buttons are considered of the same group
2632 &apos;&apos;&apos; when their tab indexes are contiguous.
2633 &apos;&apos;&apos; Args:
2634 &apos;&apos;&apos; psRadioButton: the exact name of the 1st radio button of the group
2635 &apos;&apos;&apos; Returns:
2636 &apos;&apos;&apos; A comma-separated list of the names of the 1st and the next radio buttons
2637 &apos;&apos;&apos; belonging to the same group in their tabindex order.
2638 &apos;&apos;&apos; The input argument when not a radio button
2641 Dim sList As String &apos; Return value
2642 Dim oRadioControl As Object &apos; DialogControl instance corresponding with the argument
2643 Dim oControl As Object &apos; DialogControl instance
2644 Dim vRadioList As Variant &apos; Array of all radio buttons having a tab index &gt; tab index of argument
2645 &apos; 1st column = name of radio button, 2nd = its tab index
2646 Dim iRadioTabIndex As Integer &apos; Tab index of the argument
2647 Dim iTabIndex As Integer &apos; Any tab index
2648 Dim vControlNames As Variant &apos; Array of control names
2649 Dim sControlName As String &apos; A single item in vControlNames()
2650 Dim i As Long
2651 Const cstComma = &quot;,&quot;
2653 Check:
2654 On Local Error GoTo Catch
2655 sList = psRadioButton
2656 vRadioList = Array()
2658 Try:
2659 Set oRadioControl = Controls(psRadioButton)
2660 If oRadioControl.ControlType &lt;&gt; &quot;RadioButton&quot; Then GoTo Finally
2661 iRadioTabIndex = oRadioControl._ControlModel.Tabindex
2662 vRadioList = ScriptForge.SF_Array.AppendRow(vRadioList, Array(psRadioButton, iRadioTabIndex))
2664 &apos; Scan all controls. Store radio buttons having tab index &gt; 1st radio button
2665 vControlNames = Controls()
2666 For Each sControlName In vControlNames
2667 Set oControl = Controls(sControlName)
2668 With oControl
2669 If .Name &lt;&gt; psRadioButton Then
2670 If .ControlType = &quot;RadioButton&quot; Then
2671 iTabIndex = ._ControlModel.Tabindex
2672 If iTabIndex &gt; iRadioTabIndex Then
2673 vRadioList = ScriptForge.SF_Array.AppendRow(vRadioList, Array(.Name, iTabIndex))
2674 End If
2675 End If
2676 End If
2677 End With
2678 Next sControlName
2680 vRadioList = ScriptForge.SF_Array.SortRows(vRadioList, 1)
2681 &apos; Retain contiguous tab indexes
2682 For i = 1 To UBound(vRadioList, 1) &apos; First row = argument
2683 If vRadioList(i, 1) = iRadioTabIndex + i Then sList = sList &amp; cstComma &amp; vRadioList(i, 0)
2684 Next i
2686 Finally:
2687 _FindRadioSiblings = sList
2688 Exit Function
2689 Catch:
2690 sList = psRadioButton
2691 GoTo Finally
2692 End Function &apos; SFDialogs.SF_Dialog._FindRadioSiblings
2694 REM -----------------------------------------------------------------------------
2695 Public Function _GetEventName(ByVal psProperty As String) As String
2696 &apos;&apos;&apos; Return the LO internal event name derived from the SF property name
2697 &apos;&apos;&apos; The SF property name is not case sensitive, while the LO name is case-sensitive
2698 &apos; Corrects the typo on ErrorOccur(r?)ed, if necessary
2700 Dim vProperties As Variant &apos; Array of class properties
2701 Dim sProperty As String &apos; Correctly cased property name
2703 vProperties = Properties()
2704 sProperty = vProperties(ScriptForge.SF_Array.IndexOf(vProperties, psProperty, SortOrder := &quot;ASC&quot;))
2706 _GetEventName = LCase(Mid(sProperty, 3, 1)) &amp; Right(sProperty, Len(sProperty) - 3)
2708 End Function &apos; SFDialogs.SF_Dialog._GetEventName
2710 REM -----------------------------------------------------------------------------
2711 Private Function _GetListener(ByVal psEventName As String) As String
2712 &apos;&apos;&apos; Getting/Setting macros triggered by events requires a Listener-EventName pair
2713 &apos;&apos;&apos; Return the X...Listener corresponding with the event name in argument
2715 Select Case UCase(psEventName)
2716 Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
2717 _GetListener = &quot;XFocusListener&quot;
2718 Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
2719 _GetListener = &quot;XKeyListener&quot;
2720 Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
2721 _GetListener = &quot;XMouseMotionListener&quot;
2722 Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
2723 _GetListener = &quot;XMouseListener&quot;
2724 Case Else
2725 _GetListener = &quot;&quot;
2726 End Select
2728 End Function &apos; SFDialogs.SF_Dialog._GetListener
2730 REM -----------------------------------------------------------------------------
2731 Public Sub _Initialize()
2732 &apos;&apos;&apos; Complete the object creation process:
2733 &apos;&apos;&apos; - Initialization of private members
2734 &apos;&apos;&apos; - Creation of the dialog graphical interface
2735 &apos;&apos;&apos; - Addition of the new object in the Dialogs buffer
2736 &apos;&apos;&apos; - Initialisation of persistent storage for controls
2738 Dim lControls As Long &apos; Number of controls at dialog creation
2739 Try:
2740 &apos; Keep reference to model
2741 Set _DialogModel = _DialogControl.Model
2743 &apos; Store initial position and dimensions
2744 With _DialogModel
2745 _Left = .PositionX
2746 _Top = .PositionY
2747 _Width = .Width
2748 _Height = .Height
2749 End With
2751 &apos; Add dialog reference to cache
2752 _CacheIndex = SF_Register._AddDialogToCache(_DialogControl, [Me])
2754 &apos; Size the persistent storage
2755 _ControlCache = Array()
2756 lControls = UBound(_DialogModel.getElementNames())
2757 If lControls &gt;= 0 Then ReDim _ControlCache(0 To lControls)
2759 Finally:
2760 Exit Sub
2761 End Sub &apos; SFDialogs.SF_Dialog._Initialize
2763 REM -----------------------------------------------------------------------------
2764 Private Function _IsStillAlive(Optional ByVal pbError As Boolean) As Boolean
2765 &apos;&apos;&apos; Return True if the dialog service is still active
2766 &apos;&apos;&apos; If dead the actual instance is disposed. The execution is cancelled when pbError = True (default)
2767 &apos;&apos;&apos; Args:
2768 &apos;&apos;&apos; pbError: if True (default), raise a fatal error
2770 Dim bAlive As Boolean &apos; Return value
2771 Dim sDialog As String &apos; Alias of DialogName
2773 Check:
2774 On Local Error GoTo Catch &apos; Anticipate DisposedException errors or alike
2775 If IsMissing(pbError) Then pbError = True
2777 Try:
2778 bAlive = ( Not IsNull(_DialogProvider) Or _BuiltFromScratch )
2779 If bAlive Then bAlive = Not IsNull(_DialogControl)
2780 If Not bAlive Then GoTo Catch
2782 Finally:
2783 _IsStillAlive = bAlive
2784 Exit Function
2785 Catch:
2786 bAlive = False
2787 On Error GoTo 0
2788 sDialog = _Name
2789 Dispose()
2790 If pbError Then ScriptForge.SF_Exception.RaiseFatal(DIALOGDEADERROR, sDialog)
2791 GoTo Finally
2792 End Function &apos; SFDialogs.SF_Dialog._IsStillAlive
2794 REM -----------------------------------------------------------------------------
2795 Private Sub _JumpToPage(ByVal plPage As Long)
2796 &apos;&apos;&apos; Called when the Page property is set to a new value
2797 &apos;&apos;&apos; The rules defined in the _pageManagement array are applied here
2799 Dim oPageManager As Object &apos; A single entry in _PageManagement of type _PageManager
2800 Dim oControl As Object &apos; DialogControl instance
2801 Dim lPage As Long &apos; A dialog page number
2803 Check:
2804 On Local Error GoTo Finally
2805 &apos; ControlName As String &apos; Case-sensitive name of control involved in page management
2806 &apos; PageMgtType As Integer &apos; One of the PILOTCONTROL, TABCONTROL, BACKCONTROL, NEXTCONTROL constants
2807 &apos; PageNumber As Long &apos; When &gt; 0, the page to activate for tab controls
2808 &apos; ListenerType As Integer &apos; One of the ITEMSTATECHANGED, ACTIONPERFORMED constants
2810 If plPage &lt;= 0 Or (_LastPage &gt; 0 And plPage &gt; _LastPage) Then Exit Sub
2811 If UBound(_PageManagement) &lt; 0 Then Exit Sub
2813 Try:
2814 &apos; Controls listed in the array must be synchronized with the page #
2815 &apos; Listboxes and comboboxes must be set to the corresponding value
2816 &apos; The right radio button must be selected
2817 &apos; One corresponding button must be dimmed, other must be enabled
2818 &apos; The Next button must be dimmed when last page otherwise enabled
2819 For Each oPageManager In _PageManagement
2820 With oPageManager
2821 lPage = .PageNumber
2822 Set oControl = Controls(.ControlName)
2823 With oControl
2824 Select Case .ControlType
2825 Case &quot;ListBox&quot;, &quot;ComboBox&quot;
2826 If plPage &lt;= .ListCount Then .ListIndex = plPage - 1 &apos; ListIndex is zero-based
2827 Case &quot;RadioButton&quot;
2828 .Value = ( plPage = lPage )
2829 Case &quot;Button&quot;
2830 Select Case oPageManager.PageMgtType
2831 Case TABCONTROL
2832 .Value = ( plPage = lPage )
2833 Case BACKCONTROL
2834 .Enabled = ( plPage &lt;&gt; 1 )
2835 Case NEXTCONTROL
2836 .Enabled = ( _LastPage = 0 Or plPage &lt; _LastPage )
2837 Case Else
2838 End Select
2839 Case Else
2840 End Select
2841 End With
2842 End With
2843 Next oPageManager
2845 Finally:
2846 Exit Sub
2847 End Sub &apos; SFDialogs.SF_Dialog._JumpToPage
2849 REM -----------------------------------------------------------------------------
2850 Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
2851 &apos;&apos;&apos; Return the value of the named property
2852 &apos;&apos;&apos; Args:
2853 &apos;&apos;&apos; psProperty: the name of the property
2855 Static oSession As Object &apos; Alias of SF_Session
2856 Dim oPosSize As Object &apos; com.sun.star.awt.Rectangle
2857 Dim oDialogEvents As Object &apos; com.sun.star.container.XNameContainer
2858 Dim sEventName As String &apos; Internal event name
2859 Dim cstThisSub As String
2860 Const cstSubArgs = &quot;&quot;
2862 cstThisSub = &quot;SFDialogs.Dialog.get&quot; &amp; psProperty
2863 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2865 ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
2866 If Not _IsStillAlive() Then GoTo Finally
2868 If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
2869 Select Case UCase(psProperty)
2870 Case UCase(&quot;Caption&quot;)
2871 If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _PropertyGet = _DialogModel.Title
2872 Case UCase(&quot;Height&quot;)
2873 If _Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
2874 _PropertyGet = SF_DialogUtils._ConvertToAppFont(_DialogControl, False).Height
2875 Else
2876 If oSession.HasUNOProperty(_DialogModel, &quot;Height&quot;) Then _PropertyGet = _DialogModel.Height
2877 End If
2878 Case UCase(&quot;Modal&quot;)
2879 _PropertyGet = _Modal
2880 Case UCase(&quot;Name&quot;)
2881 _PropertyGet = _Name
2882 Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
2883 , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
2884 , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
2885 &apos; Check OnEvents set statically in Basic IDE
2886 Set oDialogEvents = _DialogModel.getEvents()
2887 sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; _GetEventName(psProperty)
2888 If oDialogEvents.hasByName(sEventName) Then
2889 _PropertyGet = oDialogEvents.getByName(sEventName).ScriptCode
2890 Else
2891 &apos; Check OnEvents set dynamically by code
2892 Select Case UCase(psProperty)
2893 Case UCase(&quot;OnFocusGained&quot;) : _PropertyGet = _OnFocusGained
2894 Case UCase(&quot;OnFocusLost&quot;) : _PropertyGet = _OnFocusLost
2895 Case UCase(&quot;OnKeyPressed&quot;) : _PropertyGet = _OnKeyPressed
2896 Case UCase(&quot;OnKeyReleased&quot;) : _PropertyGet = _OnKeyReleased
2897 Case UCase(&quot;OnMouseDragged&quot;) : _PropertyGet = _OnMouseDragged
2898 Case UCase(&quot;OnMouseEntered&quot;) : _PropertyGet = _OnMouseEntered
2899 Case UCase(&quot;OnMouseExited&quot;) : _PropertyGet = _OnMouseExited
2900 Case UCase(&quot;OnMouseMoved&quot;) : _PropertyGet = _OnMouseMoved
2901 Case UCase(&quot;OnMousePressed&quot;) : _PropertyGet = _OnMousePressed
2902 Case UCase(&quot;OnMouseReleased&quot;) : _PropertyGet = _OnMouseReleased
2903 Case Else : _PropertyGet = &quot;&quot;
2904 End Select
2905 End If
2906 Case UCase(&quot;Page&quot;)
2907 If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then _PropertyGet = _DialogModel.Step
2908 Case UCase(&quot;Visible&quot;)
2909 If oSession.HasUnoMethod(_DialogControl, &quot;isVisible&quot;) Then _PropertyGet = CBool(_DialogControl.isVisible())
2910 Case UCase(&quot;Width&quot;)
2911 If _Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
2912 _PropertyGet = SF_DialogUtils._ConvertToAppFont(_DialogControl, False).Width
2913 Else
2914 If oSession.HasUNOProperty(_DialogModel, &quot;Width&quot;) Then _PropertyGet = _DialogModel.Width
2915 End If
2916 Case UCase(&quot;XDialogModel&quot;)
2917 Set _PropertyGet = _DialogModel
2918 Case UCase(&quot;XDialogView&quot;)
2919 Set _PropertyGet = _DialogControl
2920 Case Else
2921 _PropertyGet = Null
2922 End Select
2924 Finally:
2925 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
2926 Exit Function
2927 Catch:
2928 GoTo Finally
2929 End Function &apos; SFDialogs.SF_Dialog._PropertyGet
2931 REM -----------------------------------------------------------------------------
2932 Private Function _PropertySet(Optional ByVal psProperty As String _
2933 , Optional ByVal pvValue As Variant _
2934 ) As Boolean
2935 &apos;&apos;&apos; Set the new value of the named property
2936 &apos;&apos;&apos; Args:
2937 &apos;&apos;&apos; psProperty: the name of the property
2938 &apos;&apos;&apos; pvValue: the new value of the given property
2939 &apos;&apos;&apos; Returns:
2940 &apos;&apos;&apos; True if successful
2942 Dim bSet As Boolean &apos; Return value
2943 Static oSession As Object &apos; Alias of SF_Session
2944 Dim cstThisSub As String
2945 Const cstSubArgs = &quot;Value&quot;
2947 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
2948 bSet = False
2950 cstThisSub = &quot;SFDialogs.Dialog.set&quot; &amp; psProperty
2951 ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
2952 If Not _IsStillAlive() Then GoTo Finally
2954 If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
2955 bSet = True
2956 Select Case UCase(psProperty)
2957 Case UCase(&quot;Caption&quot;)
2958 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Catch
2959 If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _DialogModel.Title = pvValue
2960 Case UCase(&quot;Height&quot;)
2961 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
2962 bSet = Resize(Height := pvValue)
2963 Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
2964 , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
2965 , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
2966 If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Catch
2967 bSet = SF_DialogListener._SetOnProperty([Me], psProperty, pvValue)
2968 Case UCase(&quot;Page&quot;)
2969 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
2970 If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then
2971 _DialogModel.Step = CLng(pvValue)
2972 &apos; Execute the page manager instructions
2973 _JumpToPage(pvValue)
2974 End If
2975 Case UCase(&quot;Visible&quot;)
2976 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
2977 If oSession.HasUnoMethod(_DialogControl, &quot;setVisible&quot;) Then _DialogControl.setVisible(pvValue)
2978 Case UCase(&quot;Width&quot;)
2979 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
2980 bSet = Resize(Width := pvValue)
2981 Case Else
2982 bSet = False
2983 End Select
2985 Finally:
2986 _PropertySet = bSet
2987 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
2988 Exit Function
2989 Catch:
2990 bSet = False
2991 GoTo Finally
2992 End Function &apos; SFDialogs.SF_Dialog._PropertySet
2994 REM -----------------------------------------------------------------------------
2995 Private Function _RegisterPageListener(ByVal psControlName As String _
2996 , ByVal psControlTypes As String _
2997 , ByVal piMgtType As Integer _
2998 , ByVal plPageNumber As Long _
2999 , ByVal piListener As Integer _
3000 ) As Boolean
3001 &apos;&apos;&apos; Insert a new entry in the _PageManagement array when 1st argument is a listbox, a combobox or a button
3002 &apos;&apos;&apos; or insert a new entry in the _PageManagement array by radio button in the same group as the 1st argument
3003 &apos;&apos;&apos; Args:
3004 &apos;&apos;&apos; psControlName: name of the involved control
3005 &apos;&apos;&apos; psControlTypes: comma-separated list of allowed control types
3006 &apos;&apos;&apos; piMgtType: one of the PILOTCONTROL, TABCONTROL, BACKCONTROL, NEXTCONTROL constants
3007 &apos;&apos;&apos; plPageNumber: when &gt; 0 the page to jump to when control is clicked
3008 &apos;&apos;&apos; piListener: one of the ACTIONPERFORMED, ITEMSTATECHANGED constants
3010 Dim bRegister As Boolean &apos; Return value
3011 Dim oControl As Object &apos; A DialogControl object
3012 Dim oControl2 As Object &apos; An alternative DialogControl object for radio buttons
3013 Dim vControls As Variant &apos; Array of involved controls - mostly 1 item, more when radio button
3014 Dim oPageManager As Object &apos; Type _PageManager
3015 Dim bRadio As Boolean &apos; True when argument is a radio button
3016 Dim sName As String &apos; Control name
3017 Dim i As Long
3019 Check:
3020 On Local Error GoTo Catch
3021 bRegister = False
3023 Try:
3024 Set oControl = Controls(psControlName)
3025 With oControl
3026 &apos; Check the type of control otherwise return False
3027 If InStr(psControlTypes, .ControlType) = 0 Then GoTo Catch
3028 &apos; Are there siblings ? Siblings are returned as a comma-separated list of names
3029 bRadio = ( .ControlType = &quot;RadioButton&quot;)
3030 If bRadio Then vControls = Split(_FindRadioSiblings(.Name), &quot;,&quot;) Else vControls = Array(.Name)
3031 &apos; Several loops when radio buttons
3032 For i = 0 To UBound(vControls)
3033 sName = vControls(i)
3034 &apos; Prepare the next entry in the _PageManagement array
3035 Set oPageManager = New _PageManager
3036 With oPageManager
3037 .ControlName = sName
3038 .PageMgtType = piMgtType
3039 .PageNumber = Iif(bRadio, i + 1, plPageNumber)
3040 .ListenerType = piListener
3041 End With
3042 _PageManagement = ScriptForge.SF_Array.Append(_PageManagement, oPageManager)
3043 &apos; Activate the listener
3044 &apos; Use alternative control for radio buttons &gt; first
3045 If i = 0 Then Set oControl2 = oControl Else Set oControl2 = Controls(sName)
3046 With oControl2
3047 If piListener = ACTIONPERFORMED Then
3048 ._ControlView.addActionListener(_ActionListener)
3049 ElseIf piListener = ITEMSTATECHANGED Then
3050 ._ControlView.addItemListener(_ItemListener)
3051 End If
3052 End With
3053 Next i
3054 End With
3056 bRegister = True
3058 Finally:
3059 _RegisterPageListener = bRegister
3060 Exit Function
3061 Catch:
3062 GoTo Finally
3063 End Function &apos; SFDialogs.SF_Dialog._RegisterPageListener
3065 REM -----------------------------------------------------------------------------
3066 Private Sub _RemoveAllListeners()
3067 &apos;&apos;&apos; Executed at dialog termination to drop at once all listeners set
3068 &apos;&apos;&apos; either by the page manager or by an On-property setting
3070 Dim oPageManager As Object &apos; Item of _PageManagement array of _PageManager type
3071 Dim oControl As Object &apos; DialogControl instance
3072 Dim i As Long
3074 On Local Error GoTo Finally &apos; Never interrupt
3076 Try:
3077 &apos; Scan the _PageManagement array containing the actual settings of the page manager
3078 For Each oPageManager In _PageManagement
3079 With oPageManager
3080 If .ListenerType &gt; 0 Then
3081 Set oControl = Controls(.ControlName)
3082 If .ListenerType = ACTIONPERFORMED Then
3083 oControl._ControlView.removeActionListener(_ActionListener)
3084 ElseIf .ListenerType = ITEMSTATECHANGED Then
3085 oControl._ControlView.removeItemListener(_ItemListener)
3086 End If
3087 End If
3088 End With
3089 Next oPageManager
3091 Set _ActionListener = Nothing
3092 Set _ItemListener = Nothing
3094 &apos; Clean listeners linked to On properties
3095 With _DialogControl
3096 If Not IsNull(_FocusListener) Then .removeFocusListener(_FocusListener)
3097 If Not IsNull(_KeyListener) Then .removeKeyListener(_KeyListener)
3098 If Not IsNull(_MouseListener) Then .removeMouseListener(_MouseListener)
3099 If Not IsNull(_MouseMotionListener) Then .removeMouseMotionListener(_MouseMotionListener)
3100 End With
3102 Set _FocusListener = Nothing
3103 Set _KeyListener = Nothing
3104 Set _MouseListener = Nothing
3105 Set _MouseMotionListener = Nothing
3107 Finally:
3108 Exit Sub
3109 End Sub &apos; SFDialogs.SF_Dialog._RemoveAllListeners
3110 REM -----------------------------------------------------------------------------
3111 Private Function _Repr() As String
3112 &apos;&apos;&apos; Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
3113 &apos;&apos;&apos; Args:
3114 &apos;&apos;&apos; Return:
3115 &apos;&apos;&apos; &quot;[DIALOG]: Container.Library.Name&quot;
3117 _Repr = &quot;[DIALOG]: &quot; &amp; _Container &amp; &quot;.&quot; &amp; _Library &amp; &quot;.&quot; &amp; _Name
3119 End Function &apos; SFDialogs.SF_Dialog._Repr
3121 REM ============================================ END OF SFDIALOGS.SF_DIALOG
3122 </script:module>