summaryrefslogtreecommitdiff
path: root/wizards/source/sfdocuments/SF_FormControl.xba
blob: a40b902e342509c72792a6ec7326aeafba64e38e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_FormControl" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
REM ===			The ScriptForge library and its associated libraries are part of the LibreOffice project.				===
REM	===						The SFDocuments library is one of the associated libraries.									===
REM ===					Full documentation is available on https://help.libreoffice.org/								===
REM =======================================================================================================================

Option Compatible
Option ClassModule

Option Explicit

&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
&apos;&apos;&apos;	SF_FormControl
&apos;&apos;&apos;	================
&apos;&apos;&apos;		Manage the controls belonging to a form or subform stored in a document
&apos;&apos;&apos;		Each instance of the current class represents a single control within a form, a subform or a tablecontrol
&apos;&apos;&apos;		A prerequisite is that all controls within the same form, subform or tablecontrol must have
&apos;&apos;&apos;		a unique name. This is also true for the individual radio buttons belonging to the same group.
&apos;&apos;&apos;		A common group name must identify such a single group.
&apos;&apos;&apos;
&apos;&apos;&apos;		The focus is clearly set on getting and setting the values displayed by the controls of the form,
&apos;&apos;&apos;		not on their formatting. The latter is easily accessible via the XControlModel and XControlView
&apos;&apos;&apos;		UNO objects.
&apos;&apos;&apos;		Essentially a single property &quot;Value&quot; maps many alternative UNO properties depending each on
&apos;&apos;&apos;		the control type.
&apos;&apos;&apos;
&apos;&apos;&apos;		Service invocations:
&apos;&apos;&apos;			Dim myForm As Object, myControl As Object
&apos;&apos;&apos;				Set myForm = ... (read the comments in the SF_Form module)
&apos;&apos;&apos;				Set myControl = myForm.Controls(&quot;myTextBox&quot;)
&apos;&apos;&apos;				myControl.Value = &quot;Current time = &quot; &amp; Now()
&apos;&apos;&apos;
&apos;&apos;&apos;			REM the control is the subject of an event
&apos;&apos;&apos;			Sub OnEvent(ByRef poEvent As Object)
&apos;&apos;&apos;			Dim myControl As Object
&apos;&apos;&apos;				Set myControl = CreateScriptService(&quot;SFDocuments.FormEvent&quot;, poEvent)
&apos;&apos;&apos;
&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;

REM ================================================================== EXCEPTIONS

Private Const FORMCONTROLTYPEERROR		=	&quot;FORMCONTROLTYPEERROR&quot;

REM ============================================================= PRIVATE MEMBERS

Private [Me]				As Object
Private [_Parent]			As Object
Private ObjectType			As String		&apos; Must be FORMCONTROL
Private ServiceName 		As String

&apos;	Control naming and context
Private _Name				As String
Private _IndexOfNames		As Long			&apos; Index in ElementNames array. Used to access SF_Form._ControlCache
Private _FormName			As String		&apos; Parent form name
Private _ParentForm			As Object		&apos; Parent form or subform instance
Private _ParentIsTable		As Boolean		&apos; True when parent is a table control

&apos;	Control UNO references
Private _ControlModel		As Object		&apos; com.sun.star.awt.XControlModel
Private _ControlView		As Object		&apos; com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl

&apos;	Control attributes
Private	_ImplementationName	As String
Private _ControlType		As String		&apos; One of the CTLxxx constants
Private _ClassId			As Integer		&apos; Numerical type of control

&apos;	Cache storage for table controls
Private _ControlNames		As Variant		&apos; Array of control names
Private _ControlCache		As Variant		&apos; Array of control objects sorted like ElementNames of XControlModel

REM ============================================================ MODULE CONSTANTS

&apos;													ClassId
Private Const CTLBUTTON			= &quot;Button&quot;			&apos;	2
Private Const CTLCHECKBOX		= &quot;CheckBox&quot;		&apos;	5		
Private Const CTLCOMBOBOX		= &quot;ComboBox&quot;		&apos;	7
Private Const CTLCURRENCYFIELD	= &quot;CurrencyField&quot;	&apos;	18
Private Const CTLDATEFIELD		= &quot;DateField&quot;		&apos;	15
Private Const CTLFILECONTROL	= &quot;FileControl&quot;		&apos;	12
Private Const CTLFIXEDTEXT		= &quot;FixedText&quot;		&apos;	10
Private Const CTLFORMATTEDFIELD	= &quot;FormattedField&quot;	&apos;	Idem TextField
Private Const CTLGROUPBOX		= &quot;GroupBox&quot;		&apos;	8
Private Const CTLHIDDENCONTROL	= &quot;HiddenControl&quot;	&apos;	13
Private Const CTLIMAGEBUTTON	= &quot;ImageButton&quot;		&apos;	4
Private Const CTLIMAGECONTROL	= &quot;ImageControl&quot;	&apos;	14
Private Const CTLLISTBOX		= &quot;ListBox&quot;			&apos;	6
Private Const CTLNAVIGATIONBAR	= &quot;NavigationBar&quot;	&apos;	22
Private Const CTLNUMERICFIELD	= &quot;NumericField&quot;	&apos;	17
Private Const CTLPATTERNFIELD	= &quot;PatternField&quot;	&apos;	19
Private Const CTLRADIOBUTTON	= &quot;RadioButton&quot;		&apos;	3
Private Const CTLSCROLLBAR		= &quot;ScrollBar&quot;		&apos;	20
Private Const CTLSPINBUTTON		= &quot;SpinButton&quot;		&apos;	21
Private Const CTLTABLECONTROL	= &quot;TableControl&quot;	&apos;	11
Private Const CTLTEXTFIELD		= &quot;TextField&quot;		&apos;	9
Private Const CTLTIMEFIELD		= &quot;TimeField&quot;		&apos;	16

REM ====================================================== CONSTRUCTOR/DESTRUCTOR

REM -----------------------------------------------------------------------------
Private Sub Class_Initialize()
	Set [Me] = Nothing
	Set [_Parent] = Nothing
	ObjectType = &quot;FORMCONTROL&quot;
	ServiceName = &quot;SFDocuments.FormControl&quot;
	_Name = &quot;&quot;
	_IndexOfNames = -1
	_FormName = &quot;&quot;
	_ParentIsTable = False
	Set _ParentForm = Nothing
	Set _ControlModel = Nothing
	Set _ControlView = Nothing
	_ImplementationName = &quot;&quot;
	_ControlType = &quot;&quot;
	_ClassId = 0
	_ControlNames = Array()
	_ControlCache = Array()
End Sub		&apos;	SFDocuments.SF_FormControl Constructor

REM -----------------------------------------------------------------------------
Private Sub Class_Terminate()
	Call Class_Initialize()
End Sub		&apos;	SFDocuments.SF_FormControl Destructor

REM -----------------------------------------------------------------------------
Public Function Dispose() As Variant
	If Not IsNull([_Parent]) And _IndexOfNames &gt;= 0 Then [_Parent]._ControlCache(_IndexOfNames) = Empty
	Call Class_Terminate()
	Set Dispose = Nothing
End Function	&apos;	SFDocuments.SF_FormControl Explicit Destructor

REM ================================================================== PROPERTIES

