calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / wizards / source / sfdialogs / SF_DialogControl.xba
blobf4a0891d92c435defc1a9585c3d48d2b46e04212
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_DialogControl" 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_DialogControl
16 &apos;&apos;&apos; ================
17 &apos;&apos;&apos; Manage the controls belonging to a dialog defined with the Basic IDE
18 &apos;&apos;&apos; Each instance of the current class represents a single control within a dialog box
19 &apos;&apos;&apos;
20 &apos;&apos;&apos; The focus is clearly set on getting and setting the values displayed by the controls of the dialog box,
21 &apos;&apos;&apos; not on their formatting. The latter is easily accessible via the XControlModel and XControlView
22 &apos;&apos;&apos; UNO objects.
23 &apos;&apos;&apos; Essentially a single property &quot;Value&quot; maps many alternative UNO properties depending each on
24 &apos;&apos;&apos; the control type.
25 &apos;&apos;&apos;
26 &apos;&apos;&apos; A special attention is given to controls with types TreeControl and TableControl
27 &apos;&apos;&apos; It is easy with the API proposed in the current class to populate a tree, either
28 &apos;&apos;&apos; - branch by branch (CreateRoot and AddSubNode), or
29 &apos;&apos;&apos; - with a set of branches at once (AddSubtree)
30 &apos;&apos;&apos; Additionally populating a TreeControl can be done statically or dynamically
31 &apos;&apos;&apos;
32 &apos;&apos;&apos; With the method SetTableData(), feed a tablecontrol with a sortable and selectable
33 &apos;&apos;&apos; array of data. Columns and rows may receive a header. Column widths are adjusted manually by the user or
34 &apos;&apos;&apos; with the same method. Alignments can be set as well by script.
35 &apos;&apos;&apos;
36 &apos;&apos;&apos; Service invocation:
37 &apos;&apos;&apos; Dim myDialog As Object, myControl As Object
38 &apos;&apos;&apos; Set myDialog = CreateScriptService(&quot;SFDialogs.Dialog&quot;, &quot;GlobalScope&quot;, myLibrary, DialogName)
39 &apos;&apos;&apos; Set myControl = myDialog.Controls(&quot;myTextBox&quot;)
40 &apos;&apos;&apos; myControl.Value = &quot;Dialog started at &quot; &amp; Now()
41 &apos;&apos;&apos; myDialog.Execute()
42 &apos;&apos;&apos; &apos; ... process the controls actual values
43 &apos;&apos;&apos; myDialog.Terminate()
44 &apos;&apos;&apos;
45 &apos;&apos;&apos; Detailed user documentation:
46 &apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_dialogcontrol.html?DbPAR=BASIC
47 &apos;&apos;&apos;
48 &apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
50 REM ================================================================== EXCEPTIONS
52 Private Const CONTROLTYPEERROR = &quot;CONTROLTYPEERROR&quot;
53 Private Const TEXTFIELDERROR = &quot;TEXTFIELDERROR&quot;
55 REM ============================================================= PRIVATE MEMBERS
57 Private [Me] As Object
58 Private [_Parent] As Object
59 Private ObjectType As String &apos; Must be DIALOGCONTROL
60 Private ServiceName As String
62 &apos; Control naming
63 Private _Name As String
64 Private _IndexOfNames As Long &apos; Index in ElementNames array. Used to access SF_Dialog._ControlCache
65 Private _DialogName As String &apos; Parent dialog name
67 &apos; Control UNO references
68 Private _ControlModel As Object &apos; com.sun.star.awt.XControlModel
69 Private _ControlView As Object &apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
70 Private _TreeDataModel As Object &apos; com.sun.star.awt.tree.MutableTreeDataModel
71 Private _GridColumnModel As Object &apos; com.sun.star.awt.grid.XGridColumnModel
72 Private _GridDataModel As Object &apos; com.sun.star.awt.grid.XGridDataModel
74 &apos; Control attributes
75 Private _ImplementationName As String
76 Private _ControlType As String &apos; One of the CTLxxx constants
78 &apos; Tree control on-select and on-expand attributes
79 &apos; Tree controls may be associated with events not defined in the Basic IDE
80 Private _OnNodeSelected As String &apos; Script to invoke when a node is selected
81 Private _OnNodeExpanded As String &apos; Script to invoke when a node is expanded
82 Private _SelectListener As Object &apos; com.sun.star.view.XSelectionChangeListener
83 Private _ExpandListener As Object &apos; com.sun.star.awt.tree.XTreeExpansionListener
85 &apos; Table control attributes
86 Private _ColumnWidths As Variant &apos; Array of column widths
88 REM ============================================================ MODULE CONSTANTS
90 Private Const CTLBUTTON = &quot;Button&quot;
91 Private Const CTLCHECKBOX = &quot;CheckBox&quot;
92 Private Const CTLCOMBOBOX = &quot;ComboBox&quot;
93 Private Const CTLCURRENCYFIELD = &quot;CurrencyField&quot;
94 Private Const CTLDATEFIELD = &quot;DateField&quot;
95 Private Const CTLFILECONTROL = &quot;FileControl&quot;
96 Private Const CTLFIXEDLINE = &quot;FixedLine&quot;
97 Private Const CTLFIXEDTEXT = &quot;FixedText&quot;
98 Private Const CTLFORMATTEDFIELD = &quot;FormattedField&quot;
99 Private Const CTLGROUPBOX = &quot;GroupBox&quot;
100 Private Const CTLIMAGECONTROL = &quot;ImageControl&quot;
101 Private Const CTLLISTBOX = &quot;ListBox&quot;
102 Private Const CTLNUMERICFIELD = &quot;NumericField&quot;
103 Private Const CTLPATTERNFIELD = &quot;PatternField&quot;
104 Private Const CTLPROGRESSBAR = &quot;ProgressBar&quot;
105 Private Const CTLRADIOBUTTON = &quot;RadioButton&quot;
106 Private Const CTLSCROLLBAR = &quot;ScrollBar&quot;
107 Private Const CTLTABLECONTROL = &quot;TableControl&quot;
108 Private Const CTLTEXTFIELD = &quot;TextField&quot;
109 Private Const CTLTIMEFIELD = &quot;TimeField&quot;
110 Private Const CTLTREECONTROL = &quot;TreeControl&quot;
112 REM ====================================================== CONSTRUCTOR/DESTRUCTOR
114 REM -----------------------------------------------------------------------------
115 Private Sub Class_Initialize()
116 Set [Me] = Nothing
117 Set [_Parent] = Nothing
118 ObjectType = &quot;DIALOGCONTROL&quot;
119 ServiceName = &quot;SFDialogs.DialogControl&quot;
120 _Name = &quot;&quot;
121 _IndexOfNames = -1
122 _DialogName = &quot;&quot;
123 Set _ControlModel = Nothing
124 Set _ControlView = Nothing
125 Set _TreeDataModel = Nothing
126 Set _GridColumnModel = Nothing
127 Set _GridDataModel = Nothing
128 _ImplementationName = &quot;&quot;
129 _ControlType = &quot;&quot;
130 _OnNodeSelected = &quot;&quot;
131 _OnNodeExpanded = &quot;&quot;
132 Set _SelectListener = Nothing
133 Set _ExpandListener = Nothing
134 _ColumnWidths = Array()
135 End Sub &apos; SFDialogs.SF_DialogControl Constructor
137 REM -----------------------------------------------------------------------------
138 Private Sub Class_Terminate()
139 Call Class_Initialize()
140 End Sub &apos; SFDialogs.SF_DialogControl Destructor
142 REM -----------------------------------------------------------------------------
143 Public Function Dispose() As Variant
144 Call Class_Terminate()
145 Set Dispose = Nothing
146 End Function &apos; SFDialogs.SF_DialogControl Explicit Destructor
148 REM ================================================================== PROPERTIES
150 REM -----------------------------------------------------------------------------
151 Property Get Cancel() As Variant
152 &apos;&apos;&apos; The Cancel property specifies if a command button has or not the behaviour of a Cancel button.
153 Cancel = _PropertyGet(&quot;Cancel&quot;, False)
154 End Property &apos; SFDialogs.SF_DialogControl.Cancel (get)
156 REM -----------------------------------------------------------------------------
157 Property Let Cancel(Optional ByVal pvCancel As Variant)
158 &apos;&apos;&apos; Set the updatable property Cancel
159 _PropertySet(&quot;Cancel&quot;, pvCancel)
160 End Property &apos; SFDialogs.SF_DialogControl.Cancel (let)
162 REM -----------------------------------------------------------------------------
163 Property Get Caption() As Variant
164 &apos;&apos;&apos; The Caption property refers to the text associated with the control
165 Caption = _PropertyGet(&quot;Caption&quot;, &quot;&quot;)
166 End Property &apos; SFDialogs.SF_DialogControl.Caption (get)
168 REM -----------------------------------------------------------------------------
169 Property Let Caption(Optional ByVal pvCaption As Variant)
170 &apos;&apos;&apos; Set the updatable property Caption
171 _PropertySet(&quot;Caption&quot;, pvCaption)
172 End Property &apos; SFDialogs.SF_DialogControl.Caption (let)
174 REM -----------------------------------------------------------------------------
175 Property Get ControlType() As String
176 &apos;&apos;&apos; Return the type of the actual control: &quot;CheckBox&quot;, &quot;TextField&quot;, &quot;DateField&quot;, ...
177 ControlType = _PropertyGet(&quot;ControlType&quot;)
178 End Property &apos; SFDialogs.SF_DialogControl.ControlType
180 REM -----------------------------------------------------------------------------
181 Property Get CurrentNode() As Variant
182 &apos;&apos;&apos; The CurrentNode property returns the currently selected node
183 &apos;&apos;&apos; It returns Empty when there is no node selected
184 &apos;&apos;&apos; When there are several selections, it returns the topmost node among the selected ones
185 CurrentNode = _PropertyGet(&quot;CurrentNode&quot;, &quot;&quot;)
186 End Property &apos; SFDialogs.SF_DialogControl.CurrentNode (get)
188 REM -----------------------------------------------------------------------------
189 Property Let CurrentNode(Optional ByVal pvCurrentNode As Variant)
190 &apos;&apos;&apos; Set a single selection in a tree control
191 _PropertySet(&quot;CurrentNode&quot;, pvCurrentNode)
192 End Property &apos; SFDialogs.SF_DialogControl.CurrentNode (let)
194 REM -----------------------------------------------------------------------------
195 Property Get Default() As Variant
196 &apos;&apos;&apos; The Default property specifies whether a command button is the default (OK) button.
197 Default = _PropertyGet(&quot;Default&quot;, False)
198 End Property &apos; SFDialogs.SF_DialogControl.Default (get)
200 REM -----------------------------------------------------------------------------
201 Property Let Default(Optional ByVal pvDefault As Variant)
202 &apos;&apos;&apos; Set the updatable property Default
203 _PropertySet(&quot;Default&quot;, pvDefault)
204 End Property &apos; SFDialogs.SF_DialogControl.Default (let)
206 REM -----------------------------------------------------------------------------
207 Property Get Enabled() As Variant
208 &apos;&apos;&apos; The Enabled property specifies if the control is accessible with the cursor.
209 Enabled = _PropertyGet(&quot;Enabled&quot;)
210 End Property &apos; SFDialogs.SF_DialogControl.Enabled (get)
212 REM -----------------------------------------------------------------------------
213 Property Let Enabled(Optional ByVal pvEnabled As Variant)
214 &apos;&apos;&apos; Set the updatable property Enabled
215 _PropertySet(&quot;Enabled&quot;, pvEnabled)
216 End Property &apos; SFDialogs.SF_DialogControl.Enabled (let)
218 REM -----------------------------------------------------------------------------
219 Property Get Format() As Variant
220 &apos;&apos;&apos; The Format property specifies the format in which to display dates and times.
221 Format = _PropertyGet(&quot;Format&quot;, &quot;&quot;)
222 End Property &apos; SFDialogs.SF_DialogControl.Format (get)
224 REM -----------------------------------------------------------------------------
225 Property Let Format(Optional ByVal pvFormat As Variant)
226 &apos;&apos;&apos; Set the updatable property Format
227 &apos;&apos;&apos; NB: Format is read-only for formatted field controls
228 _PropertySet(&quot;Format&quot;, pvFormat)
229 End Property &apos; SFDialogs.SF_DialogControl.Format (let)
231 REM -----------------------------------------------------------------------------
232 Property Get ListCount() As Long
233 &apos;&apos;&apos; The ListCount property specifies the number of rows in a list box or a combo box
234 ListCount = _PropertyGet(&quot;ListCount&quot;, 0)
235 End Property &apos; SFDialogs.SF_DialogControl.ListCount (get)
237 REM -----------------------------------------------------------------------------
238 Property Get ListIndex() As Variant
239 &apos;&apos;&apos; The ListIndex property specifies which item is selected in a list box or combo box.
240 &apos;&apos;&apos; In case of multiple selection, the index of the first one is returned or only one is set
241 ListIndex = _PropertyGet(&quot;ListIndex&quot;, -1)
242 End Property &apos; SFDialogs.SF_DialogControl.ListIndex (get)
244 REM -----------------------------------------------------------------------------
245 Property Let ListIndex(Optional ByVal pvListIndex As Variant)
246 &apos;&apos;&apos; Set the updatable property ListIndex
247 _PropertySet(&quot;ListIndex&quot;, pvListIndex)
248 End Property &apos; SFDialogs.SF_DialogControl.ListIndex (let)
250 REM -----------------------------------------------------------------------------
251 Property Get Locked() As Variant
252 &apos;&apos;&apos; The Locked property specifies if a control is read-only
253 Locked = _PropertyGet(&quot;Locked&quot;, False)
254 End Property &apos; SFDialogs.SF_DialogControl.Locked (get)
256 REM -----------------------------------------------------------------------------
257 Property Let Locked(Optional ByVal pvLocked As Variant)
258 &apos;&apos;&apos; Set the updatable property Locked
259 _PropertySet(&quot;Locked&quot;, pvLocked)
260 End Property &apos; SFDialogs.SF_DialogControl.Locked (let)
262 REM -----------------------------------------------------------------------------
263 Property Get MultiSelect() As Variant
264 &apos;&apos;&apos; The MultiSelect property specifies whether a user can make multiple selections in a listbox
265 MultiSelect = _PropertyGet(&quot;MultiSelect&quot;, False)
266 End Property &apos; SFDialogs.SF_DialogControl.MultiSelect (get)
268 REM -----------------------------------------------------------------------------
269 Property Let MultiSelect(Optional ByVal pvMultiSelect As Variant)
270 &apos;&apos;&apos; Set the updatable property MultiSelect
271 _PropertySet(&quot;MultiSelect&quot;, pvMultiSelect)
272 End Property &apos; SFDialogs.SF_DialogControl.MultiSelect (let)
274 REM -----------------------------------------------------------------------------
275 Property Get Name() As String
276 &apos;&apos;&apos; Return the name of the actual control
277 Name = _PropertyGet(&quot;Name&quot;)
278 End Property &apos; SFDialogs.SF_DialogControl.Name
280 REM -----------------------------------------------------------------------------
281 Property Get OnActionPerformed() As Variant
282 &apos;&apos;&apos; Get the script associated with the OnActionPerformed event
283 OnActionPerformed = _PropertyGet(&quot;OnActionPerformed&quot;)
284 End Property &apos; SFDialogs.SF_DialogControl.OnActionPerformed (get)
286 REM -----------------------------------------------------------------------------
287 Property Get OnAdjustmentValueChanged() As Variant
288 &apos;&apos;&apos; Get the script associated with the OnAdjustmentValueChanged event
289 OnAdjustmentValueChanged = _PropertyGet(&quot;OnAdjustmentValueChanged&quot;)
290 End Property &apos; SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (get)
292 REM -----------------------------------------------------------------------------
293 Property Get OnFocusGained() As Variant
294 &apos;&apos;&apos; Get the script associated with the OnFocusGained event
295 OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
296 End Property &apos; SFDialogs.SF_DialogControl.OnFocusGained (get)
298 REM -----------------------------------------------------------------------------
299 Property Get OnFocusLost() As Variant
300 &apos;&apos;&apos; Get the script associated with the OnFocusLost event
301 OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
302 End Property &apos; SFDialogs.SF_DialogControl.OnFocusLost (get)
304 REM -----------------------------------------------------------------------------
305 Property Get OnItemStateChanged() As Variant
306 &apos;&apos;&apos; Get the script associated with the OnItemStateChanged event
307 OnItemStateChanged = _PropertyGet(&quot;OnItemStateChanged&quot;)
308 End Property &apos; SFDialogs.SF_DialogControl.OnItemStateChanged (get)
310 REM -----------------------------------------------------------------------------
311 Property Get OnKeyPressed() As Variant
312 &apos;&apos;&apos; Get the script associated with the OnKeyPressed event
313 OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
314 End Property &apos; SFDialogs.SF_DialogControl.OnKeyPressed (get)
316 REM -----------------------------------------------------------------------------
317 Property Get OnKeyReleased() As Variant
318 &apos;&apos;&apos; Get the script associated with the OnKeyReleased event
319 OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
320 End Property &apos; SFDialogs.SF_DialogControl.OnKeyReleased (get)
322 REM -----------------------------------------------------------------------------
323 Property Get OnMouseDragged() As Variant
324 &apos;&apos;&apos; Get the script associated with the OnMouseDragged event
325 OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
326 End Property &apos; SFDialogs.SF_DialogControl.OnMouseDragged (get)
328 REM -----------------------------------------------------------------------------
329 Property Get OnMouseEntered() As Variant
330 &apos;&apos;&apos; Get the script associated with the OnMouseEntered event
331 OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
332 End Property &apos; SFDialogs.SF_DialogControl.OnMouseEntered (get)
334 REM -----------------------------------------------------------------------------
335 Property Get OnMouseExited() As Variant
336 &apos;&apos;&apos; Get the script associated with the OnMouseExited event
337 OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
338 End Property &apos; SFDialogs.SF_DialogControl.OnMouseExited (get)
340 REM -----------------------------------------------------------------------------
341 Property Get OnMouseMoved() As Variant
342 &apos;&apos;&apos; Get the script associated with the OnMouseMoved event
343 OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
344 End Property &apos; SFDialogs.SF_DialogControl.OnMouseMoved (get)
346 REM -----------------------------------------------------------------------------
347 Property Get OnMousePressed() As Variant
348 &apos;&apos;&apos; Get the script associated with the OnMousePressed event
349 OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
350 End Property &apos; SFDialogs.SF_DialogControl.OnMousePressed (get)
352 REM -----------------------------------------------------------------------------
353 Property Get OnMouseReleased() As Variant
354 &apos;&apos;&apos; Get the script associated with the OnMouseReleased event
355 OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
356 End Property &apos; SFDialogs.SF_DialogControl.OnMouseReleased (get)
358 REM -----------------------------------------------------------------------------
359 Property Get OnNodeExpanded() As Variant
360 &apos;&apos;&apos; Get the script associated with the OnNodeExpanded event
361 OnNodeExpanded = _PropertyGet(&quot;OnNodeExpanded&quot;)
362 End Property &apos; SFDialogs.SF_DialogControl.OnNodeExpanded (get)
364 REM -----------------------------------------------------------------------------
365 Property Let OnNodeExpanded(Optional ByVal pvOnNodeExpanded As Variant)
366 &apos;&apos;&apos; Set the updatable property OnNodeExpanded
367 _PropertySet(&quot;OnNodeExpanded&quot;, pvOnNodeExpanded)
368 End Property &apos; SFDialogs.SF_DialogControl.OnNodeExpanded (let)
370 REM -----------------------------------------------------------------------------
371 Property Get OnNodeSelected() As Variant
372 &apos;&apos;&apos; Get the script associated with the OnNodeSelected event
373 OnNodeSelected = _PropertyGet(&quot;OnNodeSelected&quot;)
374 End Property &apos; SFDialogs.SF_DialogControl.OnNodeSelected (get)
376 REM -----------------------------------------------------------------------------
377 Property Let OnNodeSelected(Optional ByVal pvOnNodeSelected As Variant)
378 &apos;&apos;&apos; Set the updatable property OnNodeSelected
379 _PropertySet(&quot;OnNodeSelected&quot;, pvOnNodeSelected)
380 End Property &apos; SFDialogs.SF_DialogControl.OnNodeSelected (let)
382 REM -----------------------------------------------------------------------------
383 Property Get OnTextChanged() As Variant
384 &apos;&apos;&apos; Get the script associated with the OnTextChanged event
385 OnTextChanged = _PropertyGet(&quot;OnTextChanged&quot;)
386 End Property &apos; SFDialogs.SF_DialogControl.OnTextChanged (get)
388 REM -----------------------------------------------------------------------------
389 Property Get Page() As Variant
390 &apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step. The Page property of the Dialog object defines which page of the dialog is active.
391 &apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
392 &apos;&apos;&apos; For example, if a control has a page value of 1, it is only visible on page 1 of the dialog.
393 &apos;&apos;&apos; If the page value of the dialog is increased from 1 to 2, then all controls with a page value of 1 disappear and all controls with a page value of 2 become visible.
394 Page = _PropertyGet(&quot;Page&quot;)
395 End Property &apos; SFDialogs.SF_DialogControl.Page (get)
397 REM -----------------------------------------------------------------------------
398 Property Let Page(Optional ByVal pvPage As Variant)
399 &apos;&apos;&apos; Set the updatable property Page
400 _PropertySet(&quot;Page&quot;, pvPage)
401 End Property &apos; SFDialogs.SF_DialogControl.Page (let)
403 REM -----------------------------------------------------------------------------
404 Property Get Parent() As Object
405 &apos;&apos;&apos; Return the Parent dialog object of the actual control
406 Parent = _PropertyGet(&quot;Parent&quot;, Nothing)
407 End Property &apos; SFDialogs.SF_DialogControl.Parent
409 REM -----------------------------------------------------------------------------
410 Property Get Picture() As Variant
411 &apos;&apos;&apos; The Picture property specifies a bitmap or other type of graphic to be displayed on the specified control
412 Picture = _PropertyGet(&quot;Picture&quot;, &quot;&quot;)
413 End Property &apos; SFDialogs.SF_DialogControl.Picture (get)
415 REM -----------------------------------------------------------------------------
416 Property Let Picture(Optional ByVal pvPicture As Variant)
417 &apos;&apos;&apos; Set the updatable property Picture
418 _PropertySet(&quot;Picture&quot;, pvPicture)
419 End Property &apos; SFDialogs.SF_DialogControl.Picture (let)
421 REM -----------------------------------------------------------------------------
422 Property Get RootNode() As Variant
423 &apos;&apos;&apos; The RootNode property returns the last root node of a tree control
424 RootNode = _PropertyGet(&quot;RootNode&quot;, &quot;&quot;)
425 End Property &apos; SFDialogs.SF_DialogControl.RootNode (get)
427 REM -----------------------------------------------------------------------------
428 Property Get RowSource() As Variant
429 &apos;&apos;&apos; The RowSource property specifies the data contained in a combobox or a listbox
430 &apos;&apos;&apos; as a zero-based array of string values
431 RowSource = _PropertyGet(&quot;RowSource&quot;, &quot;&quot;)
432 End Property &apos; SFDialogs.SF_DialogControl.RowSource (get)
434 REM -----------------------------------------------------------------------------
435 Property Let RowSource(Optional ByVal pvRowSource As Variant)
436 &apos;&apos;&apos; Set the updatable property RowSource
437 _PropertySet(&quot;RowSource&quot;, pvRowSource)
438 End Property &apos; SFDialogs.SF_DialogControl.RowSource (let)
440 REM -----------------------------------------------------------------------------
441 Property Get Text() As Variant
442 &apos;&apos;&apos; The Text property specifies the actual content of the control like it is displayed on the screen
443 Text = _PropertyGet(&quot;Text&quot;, &quot;&quot;)
444 End Property &apos; SFDialogs.SF_DialogControl.Text (get)
446 REM -----------------------------------------------------------------------------
447 Property Get TipText() As Variant
448 &apos;&apos;&apos; The TipText property specifies the text that appears in a screentip when you hold the mouse pointer over a control
449 TipText = _PropertyGet(&quot;TipText&quot;, &quot;&quot;)
450 End Property &apos; SFDialogs.SF_DialogControl.TipText (get)
452 REM -----------------------------------------------------------------------------
453 Property Let TipText(Optional ByVal pvTipText As Variant)
454 &apos;&apos;&apos; Set the updatable property TipText
455 _PropertySet(&quot;TipText&quot;, pvTipText)
456 End Property &apos; SFDialogs.SF_DialogControl.TipText (let)
458 REM -----------------------------------------------------------------------------
459 Property Get TripleState() As Variant
460 &apos;&apos;&apos; The TripleState property specifies how a check box will display Null values
461 &apos;&apos;&apos; When True, the control will cycle through states for Yes, No, and Null values. The control appears dimmed (grayed) when its Value property is set to Null.
462 &apos;&apos;&apos; When False, the control will cycle through states for Yes and No values. Null values display as if they were No values.
463 TripleState = _PropertyGet(&quot;TripleState&quot;, False)
464 End Property &apos; SFDialogs.SF_DialogControl.TripleState (get)
466 REM -----------------------------------------------------------------------------
467 Property Let TripleState(Optional ByVal pvTripleState As Variant)
468 &apos;&apos;&apos; Set the updatable property TripleState
469 _PropertySet(&quot;TripleState&quot;, pvTripleState)
470 End Property &apos; SFDialogs.SF_DialogControl.TripleState (let)
472 REM -----------------------------------------------------------------------------
473 Property Get Value() As Variant
474 &apos;&apos;&apos; The Value property specifies the data contained in the control
475 Value = _PropertyGet(&quot;Value&quot;, Empty)
476 End Property &apos; SFDialogs.SF_DialogControl.Value (get)
478 REM -----------------------------------------------------------------------------
479 Property Let Value(Optional ByVal pvValue As Variant)
480 &apos;&apos;&apos; Set the updatable property Value
481 _PropertySet(&quot;Value&quot;, pvValue)
482 End Property &apos; SFDialogs.SF_DialogControl.Value (let)
484 REM -----------------------------------------------------------------------------
485 Property Get Visible() As Variant
486 &apos;&apos;&apos; The Visible property specifies if the control is accessible with the cursor.
487 Visible = _PropertyGet(&quot;Visible&quot;, True)
488 End Property &apos; SFDialogs.SF_DialogControl.Visible (get)
490 REM -----------------------------------------------------------------------------
491 Property Let Visible(Optional ByVal pvVisible As Variant)
492 &apos;&apos;&apos; Set the updatable property Visible
493 _PropertySet(&quot;Visible&quot;, pvVisible)
494 End Property &apos; SFDialogs.SF_DialogControl.Visible (let)
496 REM -----------------------------------------------------------------------------
497 Property Get XControlModel() As Object
498 &apos;&apos;&apos; The XControlModel property returns the model UNO object of the control
499 XControlModel = _PropertyGet(&quot;XControlModel&quot;, Nothing)
500 End Property &apos; SFDialogs.SF_DialogControl.XControlModel (get)
502 REM -----------------------------------------------------------------------------
503 Property Get XControlView() As Object
504 &apos;&apos;&apos; The XControlView property returns the view UNO object of the control
505 XControlView = _PropertyGet(&quot;XControlView&quot;, Nothing)
506 End Property &apos; SFDialogs.SF_DialogControl.XControlView (get)
508 REM -----------------------------------------------------------------------------
509 Property Get XGridColumnModel() As Object
510 &apos;&apos;&apos; The XGridColumnModel property returns the mutable data model UNO object of the tree control
511 XGridColumnModel = _PropertyGet(&quot;XGridColumnModel&quot;, Nothing)
512 End Property &apos; SFDialogs.SF_DialogControl.XGridColumnModel (get)
514 REM -----------------------------------------------------------------------------
515 Property Get XGridDataModel() As Object
516 &apos;&apos;&apos; The XGridDataModel property returns the mutable data model UNO object of the tree control
517 XGridDataModel = _PropertyGet(&quot;XGridDataModel&quot;, Nothing)
518 End Property &apos; SFDialogs.SF_DialogControl.XGridDataModel (get)
520 REM -----------------------------------------------------------------------------
521 Property Get XTreeDataModel() As Object
522 &apos;&apos;&apos; The XTreeDataModel property returns the mutable data model UNO object of the tree control
523 XTreeDataModel = _PropertyGet(&quot;XTreeDataModel&quot;, Nothing)
524 End Property &apos; SFDialogs.SF_DialogControl.XTreeDataModel (get)
526 REM ===================================================================== METHODS
528 REM -----------------------------------------------------------------------------
529 Public Function AddSubNode(Optional ByRef ParentNode As Variant _
530 , Optional ByVal DisplayValue As Variant _
531 , Optional ByRef DataValue As Variant _
532 ) As Variant
533 &apos;&apos;&apos; Return a new node of the tree control subordinate to a parent node
534 &apos;&apos;&apos; Args:
535 &apos;&apos;&apos; ParentNode: A node UNO object, of type com.sun.star.awt.tree.XMutableTreeNode
536 &apos;&apos;&apos; DisplayValue: the text appearing in the control box
537 &apos;&apos;&apos; DataValue: any value associated with the new node. Default = Empty
538 &apos;&apos;&apos; Returns:
539 &apos;&apos;&apos; The new node UNO object: com.sun.star.awt.tree.XMutableTreeNode
540 &apos;&apos;&apos; Examples:
541 &apos;&apos;&apos; Dim myTree As Object, myNode As Object, theRoot As Object
542 &apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
543 &apos;&apos;&apos; Set theRoot = myTree.CreateRoot(&quot;Tree top&quot;)
544 &apos;&apos;&apos; Set myNode = myTree.AddSubNode(theRoot, &quot;A branch ...&quot;)
546 Dim oNode As Object &apos; Return value
547 Const cstThisSub = &quot;SFDialogs.DialogControl.AddSubNode&quot;
548 Const cstSubArgs = &quot;ParentNode, DisplayValue, [DataValue=Empty]&quot;
550 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
551 Set oNode = Nothing
553 Check:
554 If IsMissing(DataValue) Then DataValue = Empty
555 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
556 If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
557 If Not ScriptForge.SF_Utils._Validate(ParentNode, &quot;ParentNode&quot;, V_OBJECT) Then GoTo Catch
558 If ScriptForge.SF_Session.UnoObjectType(ParentNode) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo Catch
559 If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
560 End If
562 Try:
563 With _TreeDataModel
564 Set oNode = .createNode(DisplayValue, True)
565 oNode.DataValue = DataValue
566 ParentNode.appendChild(oNode)
567 End With
569 Finally:
570 Set AddSubNode = oNode
571 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
572 Exit Function
573 Catch:
574 GoTo Finally
575 CatchType:
576 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;AddSubNode&quot;)
577 GoTo Finally
578 End Function &apos; SFDialogs.SF_DialogControl.AddSubNode
580 REM -----------------------------------------------------------------------------
581 Public Function AddSubTree(Optional ByRef ParentNode As Variant _
582 , Optional ByRef FlatTree As Variant _
583 , Optional ByVal WithDataValue As Variant _
584 ) As Boolean
585 &apos;&apos;&apos; Return True when a subtree, subordinate to a parent node, could be inserted successfully in a tree control
586 &apos;&apos;&apos; If the parent node had already child nodes before calling this method, the child nodes are erased
587 &apos;&apos;&apos; Args:
588 &apos;&apos;&apos; ParentNode: A node UNO object, of type com.sun.star.awt.tree.XMutableTreeNode
589 &apos;&apos;&apos; FlatTree: a 2D array sorted on the columns containing the DisplayValues
590 &apos;&apos;&apos; Flat tree &gt;&gt;&gt;&gt; Resulting subtree
591 &apos;&apos;&apos; A1 B1 C1 |__ A1
592 &apos;&apos;&apos; A1 B1 C2 |__ B1
593 &apos;&apos;&apos; A1 B2 C3 |__ C1
594 &apos;&apos;&apos; A2 B3 C4 |__ C2
595 &apos;&apos;&apos; A2 B3 C5 |__ B2
596 &apos;&apos;&apos; A3 B4 C6 |__ C3
597 &apos;&apos;&apos; |__ A2
598 &apos;&apos;&apos; |__ B3
599 &apos;&apos;&apos; |__ C4
600 &apos;&apos;&apos; |__ C5
601 &apos;&apos;&apos; |__ A3
602 &apos;&apos;&apos; |__ B4
603 &apos;&apos;&apos; |__ C6
604 &apos;&apos;&apos; Typically, such an array can be issued by the GetRows method applied on the SFDatabases.Database service
605 &apos;&apos;&apos; when an array item containing the text to be displayed is = &quot;&quot; or is empty/null,
606 &apos;&apos;&apos; no new subnode is created and the remainder of the row is skipped
607 &apos;&apos;&apos; When AddSubTree() is called from a Python script, FlatTree may be an array of arrays
608 &apos;&apos;&apos; WithDataValue:
609 &apos;&apos;&apos; When False (default), every column of FlatTree contains the text to be displayed in the tree control
610 &apos;&apos;&apos; When True, the texts to be displayed (DisplayValue) are in columns 0, 2, 4, ...
611 &apos;&apos;&apos; while the DataValues are in columns 1, 3, 5, ...
612 &apos;&apos;&apos; Returns:
613 &apos;&apos;&apos; True when successful
614 &apos;&apos;&apos; Examples:
615 &apos;&apos;&apos; Dim myTree As Object, theRoot As Object, oDb As Object, vData As Variant
616 &apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
617 &apos;&apos;&apos; Set theRoot = myTree.CreateRoot(&quot;By product category&quot;)
618 &apos;&apos;&apos; Set oDb = CreateScriptService(&quot;SFDatabases.Database&quot;, &quot;/home/.../mydatabase.odb&quot;)
619 &apos;&apos;&apos; vData = oDb.GetRows(&quot;SELECT [Category].[Name], [Category].[ID], [Product].[Name], [Product].[ID] &quot; _
620 &apos;&apos;&apos; &amp; &quot;FROM [Category], [Product] WHERE [Product].[CategoryID] = [Category].[ID] &quot; _
621 &apos;&apos;&apos; &amp; &quot;ORDER BY [Category].[Name], [Product].[Name]&quot;)
622 &apos;&apos;&apos; myTree.AddSubTree(theRoot, vData, WithDataValue := True)
624 Dim bSubTree As Boolean &apos; Return value
625 Dim oNode As Object &apos; com.sun.star.awt.tree.XMutableTreeNode
626 Dim oNewNode As Object &apos; com.sun.star.awt.tree.XMutableTreeNode
627 Dim lChildCount As Long &apos; Number of children nodes of a parent node
628 Dim iStep As Integer &apos; 1 when WithDataValue = False, 2 otherwise
629 Dim iDims As Integer &apos; Number of dimensions of FlatTree
630 Dim lMin1 As Long &apos; Lower bound (rows)
631 Dim lMin2 As Long &apos; Lower bounds (cols)
632 Dim lMax1 As Long &apos; Upper bound (rows)
633 Dim lMax2 As Long &apos; Upper bounds (cols)
634 Dim vFlatItem As Variant &apos; A single FlatTree item: FlatTree(i, j)
635 Dim vFlatItem2 As Variant &apos; A single FlatTree item
636 Dim bChange As Boolean &apos; When True, the item in FlatTree is different from the item above
637 Dim sValue As String &apos; Alias for display values
638 Dim i As Long, j As Long
639 Const cstThisSub = &quot;SFDialogs.DialogControl.AddSubTree&quot;
640 Const cstSubArgs = &quot;ParentNode, FlatTree, [WithDataValue=False]&quot;
642 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
643 bSubTree = False
645 Check:
646 If IsMissing(WithDataValue) Or IsEmpty(WithDataValue) Then WithDataValue = False
647 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
648 If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
649 If Not ScriptForge.SF_Utils._Validate(ParentNode, &quot;ParentNode&quot;, V_OBJECT) Then GoTo Catch
650 If ScriptForge.SF_Session.UnoObjectType(ParentNode) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo Catch
651 If Not ScriptForge.SF_Utils._ValidateArray(FlatTree, &quot;FlatTree&quot;) Then GoTo Catch &apos; Dimensions checked below
652 If Not ScriptForge.SF_Utils._Validate(WithDataValue, &quot;WithDataValue&quot;, V_BOOLEAN) Then GoTo Catch
653 End If
655 Try:
656 With _TreeDataModel
657 &apos; Clean subtree
658 lChildCount = ParentNode.getChildCount()
659 For i = 1 To lChildCount
660 ParentNode.removeChildByIndex(0) &apos; This cleans all subtrees too
661 Next i
663 &apos; Determine bounds
664 iDims = ScriptForge.SF_Array.CountDims(FlatTree)
665 Select Case iDims
666 Case -1, 0 : GoTo Catch
667 Case 1 &apos; Called probably from Python
668 lMin1 = LBound(FlatTree, 1) : lMax1 = UBound(FlatTree, 1)
669 If Not IsArray(FlatTree(0)) Then GoTo Catch
670 If UBound(FlatTree(0)) &lt; LBound(FlatTree(0)) Then GoTo Catch &apos; No columns
671 lMin2 = LBound(FlatTree(0)) : lMax2 = UBound(FlatTree(0))
672 Case 2
673 lMin1 = LBound(FlatTree, 1) : lMax1 = UBound(FlatTree, 1)
674 lMin2 = LBound(FlatTree, 2) : lMax2 = UBound(FlatTree, 2)
675 Case Else : GoTo Catch
676 End Select
678 &apos; Build a new subtree
679 iStep = Iif(WithDataValue, 2, 1)
680 For i = lMin1 To lMax1
681 bChange = ( i = 0 )
682 &apos; Restart from the parent node at each i-iteration
683 Set oNode = ParentNode
684 For j = lMin2 To lMax2 Step iStep &apos; Array columns
685 If iDims = 1 Then vFlatItem = FlatTree(i)(j) Else vFlatItem = FlatTree(i, j)
686 If vFlatItem = &quot;&quot; Or IsNull(vFlatItem) Or IsEmpty(vFlatItem) Then
687 Set oNode = Nothing
688 Exit For &apos; Exit j-loop
689 End If
690 If Not bChange Then
691 If iDims = 1 Then vFlatItem2 = FlatTree(i - 1)(j) Else vFlatItem2 = FlatTree(i - 1, j)
692 bChange = ( vFlatItem &lt;&gt; vFlatItem2 )
693 End If
694 If bChange Then &apos; Create new subnode at tree depth = j
695 If VarType(vFlatItem) = V_STRING Then sValue = vFlatItem Else sValue = ScriptForge.SF_String.Represent(vFlatItem)
696 Set oNewNode = .createNode(sValue, True)
697 If WithDataValue Then
698 If iDims = 1 Then vFlatItem2 = FlatTree(i)(j + 1) Else vFlatItem2 = FlatTree(i, j + 1)
699 oNewNode.DataValue = vFlatItem2
700 End If
701 oNode.appendChild(oNewNode)
702 Set oNode = oNewNode
703 Else
704 &apos; Position next current node on last child of actual current node
705 lChildCount = oNode.getChildCount()
706 If lChildCount &gt; 0 Then Set oNode = oNode.getChildAt(lChildCount - 1) Else Set oNode = Nothing
707 End If
708 Next j
709 Next i
710 bSubTree = True
711 End With
713 Finally:
714 AddSubTree = bSubTree
715 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
716 Exit Function
717 Catch:
718 GoTo Finally
719 CatchType:
720 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;AddSubTree&quot;)
721 GoTo Finally
722 End Function &apos; SFDialogs.SF_DialogControl.AddSubTree
724 REM -----------------------------------------------------------------------------
725 Public Function CreateRoot(Optional ByVal DisplayValue As Variant _
726 , Optional ByRef DataValue As Variant _
727 ) As Variant
728 &apos;&apos;&apos; Return a new root node of the tree control. The new tree root is inserted below pre-existing root nodes
729 &apos;&apos;&apos; Args:
730 &apos;&apos;&apos; DisplayValue: the text appearing in the control box
731 &apos;&apos;&apos; DataValue: any value associated with the root node. Default = Empty
732 &apos;&apos;&apos; Returns:
733 &apos;&apos;&apos; The new root node as a UNO object of type com.sun.star.awt.tree.XMutableTreeNode
734 &apos;&apos;&apos; Examples:
735 &apos;&apos;&apos; Dim myTree As Object, myNode As Object
736 &apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
737 &apos;&apos;&apos; Set myNode = myTree.CreateRoot(&quot;Tree starts here ...&quot;)
739 Dim oRoot As Object &apos; Return value
740 Const cstThisSub = &quot;SFDialogs.DialogControl.CreateRoot&quot;
741 Const cstSubArgs = &quot;DisplayValue, [DataValue=Empty]&quot;
743 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
744 Set oRoot = Nothing
746 Check:
747 If IsMissing(DataValue) Then DataValue = Empty
748 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
749 If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
750 If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
751 End If
753 Try:
754 With _TreeDataModel
755 Set oRoot = .createNode(DisplayValue, True)
756 oRoot.DataValue = DataValue
757 .setRoot(oRoot)
758 &apos; To be visible, a root must have contained at least 1 child. Create a fictive one and erase it.
759 &apos; This behaviour does not seem related to the RootDisplayed property ??
760 oRoot.appendChild(.createNode(&quot;Something&quot;, False))
761 oRoot.removeChildByIndex(0)
762 End With
764 Finally:
765 Set CreateRoot = oRoot
766 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
767 Exit Function
768 Catch:
769 GoTo Finally
770 CatchType:
771 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;CreateRoot&quot;)
772 GoTo Finally
773 End Function &apos; SFDialogs.SF_DialogControl.CreateRoot
775 REM -----------------------------------------------------------------------------
776 Public Function FindNode(Optional ByVal DisplayValue As String _
777 , Optional ByRef DataValue As Variant _
778 , Optional ByVal CaseSensitive As Boolean _
779 ) As Object
780 &apos;&apos;&apos; Traverses the tree and find recursively, starting from the root, a node meeting some criteria
781 &apos;&apos;&apos; Either (1 match is enough):
782 &apos;&apos;&apos; having its DisplayValue like DisplayValue
783 &apos;&apos;&apos; having its DataValue = DataValue
784 &apos;&apos;&apos; Comparisons may be or not case-sensitive
785 &apos;&apos;&apos; The first matching occurrence is returned
786 &apos;&apos;&apos; Args:
787 &apos;&apos;&apos; DisplayValue: the pattern to be matched
788 &apos;&apos;&apos; DataValue: a string, a numeric value or a date or Empty (if not applicable)
789 &apos;&apos;&apos; CaseSensitive: applicable on both criteria. Default = False
790 &apos;&apos;&apos; Returns:
791 &apos;&apos;&apos; The found node of type com.sun.star.awt.tree.XMutableTreeNode or Nothing if not found
792 &apos;&apos;&apos; Examples:
793 &apos;&apos;&apos; Dim myTree As Object, myNode As Object
794 &apos;&apos;&apos; Set myTree = myDialog.Controls(&quot;myTreeControl&quot;)
795 &apos;&apos;&apos; Set myNode = myTree.FindNode(&quot;*Sophie*&quot;, CaseSensitive := True)
798 Dim oNode As Object &apos; Return value
799 Const cstThisSub = &quot;SFDialogs.DialogControl.FindNode&quot;
800 Const cstSubArgs = &quot;[DisplayValue=&quot;&quot;&quot;&quot;], [DataValue=Empty], [CaseSensitive=False]&quot;
802 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
803 Set oNode = Nothing
805 Check:
806 If IsMissing(DisplayValue) Or IsEmpty(DisplayValue) Then DisplayValue = &quot;&quot;
807 If IsMissing(DataValue) Then DataValue = Empty
808 If IsMissing(CaseSensitive) Or IsEmpty(CaseSensitive) Then CaseSensitive = False
809 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
810 If _ControlType &lt;&gt; CTLTREECONTROL Then GoTo CatchType
811 If Not ScriptForge.SF_Utils._Validate(DisplayValue, &quot;DisplayValue&quot;, V_STRING) Then GoTo Catch
812 If Not ScriptForge.SF_Utils._Validate(CaseSensitive, &quot;CaseSensitive&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
813 End If
815 Try:
816 Set oNode = _FindNode(_TreeDataModel.getRoot(), DisplayValue, DataValue, CaseSensitive)
818 Finally:
819 Set FindNode = oNode
820 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
821 Exit Function
822 Catch:
823 GoTo Finally
824 CatchType:
825 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;FindNode&quot;)
826 GoTo Finally
827 End Function &apos; SFDialogs.SF_DialogControl.FindNode
829 REM -----------------------------------------------------------------------------
830 Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
831 &apos;&apos;&apos; Return the actual value of the given property
832 &apos;&apos;&apos; Args:
833 &apos;&apos;&apos; PropertyName: the name of the property as a string
834 &apos;&apos;&apos; Returns:
835 &apos;&apos;&apos; The actual value of the property
836 &apos;&apos;&apos; If the property does not exist, returns Null
837 &apos;&apos;&apos; Exceptions:
838 &apos;&apos;&apos; see the exceptions of the individual properties
839 &apos;&apos;&apos; Examples:
840 &apos;&apos;&apos; myModel.GetProperty(&quot;MyProperty&quot;)
842 Const cstThisSub = &quot;SFDialogs.DialogControl.GetProperty&quot;
843 Const cstSubArgs = &quot;&quot;
845 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
846 GetProperty = Null
848 Check:
849 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
850 If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
851 End If
853 Try:
854 GetProperty = _PropertyGet(PropertyName)
856 Finally:
857 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
858 Exit Function
859 Catch:
860 GoTo Finally
861 End Function &apos; SFDialogs.SF_DialogControl.GetProperty
863 REM -----------------------------------------------------------------------------
864 Public Function Methods() As Variant
865 &apos;&apos;&apos; Return the list of public methods of the Model service as an array
867 Methods = Array( _
868 &quot;AddSubNode&quot; _
869 , &quot;AddSubTree&quot; _
870 , &quot;CreateRoot&quot; _
871 , &quot;FindNode&quot; _
872 , &quot;SetFocus&quot; _
873 , &quot;WriteLine&quot; _
876 End Function &apos; SFDialogs.SF_DialogControl.Methods
878 REM -----------------------------------------------------------------------------
879 Public Function Properties() As Variant
880 &apos;&apos;&apos; Return the list or properties of the Timer class as an array
882 Properties = Array( _
883 &quot;Cancel&quot; _
884 , &quot;Caption&quot; _
885 , &quot;ControlType&quot; _
886 , &quot;CurrentNode&quot; _
887 , &quot;Default&quot; _
888 , &quot;Enabled&quot; _
889 , &quot;Format&quot; _
890 , &quot;ListCount&quot; _
891 , &quot;ListIndex&quot; _
892 , &quot;Locked&quot; _
893 , &quot;MultiSelect&quot; _
894 , &quot;Name&quot; _
895 , &quot;OnActionPerformed&quot; _
896 , &quot;OnAdjustmentValueChanged&quot; _
897 , &quot;OnFocusGained&quot; _
898 , &quot;OnFocusLost&quot; _
899 , &quot;OnItemStateChanged&quot; _
900 , &quot;OnKeyPressed&quot; _
901 , &quot;OnKeyReleased&quot; _
902 , &quot;OnMouseDragged&quot; _
903 , &quot;OnMouseEntered&quot; _
904 , &quot;OnMouseExited&quot; _
905 , &quot;OnMouseMoved&quot; _
906 , &quot;OnMousePressed&quot; _
907 , &quot;OnMouseReleased&quot; _
908 , &quot;OnNodeExpanded&quot; _
909 , &quot;OnNodeSelected&quot; _
910 , &quot;OnTextChanged&quot; _
911 , &quot;Page&quot; _
912 , &quot;Parent&quot; _
913 , &quot;Picture&quot; _
914 , &quot;RootNode&quot; _
915 , &quot;RowSource&quot; _
916 , &quot;Text&quot; _
917 , &quot;TipText&quot; _
918 , &quot;TripleState&quot; _
919 , &quot;Value&quot; _
920 , &quot;Visible&quot; _
921 , &quot;XControlModel&quot; _
922 , &quot;XControlView&quot; _
923 , &quot;XGridColumnModel&quot; _
924 , &quot;XGridDataModel&quot; _
925 , &quot;XTreeDataModel&quot; _
928 End Function &apos; SFDialogs.SF_DialogControl.Properties
930 REM -----------------------------------------------------------------------------
931 Public Function SetFocus() As Boolean
932 &apos;&apos;&apos; Set the focus on the current Control instance
933 &apos;&apos;&apos; Probably called from after an event occurrence
934 &apos;&apos;&apos; Args:
935 &apos;&apos;&apos; Returns:
936 &apos;&apos;&apos; True if focusing is successful
937 &apos;&apos;&apos; Example:
938 &apos;&apos;&apos; Dim oDlg As Object, oControl As Object
939 &apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myControl&quot;) &apos; Control stored in current document&apos;s standard library
940 &apos;&apos;&apos; Set oControl = oDlg.Controls(&quot;thisControl&quot;)
941 &apos;&apos;&apos; oControl.SetFocus()
943 Dim bSetFocus As Boolean &apos; Return value
944 Const cstThisSub = &quot;SFDialogs.DialogControl.SetFocus&quot;
945 Const cstSubArgs = &quot;&quot;
947 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
948 bSetFocus = False
950 Check:
951 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
952 If Not [_Parent]._IsStillAlive() Then GoTo Finally
953 End If
955 Try:
956 If Not IsNull(_ControlView) Then
957 _ControlView.setFocus()
958 bSetFocus = True
959 End If
961 Finally:
962 SetFocus = bSetFocus
963 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
964 Exit Function
965 Catch:
966 GoTo Finally
967 End Function &apos; SFControls.SF_DialogControl.SetFocus
969 REM -----------------------------------------------------------------------------
970 Public Function SetProperty(Optional ByVal PropertyName As Variant _
971 , Optional ByRef Value As Variant _
972 ) As Boolean
973 &apos;&apos;&apos; Set a new value to the given property
974 &apos;&apos;&apos; Args:
975 &apos;&apos;&apos; PropertyName: the name of the property as a string
976 &apos;&apos;&apos; Value: its new value
977 &apos;&apos;&apos; Exceptions
978 &apos;&apos;&apos; ARGUMENTERROR The property does not exist
980 Const cstThisSub = &quot;SFDialogs.DialogControl.SetProperty&quot;
981 Const cstSubArgs = &quot;PropertyName, Value&quot;
983 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
984 SetProperty = False
986 Check:
987 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
988 If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
989 End If
991 Try:
992 SetProperty = _PropertySet(PropertyName, Value)
994 Finally:
995 SF_Utils._ExitFunction(cstThisSub)
996 Exit Function
997 Catch:
998 GoTo Finally
999 End Function &apos; SFDialogs.SF_DialogControl.SetProperty
1001 REM -----------------------------------------------------------------------------
1002 Public Function SetTableData(Optional ByRef DataArray As Variant _
1003 , Optional ByRef Widths As Variant _
1004 , Optional ByRef Alignments As Variant _
1005 ) As Boolean
1006 &apos;&apos;&apos; Fill a table control with the given data. Preexisting data is erased
1007 &apos;&apos;&apos; The Basic IDE allows to define if the control has a row and/or a column header
1008 &apos;&apos;&apos; When it is the case, the array in argument should contain those headers resp. in the first
1009 &apos;&apos;&apos; column and/or in the first row
1010 &apos;&apos;&apos; A column in the control shall be sortable when the data (headers excluded) in that column
1011 &apos;&apos;&apos; is homogeneously filled either with numbers or with strings
1012 &apos;&apos;&apos; Columns containing strings will be left-aligned, those with numbers will be right-aligned
1013 &apos;&apos;&apos; Args:
1014 &apos;&apos;&apos; DataArray: the set of data to display in the table control, including optional column/row headers
1015 &apos;&apos;&apos; Is a 2D array in Basic, is a tuple of tuples when called from Python
1016 &apos;&apos;&apos; Widths: the column&apos;s relative widths as a 1D array, each element corresponding with a column
1017 &apos;&apos;&apos; If the array is shorter than the number of columns, the last value is kept for the next columns.
1018 &apos;&apos;&apos; Example:
1019 &apos;&apos;&apos; Widths := Array(1, 2)
1020 &apos;&apos;&apos; means that the first column is half as wide as all the other columns
1021 &apos;&apos;&apos; When the argument is absent, the columns are evenly spread over the control
1022 &apos;&apos;&apos; Alignments: the column&apos;s horizontal alignment as a string with length = number of columns.
1023 &apos;&apos;&apos; Possible characters are:
1024 &apos;&apos;&apos; L(EFT), C(ENTER), R(IGHT) or space (default behaviour)
1025 &apos;&apos;&apos; Returns:
1026 &apos;&apos;&apos; True when successful
1027 &apos;&apos;&apos; Examples:
1028 &apos;&apos;&apos; Dim myTable As Object, bSet As Boolean, vData As Variant
1029 &apos;&apos;&apos; Set myTable = myDialog.Controls(&quot;myTableControl&quot;) &apos; This control has only column headers
1030 &apos;&apos;&apos; vData = Array(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;)
1031 &apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(1, 2, 3))
1032 &apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(4, 5, 6))
1033 &apos;&apos;&apos; vData = SF_Array.AppendRow(vData, Array(7, 8, 9))
1034 &apos;&apos;&apos; bSet = myTable.SetTableData(vData, Alignments := &quot; C &quot;)
1036 Dim bData As Boolean &apos; Return value
1037 Dim iDims As Integer &apos; Number of dimensions of DataArray
1038 Dim lMin1 As Long &apos; LBound1 of input array
1039 Dim lMax1 As Long &apos; UBound1 of input array
1040 Dim lMin2 As Long &apos; LBound2 of input array
1041 Dim lMax2 As Long &apos; UBound2 of input array
1042 Dim lControlWidth As Long &apos; Width of the table control
1043 Dim lMinW As Long &apos; lBound of Widths
1044 Dim lMaxW As Long &apos; UBound of vWidths
1045 Dim lMinRow As Long &apos; Row index of effective data subarray
1046 Dim lMinCol As Long &apos; Column index of effective data subarray
1047 Dim vRowHeaders As Variant &apos; Array of row headers
1048 Dim sRowHeader As String &apos; A single row header
1049 Dim vColHeaders As Variant &apos; Array of column headers
1050 Dim oColumn As Object &apos; com.sun.star.awt.grid.XGridColumn
1051 Dim dWidth As Double &apos; A single item of Widths
1052 Dim dRelativeWidth As Double &apos; Sum of Widths up to the number of columns
1053 Dim dWidthFactor As Double &apos; Factor to apply to relative widths to get absolute column widths
1054 Dim vDataRow As Variant &apos; A single row content in the tablecontrol
1055 Dim vDataItem As Variant &apos; A single DataArray item
1056 Dim sAlign As String &apos; Column&apos;s horizontal alignments (single chars: L, C, R, space)
1057 Dim lAlign As Long &apos; com.sun.star.style.HorizontalAlignment.XXX
1058 Dim i As Long, j As Long, k As Long
1060 Const cstRowHdrWidth = 12 &apos; Estimated width of the row header
1062 Const cstThisSub = &quot;SFDialogs.DialogControl.SetTableData&quot;
1063 Const cstSubArgs = &quot;DataArray, [Widths=Array(1)], [Alignments=&quot;&quot;&quot;&quot;]&quot;
1065 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1066 bData = False
1068 Check:
1069 If IsMissing(Widths) Or IsEmpty(Widths) Then Widths = Array(1)
1070 If IsMissing(Alignments) Or IsEmpty(Alignments) Then Alignments = &quot;&quot;
1071 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
1072 If _ControlType &lt;&gt; CTLTABLECONTROL Then GoTo CatchType
1073 If Not ScriptForge.SF_Utils._ValidateArray(DataArray, &quot;DataArray&quot;) Then GoTo Catch &apos; Dimensions are checked below
1074 If Not ScriptForge.SF_Utils._ValidateArray(Widths, &quot;Widths&quot;, 1, ScriptForge.V_NUMERIC, True) Then GoTo Catch
1075 If Not ScriptForge.SF_Utils._Validate(Alignments, &quot;Alignments&quot;, V_STRING) Then GoTo Catch
1076 End If
1078 Try:
1079 &apos; Erase any pre-existing data and columns
1080 _GridDataModel.removeAllRows()
1081 For i = _GridColumnModel.ColumnCount - 1 To 0 Step -1
1082 _GridColumnModel.removeColumn(i)
1083 Next i
1085 &apos; LBounds, UBounds - Basic or Pytho
1086 iDims = ScriptForge.SF_Array.CountDims(DataArray)
1087 Select Case iDims
1088 Case -1, 0 : GoTo Catch
1089 Case 1 &apos; Called probably from Python
1090 lMin1 = LBound(DataArray, 1) : lMax1 = UBound(DataArray, 1)
1091 If Not IsArray(DataArray(0)) Then GoTo Catch
1092 If UBound(DataArray(0)) &lt; LBound(DataArray(0)) Then GoTo Catch &apos; No columns
1093 lMin2 = LBound(DataArray(0)) : lMax2 = UBound(DataArray(0))
1094 Case 2
1095 lMin1 = LBound(DataArray, 1) : lMax1 = UBound(DataArray, 1)
1096 lMin2 = LBound(DataArray, 2) : lMax2 = UBound(DataArray, 2)
1097 Case Else : GoTo Catch
1098 End Select
1100 &apos; Extract headers from data array
1101 lMinW = LBound(Widths) : lMaxW = UBound(Widths)
1102 With _ControlModel
1103 If .ShowColumnHeader Then
1104 lMinRow = lMin1 + 1
1105 If iDims = 1 Then
1106 vColHeaders = DataArray(lMin1)
1107 Else
1108 vColHeaders = ScriptForge.SF_Array.ExtractRow(DataArray, lMin1)
1109 End If
1110 Else
1111 lMinRow = lMin1
1112 vColHeaders = Array()
1113 End If
1114 If .ShowRowHeader Then
1115 lMinCol = lMin2 + 1
1116 If iDims = 1 Then
1117 vRowHeaders = Array()
1118 ReDim vRowHeaders(lMin1 To lMax1)
1119 For i = lMin1 To lMax1
1120 vRowHeaders(i) = DataArray(i)(lMin2)
1121 Next i
1122 Else
1123 vRowHeaders = ScriptForge.SF_Array.ExtractColumn(DataArray, lMin2)
1124 End If
1125 Else
1126 lMinCol = lMin2
1127 vRowHeaders = Array()
1128 End If
1129 End With
1131 &apos; Create the columns
1132 For j = lMinCol To lMax2
1133 Set oColumn = _GridColumnModel.createColumn()
1134 If _ControlModel.ShowColumnHeader Then oColumn.Title = vColHeaders(j)
1135 _GridColumnModel.addColumn(oColumn)
1136 Next j
1137 &apos; Size the columns. Column sizing cannot be done before all the columns are added
1138 If lMaxW &gt;= lMinW Then &apos; There must be at least 1 width given as argument
1139 &apos; Size the columns proportionally with their relative widths
1140 dRelativeWidth = 0.0
1141 i = lMinW - 1
1142 &apos; Compute the sum of the relative widths
1143 For j = 0 To lMax2 - lMinCol
1144 i = i + 1
1145 If i &gt;= lMinW And i &lt;= lMaxW Then dRelativeWidth = dRelativeWidth + Widths(i) Else dRelativeWidth = dRelativeWidth + Widths(lMaxW)
1146 Next j
1147 &apos; Set absolute widths
1148 If dRelativeWidth &gt; 0.0 Then dWidthFactor = CDbl((_ControlModel.Width - cstRowHdrWidth) / dRelativeWidth) Else dWidthFactor = 1.0
1149 i = lMinW - 1
1150 For j = 0 To lMax2 - lMinCol
1151 i = i + 1
1152 If i &gt;= lMinW And i &lt;= lMaxW Then dWidth = CDbl(Widths(i)) Else dWidth = CDbl(Widths(lMaxW))
1153 _GridColumnModel.Columns(j).ColumnWidth = CLng(dWidthFactor * dWidth)
1154 Next j
1155 Else
1156 &apos; Size all columns evenly
1157 For j = 0 To lMax2 - lMinCol
1158 _GridColumnModel.Columns(j).ColumnWidth = (_ControlModel.Width - cstRowHdrWidth) / (lMax2 - lMonCol + 1)
1159 Next j
1160 End If
1162 &apos; Initialize the column alignment
1163 If Len(Alignments) &gt;= lMax2 - lMinCol + 1 Then sAlign = Alignments Else sAlign = Alignments &amp; Space(lMax2 - lMinCol + 1 - Len(Alignments))
1165 &apos; Feed the table with data and define/confirm the column alignment
1166 vDataRow = Array()
1167 For i = lMinRow To lMax1
1168 ReDim vDataRow(0 To lMax2 - lMinCol)
1169 For j = lMinCol To lMax2
1170 If iDims = 1 Then vDataItem = DataArray(i)(j) Else vDataItem = DataArray(i, j)
1171 If VarType(vDataItem) = V_STRING Then
1172 ElseIf ScriptForge.SF_Utils._VarTypeExt(vDataItem) = ScriptForge.V_NUMERIC Then
1173 Else
1174 vDataItem = ScriptForge.SF_String.Represent(vDataItem)
1175 End If
1176 vDataRow(j - lMinCol) = vDataItem
1177 &apos; Store alignment while processing the first row of the array
1178 If i = lMinRow Then
1179 k = j - lMinCol + 1
1180 If Mid(sAlign, k, 1) = &quot; &quot; Then Mid(sAlign, k, 1) = Iif(VarType(vDataItem) = V_STRING, &quot;L&quot;, &quot;R&quot;)
1181 End If
1182 Next j
1183 If _ControlModel.ShowRowHeader Then sRowHeader = vRowHeaders(i) Else sRowHeader = &quot;&quot;
1184 _GridDataModel.addRow(sRowHeader, vDataRow)
1185 Next i
1187 &apos; Determine alignments of each column
1188 For j = 0 To lMax2 - lMinCol
1189 Select Case Mid(sAlign, j + 1, 1)
1190 Case &quot;L&quot;, &quot; &quot; : lAlign = com.sun.star.style.HorizontalAlignment.LEFT
1191 Case &quot;R&quot; : lAlign = com.sun.star.style.HorizontalAlignment.RIGHT
1192 Case &quot;C&quot; : lAlign = com.sun.star.style.HorizontalAlignment.CENTER
1193 Case Else
1194 End Select
1195 _GridColumnModel.Columns(j).HorizontalAlign = lAlign
1196 Next j
1198 bData = True
1200 Finally:
1201 SetTableData = bData
1202 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1203 Exit Function
1204 Catch:
1205 GoTo Finally
1206 CatchType:
1207 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, &quot;SetTableData&quot;)
1208 GoTo Finally
1209 End Function &apos; SFDialogs.SF_DialogControl.SetTableData
1211 REM -----------------------------------------------------------------------------
1212 Public Function WriteLine(Optional ByVal Line As Variant) As Boolean
1213 &apos;&apos;&apos; Add a new line to a multiline TextField control
1214 &apos;&apos;&apos; Args:
1215 &apos;&apos;&apos; Line: (default = &quot;&quot;) the line to insert at the end of the text box
1216 &apos;&apos;&apos; a newline character will be inserted before the line, if relevant
1217 &apos;&apos;&apos; Returns:
1218 &apos;&apos;&apos; True if insertion is successful
1219 &apos;&apos;&apos; Exceptions
1220 &apos;&apos;&apos; TEXTFIELDERROR Method applicable on multiline text fields only
1221 &apos;&apos;&apos; Example:
1222 &apos;&apos;&apos; Dim oDlg As Object, oControl As Object
1223 &apos;&apos;&apos; Set oDlg = CreateScriptService(,, &quot;myControl&quot;) &apos; Control stored in current document&apos;s standard library
1224 &apos;&apos;&apos; Set oControl = oDlg.Controls(&quot;thisControl&quot;)
1225 &apos;&apos;&apos; oControl.WriteLine(&quot;a new line&quot;)
1227 Dim bWriteLine As Boolean &apos; Return value
1228 Dim lTextLength As Long &apos; Actual length of text in box
1229 Dim oSelection As New com.sun.star.awt.Selection
1230 Dim sNewLine As String &apos; Newline character(s)
1231 Const cstThisSub = &quot;SFDialogs.DialogControl.WriteLine&quot;
1232 Const cstSubArgs = &quot;[Line=&quot;&quot;&quot;&quot;]&quot;
1234 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1235 bWriteLine = False
1237 Check:
1238 If IsMissing(Line) Or IsEmpty(Line) Then Line = &quot;&quot;
1239 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
1240 If Not [_Parent]._IsStillAlive() Then GoTo Finally
1241 If Not ScriptForge.SF_Utils._Validate(Line, &quot;Line&quot;, V_STRING) Then GoTo Finally
1242 End If
1243 If ControlType &lt;&gt; CTLTEXTFIELD Then GoTo CatchField
1244 If _ControlModel.MultiLine = False Then GoTo CatchField
1246 Try:
1247 _ControlModel.HardLineBreaks = True
1248 sNewLine = ScriptForge.SF_String.sfNEWLINE
1249 With _ControlView
1250 lTextLength = Len(.getText())
1251 If lTextLength = 0 Then &apos; Text field is still empty
1252 oSelection.Min = 0 : oSelection.Max = 0
1253 .setText(Line)
1254 Else &apos; Put cursor at the end of the actual text
1255 oSelection.Min = lTextLength : oSelection.Max = lTextLength
1256 .insertText(oSelection, sNewLine &amp; Line)
1257 End If
1258 &apos; Put the cursor at the end of the inserted text
1259 oSelection.Max = oSelection.Max + Len(sNewLine) + Len(Line)
1260 oSelection.Min = oSelection.Max
1261 .setSelection(oSelection)
1262 End With
1263 bWriteLine = True
1265 Finally:
1266 WriteLine = bWriteLine
1267 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1268 Exit Function
1269 Catch:
1270 GoTo Finally
1271 CatchField:
1272 ScriptForge.SF_Exception.RaiseFatal(TEXTFIELDERROR, _Name, _DialogName)
1273 GoTo Finally
1274 End Function &apos; SFControls.SF_DialogControl.WriteLine
1276 REM =========================================================== PRIVATE FUNCTIONS
1278 REM -----------------------------------------------------------------------------
1279 Private Function _FindNode(ByRef poNode As Object _
1280 , ByVal psDisplayValue As String _
1281 , ByRef pvDataValue As Variant _
1282 , ByVal pbCaseSensitive As Boolean _
1283 ) As Object
1284 &apos;&apos;&apos; Traverses the tree and find recursively, starting from the root, a node meeting some criteria
1285 &apos;&apos;&apos; Either (1 match is enough):
1286 &apos;&apos;&apos; having its DisplayValue like psDisplayValue
1287 &apos;&apos;&apos; having its DataValue = pvDataValue
1288 &apos;&apos;&apos; Comparisons may be or not case-sensitive
1289 &apos;&apos;&apos; The first matching occurrence is returned
1290 &apos;&apos;&apos; Args:
1291 &apos;&apos;&apos; poNode: the current node, the root at 1st call
1292 &apos;&apos;&apos; psDisplayValue: the pattern to be matched
1293 &apos;&apos;&apos; pvDataValue: a string, a numeric value or a date or Empty (if not applicable)
1294 &apos;&apos;&apos; pbCaseSensitive: applicable on both criteria
1295 &apos;&apos;&apos; Returns:
1296 &apos;&apos;&apos; The found node of type com.sun.star.awt.tree.XMutableTreeNode
1298 Dim oChild As Object &apos; Child node com.sun.star.awt.tree.XMutableTreeNode
1299 Dim oFind As Object &apos; Found node com.sun.star.awt.tree.XMutableTreeNode
1300 Dim lChildCount As Long &apos; Number of children of a node
1301 Dim bFound As Boolean &apos; True when node found
1302 Dim i As Long
1304 Set _FindNode = Nothing
1305 On Local Error GoTo Finally &apos; Better not found than raise an error
1307 Check:
1308 &apos; Does the actual node match the criteria ?
1309 bFound = False
1310 If Len(psDisplayValue) &gt; 0 Then
1311 bFound = ScriptForge.SF_String.IsLike(poNode.DisplayValue, psDisplayValue, pbCaseSensitive)
1312 End If
1313 If Not bFound And Not IsEmpty(poNode.DataValue) Then
1314 If Not IsEmpty(pvdataValue) Then bFound = ( ScriptForge.SF_Array._ValCompare(poNode.DataValue, pvDataB-Value, pbCaseSensitive) = 0 )
1315 End If
1316 If bFound Then
1317 Set _FindNode = poNode
1318 Exit Function
1319 End If
1321 Try:
1322 &apos; Explore sub-branches
1323 lChildCount = poNode.getChildCount
1324 If lChildCount &gt; 0 Then
1325 For i = 0 To lChildCount - 1
1326 Set oChild = poNode.getChildAt(i)
1327 Set oFind = _FindNode(oChild, psDisplayValue, pvDataValue, pbCaseSensitive) &apos; Recursive call
1328 If Not IsNull(oFind) Then
1329 Set _FindNode = oFind
1330 Exit For
1331 End If
1332 Next i
1333 End If
1335 Finally:
1336 Exit Function
1337 End Function &apos; SFDialogs.SF_DialogControl._FindNode
1339 REM -----------------------------------------------------------------------------
1340 Private Function _FormatsList() As Variant
1341 &apos;&apos;&apos; Return the allowed format entries as a zero-based array for Date and Time control types
1343 Dim vFormats() As Variant &apos; Return value
1345 Select Case _ControlType
1346 Case CTLDATEFIELD
1347 vFormats = Array( _
1348 &quot;Standard (short)&quot; _
1349 , &quot;Standard (short YY)&quot; _
1350 , &quot;Standard (short YYYY)&quot; _
1351 , &quot;Standard (long)&quot; _
1352 , &quot;DD/MM/YY&quot; _
1353 , &quot;MM/DD/YY&quot; _
1354 , &quot;YY/MM/DD&quot; _
1355 , &quot;DD/MM/YYYY&quot; _
1356 , &quot;MM/DD/YYYY&quot; _
1357 , &quot;YYYY/MM/DD&quot; _
1358 , &quot;YY-MM-DD&quot; _
1359 , &quot;YYYY-MM-DD&quot; _
1361 Case CTLTIMEFIELD
1362 vFormats = Array( _
1363 &quot;24h short&quot; _
1364 , &quot;24h long&quot; _
1365 , &quot;12h short&quot; _
1366 , &quot;12h long&quot; _
1368 Case Else
1369 vFormats = Array()
1370 End Select
1372 _FormatsList = vFormats
1374 End Function &apos; SFDialogs.SF_DialogControl._FormatsList
1376 REM -----------------------------------------------------------------------------
1377 Public Function _GetEventName(ByVal psProperty As String) As String
1378 &apos;&apos;&apos; Return the LO internal event name derived from the SF property name
1379 &apos;&apos;&apos; The SF property name is not case sensitive, while the LO name is case-sensitive
1380 &apos; Corrects the typo on ErrorOccur(r?)ed, if necessary
1382 Dim vProperties As Variant &apos; Array of class properties
1383 Dim sProperty As String &apos; Correctly cased property name
1385 vProperties = Properties()
1386 sProperty = vProperties(ScriptForge.SF_Array.IndexOf(vProperties, psProperty, SortOrder := &quot;ASC&quot;))
1388 _GetEventName = LCase(Mid(sProperty, 3, 1)) &amp; Right(sProperty, Len(sProperty) - 3)
1390 End Function &apos; SFDialogs.SF_DialogControl._GetEventName
1392 REM -----------------------------------------------------------------------------
1393 Private Function _GetListener(ByVal psEventName As String) As String
1394 &apos;&apos;&apos; Getting/Setting macros triggered by events requires a Listener-EventName pair
1395 &apos;&apos;&apos; Return the X...Listener corresponding with the event name in argument
1397 Select Case UCase(psEventName)
1398 Case UCase(&quot;OnActionPerformed&quot;)
1399 _GetListener = &quot;XActionListener&quot;
1400 Case UCase(&quot;OnAdjustmentValueChanged&quot;)
1401 _GetListener = &quot;XAdjustmentListener&quot;
1402 Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
1403 _GetListener = &quot;XFocusListener&quot;
1404 Case UCase(&quot;OnItemStateChanged&quot;)
1405 _GetListener = &quot;XItemListener&quot;
1406 Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
1407 _GetListener = &quot;XKeyListener&quot;
1408 Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
1409 _GetListener = &quot;XMouseMotionListener&quot;
1410 Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
1411 _GetListener = &quot;XMouseListener&quot;
1412 Case UCase(&quot;OnTextChanged&quot;)
1413 _GetListener = &quot;XTextListener&quot;
1414 Case Else
1415 _GetListener = &quot;&quot;
1416 End Select
1418 End Function &apos; SFDialogs.SF_DialogControl._GetListener
1420 REM -----------------------------------------------------------------------------
1421 Public Sub _Initialize()
1422 &apos;&apos;&apos; Complete the object creation process:
1423 &apos;&apos;&apos; - Initialization of private members
1424 &apos;&apos;&apos; - Collection of specific attributes
1425 &apos;&apos;&apos; - synchronization with parent dialog instance
1427 Dim vServiceName As Variant &apos; Split service name
1428 Dim sType As String &apos; Last component of service name
1430 Try:
1431 _ImplementationName = _ControlModel.getImplementationName()
1433 &apos; Identify the control type
1434 vServiceName = Split(_ControlModel.getServiceName(), &quot;.&quot;)
1435 sType = vServiceName(UBound(vServiceName))
1436 Select Case sType
1437 Case &quot;UnoControlSpinButtonModel&quot;
1438 _ControlType = &quot;&quot; &apos; Not supported
1439 Case &quot;Edit&quot; : _ControlType = CTLTEXTFIELD
1440 Case &quot;TreeControlModel&quot;
1441 &apos; Initialize the data model
1442 _ControlType = CTLTREECONTROL
1443 Set _ControlModel.DataModel = CreateUnoService(&quot;com.sun.star.awt.tree.MutableTreeDataModel&quot;)
1444 Set _TreeDataModel = _ControlModel.DataModel
1445 Case &quot;UnoControlGridModel&quot;
1446 _ControlType = CTLTABLECONTROL
1447 Set _GridColumnModel = _ControlModel.ColumnModel
1448 Set _GridDataModel = _ControlModel.GridDataModel
1449 Case Else : _ControlType = sType
1450 End Select
1452 &apos; Store the SF_DialogControl object in the parent cache
1453 Set _Parent._ControlCache(_IndexOfNames) = [Me]
1455 Finally:
1456 Exit Sub
1457 End Sub &apos; SFDialogs.SF_DialogControl._Initialize
1459 REM -----------------------------------------------------------------------------
1460 Private Function _PropertyGet(Optional ByVal psProperty As String _
1461 , Optional ByVal pvDefault As Variant _
1462 ) As Variant
1463 &apos;&apos;&apos; Return the value of the named property
1464 &apos;&apos;&apos; Args:
1465 &apos;&apos;&apos; psProperty: the name of the property
1466 &apos;&apos;&apos; pvDefault: the value returned when the property is not applicable on the control&apos;s type
1467 &apos;&apos;&apos; Getting a non-existing property for a specific control type should
1468 &apos;&apos;&apos; not generate an error to not disrupt the Basic IDE debugger
1470 Dim vGet As Variant &apos; Return value
1471 Static oSession As Object &apos; Alias of SF_Session
1472 Dim vSelection As Variant &apos; Alias of Model.SelectedItems or Model.Selection
1473 Dim vList As Variant &apos; Alias of Model.StringItemList
1474 Dim lIndex As Long &apos; Index in StringItemList
1475 Dim sItem As String &apos; A single item
1476 Dim vDate As Variant &apos; com.sun.star.util.Date or com.sun.star.util.Time
1477 Dim vValues As Variant &apos; Array of listbox values
1478 Dim oControlEvents As Object &apos; com.sun.star.container.XNameContainer
1479 Dim sEventName As String &apos; Internal event name
1480 Dim i As Long
1481 Dim cstThisSub As String
1482 Const cstSubArgs = &quot;&quot;
1484 cstThisSub = &quot;SFDialogs.DialogControl.get&quot; &amp; psProperty
1485 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1487 ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
1488 If Not [_Parent]._IsStillAlive() Then GoTo Finally
1490 If IsMissing(pvDefault) Then pvDefault = Null
1491 _PropertyGet = pvDefault
1493 If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
1494 Select Case UCase(psProperty)
1495 Case UCase(&quot;Cancel&quot;)
1496 Select Case _ControlType
1497 Case CTLBUTTON
1498 If oSession.HasUNOProperty(_ControlModel, &quot;PushButtonType&quot;) Then _PropertyGet = ( _ControlModel.PushButtonType = com.sun.star.awt.PushButtonType.CANCEL )
1499 Case Else : GoTo CatchType
1500 End Select
1501 Case UCase(&quot;Caption&quot;)
1502 Select Case _ControlType
1503 Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
1504 If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _PropertyGet = _ControlModel.Label
1505 Case Else : GoTo CatchType
1506 End Select
1507 Case UCase(&quot;ControlType&quot;)
1508 _PropertyGet = _ControlType
1509 Case UCase(&quot;CurrentNode&quot;)
1510 Select Case _ControlType
1511 Case CTLTREECONTROL
1512 If oSession.HasUNOMethod(_ControlView, &quot;getSelection&quot;) Then
1513 _PropertyGet = Empty
1514 If _ControlModel.SelectionType &lt;&gt; com.sun.star.view.SelectionType.NONE Then
1515 vSelection = _ControlView.getSelection()
1516 If IsArray(vSelection) Then
1517 If UBound(vSelection) &gt;= 0 Then Set _PropertyGet = vSelection(0)
1518 Else
1519 Set _PropertyGet = vSelection
1520 End If
1521 End If
1522 End If
1523 Case Else : GoTo CatchType
1524 End Select
1525 Case UCase(&quot;Default&quot;)
1526 Select Case _ControlType
1527 Case CTLBUTTON
1528 If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _PropertyGet = _ControlModel.DefaultButton
1529 Case Else : GoTo CatchType
1530 End Select
1531 Case UCase(&quot;Enabled&quot;)
1532 If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _PropertyGet = _ControlModel.Enabled
1533 Case UCase(&quot;Format&quot;)
1534 Select Case _ControlType
1535 Case CTLDATEFIELD
1536 If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.DateFormat)
1537 Case CTLTIMEFIELD
1538 If oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.TimeFormat)
1539 Case CTLFORMATTEDFIELD
1540 If oSession.HasUNOProperty(_ControlModel, &quot;FormatsSupplier&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;FormatKey&quot;) Then
1541 _PropertyGet = _ControlModel.FormatsSupplier.getNumberFormats.getByKey(_ControlModel.FormatKey).FormatString
1542 End If
1543 Case Else : GoTo CatchType
1544 End Select
1545 Case UCase(&quot;ListCount&quot;)
1546 Select Case _ControlType
1547 Case CTLCOMBOBOX, CTLLISTBOX
1548 If oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then _PropertyGet = UBound(_ControlModel.StringItemList) + 1
1549 Case CTLTABLECONTROL &apos; Returns zero when no table data yet
1550 If oSession.HasUNOProperty(_GridDataModel, &quot;RowCount&quot;) Then _PropertyGet = _GridDataModel.RowCount
1551 Case Else : GoTo CatchType
1552 End Select
1553 Case UCase(&quot;ListIndex&quot;)
1554 Select Case _ControlType
1555 Case CTLCOMBOBOX
1556 _PropertyGet = -1 &apos; Not found, multiselection
1557 If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
1558 _PropertyGet = ScriptForge.SF_Array.IndexOf(_ControlModel.StringItemList, _ControlModel.Text, CaseSensitive := True)
1559 End If
1560 Case CTLLISTBOX
1561 _PropertyGet = -1 &apos; Not found, multiselection
1562 If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
1563 vSelection = _ControlModel.SelectedItems
1564 If UBound(vSelection) &gt;= 0 Then _PropertyGet = vSelection(0)
1565 End If
1566 Case CTLTABLECONTROL
1567 _PropertyGet = -1 &apos; No row selected, no data, multiselection
1568 If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
1569 And oSession.HasUNOProperty(_ControlView, &quot;CurrentRow&quot;) Then
1570 &apos; Other selection types (multi, range) not supported
1571 If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE Then
1572 lIndex = _ControlView.CurrentRow
1573 If lIndex &lt; 0 And oSession.HasUNOProperty(_ControlView, &quot;SelectedRows&quot;) Then
1574 If UBound(_ControlView.SelectedRows) &gt;= 0 Then lIndex = _ControlView.SelectedRows(0)
1575 End If
1576 _PropertyGet = lIndex
1577 End If
1578 End If
1579 Case Else : GoTo CatchType
1580 End Select
1581 Case UCase(&quot;Locked&quot;)
1582 Select Case _ControlType
1583 Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLLISTBOX _
1584 , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
1585 If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _PropertyGet = _ControlModel.ReadOnly
1586 Case Else : GoTo CatchType
1587 End Select
1588 Case UCase(&quot;MultiSelect&quot;)
1589 Select Case _ControlType
1590 Case CTLLISTBOX
1591 If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
1592 _PropertyGet = _ControlModel.MultiSelection
1593 ElseIf oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then &apos; Not documented: gridcontrols only TBC ??
1594 _PropertyGet = _ControlModel.MultiSelectionSimpleMode
1595 End If
1596 Case Else : GoTo CatchType
1597 End Select
1598 Case UCase(&quot;Name&quot;)
1599 _PropertyGet = _Name
1600 Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
1601 , UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
1602 , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
1603 , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnTextChanged&quot;)
1604 Set oControlEvents = _ControlModel.getEvents()
1605 sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; _GetEventName(psProperty)
1606 If oControlEvents.hasByName(sEventName) Then
1607 _PropertyGet = oControlEvents.getByName(sEventName).ScriptCode
1608 Else
1609 _PropertyGet = &quot;&quot;
1610 End If
1611 Case UCase(&quot;OnNodeExpanded&quot;)
1612 Select Case _ControlType
1613 Case CTLTREECONTROL
1614 _PropertyGet = _OnNodeExpanded
1615 Case Else : GoTo CatchType
1616 End Select
1617 Case UCase(&quot;OnNodeSelected&quot;)
1618 Select Case _ControlType
1619 Case CTLTREECONTROL
1620 _PropertyGet = _OnNodeSelected
1621 Case Else : GoTo CatchType
1622 End Select
1623 Case UCase(&quot;Page&quot;)
1624 If oSession.HasUnoProperty(_ControlModel, &quot;Step&quot;) Then _PropertyGet = _ControlModel.Step
1625 Case UCase(&quot;Parent&quot;)
1626 Set _PropertyGet = [_Parent]
1627 Case UCase(&quot;Picture&quot;)
1628 Select Case _ControlType
1629 Case CTLBUTTON, CTLIMAGECONTROL
1630 If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _PropertyGet = ScriptForge.SF_FileSystem._ConvertFromUrl(_ControlModel.ImageURL)
1631 Case Else : GoTo CatchType
1632 End Select
1633 Case UCase(&quot;RootNode&quot;)
1634 Select Case _ControlType
1635 Case CTLTREECONTROL
1636 _PropertyGet = _TreeDataModel.getRoot()
1637 Case Else : GoTo CatchType
1638 End Select
1639 Case UCase(&quot;RowSource&quot;)
1640 Select Case _ControlType
1641 Case CTLCOMBOBOX, CTLLISTBOX
1642 If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then
1643 If IsArray(_ControlModel.StringItemList) Then _PropertyGet = _ControlModel.StringItemList Else _PropertyGet = Array(_ControlModel.StringItemList)
1644 End If
1645 Case Else : GoTo CatchType
1646 End Select
1647 Case UCase(&quot;Text&quot;)
1648 Select Case _ControlType
1649 Case CTLCOMBOBOX, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLPATTERNFIELD, CTLTEXTFIELD
1650 If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _PropertyGet = _ControlModel.Text
1651 Case Else : GoTo CatchType
1652 End Select
1653 Case UCase(&quot;TipText&quot;)
1654 If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _PropertyGet = _ControlModel.HelpText
1655 Case UCase(&quot;TripleState&quot;)
1656 Select Case _ControlType
1657 Case CTLCHECKBOX
1658 If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _PropertyGet = _ControlModel.TriState
1659 Case Else : GoTo CatchType
1660 End Select
1661 Case UCase(&quot;Value&quot;) &apos; Default values are set here by control type, not in the 2nd argument
1662 vGet = pvDefault
1663 Select Case _ControlType
1664 Case CTLBUTTON &apos;Boolean, toggle buttons only
1665 vGet = False
1666 If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) Then
1667 If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 )
1668 End If
1669 Case CTLCHECKBOX &apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
1670 If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = _ControlModel.State Else vGet = 2
1671 Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD &apos;String
1672 If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then vGet = _ControlModel.Text Else vGet = &quot;&quot;
1673 Case CTLCURRENCYFIELD, CTLNUMERICFIELD &apos;Numeric
1674 If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then vGet = _ControlModel.Value Else vGet = 0
1675 Case CTLDATEFIELD &apos;Date
1676 vGet = CDate(1)
1677 If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
1678 If VarType(_ControlModel.Date) = ScriptForge.V_OBJECT Then &apos; com.sun.star.util.Date
1679 Set vDate = _ControlModel.Date
1680 vGet = DateSerial(vDate.Year, vDate.Month, vDate.Day)
1681 End If
1682 End If
1683 Case CTLFORMATTEDFIELD &apos;String or numeric
1684 If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then vGet = _ControlModel.EffectiveValue Else vGet = &quot;&quot;
1685 Case CTLLISTBOX &apos;String or array of strings depending on MultiSelection
1686 &apos; StringItemList is the list of the items displayed in the box
1687 &apos; SelectedItems is the list of the indexes in StringItemList of the selected items
1688 &apos; It can go beyond the limits of StringItemList
1689 &apos; It can contain multiple values even if the listbox is not multiselect
1690 If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) _
1691 And oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
1692 vSelection = _ControlModel.SelectedItems
1693 vList = _ControlModel.StringItemList
1694 If _ControlModel.MultiSelection Then vValues = Array()
1695 For i = 0 To UBound(vSelection)
1696 lIndex = vSelection(i)
1697 If lIndex &gt;= 0 And lIndex &lt;= UBound(vList) Then
1698 If Not _ControlModel.MultiSelection Then
1699 vValues = vList(lIndex)
1700 Exit For
1701 End If
1702 vValues = ScriptForge.SF_Array.Append(vValues, vList(lIndex))
1703 End If
1704 Next i
1705 vGet = vValues
1706 Else
1707 vGet = &quot;&quot;
1708 End If
1709 Case CTLPROGRESSBAR &apos;Numeric
1710 If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValue&quot;) Then vGet = _ControlModel.ProgressValue Else vGet = 0
1711 Case CTLRADIOBUTTON &apos;Boolean
1712 If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 ) Else vGet = False
1713 Case CTLSCROLLBAR &apos;Numeric
1714 If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then vGet = _ControlModel.ScrollValue Else vGet = 0
1715 Case CTLTABLECONTROL
1716 vGet = Array() &apos; Default value when no row selected, no data, multiselection
1717 If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
1718 And oSession.HasUNOProperty(_ControlView, &quot;CurrentRow&quot;) Then
1719 &apos; Other selection types (multi, range) not supported
1720 If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE Then
1721 lIndex = _ControlView.CurrentRow
1722 If lIndex &lt; 0 And oSession.HasUNOProperty(_ControlView, &quot;SelectedRows&quot;) Then
1723 If UBound(_ControlView.SelectedRows) &gt;= 0 Then lIndex = _ControlView.SelectedRows(0)
1724 End If
1725 If lIndex &gt;= 0 Then vGet = _GridDataModel.getRowData(lIndex)
1726 End If
1727 End If
1728 Case CTLTIMEFIELD
1729 vGet = CDate(0)
1730 If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
1731 If VarType(_ControlModel.Time) = ScriptForge.V_OBJECT Then &apos; com.sun.star.Util.Time
1732 Set vDate = _ControlModel.Time
1733 vGet = TimeSerial(vDate.Hours, vDate.Minutes, vDate.Seconds)
1734 End If
1735 End If
1736 Case Else : GoTo CatchType
1737 End Select
1738 _PropertyGet = vGet
1739 Case UCase(&quot;Visible&quot;)
1740 If oSession.HasUnoMethod(_ControlView, &quot;isVisible&quot;) Then _PropertyGet = CBool(_ControlView.isVisible())
1741 Case UCase(&quot;XControlModel&quot;)
1742 Set _PropertyGet = _ControlModel
1743 Case UCase(&quot;XControlView&quot;)
1744 Set _PropertyGet = _ControlView
1745 Case UCase(&quot;XGridColumnModel&quot;)
1746 Set _PropertyGet = _GridColumnModel
1747 Case UCase(&quot;XGridDataModel&quot;)
1748 Set _PropertyGet = _GridDataModel
1749 Case UCase(&quot;XTreeDataModel&quot;)
1750 Set _PropertyGet = _TreeDataModel
1751 Case Else
1752 _PropertyGet = Null
1753 End Select
1755 Finally:
1756 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
1757 Exit Function
1758 Catch:
1759 GoTo Finally
1760 CatchType:
1761 GoTo Finally
1762 End Function &apos; SFDialogs.SF_DialogControl._PropertyGet
1764 REM -----------------------------------------------------------------------------
1765 Private Function _PropertySet(Optional ByVal psProperty As String _
1766 , Optional ByVal pvValue As Variant _
1767 ) As Boolean
1768 &apos;&apos;&apos; Set the new value of the named property
1769 &apos;&apos;&apos; Args:
1770 &apos;&apos;&apos; psProperty: the name of the property
1771 &apos;&apos;&apos; pvValue: the new value of the given property
1773 Dim bSet As Boolean &apos; Return value
1774 Static oSession As Object &apos; Alias of SF_Session
1775 Dim vSet As Variant &apos; Value to set in UNO model or view property
1776 Dim vFormats As Variant &apos; Format property: output of _FormatsList()
1777 Dim iFormat As Integer &apos; Format property: index in vFormats
1778 Dim vSelection As Variant &apos; Alias of Model.SelectedItems
1779 Dim vList As Variant &apos; Alias of Model.StringItemList
1780 Dim lIndex As Long &apos; Index in StringItemList
1781 Dim sItem As String &apos; A single item
1782 Dim vCtlTypes As Variant &apos; Array of allowed control types
1783 Dim i As Long
1784 Dim cstThisSub As String
1785 Const cstSubArgs = &quot;Value&quot;
1787 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
1788 bSet = False
1790 cstThisSub = &quot;SFDialogs.DialogControl.set&quot; &amp; psProperty
1791 ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
1792 If Not [_Parent]._IsStillAlive() Then GoTo Finally
1794 If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
1795 bSet = True
1796 Select Case UCase(psProperty)
1797 Case UCase(&quot;Cancel&quot;)
1798 Select Case _ControlType
1799 Case CTLBUTTON
1800 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Cancel&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1801 If oSession.HasUNOProperty(_ControlModel, &quot;PushButtonType&quot;) Then
1802 If pvValue Then vSet = com.sun.star.awt.PushButtonType.CANCEL Else vSet = com.sun.star.awt.PushButtonType.STANDARD
1803 _ControlModel.PushButtonType = vSet
1804 End If
1805 Case Else : GoTo CatchType
1806 End Select
1807 Case UCase(&quot;Caption&quot;)
1808 Select Case _ControlType
1809 Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
1810 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Finally
1811 If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _ControlModel.Label = pvValue
1812 Case Else : GoTo CatchType
1813 End Select
1814 Case UCase(&quot;CurrentNode&quot;)
1815 Select Case _ControlType
1816 Case CTLTREECONTROL
1817 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Selection&quot;, ScriptForge.V_OBJECT) Then GoTo Finally
1818 If oSession.UnoObjectType(pvValue) &lt;&gt; &quot;toolkit.MutableTreeNode&quot; Then GoTo CatchType
1819 With _ControlView
1820 .clearSelection()
1821 If Not IsNull(pvValue) Then
1822 .addSelection(pvValue)
1823 &apos; Suspending temporarily the expansion listener avoids conflicts
1824 If Len(_OnNodeExpanded) &gt; 0 Then _ControlView.removeTreeExpansionListener(_ExpandListener)
1825 .makeNodeVisible(pvValue) &apos; Expand parent nodes and put node in the display area
1826 If Len(_OnNodeExpanded) &gt; 0 Then _ControlView.addTreeExpansionListener(_ExpandListener)
1827 End If
1828 End With
1829 Case Else : GoTo CatchType
1830 End Select
1831 Case UCase(&quot;Default&quot;)
1832 Select Case _ControlType
1833 Case CTLBUTTON
1834 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Default&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1835 If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _ControlModel.DefaultButton = pvValue
1836 Case Else : GoTo CatchType
1837 End Select
1838 Case UCase(&quot;Enabled&quot;)
1839 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Enabled&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1840 If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _ControlModel.Enabled = pvValue
1841 Case UCase(&quot;Format&quot;)
1842 Select Case _ControlType
1843 Case CTLDATEFIELD, CTLTIMEFIELD
1844 vFormats = _FormatsList()
1845 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Format&quot;, V_STRING, vFormats) Then GoTo Finally
1846 iFormat = ScriptForge.SF_Array.IndexOf(vFormats, pvValue, CaseSensitive := False)
1847 If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then
1848 _ControlModel.DateFormat = iFormat
1849 ElseIf oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then
1850 _ControlModel.TimeFormat = iFormat
1851 End If
1852 Case Else : GoTo CatchType
1853 End Select
1854 Case UCase(&quot;ListIndex&quot;)
1855 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;ListIndex&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1856 Select Case _ControlType
1857 Case CTLCOMBOBOX
1858 If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
1859 _ControlModel.Text = _ControlModel.StringItemList(CInt(pvValue))
1860 End If
1861 Case CTLLISTBOX
1862 If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) Then _ControlModel.SelectedItems = Array(CInt(pvValue))
1863 Case CTLTABLECONTROL
1864 If oSession.HasUNOProperty(_ControlModel, &quot;SelectionModel&quot;) _
1865 And oSession.HasUNOMethod(_ControlView, &quot;selectRow&quot;) Then
1866 &apos; Other selection types (multi, range) not supported
1867 If _ControlModel.SelectionModel = com.sun.star.view.SelectionType.SINGLE _
1868 And pvValue &gt;= 0 And pvValue &lt;= _GridDataModel.RowCount - 1 Then
1869 _ControlView.selectRow(pvValue)
1870 End If
1871 End If
1872 Case Else : GoTo CatchType
1873 End Select
1874 Case UCase(&quot;Locked&quot;)
1875 Select Case _ControlType
1876 Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLLISTBOX _
1877 , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
1878 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Locked&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1879 If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _ControlModel.ReadOnly = pvValue
1880 Case Else : GoTo CatchType
1881 End Select
1882 Case UCase(&quot;MultiSelect&quot;)
1883 Select Case _ControlType
1884 Case CTLLISTBOX
1885 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;MultiSelect&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1886 If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then _ControlModel.MultiSelection = pvValue
1887 If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then _ControlModel.MultiSelectionSimpleMode = pvValue
1888 If oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) Then
1889 If Not pvValue And UBound(_ControlModel.SelectedItems) &gt; 0 Then &apos; Cancel selections when MultiSelect becomes False
1890 lIndex = _ControlModel.SelectedItems(0)
1891 _ControlModel.SelectedItems = Array(lIndex)
1892 End If
1893 End If
1894 Case Else : GoTo CatchType
1895 End Select
1896 Case UCase(&quot;OnNodeExpanded&quot;)
1897 Select Case _ControlType
1898 Case CTLTREECONTROL
1899 If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
1900 &apos; If the listener was already set, then stop it
1901 If Len(_OnNodeExpanded) &gt; 0 Then
1902 _ControlView.removeTreeExpansionListener(_ExpandListener)
1903 Set _ExpandListener = Nothing
1904 _OnNodeExpanded = &quot;&quot;
1905 End If
1906 &apos; Setup a new fresh listener
1907 If Len(pvValue) &gt; 0 Then
1908 Set _ExpandListener = CreateUnoListener(&quot;_SFEXP_&quot;, &quot;com.sun.star.awt.tree.XTreeExpansionListener&quot;)
1909 _ControlView.addTreeExpansionListener(_ExpandListener)
1910 _OnNodeExpanded = pvValue
1911 End If
1912 Case Else : GoTo CatchType
1913 End Select
1914 Case UCase(&quot;OnNodeSelected&quot;)
1915 Select Case _ControlType
1916 Case CTLTREECONTROL
1917 If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
1918 &apos; If the listener was already set, then stop it
1919 If Len(_OnNodeSelected) &gt; 0 Then
1920 _ControlView.removeSelectionChangeListener(_SelectListener)
1921 Set _SelectListener = Nothing
1922 _OnNodeSelected = &quot;&quot;
1923 End If
1924 &apos; Setup a new fresh listener
1925 If Len(pvValue) &gt; 0 Then
1926 Set _SelectListener = CreateUnoListener(&quot;_SFSEL_&quot;, &quot;com.sun.star.view.XSelectionChangeListener&quot;)
1927 _ControlView.addSelectionChangeListener(_SelectListener)
1928 _OnNodeSelected = pvValue
1929 End If
1930 Case Else : GoTo CatchType
1931 End Select
1932 Case UCase(&quot;Page&quot;)
1933 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1934 If oSession.HasUnoProperty(_ControlModel, &quot;Step&quot;) Then _ControlModel.Step = CLng(pvValue)
1935 Case UCase(&quot;Picture&quot;)
1936 Select Case _ControlType
1937 Case CTLBUTTON, CTLIMAGECONTROL
1938 If Not ScriptForge.SF_Utils._ValidateFile(pvValue, &quot;Picture&quot;) Then GoTo Finally
1939 If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _ControlModel.ImageURL = ScriptForge.SF_FileSystem._ConvertToUrl(pvValue)
1940 Case Else : GoTo CatchType
1941 End Select
1942 Case UCase(&quot;RowSource&quot;)
1943 Select Case _ControlType
1944 Case CTLCOMBOBOX, CTLLISTBOX
1945 If Not IsArray(pvValue) Then
1946 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;RowSource&quot;, V_STRING) Then GoTo Finally
1947 pvArray = Array(pvArray)
1948 ElseIf Not ScriptForge.SF_Utils._ValidateArray(pvValue, &quot;RowSource&quot;, 1, V_STRING, True) Then
1949 GoTo Finally
1950 End If
1951 If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then _ControlModel.StringItemList = pvValue
1952 Case Else : GoTo CatchType
1953 End Select
1954 Case UCase(&quot;TipText&quot;)
1955 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TipText&quot;, V_STRING) Then GoTo Finally
1956 If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _ControlModel.HelpText = pvValue
1957 Case UCase(&quot;TripleState&quot;)
1958 Select Case _ControlType
1959 Case CTLCHECKBOX
1960 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TripleState&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1961 If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _ControlModel.TriState = pvValue
1962 Case Else : GoTo CatchType
1963 End Select
1964 Case UCase(&quot;Value&quot;)
1965 Select Case _ControlType
1966 Case CTLBUTTON &apos;Boolean, toggle buttons only
1967 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
1968 If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
1969 _ControlModel.State = Iif(pvValue, 1, 0)
1970 End If
1971 Case CTLCHECKBOX &apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
1972 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(ScriptForge.V_BOOLEAN, ScriptForge.V_NUMERIC), Array(0, 1, 2, True, False)) Then GoTo Finally
1973 If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
1974 If VarType(pvValue) = ScriptForge.V_BOOLEAN Then pvValue = Iif(pvValue, 1, 0)
1975 _ControlModel.State = pvValue
1976 End If
1977 Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD &apos;String
1978 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
1979 If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _ControlModel.Text = pvValue
1980 Case CTLCURRENCYFIELD, CTLNUMERICFIELD &apos;Numeric
1981 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
1982 If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then _ControlModel.Value = pvValue
1983 Case CTLDATEFIELD &apos;Date
1984 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
1985 If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
1986 Set vSet = New com.sun.star.util.Date
1987 vSet.Year = Year(pvValue)
1988 vSet.Month = Month(pvValue)
1989 vSet.Day = Day(pvValue)
1990 _ControlModel.Date = vSet
1991 End If
1992 Case CTLFORMATTEDFIELD &apos;String or numeric
1993 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(V_STRING, ScriptForge.V_NUMERIC)) Then GoTo Finally
1994 If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then _ControlModel.EffectiveValue = pvValue
1995 Case CTLLISTBOX &apos;String or array of strings depending on MultiSelection
1996 &apos; StringItemList is the list of the items displayed in the box
1997 &apos; SelectedItems is the list of the indexes in StringItemList of the selected items
1998 &apos; It can go beyond the limits of StringItemList
1999 &apos; It can contain multiple values even if the listbox is not multiselect
2000 If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) _
2001 And oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
2002 vSelection = Array()
2003 If _ControlModel.MultiSelection Then
2004 If Not ScriptForge.SF_Utils._ValidateArray(pvValue, &quot;Value&quot;, 1, V_STRING, True) Then GoTo Finally
2005 vList = _ControlModel.StringItemList
2006 For i = LBound(pvValue) To UBound(pvValue)
2007 sItem = pvValue(i)
2008 lIndex = ScriptForge.SF_Array.IndexOf(vList, sItem)
2009 If lIndex &gt;= 0 Then vSelection = ScriptForge.SF_Array.Append(vSelection, lIndex)
2010 Next i
2011 Else
2012 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
2013 lIndex = ScriptForge.SF_Array.IndexOf(_ControlModel.StringItemList, pvValue)
2014 If lIndex &gt;= 0 Then vSelection = Array(lIndex)
2015 End If
2016 _ControlModel.SelectedItems = vSelection
2017 End If
2018 Case CTLPROGRESSBAR &apos;Numeric
2019 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
2020 If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValueMin&quot;) Then
2021 If pvValue &lt; _ControlModel.ProgressValueMin Then pvValue = _ControlModel.ProgressValueMin
2022 End If
2023 If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValueMax&quot;) Then
2024 If pvValue &gt; _ControlModel.ProgressValueMax Then pvValue = _ControlModel.ProgressValueMax
2025 End If
2026 If oSession.HasUnoProperty(_ControlModel, &quot;ProgressValue&quot;) Then _ControlModel.ProgressValue = pvValue
2027 Case CTLRADIOBUTTON &apos;Boolean
2028 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
2029 If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then _ControlModel.State = Iif(pvValue, 1, 0)
2030 Case CTLSCROLLBAR &apos;Numeric
2031 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
2032 If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMin&quot;) Then
2033 If pvValue &lt; _ControlModel.ScrollValueMin Then pvValue = _ControlModel.ScrollValueMin
2034 End If
2035 If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMax&quot;) Then
2036 If pvValue &gt; _ControlModel.ScrollValueMax Then pvValue = _ControlModel.ScrollValueMax
2037 End If
2038 If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then _ControlModel.ScrollValue = pvValue
2039 Case CTLTIMEFIELD
2040 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
2041 If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
2042 Set vSet = New com.sun.star.util.Time
2043 vSet.Hours = Hour(pvValue)
2044 vSet.Minutes = Minute(pvValue)
2045 vSet.Seconds = Second(pvValue)
2046 _ControlModel.Time = vSet
2047 End If
2048 Case Else : GoTo CatchType
2049 End Select
2050 Case UCase(&quot;Visible&quot;)
2051 If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
2052 If oSession.HasUnoMethod(_ControlView, &quot;setVisible&quot;) Then
2053 If pvValue Then
2054 If oSession.HasUnoProperty(_ControlModel, &quot;EnableVisible&quot;) Then _ControlModel.EnableVisible = True
2055 End If
2056 _ControlView.setVisible(pvValue)
2057 End If
2058 Case Else
2059 bSet = False
2060 End Select
2062 Finally:
2063 _PropertySet = bSet
2064 ScriptForge.SF_Utils._ExitFunction(cstThisSub)
2065 Exit Function
2066 Catch:
2067 GoTo Finally
2068 CatchType:
2069 ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _DialogName, _ControlType, psProperty)
2070 GoTo Finally
2071 End Function &apos; SFDialogs.SF_DialogControl._PropertySet
2073 REM -----------------------------------------------------------------------------
2074 Private Function _Repr() As String
2075 &apos;&apos;&apos; Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
2076 &apos;&apos;&apos; Args:
2077 &apos;&apos;&apos; Return:
2078 &apos;&apos;&apos; &quot;[DIALOGCONTROL]: Name, Type (dialogname)
2079 _Repr = &quot;[DIALOGCONTROL]: &quot; &amp; _Name &amp; &quot;, &quot; &amp; _ControlType &amp; &quot; (&quot; &amp; _DialogName &amp; &quot;)&quot;
2081 End Function &apos; SFDialogs.SF_DialogControl._Repr
2083 REM ============================================ END OF SFDIALOGS.SF_DIALOGCONTROL
2084 </script:module>