REM -----------------------------------------------------------------------------
Property Get Action() As Variant
&apos;&apos;&apos;	The Action property specifies the action triggered when the button is clicked
&apos;&apos;&apos;	Accepted values:	none, submitForm, resetForm, refreshForm, moveToFirst, moveToLast,
&apos;&apos;&apos;						moveToNext, moveToPrev, saveRecord, moveToNew, deleteRecord, undoRecord
	Action = _PropertyGet(&quot;Action&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Action (get)

REM -----------------------------------------------------------------------------
Property Let Action(Optional ByVal pvAction As Variant)
&apos;&apos;&apos;	Set the updatable property Action
	_PropertySet(&quot;Action&quot;, pvAction)
End Property	&apos;	SFDocuments.SF_FormControl.Action (let)

REM -----------------------------------------------------------------------------
Property Get Caption() As Variant
&apos;&apos;&apos;	The Caption property refers to the text associated with the control
	Caption = _PropertyGet(&quot;Caption&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Caption (get)

REM -----------------------------------------------------------------------------
Property Let Caption(Optional ByVal pvCaption As Variant)
&apos;&apos;&apos;	Set the updatable property Caption
	_PropertySet(&quot;Caption&quot;, pvCaption)
End Property	&apos;	SFDocuments.SF_FormControl.Caption (let)

REM -----------------------------------------------------------------------------
Property Get ControlSource() As Variant
&apos;&apos;&apos;	The ControlSource property specifies the rowset field mapped onto the actual control
	ControlSource = _PropertyGet(&quot;ControlSource&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.ControlSource (get)

REM -----------------------------------------------------------------------------
Property Get ControlType() As String
&apos;&apos;&apos;	Return the type of the actual control: &quot;CheckBox&quot;, &quot;TextField&quot;, &quot;DateField&quot;, ...
	ControlType = _PropertyGet(&quot;ControlType&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.ControlType

REM -----------------------------------------------------------------------------
Property Get Default() As Variant
&apos;&apos;&apos;	The Default property specifies whether a command button is the default (OK) button.
	Default = _PropertyGet(&quot;Default&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.Default (get)

REM -----------------------------------------------------------------------------
Property Let Default(Optional ByVal pvDefault As Variant)
&apos;&apos;&apos;	Set the updatable property Default
	_PropertySet(&quot;Default&quot;, pvDefault)
End Property	&apos;	SFDocuments.SF_FormControl.Default (let)

REM -----------------------------------------------------------------------------
Property Get DefaultValue() As Variant
&apos;&apos;&apos;	The DefaultValue property specifies how the control is initialized in a new record
	DefaultValue = _PropertyGet(&quot;DefaultValue&quot;, Null)
End Property	&apos;	SFDocuments.SF_FormControl.DefaultValue (get)

REM -----------------------------------------------------------------------------
Property Let DefaultValue(Optional ByVal pvDefaultValue As Variant)
&apos;&apos;&apos;	Set the updatable property DefaultValue
	_PropertySet(&quot;DefaultValue&quot;, pvDefaultValue)
End Property	&apos;	SFDocuments.SF_FormControl.DefaultValue (let)

REM -----------------------------------------------------------------------------
Property Get Enabled() As Variant
&apos;&apos;&apos;	The Enabled property specifies if the control is accessible with the cursor.
	Enabled = _PropertyGet(&quot;Enabled&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.Enabled (get)

REM -----------------------------------------------------------------------------
Property Let Enabled(Optional ByVal pvEnabled As Variant)
&apos;&apos;&apos;	Set the updatable property Enabled
	_PropertySet(&quot;Enabled&quot;, pvEnabled)
End Property	&apos;	SFDocuments.SF_FormControl.Enabled (let)

REM -----------------------------------------------------------------------------
Property Get Format() As Variant
&apos;&apos;&apos;	The Format property specifies the format in which to display dates and times.
	Format = _PropertyGet(&quot;Format&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Format (get)

REM -----------------------------------------------------------------------------
Property Let Format(Optional ByVal pvFormat As Variant)
&apos;&apos;&apos;	Set the updatable property Format
&apos;&apos;&apos;	NB: Format is read-only for formatted field controls
	_PropertySet(&quot;Format&quot;, pvFormat)
End Property	&apos;	SFDocuments.SF_FormControl.Format (let)

REM -----------------------------------------------------------------------------
Property Get ListCount() As Long
&apos;&apos;&apos;	The ListCount property specifies the number of rows in a list box or a combo box
	ListCount = _PropertyGet(&quot;ListCount&quot;, 0)
End Property	&apos;	SFDocuments.SF_FormControl.ListCount (get)

REM -----------------------------------------------------------------------------
Property Get ListIndex() As Variant
&apos;&apos;&apos;	The ListIndex property specifies which item is selected in a list box or combo box.
&apos;&apos;&apos;	In case of multiple selection, the index of the first one is returned or only one is set
	ListIndex = _PropertyGet(&quot;ListIndex&quot;, -1)
End Property	&apos;	SFDocuments.SF_FormControl.ListIndex (get)

REM -----------------------------------------------------------------------------
Property Let ListIndex(Optional ByVal pvListIndex As Variant)
&apos;&apos;&apos;	Set the updatable property ListIndex
	_PropertySet(&quot;ListIndex&quot;, pvListIndex)
End Property	&apos;	SFDocuments.SF_FormControl.ListIndex (let)

REM -----------------------------------------------------------------------------
Property Get ListSource() As Variant
&apos;&apos;&apos;	The ListSource property specifies the data contained in a combobox or a listbox
&apos;&apos;&apos;	as a zero-based array of string values
	ListSource = _PropertyGet(&quot;ListSource&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.ListSource (get)

REM -----------------------------------------------------------------------------
Property Let ListSource(Optional ByVal pvListSource As Variant)
&apos;&apos;&apos;	Set the updatable property ListSource
	_PropertySet(&quot;ListSource&quot;, pvListSource)
End Property	&apos;	SFDocuments.SF_FormControl.ListSource (let)

REM -----------------------------------------------------------------------------
Property Get ListSourceType() As Variant
&apos;&apos;&apos;	The ListSourceType property specifies the kind of data source used to fill the list data of a listbox or a combobox
	ListSourceType = _PropertyGet(&quot;ListSourceType&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.ListSourceType (get)

REM -----------------------------------------------------------------------------
Property Let ListSourceType(Optional ByVal pvListSourceType As Variant)
&apos;&apos;&apos;	Set the updatable property ListSourceType
	_PropertySet(&quot;ListSourceType&quot;, pvListSourceType)
End Property	&apos;	SFDocuments.SF_FormControl.ListSourceType (let)

REM -----------------------------------------------------------------------------
Property Get Locked() As Variant
&apos;&apos;&apos;	The Locked property specifies if a control is read-only
	Locked = _PropertyGet(&quot;Locked&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.Locked (get)

REM -----------------------------------------------------------------------------
Property Let Locked(Optional ByVal pvLocked As Variant)
&apos;&apos;&apos;	Set the updatable property Locked
	_PropertySet(&quot;Locked&quot;, pvLocked)
End Property	&apos;	SFDocuments.SF_FormControl.Locked (let)

REM -----------------------------------------------------------------------------
Property Get MultiSelect() As Variant
&apos;&apos;&apos;	The MultiSelect property specifies whether a user can make multiple selections in a listbox
	MultiSelect = _PropertyGet(&quot;MultiSelect&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.MultiSelect (get)

REM -----------------------------------------------------------------------------
Property Let MultiSelect(Optional ByVal pvMultiSelect As Variant)
&apos;&apos;&apos;	Set the updatable property MultiSelect
	_PropertySet(&quot;MultiSelect&quot;, pvMultiSelect)
End Property	&apos;	SFDocuments.SF_FormControl.MultiSelect (let)

REM -----------------------------------------------------------------------------
Property Get Name() As String
&apos;&apos;&apos;	Return the name of the actual control
	Name = _PropertyGet(&quot;Name&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Name

REM -----------------------------------------------------------------------------
Property Get OnActionPerformed() As Variant
&apos;&apos;&apos;	Get the script associated with the OnActionPerformed event
	OnActionPerformed = _PropertyGet(&quot;OnActionPerformed&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnActionPerformed (get)

REM -----------------------------------------------------------------------------
Property Let OnActionPerformed(Optional ByVal pvOnActionPerformed As Variant)
&apos;&apos;&apos;	Set the updatable property OnActionPerformed
	_PropertySet(&quot;OnActionPerformed&quot;, pvOnActionPerformed)
End Property	&apos;	SFDocuments.SF_FormControl.OnActionPerformed (let)

REM -----------------------------------------------------------------------------
Property Get OnAdjustmentValueChanged() As Variant
&apos;&apos;&apos;	Get the script associated with the OnAdjustmentValueChanged event
	OnAdjustmentValueChanged = _PropertyGet(&quot;OnAdjustmentValueChanged&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnAdjustmentValueChanged (get)

REM -----------------------------------------------------------------------------
Property Let OnAdjustmentValueChanged(Optional ByVal pvOnAdjustmentValueChanged As Variant)
&apos;&apos;&apos;	Set the updatable property OnAdjustmentValueChanged
	_PropertySet(&quot;OnAdjustmentValueChanged&quot;, pvOnAdjustmentValueChanged)
End Property	&apos;	SFDocuments.SF_FormControl.OnAdjustmentValueChanged (let)

REM -----------------------------------------------------------------------------
Property Get OnApproveAction() As Variant
&apos;&apos;&apos;	Get the script associated with the OnApproveAction event
	OnApproveAction = _PropertyGet(&quot;OnApproveAction&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveAction (get)

REM -----------------------------------------------------------------------------
Property Let OnApproveAction(Optional ByVal pvOnApproveAction As Variant)
&apos;&apos;&apos;	Set the updatable property OnApproveAction
	_PropertySet(&quot;OnApproveAction&quot;, pvOnApproveAction)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveAction (let)

REM -----------------------------------------------------------------------------
Property Get OnApproveReset() As Variant
&apos;&apos;&apos;	Get the script associated with the OnApproveReset event
	OnApproveReset = _PropertyGet(&quot;OnApproveReset&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveReset (get)

REM -----------------------------------------------------------------------------
Property Let OnApproveReset(Optional ByVal pvOnApproveReset As Variant)
&apos;&apos;&apos;	Set the updatable property OnApproveReset
	_PropertySet(&quot;OnApproveReset&quot;, pvOnApproveReset)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveReset (let)

REM -----------------------------------------------------------------------------
Property Get OnApproveUpdate() As Variant
&apos;&apos;&apos;	Get the script associated with the OnApproveUpdate event
	OnApproveUpdate = _PropertyGet(&quot;OnApproveUpdate&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveUpdate (get)

REM -----------------------------------------------------------------------------
Property Let OnApproveUpdate(Optional ByVal pvOnApproveUpdate As Variant)
&apos;&apos;&apos;	Set the updatable property OnApproveUpdate
	_PropertySet(&quot;OnApproveUpdate&quot;, pvOnApproveUpdate)
End Property	&apos;	SFDocuments.SF_FormControl.OnApproveUpdate (let)

REM -----------------------------------------------------------------------------
Property Get OnChanged() As Variant
&apos;&apos;&apos;	Get the script associated with the OnChanged event
	OnChanged = _PropertyGet(&quot;OnChanged&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnChanged (get)

REM -----------------------------------------------------------------------------
Property Let OnChanged(Optional ByVal pvOnChanged As Variant)
&apos;&apos;&apos;	Set the updatable property OnChanged
	_PropertySet(&quot;OnChanged&quot;, pvOnChanged)
End Property	&apos;	SFDocuments.SF_FormControl.OnChanged (let)

REM -----------------------------------------------------------------------------
Property Get OnErrorOccurred() As Variant
&apos;&apos;&apos;	Get the script associated with the OnErrorOccurred event
	OnErrorOccurred = _PropertyGet(&quot;OnErrorOccurred&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnErrorOccurred (get)

REM -----------------------------------------------------------------------------
Property Let OnErrorOccurred(Optional ByVal pvOnErrorOccurred As Variant)
&apos;&apos;&apos;	Set the updatable property OnErrorOccurred
	_PropertySet(&quot;OnErrorOccurred&quot;, pvOnErrorOccurred)
End Property	&apos;	SFDocuments.SF_FormControl.OnErrorOccurred (let)

REM -----------------------------------------------------------------------------
Property Get OnFocusGained() As Variant
&apos;&apos;&apos;	Get the script associated with the OnFocusGained event
	OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnFocusGained (get)

REM -----------------------------------------------------------------------------
Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
&apos;&apos;&apos;	Set the updatable property OnFocusGained
	_PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
End Property	&apos;	SFDocuments.SF_FormControl.OnFocusGained (let)

REM -----------------------------------------------------------------------------
Property Get OnFocusLost() As Variant
&apos;&apos;&apos;	Get the script associated with the OnFocusLost event
	OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnFocusLost (get)

REM -----------------------------------------------------------------------------
Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
&apos;&apos;&apos;	Set the updatable property OnFocusLost
	_PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
End Property	&apos;	SFDocuments.SF_FormControl.OnFocusLost (let)

REM -----------------------------------------------------------------------------
Property Get OnItemStateChanged() As Variant
&apos;&apos;&apos;	Get the script associated with the OnItemStateChanged event
	OnItemStateChanged = _PropertyGet(&quot;OnItemStateChanged&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnItemStateChanged (get)

REM -----------------------------------------------------------------------------
Property Let OnItemStateChanged(Optional ByVal pvOnItemStateChanged As Variant)
&apos;&apos;&apos;	Set the updatable property OnItemStateChanged
	_PropertySet(&quot;OnItemStateChanged&quot;, pvOnItemStateChanged)
End Property	&apos;	SFDocuments.SF_FormControl.OnItemStateChanged (let)

REM -----------------------------------------------------------------------------
Property Get OnKeyPressed() As Variant
&apos;&apos;&apos;	Get the script associated with the OnKeyPressed event
	OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnKeyPressed (get)

REM -----------------------------------------------------------------------------
Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
&apos;&apos;&apos;	Set the updatable property OnKeyPressed
	_PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
End Property	&apos;	SFDocuments.SF_FormControl.OnKeyPressed (let)

REM -----------------------------------------------------------------------------
Property Get OnKeyReleased() As Variant
&apos;&apos;&apos;	Get the script associated with the OnKeyReleased event
	OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnKeyReleased (get)

REM -----------------------------------------------------------------------------
Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
&apos;&apos;&apos;	Set the updatable property OnKeyReleased
	_PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
End Property	&apos;	SFDocuments.SF_FormControl.OnKeyReleased (let)

REM -----------------------------------------------------------------------------
Property Get OnMouseDragged() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMouseDragged event
	OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseDragged (get)

REM -----------------------------------------------------------------------------
Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
&apos;&apos;&apos;	Set the updatable property OnMouseDragged
	_PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseDragged (let)

REM -----------------------------------------------------------------------------
Property Get OnMouseEntered() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMouseEntered event
	OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseEntered (get)

REM -----------------------------------------------------------------------------
Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
&apos;&apos;&apos;	Set the updatable property OnMouseEntered
	_PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseEntered (let)

REM -----------------------------------------------------------------------------
Property Get OnMouseExited() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMouseExited event
	OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseExited (get)

REM -----------------------------------------------------------------------------
Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
&apos;&apos;&apos;	Set the updatable property OnMouseExited
	_PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseExited (let)

REM -----------------------------------------------------------------------------
Property Get OnMouseMoved() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMouseMoved event
	OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseMoved (get)

REM -----------------------------------------------------------------------------
Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
&apos;&apos;&apos;	Set the updatable property OnMouseMoved
	_PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseMoved (let)

REM -----------------------------------------------------------------------------
Property Get OnMousePressed() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMousePressed event
	OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMousePressed (get)

REM -----------------------------------------------------------------------------
Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
&apos;&apos;&apos;	Set the updatable property OnMousePressed
	_PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
End Property	&apos;	SFDocuments.SF_FormControl.OnMousePressed (let)

REM -----------------------------------------------------------------------------
Property Get OnMouseReleased() As Variant
&apos;&apos;&apos;	Get the script associated with the OnMouseReleased event
	OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseReleased (get)

REM -----------------------------------------------------------------------------
Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
&apos;&apos;&apos;	Set the updatable property OnMouseReleased
	_PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
End Property	&apos;	SFDocuments.SF_FormControl.OnMouseReleased (let)

REM -----------------------------------------------------------------------------
Property Get OnResetted() As Variant
&apos;&apos;&apos;	Get the script associated with the OnResetted event
	OnResetted = _PropertyGet(&quot;OnResetted&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnResetted (get)

REM -----------------------------------------------------------------------------
Property Let OnResetted(Optional ByVal pvOnResetted As Variant)
&apos;&apos;&apos;	Set the updatable property OnResetted
	_PropertySet(&quot;OnResetted&quot;, pvOnResetted)
End Property	&apos;	SFDocuments.SF_FormControl.OnResetted (let)

REM -----------------------------------------------------------------------------
Property Get OnTextChanged() As Variant
&apos;&apos;&apos;	Get the script associated with the OnTextChanged event
	OnTextChanged = _PropertyGet(&quot;OnTextChanged&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnTextChanged (get)

REM -----------------------------------------------------------------------------
Property Let OnTextChanged(Optional ByVal pvOnTextChanged As Variant)
&apos;&apos;&apos;	Set the updatable property OnTextChanged
	_PropertySet(&quot;OnTextChanged&quot;, pvOnTextChanged)
End Property	&apos;	SFDocuments.SF_FormControl.OnTextChanged (let)

REM -----------------------------------------------------------------------------
Property Get OnUpdated() As Variant
&apos;&apos;&apos;	Get the script associated with the OnUpdated event
	OnUpdated = _PropertyGet(&quot;OnUpdated&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.OnUpdated (get)

REM -----------------------------------------------------------------------------
Property Let OnUpdated(Optional ByVal pvOnUpdated As Variant)
&apos;&apos;&apos;	Set the updatable property OnUpdated
	_PropertySet(&quot;OnUpdated&quot;, pvOnUpdated)
End Property	&apos;	SFDocuments.SF_FormControl.OnUpdated (let)

REM -----------------------------------------------------------------------------
Property Get Parent() As Object
&apos;&apos;&apos;	Return the Parent form or [table]control object of the actual control
	Parent = _PropertyGet(&quot;Parent&quot;, Nothing)
End Property	&apos;	SFDocuments.SF_FormControl.Parent

REM -----------------------------------------------------------------------------
Property Get Picture() As Variant
&apos;&apos;&apos;	The Picture property specifies a bitmap or other type of graphic to be displayed on the specified control
	Picture = _PropertyGet(&quot;Picture&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Picture (get)

REM -----------------------------------------------------------------------------
Property Let Picture(Optional ByVal pvPicture As Variant)
&apos;&apos;&apos;	Set the updatable property Picture
	_PropertySet(&quot;Picture&quot;, pvPicture)
End Property	&apos;	SFDocuments.SF_FormControl.Picture (let)

REM -----------------------------------------------------------------------------
Property Get Required() As Variant
&apos;&apos;&apos;	A control is said Required when it must not contain a null value
	Required = _PropertyGet(&quot;Required&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.Required (get)

REM -----------------------------------------------------------------------------
Property Let Required(Optional ByVal pvRequired As Variant)
&apos;&apos;&apos;	Set the updatable property Required
	_PropertySet(&quot;Required&quot;, pvRequired)
End Property	&apos;	SFDocuments.SF_FormControl.Required (let)

REM -----------------------------------------------------------------------------
Property Get Text() As Variant
&apos;&apos;&apos;	The Text property specifies the actual content of the control like it is displayed on the screen
	Text = _PropertyGet(&quot;Text&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.Text (get)

REM -----------------------------------------------------------------------------
Property Get TipText() As Variant
&apos;&apos;&apos;	The TipText property specifies the text that appears in a screentip when you hold the mouse pointer over a control
	TipText = _PropertyGet(&quot;TipText&quot;, &quot;&quot;)
End Property	&apos;	SFDocuments.SF_FormControl.TipText (get)

REM -----------------------------------------------------------------------------
Property Let TipText(Optional ByVal pvTipText As Variant)
&apos;&apos;&apos;	Set the updatable property TipText
	_PropertySet(&quot;TipText&quot;, pvTipText)
End Property	&apos;	SFDocuments.SF_FormControl.TipText (let)

REM -----------------------------------------------------------------------------
Property Get TripleState() As Variant
&apos;&apos;&apos;	The TripleState property specifies how a check box will display Null values
&apos;&apos;&apos;	When True, the control will cycle through states for Yes, No, and Null values. The control appears dimmed (grayed) when its Value property is set to Null.
&apos;&apos;&apos;	When False, the control will cycle through states for Yes and No values. Null values display as if they were No values.
	TripleState = _PropertyGet(&quot;TripleState&quot;, False)
End Property	&apos;	SFDocuments.SF_FormControl.TripleState (get)

REM -----------------------------------------------------------------------------
Property Let TripleState(Optional ByVal pvTripleState As Variant)
&apos;&apos;&apos;	Set the updatable property TripleState
	_PropertySet(&quot;TripleState&quot;, pvTripleState)
End Property	&apos;	SFDocuments.SF_FormControl.TripleState (let)

REM -----------------------------------------------------------------------------
Property Get Value() As Variant
&apos;&apos;&apos;	The Value property specifies the data contained in the control
	Value = _PropertyGet(&quot;Value&quot;, Empty)
End Property	&apos;	SFDocuments.SF_FormControl.Value (get)

REM -----------------------------------------------------------------------------
Property Let Value(Optional ByVal pvValue As Variant)
&apos;&apos;&apos;	Set the updatable property Value
	_PropertySet(&quot;Value&quot;, pvValue)
End Property	&apos;	SFDocuments.SF_FormControl.Value (let)

REM -----------------------------------------------------------------------------
Property Get Visible() As Variant
&apos;&apos;&apos;	The Visible property specifies if the control is accessible with the cursor.
	Visible = _PropertyGet(&quot;Visible&quot;, True)
End Property	&apos;	SFDocuments.SF_FormControl.Visible (get)

REM -----------------------------------------------------------------------------
Property Let Visible(Optional ByVal pvVisible As Variant)
&apos;&apos;&apos;	Set the updatable property Visible
	_PropertySet(&quot;Visible&quot;, pvVisible)
End Property	&apos;	SFDocuments.SF_FormControl.Visible (let)

REM -----------------------------------------------------------------------------
Property Get XControlModel() As Object
&apos;&apos;&apos;	The XControlModel property returns the model UNO object of the control
	XControlModel = _PropertyGet(&quot;XControlModel&quot;, Nothing)
End Property	&apos;	SFDocuments.SF_FormControl.XControlModel (get)

REM -----------------------------------------------------------------------------
Property Get XControlView() As Object
&apos;&apos;&apos;	The XControlView property returns the view UNO object of the control
	XControlView = _PropertyGet(&quot;XControlView&quot;, Nothing)
End Property	&apos;	SFDocuments.SF_FormControl.XControlView (get)

REM ===================================================================== METHODS

REM -----------------------------------------------------------------------------
Public Function Controls(Optional ByVal ControlName As Variant) As Variant
&apos;&apos;&apos;	Return either
&apos;&apos;&apos;		- the list of the controls contained in the actual table control
&apos;&apos;&apos;		- a Form Control object based on its name
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		ControlName: a valid control name as a case-sensitive string. If absent the list is returned
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		A zero-base array of strings if ControlName is absent
&apos;&apos;&apos;		An instance of the SF_FormControl class if ControlName exists
&apos;&apos;&apos;	Exceptions:
&apos;&apos;&apos;		ControlName is invalid
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;			Dim myGrid As Object, myList As Variant, myControl As Object
&apos;&apos;&apos;				Set myGrid = myForm.Controls(&quot;myTableControl&quot;)
&apos;&apos;&apos;				myList = myGrid.Controls()
&apos;&apos;&apos;				Set myControl = myGrid.Controls(&quot;myCheckBox&quot;)

Dim oControl As Object				&apos;	The new control class instance
Dim lIndexOfNames As Long			&apos;	Index in ElementNames array. Used to access _ControlCache
Dim vControl As Variant				&apos;	Alias of _ControlCache entry
Dim oView As Object					&apos;	com.sun.star.awt.XControl - stardiv.Toolkit.UnoDialogControl
Dim i As Long
Const cstThisSub = &quot;SFDocuments.FormControl.Controls&quot;
Const cstSubArgs = &quot;[ControlName]&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	Set Controls = Nothing

Check:
	If IsMissing(ControlName) Or IsEmpty(ControlName) Then ControlName = &quot;&quot;
	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If _ControlType &lt;&gt; CTLTABLECONTROL Then GoTo Catch
		If Not [_Parent]._IsStillAlive() Then GoTo Finally
		If Not ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING) Then GoTo Finally
	End If

Try:
	&apos;	Collect all control names if not yet done
	If UBound(_ControlNames) &lt; 0 Then
		_ControlNames = _ControlModel.getElementNames()
		If UBound(_ControlNames) &gt;= 0 Then
			ReDim _ControlCache(0 To UBound(_ControlNames))
		End If
	End If

	&apos;	Return the list of controls or a FormControl instance
	If Len(ControlName) = 0 Then
		Controls = _ControlNames

	Else

		If Not _ControlModel.hasByName(ControlName) Then GoTo CatchNotFound
		lIndexOfNames = ScriptForge.SF_Array.IndexOf(_ControlNames, ControlName, CaseSensitive := True)
		&apos;	Reuse cache when relevant
		vControl = _ControlCache(lIndexOfNames)

		If IsEmpty(vControl) Then
			&apos;	Not in cache =&gt; Create the new form control class instance
			Set oControl = New SF_FormControl
			With oControl
				._Name = ControlName
				Set .[Me] = oControl
				Set .[_Parent] = [Me]
				._ParentIsTable = True
				._IndexOfNames = lIndexOfNames
				._FormName = _FormName
				Set ._ParentForm = _ParentForm
				&apos;	Get model and view of the current control
				Set ._ControlModel = _ControlModel.getByName(ControlName)
				._ImplementationName = ._ControlModel.ColumnServiceName	&apos;	getImplementationName aborts for subcontrols !?
				&apos;	Bypass to find the control view: cannot be done from the top component
				If Not IsNull(_ControlView) Then		&apos;	Anticipate absence of ControlView in table controls when edit mode
					For i = 0 to _ControlView.getCount() - 1
						Set oView = _ControlView.GetByIndex(i)
						If Not IsNull(oView) Then
							If oView.getModel.Name = ControlName Then
								Set ._ControlView = oView
								Exit For
							End If
						End If
					Next i
				End If
				._Initialize()
			End With
		Else
			Set oControl = vControl
		End If

		Set Controls = oControl
	End If

Finally:
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
CatchNotFound:
	ScriptForge.SF_Utils._Validate(ControlName, &quot;ControlName&quot;, V_STRING, _ControlModel.getElementNames())
	GoTo Finally
End Function	&apos;	SFDocuments.SF_FormControl.Controls

REM -----------------------------------------------------------------------------
Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
&apos;&apos;&apos;	Return the actual value of the given property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		PropertyName: the name of the property as a string
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		The actual value of the property
&apos;&apos;&apos;		If the property does not exist, returns Null
&apos;&apos;&apos;	Exceptions:
&apos;&apos;&apos;		see the exceptions of the individual properties
&apos;&apos;&apos;	Examples:
&apos;&apos;&apos;		myModel.GetProperty(&quot;MyProperty&quot;)

Const cstThisSub = &quot;SFDocuments.DialogControl.GetProperty&quot;
Const cstSubArgs = &quot;&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	GetProperty = Null

Check:
	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
	End If

Try:
	GetProperty = _PropertyGet(PropertyName)

Finally:
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFDocuments.SF_FormControl.GetProperty

REM -----------------------------------------------------------------------------
Public Function Methods() As Variant
&apos;&apos;&apos;	Return the list of public methods of the Model service as an array

	Methods = Array( _
					&quot;AddSubNode&quot; _
					, &quot;AddSubTree&quot; _
					, &quot;CreateRoot&quot; _
					, &quot;FindNode&quot; _
					, &quot;SetFocus&quot; _
					, &quot;WriteLine&quot; _
					)

End Function	&apos;	SFDocuments.SF_FormControl.Methods

REM -----------------------------------------------------------------------------
Public Function Properties() As Variant
&apos;&apos;&apos;	Return the list or properties of the Timer class as an array

	Properties = Array( _
					&quot;Cancel&quot; _
					, &quot;Caption&quot; _
					, &quot;ControlSource&quot; _
					, &quot;ControlType&quot; _
					, &quot;Default&quot; _
					, &quot;DefaultValue&quot; _
					, &quot;Enabled&quot; _
					, &quot;Format&quot; _
					, &quot;ListCount&quot; _
					, &quot;ListIndex&quot; _
					, &quot;ListSource&quot; _
					, &quot;ListSourceType&quot; _
					, &quot;Locked&quot; _
					, &quot;MultiSelect&quot; _
					, &quot;Name&quot; _
					, &quot;OnActionPerformed&quot; _
					, &quot;OnAdjustmentValueChanged&quot; _
					, &quot;OnApproveAction&quot; _
					, &quot;OnApproveReset&quot; _
					, &quot;OnApproveUpdate&quot; _
					, &quot;OnChanged&quot; _
					, &quot;OnErrorOccurred&quot; _
					, &quot;OnFocusGained&quot; _
					, &quot;OnFocusLost&quot; _
					, &quot;OnItemStateChanged&quot; _
					, &quot;OnKeyPressed&quot; _
					, &quot;OnKeyReleased&quot; _
					, &quot;OnMouseDragged&quot; _
					, &quot;OnMouseEntered&quot; _
					, &quot;OnMouseExited&quot; _
					, &quot;OnMouseMoved&quot; _
					, &quot;OnMousePressed&quot; _
					, &quot;OnMouseReleased&quot; _
					, &quot;OnResetted&quot; _
					, &quot;OnTextChanged&quot; _
					, &quot;OnUpdated&quot; _
					, &quot;Parent&quot; _
					, &quot;Picture&quot; _
					, &quot;Required&quot; _
					, &quot;Text&quot; _
					, &quot;TipText&quot; _
					, &quot;TripleState&quot; _
					, &quot;Value&quot; _
					, &quot;Visible&quot; _
					, &quot;XControlModel&quot; _
					, &quot;XControlView&quot; _
					)

End Function	&apos;	SFDocuments.SF_FormControl.Properties

REM -----------------------------------------------------------------------------
Public Function SetFocus() As Boolean
&apos;&apos;&apos;	Set the focus on the current Control instance
&apos;&apos;&apos;	Probably called from after an event occurrence
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		True if focusing is successful
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		Dim oDoc As Object, oForm As Object, oControl As Object
&apos;&apos;&apos;			Set oDoc = CreateScriptService(&quot;SFDocuments.Document&quot;, ThisComponent)
&apos;&apos;&apos;			Set oForm = oDoc.Forms(0)
&apos;&apos;&apos;			Set oControl = oForm.Controls(&quot;thisControl&quot;)
&apos;&apos;&apos;			oControl.SetFocus()

Dim bSetFocus As Boolean		&apos;	Return value
Dim iColPosition As Integer		&apos;	Position of control in table
Dim oTableModel As Object		&apos;	XControlModel of parent table
Dim oControl As Object			&apos;	com.sun.star.awt.XControlModel
Dim i As Integer, j As Integer
Const cstThisSub = &quot;SFDocuments.FormControl.SetFocus&quot;
Const cstSubArgs = &quot;&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	bSetFocus = False

Check:
	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not _ParentForm._IsStillAlive() Then GoTo Finally
	End If

Try:
	If Not IsNull(_ControlView) Then
		If _ParentIsTable Then	&apos;	setFocus() method does not work on controlviews in table control ?!?
			&apos;	Find the column position of the current instance in the parent table control
			iColPosition = -1
			Set oTableModel = [_Parent]._ControlModel
			j = -1
			For i = 0 To oTableModel.Count - 1
				Set oControl = oTableModel.getByIndex(i)
				If Not oControl.Hidden Then j = j + 1		&apos;	Skip hidden columns
				If oControl.Name = _Name Then
					iColPosition = j
					Exit For
				End If
			Next i
			If iColPosition &gt;= 0 Then
				[_Parent]._ControlView.setFocus()								&apos;Set first focus on table control itself
				[_Parent]._ControlView.setCurrentColumnPosition(iColPosition)	&apos;Deprecated but no alternative found
			End If
		Else
			_ControlView.setFocus()
		End If
		bSetFocus = True
	End If
	bSetFocus = True

Finally:
	SetFocus = bSetFocus
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFControls.SF_FormControl.SetFocus

REM -----------------------------------------------------------------------------
Public Function SetProperty(Optional ByVal PropertyName As Variant _
								, Optional ByRef Value As Variant _
								) As Boolean
&apos;&apos;&apos;	Set a new value to the given property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		PropertyName: the name of the property as a string
&apos;&apos;&apos;		Value: its new value
&apos;&apos;&apos;	Exceptions
&apos;&apos;&apos;		ARGUMENTERROR		The property does not exist

Const cstThisSub = &quot;SFDocuments.DialogControl.SetProperty&quot;
Const cstSubArgs = &quot;PropertyName, Value&quot;

	If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	SetProperty = False

Check:
	If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
	End If

Try:
	SetProperty = _PropertySet(PropertyName, Value)

Finally:
	SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFDocuments.SF_FormControl.SetProperty

REM =========================================================== PRIVATE FUNCTIONS

REM -----------------------------------------------------------------------------
Private Function _FormatsList() As Variant
&apos;&apos;&apos;	Return the allowed format entries as a zero-based array for Date and Time control types

Dim vFormats() As Variant		&apos;	Return value

	Select Case _ControlType
		Case CTLDATEFIELD
			vFormats = Array( _
				&quot;Standard (short)&quot; _
				, &quot;Standard (short YY)&quot; _
				, &quot;Standard (short YYYY)&quot; _
				, &quot;Standard (long)&quot; _
				, &quot;DD/MM/YY&quot; _
				, &quot;MM/DD/YY&quot; _
				, &quot;YY/MM/DD&quot; _
				, &quot;DD/MM/YYYY&quot; _
				, &quot;MM/DD/YYYY&quot; _
				, &quot;YYYY/MM/DD&quot; _
				, &quot;YY-MM-DD&quot; _
				, &quot;YYYY-MM-DD&quot; _
				)
		Case CTLTIMEFIELD
			vFormats = Array( _
				&quot;24h short&quot; _
				, &quot;24h long&quot; _
				, &quot;12h short&quot; _
				, &quot;12h long&quot; _
				)
		Case Else
			vFormats = Array()
	End Select
	
	_FormatsList = vFormats

End Function	&apos;	SFDocuments.SF_FormControl._FormatsList

REM -----------------------------------------------------------------------------
Public Function _GetEventName(ByVal psProperty As String) As String
&apos;&apos;&apos;	Return the LO internal event name derived from the SF property name
&apos;&apos;&apos;	The SF property name is not case sensitive, while the LO name is case-sensitive
&apos;	Corrects the typo on ErrorOccur(r?)ed, if necessary

Dim vProperties As Variant			&apos;	Array of class properties
Dim sProperty As String				&apos;	Correctly cased property name

	vProperties = Properties()
	sProperty = vProperties(ScriptForge.SF_Array.IndexOf(vProperties, psProperty, SortOrder := &quot;ASC&quot;))

	_GetEventName = LCase(Mid(sProperty, 3, 1)) &amp; Right(sProperty, Len(sProperty) - 3)
	
End Function	&apos;	SFDocuments.SF_FormControl._GetEventName

REM -----------------------------------------------------------------------------
Private Function _GetListener(ByVal psEventName As String) As String
&apos;&apos;&apos;	Getting/Setting macros triggered by events requires a Listener-EventName pair
&apos;&apos;&apos;	Return the X...Listener corresponding with the event name in argument

	Select Case UCase(psEventName)
		Case UCase(&quot;OnActionPerformed&quot;)
			_GetListener = &quot;XActionListener&quot;
		Case UCase(&quot;OnAdjustmentValueChanged&quot;)
			_GetListener = &quot;XAdjustmentListener&quot;
		Case UCase(&quot;OnApproveAction&quot;)
			_GetListener = &quot;XApproveActionListener&quot;
		Case UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnResetted&quot;)
			_GetListener = &quot;XResetListener&quot;
		Case UCase(&quot;OnApproveUpdate&quot;), UCase(&quot;OnUpdated&quot;)
			_GetListener = &quot;XUpdateListener&quot;
		Case UCase(&quot;OnChanged&quot;)
			_GetListener = &quot;XChangeListener&quot;
		Case UCase(&quot;OnErrorOccurred&quot;)
			_GetListener = &quot;XErrorListener&quot;
		Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
			_GetListener = &quot;XFocusListener&quot;
		Case UCase(&quot;OnItemStateChanged&quot;)
			_GetListener = &quot;XItemListener&quot;
		Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
			_GetListener = &quot;XKeyListener&quot;
		Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
			_GetListener = &quot;XMouseMotionListener&quot;
		Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
			_GetListener = &quot;XMouseListener&quot;
		Case UCase(&quot;OnTextChanged&quot;)
			_GetListener = &quot;XTextListener&quot;
	End Select
	
End Function	&apos;	SFDocuments.SF_FormControl._GetListener

REM -----------------------------------------------------------------------------
Public Sub _Initialize()
&apos;&apos;&apos;	Complete the object creation process:
&apos;&apos;&apos;		- Initialization of private members
&apos;&apos;&apos;		- Collection of specific attributes
&apos;&apos;&apos;		- Synchronization with parent form instance

Dim vControlTypes As Variant		&apos;	Array of control types ordered by the ClassId property of XControlModel - 2
Const acHiddenControl = 13			&apos;	Class Id of an hidden control: has no ControlView

	vControlTypes = array(	CTLBUTTON _
							, CTLRADIOBUTTON _
							, CTLIMAGEBUTTON _
							, CTLCHECKBOX _
							, CTLLISTBOX _
							, CTLCOMBOBOX _
							, CTLGROUPBOX _
							, CTLTEXTFIELD _
							, CTLFIXEDTEXT _
							, CTLTABLECONTROL _
							, CTLFILECONTROL _
							, CTLHIDDENCONTROL _
							, CTLIMAGECONTROL _
							, CTLDATEFIELD _
							, CTLTIMEFIELD _
							, CTLNUMERICFIELD _
							, CTLCURRENCYFIELD _
							, CTLPATTERNFIELD _
							, CTLSCROLLBAR _
							, CTLSPINBUTTON _
							, CTLNAVIGATIONBAR _
						)

Try:
	&apos;	_implementationName is set elsewhere for controls in table control
	If Len(_ImplementationName) = 0 Then _ImplementationName = ScriptForge.SF_Session.UnoObjectType(_ControlModel)
	_ClassId = _ControlModel.ClassId

	&apos;	Identify the control type, ignore subforms and pay attention to formatted fields
	If ScriptForge.SF_Session.HasUnoproperty(_ControlModel, &quot;ClassId&quot;) Then		&apos;	All control types have a ClassId property except subforms
		_ControlType = vControlTypes(_ClassId - 2)
		&apos;	Formatted fields belong to the TextField family
		If _ControlType = CTLTEXTFIELD Then
			If _ImplementationName = &quot;com.sun.star.comp.forms.OFormattedFieldWrapper&quot; _
				Or _ImplementationName = &quot;com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted&quot; _
				Or _ImplementationName = &quot;com.sun.star.form.component.FormattedField&quot; Then		&apos;	When in table control
						_ControlType = CTLFORMATTEDFIELD
			End If
		End If
	Else
		Exit Sub	&apos;	Ignore subforms, should not happen
	End If

	With [_Parent]
		&apos;	Set control view if not set yet
		If IsNull(_ControlView) Then
			If _ClassId &gt; 0 And _ClassId &lt;&gt; acHiddenControl Then	&apos;	No view on hidden controls
				If IsNull(._FormDocument) Then		&apos;	Usual document
					Set _ControlView = ._Component.CurrentController.getControl(_ControlModel)
				Else								&apos;	Base form document
					Set _ControlView = ._FormDocument.Component.CurrentController.getControl(_ControlModel)
				End If
			End If
		End If
	End With

	&apos;	Store  the SF_FormControl object in the parent cache
	Set _Parent._ControlCache(_IndexOfNames) = [Me]

Finally:
	Exit Sub
End Sub			&apos;	SFDocuments.SF_FormControl._Initialize

REM -----------------------------------------------------------------------------
Private Function _ListboxBound() As Boolean
&apos;&apos;&apos;	Return True if the actual control, which is a listbox, has a bound column
&apos;&apos;&apos;	Called before setting the value of a listbox, i.e. the value to be rewritten in the underlying table data
&apos;&apos;&apos;	The existence of a bound column is derived from the comparison between StringItemList and ValueItemList
&apos;&apos;&apos;		String ... : the strings displayed in the list box
&apos;&apos;&apos;		Value ...  : the database values
&apos;&apos;&apos;		If they are different, then there is a bound column

Dim bListboxBound As Boolean		&apos;	Return value
Dim vValue() As variant				&apos;	Alias of the control model ValueItemList
Dim vString() As Variant			&apos;	Alias of the control model StringItemList
Dim i As Long

	bListboxBound = False

	With _ControlModel
		If Not IsNull(.ValueItemList) _
			And .DataField &lt;&gt; &quot;&quot; _
			And Not IsNull(.BoundField) _
			And ScriptForge.SF_Array.Contains(Array( _
						com.sun.star.form.ListSourceType.TABLE _
						, com.sun.star.form.ListSourceType.QUERY _
						, com.sun.star.form.ListSourceType.SQL _
						, com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
			), .ListSourceType) Then
			If IsArray(.ValueItemList) Then
				vValue = .ValueItemList
				vString = .StringItemList
				For i = 0 To UBound(vValue)
					If VarType(vValue(i)) &lt;&gt; VarType(vString(i)) Then
						bListboxBound = True
					ElseIf vValue(i) &lt;&gt; vString(i) Then
						bListboxBound = True
					End If
					If bListboxBound Then Exit For
				Next i
			End If
		End If
	End With
	
	_ListboxBound = bListboxBound

End Function		&apos;	_ListboxBound	V0.9.0

REM -----------------------------------------------------------------------------
Private Function _PropertyGet(Optional ByVal psProperty As String _
								, Optional ByVal pvDefault As Variant _
								) As Variant
&apos;&apos;&apos;	Return the value of the named property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		psProperty: the name of the property
&apos;&apos;&apos;		pvDefault: the value returned when the property is not applicable on the control&apos;s type
&apos;&apos;&apos;			Getting a non-existing property for a specific control type should
&apos;&apos;&apos;			not generate an error to not disrupt the Basic IDE debugger

Dim vGet As Variant							&apos;	Return value
Static oSession As Object					&apos;	Alias of SF_Session
Dim vSelection As Variant					&apos;	Alias of Model.SelectedItems or Model.Selection
Dim vList As Variant						&apos;	Alias of Model.StringItemList
Dim lIndex As Long							&apos;	Index in StringItemList
Dim sItem As String							&apos;	A single item
Dim vDate As Variant						&apos;	com.sun.star.util.Date or com.sun.star.util.Time
Dim vValues As Variant						&apos;	Array of listbox values
Dim oControlEvents As Object				&apos;	com.sun.star.container.XNameContainer
Dim sEventName As String					&apos;	Internal event name
Const cstUnoUrl = &quot;.uno:FormController/&quot;
Dim i As Long
Dim cstThisSub As String
Const cstSubArgs = &quot;&quot;

	cstThisSub = &quot;SFDocuments.FormControl.get&quot; &amp; psProperty
	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch

	ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
	If Not _ParentForm._IsStillAlive() Then GoTo Finally

	If IsMissing(pvDefault) Or IsEmpty(pvDefault) Then pvDefault = Null
	_PropertyGet = pvDefault

	If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
	Select Case UCase(psProperty)
		Case UCase(&quot;Action&quot;)
			Select Case _ControlType
				Case CTLBUTTON
					If oSession.HasUNOProperty(_ControlModel, &quot;ButtonType&quot;) Then
						Select Case _ControlModel.ButtonType
							Case com.sun.star.form.FormButtonType.PUSH		:	_PropertyGet = &quot;none&quot;
							Case com.sun.star.form.FormButtonType.SUBMIT	:	_PropertyGet = &quot;submitForm&quot;
							Case com.sun.star.form.FormButtonType.RESET		:	_PropertyGet = &quot;resetForm&quot;
							Case com.sun.star.form.FormButtonType.URL
								&apos;	&quot;.uno:FormController/moveToFirst&quot;
								If Left(_ControlModel.TargetURL, Len(cstUnoUrl)) = cstUnoUrl Then
									_PropertyGet = Mid(_ControlModel.TargetURL, Len(cstUnoUrl) + 1)
								ElseIf Left(_ControlModel.TargetURL, 4) = &quot;http&quot; Then
									_PropertyGet = &quot;openWebPage&quot;
								ElseIf Left(_ControlModel.TargetURL, 4) = &quot;file&quot; Then
									_PropertyGet =&quot;openDocument&quot;
								End If
						End Select
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Caption&quot;)
			Select Case _ControlType
				Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
					If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _PropertyGet = _ControlModel.Label
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ControlSource&quot;)
			Select Case _ControlType
				Case CTLCHECKBOX, CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFORMATTEDFIELD, CTLIMAGECONTROL, CTLLISTBOX _
					, CTLNUMERICFIELD, CTLPATTERNFIELD, CTLRADIOBUTTON, CTLTEXTFIELD, CTLTIMEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DataField&quot;) Then _PropertyGet = _ControlModel.DataField
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ControlType&quot;)
			_PropertyGet = _ControlType
		Case UCase(&quot;Default&quot;)
			Select Case _ControlType
				Case CTLBUTTON
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _PropertyGet = _ControlModel.DefaultButton
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;DefaultValue&quot;)
			Select Case _ControlType
				Case CTLCHECKBOX, CTLRADIOBUTTON
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultState&quot;) Then _PropertyGet = _ControlModel.DefaultState
				Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultText&quot;) Then _PropertyGet = _ControlModel.DefaultText
				Case CTLCURRENCYFIELD, CTLNUMERICFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultValue&quot;) Then _PropertyGet = _ControlModel.DefaultValue
				Case CTLDATEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultDate&quot;) Then
						If Not IsEmpty(_ControlModel.DefaultDate) Then
							vDate = _ControlModel.DefaultDate
							_PropertyGet = DateSerial(vDate.Year, vDate.Month, vDate.Day)
						End If
					End If
				Case CTLFORMATTEDFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;EffectiveDefault&quot;) Then _PropertyGet = _ControlModel.EffectiveDefault
				Case CTLLISTBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultSelection&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
						vList = _ControlModel.DefaultSelection
						If IsArray(vList) Then
							If UBound(vList) &gt;= LBound(vList) Then		&apos;	Is array initialized ?
								lIndex = UBound(_ControlModel.StringItemList)
								If vList(0) &gt;= 0 And vList(0) &lt;= lIndex Then _PropertyGet = _ControlModel.StringItemList(vList(0))
												&apos;	Only first default value is considered
							End If
						End If
					End If
				Case CTLSPINBUTTON
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultSpinValue&quot;) Then _PropertyGet = _ControlModel.DefaultSpinValue
				Case CTLTIMEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultTime&quot;) Then
						If Not IsEmpty(_ControlModel.DefaultTime) Then
							vDate = _ControlModel.DefaultTime
							_PropertyGet = TimeSerial(vDate.Hours, vDate.Minutes, vDate.Seconds)
						End If
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Enabled&quot;)
			Select Case _ControlType
				Case CTLHIDDENCONTROL	:	GoTo CatchType
				Case Else
					If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _PropertyGet = _ControlModel.Enabled
			End Select
		Case UCase(&quot;Format&quot;)
			Select Case _ControlType
				Case CTLDATEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.DateFormat)
				Case CTLTIMEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then _PropertyGet = _FormatsList()(_ControlModel.TimeFormat)
				Case CTLFORMATTEDFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;FormatsSupplier&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;FormatKey&quot;) Then
						_PropertyGet = _ControlModel.FormatsSupplier.getNumberFormats.getByKey(_ControlModel.FormatKey).FormatString
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListCount&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLLISTBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then _PropertyGet = UBound(_ControlModel.StringItemList) + 1
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListIndex&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX
					_PropertyGet = -1	&apos;	Not found, multiselection
					If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
						_PropertyGet = ScriptForge.SF_Array.IndexOf(_ControlModel.StringItemList, _ControlModel.Text, CaseSensitive := True)
					End If
				Case CTLLISTBOX
					_PropertyGet = -1	&apos;	Not found, multiselection
					If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
						vSelection = _ControlModel.SelectedItems
						If UBound(vSelection) &gt;= 0 Then _PropertyGet = vSelection(0)
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListSource&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLLISTBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;ListSource&quot;) Then
						With com.sun.star.form.ListSourceType
							Select Case _ControlModel.ListSourceType
								Case		.VALUELIST _
										,	.TABLEFIELDS
									If IsArray(_ControlModel.StringItemList) Then vValues = _ControlModel.StringItemList Else vValues = Array(_ControlModel.StringItemList)
								Case		.TABLE _
										,	.QUERY _
										,	.SQL _
										,	.SQLPASSTHROUGH
									If IsArray(_ControlModel.ListSource) Then vValues = _ControlModel.ListSource Else vValues = Array(_ControlModel.ListSource)
							End Select
						End With
						_PropertyGet = Join(vValues, &quot;;&quot;)
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListSourceType&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLLISTBOX
					If oSession.HasUnoProperty(_ControlModel, &quot;ListSourceType&quot;) Then _PropertyGet = _ControlModel.ListSourceType
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Locked&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLIMAGECONTROL _
						, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
					If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _PropertyGet = _ControlModel.ReadOnly
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;MultiSelect&quot;)
			Select Case _ControlType
				Case CTLLISTBOX
					If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
						_PropertyGet = _ControlModel.MultiSelection
					ElseIf oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then	&apos;	Not documented: gridcontrols only TBC ??
						_PropertyGet = _ControlModel.MultiSelectionSimpleMode
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Name&quot;)
			_PropertyGet = _Name
		Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnApproveAction&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveUpdate&quot;) _
				, UCase(&quot;OnChanged&quot;), UCase(&quot;OnErrorOccurred&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
				, UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
				, UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
				, UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnResetted&quot;) _
				, UCase(&quot;OnTextChanged&quot;), UCase(&quot;OnUpdated&quot;)
			If IsNull(_ControlModel) Then _PropertyGet = &quot;&quot; Else _PropertyGet = SF_Register._GetEventScriptCode(_ControlModel, psProperty, _Name)
		Case UCase(&quot;Parent&quot;)
			Set _PropertyGet = [_Parent]
		Case UCase(&quot;Picture&quot;)
			Select Case _ControlType
				Case CTLBUTTON, CTLIMAGEBUTTON, CTLIMAGECONTROL
					If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _PropertyGet = ScriptForge.SF_FileSystem._ConvertFromUrl(_ControlModel.ImageURL)
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Required&quot;)
			Select Case _ControlType
				Case CTLCHECKBOX, CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLIMAGECONTROL, CTLLISTBOX, CTLNUMERICFIELD _
						, CTLPATTERNFIELD, CTLRADIOBUTTON, CTLTEXTFIELD, CTLTIMEFIELD
					If oSession.HasUnoProperty(_ControlModel, &quot;InputRequired&quot;) Then _PropertyGet = _ControlModel.InputRequired
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Text&quot;)
			Select Case _ControlType
				Case CTLDATEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;Date&quot;) _
							And oSession.HasUNOProperty(_ControlModel, &quot;FormatKey&quot;) _
							And oSession.HasUNOProperty(_ControlModel, &quot;FormatsSupplier&quot;) Then
						If Not IsEmpty(_ControlModel.Date) Then
							vDate = DateSerial(_ControlModel.Date.Year, _ControlModel.Date.Month, _ControlModel.Date.Day)
							_PropertyGet = Format(vDate, _ControlModel.FormatsSupplier.getNumberFormats.getByKey(_ControlModel.FormatKey).FormatString)
						End If
					End If
				Case CTLTIMEFIELD
					If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) Then
						If Not IsEmpty(_ControlModel.Time) Then
							Set vDate = _ControlModel.Time
							_PropertyGet = Format(TimeSerial(vDate.Hours, vDate.Minutes, vDate.Seconds), &quot;HH:MM:SS&quot;)
						End If
					End If
				Case CTLCOMBOBOX, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLPATTERNFIELD, CTLTEXTFIELD
					If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _PropertyGet = _ControlModel.Text
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;TipText&quot;)
			Select Case _ControlType
				Case CTLHIDDENCONTROL	:	GoTo CatchType
				Case Else
					If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _PropertyGet = _ControlModel.HelpText
			End Select
		Case UCase(&quot;TripleState&quot;)
			Select Case _ControlType
				Case CTLCHECKBOX
					If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _PropertyGet = _ControlModel.TriState
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Value&quot;)	&apos;	Default values are set here by control type, not in the 2nd argument (pvDefault)
			vGet = pvDefault
			Select Case _ControlType
				Case CTLBUTTON			&apos;Boolean, toggle buttons only
					vGet = False
					If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) Then
						If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 )
					End If
				Case CTLCHECKBOX		&apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
					If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = _ControlModel.State Else vGet = 2
				Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD		&apos;String
					If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then vGet = _ControlModel.Text Else vGet = &quot;&quot;
				Case CTLCURRENCYFIELD, CTLNUMERICFIELD		&apos;Numeric
					If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then vGet = _ControlModel.Value Else vGet = 0
				Case CTLDATEFIELD		&apos;Date
					vGet = CDate(1)
					If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
						If VarType(_ControlModel.Date) = ScriptForge.V_OBJECT Then	&apos;	com.sun.star.util.Date
							Set vDate = _ControlModel.Date
							vGet = DateSerial(vDate.Year, vDate.Month, vDate.Day)
						Else	&apos;	.Date = Empty
						End If
					End If
				Case CTLFORMATTEDFIELD	&apos;String or numeric
					If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then vGet = _ControlModel.EffectiveValue Else vGet = &quot;&quot;
				Case CTLHIDDENCONTROL	&apos;String
					If oSession.HasUnoProperty(_ControlModel, &quot;HiddenValue&quot;) Then vGet = _ControlModel.HiddenValue Else vGet = &quot;&quot;
				Case CTLLISTBOX		&apos;String or array of strings depending on MultiSelection
					&apos;	StringItemList is the list of the items displayed in the box
					&apos;	ValueItemList is the list of the values in the underlying database field
					&apos;	SelectedItems is the list of the indexes in StringItemList of the selected items
						&apos;	It can go beyond the limits of StringItemList
						&apos;	It can contain multiple values even if the listbox is not multiselect
					If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) _
							And oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then
						vSelection = _ControlModel.SelectedItems
						&apos;	The list of allowed values depends on the existence of a bound column
						If _ListBoxBound() Then vList = _ControlModel.ValueItemList Else vList = _ControlModel.StringItemList
						If _ControlModel.MultiSelection Then vValues = Array()
						For i = 0 To UBound(vSelection)
							lIndex = vSelection(i)
							If lIndex &gt;= 0 And lIndex &lt;= UBound(vList) Then
								If Not _ControlModel.MultiSelection Then
									vValues = vList(lIndex)
									Exit For
								End If
								vValues = ScriptForge.SF_Array.Append(vValues, vList(lIndex))
							End If
						Next i
						vGet = vValues
					Else
						vGet = &quot;&quot;
					End If
				Case CTLRADIOBUTTON		&apos;Boolean
					If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then vGet = ( _ControlModel.State = 1 ) Else vGet = False
				Case CTLSCROLLBAR		&apos;Numeric
					vGet = 0
					If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then
						If Not IsEmpty(_ControlModel.ScrollValue) Then vGet = _ControlModel.ScrollValue
					End If
				Case CTLSPINBUTTON
					If oSession.HasUnoProperty(_ControlModel, &quot;SpinValue&quot;) Then vGet = _ControlModel.SpinValue Else vGet = 0
				Case CTLTIMEFIELD
					vGet = CDate(0)
					If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
						If VarType(_ControlModel.Time) = ScriptForge.V_OBJECT Then	&apos;	com.sun.star.Util.Time
							Set vDate = _ControlModel.Time
							vGet = TimeSerial(vDate.Hours, vDate.Minutes, vDate.Seconds)
						Else	&apos;	.Time = Empty
						End If
					End If
				Case Else	:	GoTo CatchType
			End Select
			_PropertyGet = vGet
		Case UCase(&quot;Visible&quot;)
			If oSession.HasUnoMethod(_ControlView, &quot;isVisible&quot;) Then _PropertyGet = CBool(_ControlView.isVisible())
		Case UCase(&quot;XControlModel&quot;)
			Set _PropertyGet = _ControlModel
		Case UCase(&quot;XControlView&quot;)
			Set _PropertyGet = _ControlView
		Case Else
			_PropertyGet = Null
	End Select

Finally:
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
CatchType:
	GoTo Finally
End Function	&apos;	SFDocuments.SF_FormControl._PropertyGet

REM -----------------------------------------------------------------------------
Private Function _PropertySet(Optional ByVal psProperty As String _
								, Optional ByVal pvValue As Variant _
								) As Boolean
&apos;&apos;&apos;	Set the new value of the named property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		psProperty: the name of the property
&apos;&apos;&apos;		pvValue: the new value of the given property

Dim bSet As Boolean							&apos;	Return value
Static oSession As Object					&apos;	Alias of SF_Session
Dim sFormName As String						&apos;	Full form identification for error messages
Dim vSet As Variant							&apos;	Value to set in UNO model or view property
Dim vActions As Variant						&apos;	Action property: list of available actions
Dim sAction As String						&apos;	A single action
Dim vFormats As Variant						&apos;	Format property: output of _FormatsList()
Dim iFormat As Integer						&apos;	Format property: index in vFormats
Dim vSelection As Variant					&apos;	Alias of Model.SelectedItems
Dim vList As Variant						&apos;	Alias of Model.StringItemList
Dim lIndex As Long							&apos;	Index in StringItemList
Dim sItem As String							&apos;	A single item
Dim oDatabase As Object						&apos;	The database object related to the parent form of the control instance
Dim i As Long
Dim cstThisSub As String
Const cstSubArgs = &quot;Value&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	bSet = False

	cstThisSub = &quot;SFDocuments.FormControl.set&quot; &amp; psProperty
	ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
	If Not _ParentForm._IsStillAlive() Then GoTo Finally

	If IsNull(oSession) Then Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
	bSet = True
	Select Case UCase(psProperty)
		Case UCase(&quot;Action&quot;)
			Select Case _ControlType
				Case CTLBUTTON
					vActions = Array(&quot;none&quot;, &quot;submitForm&quot;, &quot;resetForm&quot;, &quot;refreshForm&quot;, &quot;moveToFirst&quot;, &quot;moveToLast&quot;, &quot;moveToNext&quot;, &quot;moveToPrev&quot; _
										, &quot;saveRecord&quot;, &quot;moveToNew&quot;, &quot;deleteRecord&quot;, &quot;undoRecord&quot;)
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Action&quot;, ScriptForge.V_STRING, vActions) Then GoTo Finally
					If oSession.HasUNOProperty(_ControlModel, &quot;ButtonType&quot;) Then
						sAction = vActions(ScriptForge.SF_Array.IndexOf(vActions, pvValue, CaseSensitive := False))
						_ControlModel.TargetURL = &quot;&quot;
						Select Case sAction
							Case &quot;none&quot;			:	vSet = com.sun.star.form.FormButtonType.PUSH
							Case &quot;submitForm&quot;	:	vSet = com.sun.star.form.FormButtonType.SUBMIT
							Case &quot;resetForm&quot;	:	vSet = com.sun.star.form.FormButtonType.RESET
							Case Else
								vSet = com.sun.star.form.FormButtonType.URL
								_ControlModel.TargetURL = &quot;.uno:FormController/&quot; &amp; sAction
						End Select
						_ControlModel.ButtonType = vSet
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Caption&quot;)
			Select Case _ControlType
				Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Finally
					If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _ControlModel.Label = pvValue
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Default&quot;)
			Select Case _ControlType
				Case CTLBUTTON
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Default&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUNOProperty(_ControlModel, &quot;DefaultButton&quot;) Then _ControlModel.DefaultButton = pvValue
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Enabled&quot;)
			Select Case _ControlType
				Case CTLHIDDENCONTROL	:	GoTo CatchType
				Case Else
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Enabled&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Enabled&quot;) Then _ControlModel.Enabled = pvValue
			End Select
		Case UCase(&quot;Format&quot;)
			Select Case _ControlType
				Case CTLDATEFIELD, CTLTIMEFIELD
					vFormats = _FormatsList()
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Format&quot;, V_STRING, vFormats) Then GoTo Finally
					iFormat = ScriptForge.SF_Array.IndexOf(vFormats, pvValue, CaseSensitive := False)
					If oSession.HasUNOProperty(_ControlModel, &quot;DateFormat&quot;) Then
						_ControlModel.DateFormat = iFormat
					ElseIf oSession.HasUNOProperty(_ControlModel, &quot;TimeFormat&quot;) Then
						_ControlModel.TimeFormat = iFormat
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListIndex&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;ListIndex&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
			Select Case _ControlType
				Case CTLCOMBOBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
						If pvValue &gt;= 0 And pvValue &lt;= UBound(_ControlModel.StringItemList) Then _ControlModel.Text = _ControlModel.StringItemList(CInt(pvValue))
					End If
				Case CTLLISTBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) Then _ControlModel.SelectedItems = Array(CInt(pvValue))
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListSource&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLLISTBOX
					If oSession.HasUNOProperty(_ControlModel, &quot;ListSource&quot;) Then
						If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then Goto Finally
						With com.sun.star.form.ListSourceType
							Select Case _ControlModel.ListSourceType
								Case		.QUERY _
										,	.TABLE _
										,	.TABLEFIELDS
									Set oDatabase = _ParentForm.GetDatabase()
									If _ControlModel.ListSourceType = .QUERY Then vList = oDatabase.Queries Else vList = oDatabase.Tables
									If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING, vList) Then Goto Finally
									If _ControlType = CTLCOMBOBOX Then _ControlModel.ListSource = pvValue Else _ControlModel.ListSource = Array(pvValue)
									_ControlModel.refresh()
								Case .SQL
									et oDatabase = _ParentForm.GetDatabase()
									If _ControlType = CTLCOMBOBOX Then _ControlModel.ListSource = oDatabase._ReplaceSquareBrackets(pvValue) Else _ControlModel.ListSource = Array(oDatabase._ReplaceSquareBrackets(pvValue))
									_ControlModel.refresh()
								Case .VALUELIST			&apos;	ListBox only !
									_ControlModel.ListSource = Split(pvValue, &quot;;&quot;)
									_ControlModel.StringItemList = _ControlModel.ListSource
								Case .SQLPASSTHROUGH
									If _ControlType = CTLCOMBOBOX Then _ControlModel.ListSource = pvValue Else _ControlModel.ListSource = Array(pvValue)
									_ControlModel.refresh()
							End Select
						End With
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;ListSourceType&quot;)
			With com.sun.star.form.ListSourceType
				Select Case _ControlType
					Case CTLCOMBOBOX
						If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;ListSourceType&quot;, ScriptForge.V_NUMERIC, Array( _
								.TABLE _
							,	.QUERY _
							,	.SQL _
							,	.SQLPASSTHROUGH _
							,	.TABLEFIELDS _
						)) Then GoTo Finally
					Case CTLLISTBOX
						If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;ListSourceType&quot;, ScriptForge.V_NUMERIC, Array( _
								.VALUELIST _
							,	.TABLE _
							,	.QUERY _
							,	.SQL _
							,	.SQLPASSTHROUGH _
							,	.TABLEFIELDS _
						)) Then GoTo Finally
					Case Else	:	GoTo CatchType
				End Select
			End With
			If oSession.HasUnoProperty(_ControlModel, &quot;ListSourceType&quot;) Then _ControlModel.ListSourceType = pvValue
		Case UCase(&quot;Locked&quot;)
			Select Case _ControlType
				Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD, CTLIMAGECONTROL _
						, CTLLISTBOX, CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Locked&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;ReadOnly&quot;) Then _ControlModel.ReadOnly = pvValue
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;MultiSelect&quot;)
			Select Case _ControlType
				Case CTLLISTBOX
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;MultiSelect&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelection&quot;) Then _ControlModel.MultiSelection = pvValue
					If oSession.HasUnoProperty(_ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then _ControlModel.MultiSelectionSimpleMode = pvValue
					If oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) Then
						&apos;	Cancel selections when MultiSelect becomes False
						If Not pvValue And UBound(_ControlModel.SelectedItems) &gt; 0 Then
							lIndex = _ControlModel.SelectedItems(0)
							_ControlModel.SelectedItems = Array(lIndex)
						End If
					End If
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnApproveAction&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveUpdate&quot;) _
				, UCase(&quot;OnChanged&quot;), UCase(&quot;OnErrorOccurred&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
				, UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
				, UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
				, UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnResetted&quot;) _
				, UCase(&quot;OnTextChanged&quot;), UCase(&quot;OnUpdated&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then Goto Finally
			If Not IsNull(_ControlModel) Then
				bSet = SF_Register._RegisterEventScript(_ControlModel _
							, psProperty _
							, _GetListener(psProperty) _
							, pvValue _
							, _Name _
							)
			End If
		Case UCase(&quot;Picture&quot;)
			Select Case _ControlType
				Case CTLBUTTON, CTLIMAGEBUTTON, CTLIMAGECONTROL
					If Not ScriptForge.SF_Utils._ValidateFile(pvValue, &quot;Picture&quot;) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;ImageURL&quot;) Then _ControlModel.ImageURL = ScriptForge.SF_FileSystem._ConvertToUrl(pvValue)
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;TipText&quot;)
			Select Case _ControlType
				Case CTLHIDDENCONTROL	:	GoTo CatchType
				Case Else
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TipText&quot;, V_STRING) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;HelpText&quot;) Then _ControlModel.HelpText = pvValue
			End Select
		Case UCase(&quot;TripleState&quot;)
			Select Case _ControlType
				Case CTLCHECKBOX
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;TripleState&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _ControlModel.TriState = pvValue
				Case Else	:	GoTo CatchType
			End Select
		Case UCase(&quot;Value&quot;)
			Select Case _ControlType
				Case CTLBUTTON		&apos;Boolean, toggle buttons only
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Toggle&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
						_ControlModel.State = Iif(pvValue, 1, 0)
					End If
				Case CTLCHECKBOX	&apos;0 = Not checked, 1 = Checked, 2 = Don&apos;t know
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(ScriptForge.V_BOOLEAN, ScriptForge.V_NUMERIC), Array(0, 1, 2, True, False)) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then
						If VarType(pvValue) = ScriptForge.V_BOOLEAN Then pvValue = Iif(pvValue, 1, 0)
						_ControlModel.State = pvValue
					End If
				Case CTLCOMBOBOX
					If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then
						If pvValue &lt;&gt; &quot;&quot; Then
							If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING, _ControlModel.StringItemList) Then Goto Finally
						End If
						_ControlModel.Text = pvValue
					End If
				Case CTLCURRENCYFIELD, CTLNUMERICFIELD		&apos;Numeric
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Value&quot;) Then _ControlModel.Value = pvValue
				Case CTLDATEFIELD		&apos;Date
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Date&quot;) Then
						Set vSet = New com.sun.star.util.Date
						vSet.Year = Year(pvValue)
						vSet.Month = Month(pvValue)
						vSet.Day = Day(pvValue)
						_ControlModel.Date = vSet
					End If
				Case CTLFILECONTROL
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _ControlModel.Text = ScriptForge.SF_FileSystem._ConvertToUrl(pvValue)
				Case CTLFORMATTEDFIELD	&apos;String or numeric
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(V_STRING, ScriptForge.V_NUMERIC)) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;EffectiveValue&quot;) Then _ControlModel.EffectiveValue = pvValue
				Case CTLHIDDENCONTROL	&apos;String
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;HiddenValue&quot;) Then _ControlModel.HiddenValue = pvValue
				Case CTLLISTBOX		&apos;String or number - Only a single value may be set
					&apos;	StringItemList is the list of the items displayed in the box
					&apos;	ValueItemList is the list of the values in the underlying database field
					&apos;	SelectedItems is the list of the indexes in StringItemList of the selected items
					If oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) And oSession.HasUnoProperty(_ControlModel, &quot;SelectedItems&quot;) Then
						&apos;	Setting the value on a listbox is allowed only if single value and value in the list
						If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, Array(V_STRING, ScriptForge.V_NUMERIC)) Then GoTo Finally
						&apos;	The list of allowed values depends on the existence of a bound column
						If _ListboxBound() Then vList = _ControlModel.ValueItemList Else vList = _ControlModel.StringItemList
						If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, , vList) Then GoTo Finally
						_ControlModel.SelectedItems = Array(ScriptForge.SF_Array.IndexOf(vList, pvValue, CaseSensitive := True))
					End If
				Case CTLPATTERNFIELD, CTLTEXTFIELD		&apos;String
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) Then _ControlModel.Text = pvValue
				Case CTLRADIOBUTTON		&apos;Boolean
					&apos;	A group of radio buttons is presumed sharing the same GroupName
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;State&quot;) Then _ControlModel.State = Iif(pvValue, 1, 0)
				Case CTLSCROLLBAR		&apos;Numeric
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMin&quot;) Then
						If pvValue &lt; _ControlModel.ScrollValueMin Then pvValue = _ControlModel.ScrollValueMin
					End If
					If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValueMax&quot;) Then
						If pvValue &gt; _ControlModel.ScrollValueMax Then pvValue = _ControlModel.ScrollValueMax
					End If
					If oSession.HasUnoProperty(_ControlModel, &quot;ScrollValue&quot;) Then _ControlModel.ScrollValue = pvValue
				Case CTLSPINBUTTON		&apos;Numeric
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;SpinValueMin&quot;) Then
						If pvValue &lt; _ControlModel.SpinValueMin Then pvValue = _ControlModel.SpinValueMin
					End If
					If oSession.HasUnoProperty(_ControlModel, &quot;SpinValueMax&quot;) Then
						If pvValue &gt; _ControlModel.SpinValueMax Then pvValue = _ControlModel.SpinValueMax
					End If
					If oSession.HasUnoProperty(_ControlModel, &quot;SpinValue&quot;) Then _ControlModel.SpinValue = pvValue
				Case CTLTIMEFIELD
					If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_DATE) Then GoTo Finally
					If oSession.HasUnoProperty(_ControlModel, &quot;Time&quot;) Then
						Set vSet = New com.sun.star.util.Time
						vSet.Hours = Hour(pvValue)
						vSet.Minutes = Minute(pvValue)
						vSet.Seconds = Second(pvValue)
						_ControlModel.Time = vSet
					End If
				Case Else	:	GoTo CatchType
			End Select
			&apos;	FINAL COMMITMENT
			If oSession.HasUNOMethod(_ControlModel, &quot;commit&quot;) Then _ControlModel.commit()	&apos;	f.i. checkboxes have no commit method ??
		Case UCase(&quot;Visible&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
			If oSession.HasUnoMethod(_ControlView, &quot;setVisible&quot;) Then
				If pvValue Then _ControlModel.EnableVisible = True
				_ControlView.setVisible(pvValue)
			End If
		Case Else
			bSet = False
	End Select

Finally:
	_PropertySet = bSet
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
CatchType:
	If Len(_ParentForm._FormDocumentName) &gt; 0 Then sFormName = _ParentForm._FormDocumentName &amp; &quot;.&quot; Else sFormName = &quot;&quot;
	ScriptForge.SF_Exception.RaiseFatal(FORMCONTROLTYPEERROR, _Name, sFormName &amp; _FormName, _ControlType, psProperty)
	GoTo Finally
End Function	&apos;	SFDocuments.SF_FormControl._PropertySet

REM -----------------------------------------------------------------------------
Private Function _Repr() As String
&apos;&apos;&apos;	Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;	Return:
&apos;&apos;&apos;		&quot;[FORMCONTROL]: Name, Type (formname)
	_Repr = &quot;[FORMCONTROL]: &quot; &amp; _Name &amp; &quot;, &quot; &amp; _ControlType &amp; &quot; (&quot; &amp; _FormName &amp; &quot;)&quot;

End Function	&apos;	SFDocuments.SF_FormControl._Repr

REM ============================================ END OF SFDOCUMENTS.SF_FORMCONTROL
</script:module>