bump product version to 6.4.0.3
[LibreOffice.git] / wizards / source / access2base / Form.xba
blob84dee353413a097f3d8af48c2f256dc1ed82682a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Form" script:language="StarBasic">
4 REM =======================================================================================================================
5 REM === The Access2Base library is a part of the LibreOffice project. ===
6 REM === Full documentation is available on http://www.access2base.com ===
7 REM =======================================================================================================================
9 Option Compatible
10 Option ClassModule
12 Option Explicit
14 REM -----------------------------------------------------------------------------------------------------------------------
15 REM --- CLASS ROOT FIELDS ---
16 REM -----------------------------------------------------------------------------------------------------------------------
18 Private _Type As String &apos; Must be FORM
19 Private _This As Object &apos; Workaround for absence of This builtin function
20 Private _Parent As Object
21 Private _Shortcut As String
22 Private _Name As String
23 Private _DocEntry As Integer &apos; Doc- and DbContainer entries in Root structure
24 Private _DbEntry As Integer
25 Private _MainForms As Variant
26 Private _PersistentName As String
27 Private _IsLoaded As Boolean
28 Private _OpenArgs As Variant
29 Private _OrderBy As String
30 Public Component As Object &apos; com.sun.star.text.TextDocument
31 Public ContainerWindow As Object &apos; (No name)
32 Public FormsCollection As Object &apos; com.sun.star.form.OFormsCollection
33 Public DatabaseForm As Object &apos; com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.)
35 REM -----------------------------------------------------------------------------------------------------------------------
36 REM --- CONSTRUCTORS / DESTRUCTORS ---
37 REM -----------------------------------------------------------------------------------------------------------------------
38 Private Sub Class_Initialize()
39 _Type = OBJFORM
40 Set _This = Nothing
41 Set _Parent = Nothing
42 _Shortcut = &quot;&quot;
43 _Name = &quot;&quot;
44 _DocEntry = -1
45 _DbEntry = -1
46 _MainForms = Array()
47 _PersistentName = &quot;&quot;
48 _IsLoaded = False
49 _OpenArgs = &quot;&quot;
50 _OrderBy = &quot;&quot;
51 Set Component = Nothing
52 Set ContainerWindow = Nothing
53 Set FormsCollection = Nothing
54 Set DatabaseForm = Nothing
55 End Sub &apos; Constructor
57 REM -----------------------------------------------------------------------------------------------------------------------
58 Private Sub Class_Terminate()
59 On Local Error Resume Next
60 Call Class_Initialize()
61 End Sub &apos; Destructor
63 REM -----------------------------------------------------------------------------------------------------------------------
64 Public Sub Dispose()
65 Dim ofForm As Object
66 If Not IsLoaded(True) Then
67 If Not IsNull(DatabaseForm) Then DatabaseForm.Dispose()
68 End If
69 Call Class_Terminate()
70 End Sub &apos; Explicit destructor
72 REM -----------------------------------------------------------------------------------------------------------------------
73 REM --- CLASS GET/LET/SET PROPERTIES ---
74 REM -----------------------------------------------------------------------------------------------------------------------
75 Property Get AllowAdditions() As Variant
76 AllowAdditions = _PropertyGet(&quot;AllowAdditions&quot;)
77 End Property &apos; AllowAdditions (get)
79 Property Let AllowAdditions(ByVal pvValue As Variant)
80 Call _PropertySet(&quot;AllowAdditions&quot;, pvValue)
81 End Property &apos; AllowAdditions (set)
83 REM -----------------------------------------------------------------------------------------------------------------------
84 Property Get AllowDeletions() As Variant
85 AllowDeletions = _PropertyGet(&quot;AllowDeletions&quot;)
86 End Property &apos; AllowDeletions (get)
88 Property Let AllowDeletions(ByVal pvValue As Variant)
89 Call _PropertySet(&quot;AllowDeletions&quot;, pvValue)
90 End Property &apos; AllowDeletions (set)
92 REM -----------------------------------------------------------------------------------------------------------------------
93 Property Get AllowEdits() As Variant
94 AllowEdits = _PropertyGet(&quot;AllowEdits&quot;)
95 End Property &apos; AllowEdits (get)
97 Property Let AllowEdits(ByVal pvValue As Variant)
98 Call _PropertySet(&quot;AllowEdits&quot;, pvValue)
99 End Property &apos; AllowEdits (set)
101 REM -----------------------------------------------------------------------------------------------------------------------
102 Property Get Bookmark() As Variant
103 Bookmark = _PropertyGet(&quot;Bookmark&quot;)
104 End Property &apos; Bookmark (get)
106 Property Let Bookmark(ByVal pvValue As Variant)
107 Call _PropertySet(&quot;Bookmark&quot;, pvValue)
108 End Property &apos; Bookmark (set)
110 REM -----------------------------------------------------------------------------------------------------------------------
111 Property Get Caption() As Variant
112 Caption = _PropertyGet(&quot;Caption&quot;)
113 End Property &apos; Caption (get)
115 Property Let Caption(ByVal pvValue As Variant)
116 Call _PropertySet(&quot;Caption&quot;, pvValue)
117 End Property &apos; Caption (set)
119 REM -----------------------------------------------------------------------------------------------------------------------
120 Property Get CurrentRecord() As Variant
121 CurrentRecord = _PropertyGet(&quot;CurrentRecord&quot;)
122 End Property &apos; CurrentRecord (get)
124 Property Let CurrentRecord(ByVal pvValue As Variant)
125 Call _PropertySet(&quot;CurrentRecord&quot;, pvValue)
126 End Property &apos; CurrentRecord (set)
128 REM -----------------------------------------------------------------------------------------------------------------------
129 Property Get Filter() As Variant
130 Filter = _PropertyGet(&quot;Filter&quot;)
131 End Property &apos; Filter (get)
133 Property Let Filter(ByVal pvValue As Variant)
134 Call _PropertySet(&quot;Filter&quot;, pvValue)
135 End Property &apos; Filter (set)
137 REM -----------------------------------------------------------------------------------------------------------------------
138 Property Get FilterOn() As Variant
139 FilterOn = _PropertyGet(&quot;FilterOn&quot;)
140 End Property &apos; FilterOn (get)
142 Property Let FilterOn(ByVal pvValue As Variant)
143 Call _PropertySet(&quot;FilterOn&quot;, pvValue)
144 End Property &apos; FilterOn (set)
146 REM -----------------------------------------------------------------------------------------------------------------------
147 Property Get Height() As Variant
148 Height = _PropertyGet(&quot;Height&quot;)
149 End Property &apos; Height (get)
151 Property Let Height(ByVal pvValue As Variant)
152 Call _PropertySet(&quot;Height&quot;, pvValue)
153 End Property &apos; Height (set)
155 REM -----------------------------------------------------------------------------------------------------------------------
156 Function IsLoaded(ByVal Optional pbForce As Boolean) As Boolean
157 &apos;Return True if form open
158 &apos;pbForce = True forbids bypass on value of _IsLoaded
160 If _ErrorHandler() Then On Local Error Goto Error_Function
161 Utils._SetCalledSub(&quot;Form.getIsLoaded&quot;)
162 If IsMissing(pbForce) Then pbForce = False
163 If ( Not pbForce ) And _IsLoaded Then &apos; For performance reasons, a form object, once detected as loaded, is presumed remaining loaded. Except if pbForce = True
164 IsLoaded = True
165 Goto Exit_Function
166 End If
167 IsLoaded = False
169 Dim oDoc As Object, oDatabase As Object, oEnum As Object, oDesk As Object, oComp As Object, vPersistent As Variant
170 Dim i As Integer
171 Set oDoc = _A2B_.CurrentDocument()
172 Select Case oDoc.DbConnect
173 Case DBCONNECTBASE
174 Set oDesk = CreateUnoService(&quot;com.sun.star.frame.Desktop&quot;)
175 Set oEnum = oDesk.Components().createEnumeration
176 Do While oEnum.hasMoreElements &apos; Search in all open components if one corresponds with current form
177 oComp = oEnum.nextElement
178 If _hasUNOProperty(oComp, &quot;Identifier&quot;) Then
179 If oComp.Identifier = &quot;com.sun.star.sdb.FormDesign&quot; Then
180 vPersistent = Split(oComp.StringValue, &quot;/&quot;)
181 If vPersistent(UBound(vPersistent) - 1) = _PersistentName Then
182 _IsLoaded = True
183 Set Component = oComp
184 Exit Do
185 End If
186 End If
187 End If
188 Loop
189 Case DBCONNECTFORM
190 Set Component = oDoc.Document &apos; Form
191 _IsLoaded = True &apos; Interactive form always loaded by design
192 End Select
193 Set oComp = Nothing
194 IsLoaded = _IsLoaded
196 Exit_Function:
197 Utils._ResetCalledSub(&quot;Form.getIsLoaded&quot;)
198 Exit Function
199 Error_Function:
200 TraceError(TRACEABORT, Err, &quot;Form.getIsLoaded&quot;, Erl)
201 GoTo Exit_Function
202 End Function &apos; IsLoaded V1.1.0
204 REM -----------------------------------------------------------------------------------------------------------------------
205 Property Get Name() As String
206 Name = _PropertyGet(&quot;Name&quot;)
207 End Property &apos; Name (get)
209 Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
210 pName = _PropertyGet(&quot;Name&quot;)
211 End Function &apos; pName (get)
213 REM -----------------------------------------------------------------------------------------------------------------------
214 Property Get ObjectType() As String
215 ObjectType = _PropertyGet(&quot;ObjectType&quot;)
216 End Property &apos; ObjectType (get)
218 REM -----------------------------------------------------------------------------------------------------------------------
219 Property Get OnApproveCursorMove() As Variant
220 OnApproveCursorMove = _PropertyGet(&quot;OnApproveCursorMove&quot;)
221 End Property &apos; OnApproveCursorMove (get)
223 Property Let OnApproveCursorMove(ByVal pvValue As Variant)
224 Call _PropertySet(&quot;OnApproveCursorMove&quot;, pvValue)
225 End Property &apos; OnApproveCursorMove (set)
227 REM -----------------------------------------------------------------------------------------------------------------------
228 Property Get OnApproveParameter() As Variant
229 OnApproveParameter = _PropertyGet(&quot;OnApproveParameter&quot;)
230 End Property &apos; OnApproveParameter (get)
232 Property Let OnApproveParameter(ByVal pvValue As Variant)
233 Call _PropertySet(&quot;OnApproveParameter&quot;, pvValue)
235 End Property &apos; OnApproveParameter (set)
237 REM -----------------------------------------------------------------------------------------------------------------------
238 Property Get OnApproveReset() As Variant
239 OnApproveReset = _PropertyGet(&quot;OnApproveReset&quot;)
240 End Property &apos; OnApproveReset (get)
242 Property Let OnApproveReset(ByVal pvValue As Variant)
243 Call _PropertySet(&quot;OnApproveReset&quot;, pvValue)
244 End Property &apos; OnApproveReset (set)
246 REM -----------------------------------------------------------------------------------------------------------------------
247 Property Get OnApproveRowChange() As Variant
248 OnApproveRowChange = _PropertyGet(&quot;OnApproveRowChange&quot;)
249 End Property &apos; OnApproveRowChange (get)
251 Property Let OnApproveRowChange(ByVal pvValue As Variant)
252 Call _PropertySet(&quot;OnApproveRowChange&quot;, pvValue)
253 End Property &apos; OnApproveRowChange (set)
255 REM -----------------------------------------------------------------------------------------------------------------------
256 Property Get OnApproveSubmit() As Variant
257 OnApproveSubmit = _PropertyGet(&quot;OnApproveSubmit&quot;)
258 End Property &apos; OnApproveSubmit (get)
260 Property Let OnApproveSubmit(ByVal pvValue As Variant)
261 Call _PropertySet(&quot;OnApproveSubmit&quot;, pvValue)
262 End Property &apos; OnApproveSubmit (set)
264 REM -----------------------------------------------------------------------------------------------------------------------
265 Property Get OnConfirmDelete() As Variant
266 OnConfirmDelete = _PropertyGet(&quot;OnConfirmDelete&quot;)
267 End Property &apos; OnConfirmDelete (get)
269 Property Let OnConfirmDelete(ByVal pvValue As Variant)
270 Call _PropertySet(&quot;OnConfirmDelete&quot;, pvValue)
271 End Property &apos; OnConfirmDelete (set)
273 REM -----------------------------------------------------------------------------------------------------------------------
274 Property Get OnCursorMoved() As Variant
275 OnCursorMoved = _PropertyGet(&quot;OnCursorMoved&quot;)
276 End Property &apos; OnCursorMoved (get)
278 Property Let OnCursorMoved(ByVal pvValue As Variant)
279 Call _PropertySet(&quot;OnCursorMoved&quot;, pvValue)
280 End Property &apos; OnCursorMoved (set)
282 REM -----------------------------------------------------------------------------------------------------------------------
283 Property Get OnErrorOccurred() As Variant
284 OnErrorOccurred = _PropertyGet(&quot;OnErrorOccurred&quot;)
285 End Property &apos; OnErrorOccurred (get)
287 Property Let OnErrorOccurred(ByVal pvValue As Variant)
288 Call _PropertySet(&quot;OnErrorOccurred&quot;, pvValue)
289 End Property &apos; OnErrorOccurred (set)
291 REM -----------------------------------------------------------------------------------------------------------------------
292 Property Get OnLoaded() As Variant
293 OnLoaded = _PropertyGet(&quot;OnLoaded&quot;)
294 End Property &apos; OnLoaded (get)
296 Property Let OnLoaded(ByVal pvValue As Variant)
297 Call _PropertySet(&quot;OnLoaded&quot;, pvValue)
298 End Property &apos; OnLoaded (set)
300 REM -----------------------------------------------------------------------------------------------------------------------
301 Property Get OnReloaded() As Variant
302 OnReloaded = _PropertyGet(&quot;OnReloaded&quot;)
303 End Property &apos; OnReloaded (get)
305 Property Let OnReloaded(ByVal pvValue As Variant)
306 Call _PropertySet(&quot;OnReloaded&quot;, pvValue)
307 End Property &apos; OnReloaded (set)
309 REM -----------------------------------------------------------------------------------------------------------------------
310 Property Get OnReloading() As Variant
311 OnReloading = _PropertyGet(&quot;OnReloading&quot;)
312 End Property &apos; OnReloading (get)
314 Property Let OnReloading(ByVal pvValue As Variant)
315 Call _PropertySet(&quot;OnReloading&quot;, pvValue)
316 End Property &apos; OnReloading (set)
318 REM -----------------------------------------------------------------------------------------------------------------------
319 Property Get OnResetted() As Variant
320 OnResetted = _PropertyGet(&quot;OnResetted&quot;)
321 End Property &apos; OnResetted (get)
323 Property Let OnResetted(ByVal pvValue As Variant)
324 Call _PropertySet(&quot;OnResetted&quot;, pvValue)
325 End Property &apos; OnResetted (set)
327 REM -----------------------------------------------------------------------------------------------------------------------
328 Property Get OnRowChanged() As Variant
329 OnRowChanged = _PropertyGet(&quot;OnRowChanged&quot;)
330 End Property &apos; OnRowChanged (get)
332 Property Let OnRowChanged(ByVal pvValue As Variant)
333 Call _PropertySet(&quot;OnRowChanged&quot;, pvValue)
334 End Property &apos; OnRowChanged (set)
336 REM -----------------------------------------------------------------------------------------------------------------------
337 Property Get OnUnloaded() As Variant
338 OnUnloaded = _PropertyGet(&quot;OnUnloaded&quot;)
339 End Property &apos; OnUnloaded (get)
341 Property Let OnUnloaded(ByVal pvValue As Variant)
342 Call _PropertySet(&quot;OnUnloaded&quot;, pvValue)
343 End Property &apos; OnUnloaded (set)
345 REM -----------------------------------------------------------------------------------------------------------------------
346 Property Get OnUnloading() As Variant
347 OnUnloading = _PropertyGet(&quot;OnUnloading&quot;)
348 End Property &apos; OnUnloading (get)
350 Property Let OnUnloading(ByVal pvValue As Variant)
351 Call _PropertySet(&quot;OnUnloading&quot;, pvValue)
352 End Property &apos; OnUnloading (set)
354 REM -----------------------------------------------------------------------------------------------------------------------
355 Property Get OpenArgs() As Variant
356 OpenArgs = _PropertyGet(&quot;OpenArgs&quot;)
357 End Property &apos; OpenArgs (get)
359 REM -----------------------------------------------------------------------------------------------------------------------
360 Property Get OrderBy() As Variant
361 OrderBy = _PropertyGet(&quot;OrderBy&quot;)
362 End Property &apos; OrderBy (get) V1.2.0
364 Property Let OrderBy(ByVal pvValue As Variant)
365 Call _PropertySet(&quot;OrderBy&quot;, pvValue)
366 End Property &apos; OrderBy (set)
368 REM -----------------------------------------------------------------------------------------------------------------------
369 Property Get OrderByOn() As Variant
370 OrderByOn = _PropertyGet(&quot;OrderByOn&quot;)
371 End Property &apos; OrderByOn (get) V1.2.0
373 Property Let OrderByOn(ByVal pvValue As Variant)
374 Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
375 End Property &apos; OrderByOn (set)
377 REM -----------------------------------------------------------------------------------------------------------------------
378 Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
379 &apos; Return either an error or an object of type OPTIONGROUP based on its name
381 Const cstThisSub = &quot;Form.OptionGroup&quot;
382 Dim ogGroup As Object
383 Utils._SetCalledSub(cstThisSub)
384 If IsMissing(pvGroupName) Then Call _TraceArguments()
385 If _ErrorHandler() Then On Local Error Goto Error_Function
387 Set ogGroup = _OptionGroup(pvGroupName, CTLPARENTISFORM, Component, FormsCollection)
388 If Not IsNull(ogGroup) Then
389 ogGroup._DocEntry = _DocEntry
390 ogGroup._DbEntry = _DbEntry
391 End If
392 Set OptionGroup = ogGroup
394 Exit_Function:
395 Utils._ResetCalledSub(cstThisSub)
396 Exit Function
397 Error_Function:
398 TraceError(TRACEABORT, Err, Form.OptionGroup, Erl)
399 GoTo Exit_Function
400 End Function &apos; OptionGroup V1.1.0
402 REM -----------------------------------------------------------------------------------------------------------------------
403 Public Function Parent() As Object
404 Parent = _Parent
405 End Function &apos; Parent (get) V6.4.0
407 REM -----------------------------------------------------------------------------------------------------------------------
408 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
409 &apos; Return
410 &apos; a Collection object if pvIndex absent
411 &apos; a Property object otherwise
413 Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
414 vPropertiesList = _PropertiesList()
415 sObject = Utils._PCase(_Type)
416 If IsMissing(pvIndex) Then
417 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
418 Else
419 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
420 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
421 End If
423 Exit_Function:
424 Set Properties = vProperty
425 Exit Function
426 End Function &apos; Properties
428 REM -----------------------------------------------------------------------------------------------------------------------
429 Property Get Recordset() As Object
430 Recordset = _PropertyGet(&quot;Recordset&quot;)
431 End Property &apos; Recordset (get) V0.9.5
433 REM -----------------------------------------------------------------------------------------------------------------------
434 Property Get RecordSource() As Variant
435 RecordSource = _PropertyGet(&quot;RecordSource&quot;)
436 End Property &apos; RecordSource (get)
438 Property Let RecordSource(ByVal pvValue As Variant)
439 Call _PropertySet(&quot;RecordSource&quot;, pvValue)
440 End Property &apos; RecordSource (set)
442 REM -----------------------------------------------------------------------------------------------------------------------
443 Property Get Visible() As Variant
444 Visible = _PropertyGet(&quot;Visible&quot;)
445 End Property &apos; Visible (get)
447 Property Let Visible(ByVal pvValue As Variant)
448 Call _PropertySet(&quot;Visible&quot;, pvValue)
449 End Property &apos; Visible (set)
451 REM -----------------------------------------------------------------------------------------------------------------------
452 Property Get Width() As Variant
453 Width = _PropertyGet(&quot;Width&quot;)
454 End Property &apos; Width (get)
456 Property Let Width(ByVal pvValue As Variant)
457 Call _PropertySet(&quot;Width&quot;, pvValue)
458 End Property &apos; Width (set)
460 REM -----------------------------------------------------------------------------------------------------------------------
461 REM --- CLASS METHODS ---
462 REM -----------------------------------------------------------------------------------------------------------------------
464 Public Function mClose() As Variant
465 &apos; Close the form
467 If _ErrorHandler() Then On Local Error Goto Error_Function
468 Utils._SetCalledSub(&quot;Form.Close&quot;)
469 mClose = False
470 Dim oDatabase As Object, oController As Object
471 Set oDatabase = Application._CurrentDb()
472 If oDatabase._DbConnect &lt;&gt; DBCONNECTBASE Then Goto Error_NotApplicable
474 Set oController = oDatabase.Document.getFormDocuments.getByHierarchicalName(_Name)
475 oController.close()
476 Dispose()
477 mClose = True
479 Exit_Function:
480 Utils._ResetCalledSub(&quot;Form.Close&quot;)
481 Exit Function
482 Error_NotApplicable:
483 TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
484 Goto Exit_Function
485 Error_Function:
486 TraceError(TRACEABORT, Err, &quot;Form.Close&quot;, Erl)
487 GoTo Exit_Function
488 End Function &apos; Close
490 REM -----------------------------------------------------------------------------------------------------------------------
491 Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
492 &apos; Return a Control object with name or index = pvIndex
494 If _ErrorHandler() Then On Local Error Goto Error_Function
495 Utils._SetCalledSub(&quot;Form.Controls&quot;)
497 Dim ocControl As Variant, iControlCount As Integer
498 Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String
499 Dim j As Integer, iCount As Integer, sName As String, iAddCount As Integer
500 Dim oDatabaseForm As Object, iCtlCount As Integer
502 Set ocControl = Nothing
503 If Not IsLoaded Then Goto Trace_Error_NotOpen
504 &apos;Count number of controls thru the forms collection
505 iControlCount = 0
506 iCount = FormsCollection.Count
507 For i = 0 To iCount - 1
508 If i = 0 Then Set oDatabaseForm = DatabaseForm Else Set oDatabaseForm = FormsCollection.getByIndex(i)
509 If Not IsNull(oDatabaseForm) Then iControlCount = iControlCount + oDatabaseForm.getCount()
510 Next i
512 If IsMissing(pvIndex) Then &apos; No argument, return Collection pseudo-object
513 Set oCounter = New Collect
514 Set oCounter._This = oCounter
515 oCounter._CollType = COLLCONTROLS
516 Set oCounter._Parent = _This
517 oCounter._Count = iControlCount
518 Set Controls = oCounter
519 Goto Exit_Function
520 End If
522 If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
524 &apos; Start building the ocControl object
525 &apos; Determine exact name
527 sName = &quot;&quot;
528 Select Case VarType(pvIndex)
529 Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
530 If pvIndex &lt; 0 Or pvIndex &gt; iControlCount - 1 Then Goto Trace_Error_Index
531 iAddCount = 0
532 For i = 0 To iCount - 1
533 If i = 0 Then Set oDatabaseForm = DatabaseForm Else Set oDatabaseForm = FormsCollection.getByIndex(i)
534 If Not IsNull(oDatabaseForm) Then
535 iCtlCount = oDatabaseForm.getCount()
536 If pvIndex &gt;= iAddCount And pvIndex &lt;= iAddcount + iCtlCount - 1 Then
537 sName = oDatabaseForm.ElementNames(pvIndex - iAddCount)
538 Exit For
539 End If
540 iAddCount = iAddcount +iCtlCount
541 End If
542 Next i
543 Case vbString &apos; Check control name validity (non case sensitive)
544 sIndex = UCase(Utils._Trim(pvIndex))
545 bFound = False
546 For i = 0 To iCount - 1
547 If i = 0 Then Set oDatabaseForm = DatabaseForm Else Set oDatabaseForm = FormsCollection.getByIndex(i)
548 If Not IsNull(oDatabaseForm) Then
549 sControls() = oDatabaseForm.getElementNames()
550 For j = 0 To UBound(sControls)
551 If UCase(sControls(j)) = sIndex Then
552 sName = sControls(j)
553 bFound = True
554 Exit For
555 End If
556 Next j
557 If bFound Then Exit For
558 End If
559 Next i
560 If Not bFound Then Goto Trace_NotFound
561 End Select
563 &apos;Initialize a new Control object
564 Set ocControl = New Control
565 With ocControl
566 Set ._This = ocControl
567 Set ._Parent = _This
568 ._ParentType = CTLPARENTISFORM
569 ._Name = sName
570 ._Shortcut = _Shortcut &amp; &quot;!&quot; &amp; Utils._Surround(sName)
571 If IsNull(oDatabaseForm) Then ._MainForm = &quot;&quot; Else ._MainForm = oDatabaseForm.Name
572 Set .ControlModel = oDatabaseForm.getByName(sName)
573 ._ImplementationName = .ControlModel.getImplementationName()
574 ._FormComponent = Component
575 If Utils._hasUNOProperty(.ControlModel, &quot;ClassId&quot;) Then ._ClassId = .ControlModel.ClassId
576 If ._ClassId &gt; 0 And ._ClassId &lt;&gt; acHiddenControl Then
577 Set .ControlView = Component.CurrentController.getControl(.ControlModel)
578 End If
580 ._Initialize()
581 ._DocEntry = _DocEntry
582 ._DbEntry = _DbEntry
583 End With
584 Set Controls = ocControl
586 Exit_Function:
587 Utils._ResetCalledSub(&quot;Form.Controls&quot;)
588 Exit Function
589 Trace_Error_NotOpen:
590 TraceError(TRACEFATAL, ERRFORMNOTOPEN, Utils._CalledSub(), 0, , _Name)
591 Set Controls = Nothing
592 Goto Exit_Function
593 Trace_Error_Index:
594 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1)
595 Set Controls = Nothing
596 Goto Exit_Function
597 Trace_NotFound:
598 TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(), 0, , Array(pvIndex, pvIndex))
599 Set Controls = Nothing
600 Goto Exit_Function
601 Error_Function:
602 TraceError(TRACEABORT, Err, &quot;Form.Controls&quot;, Erl)
603 Set Controls = Nothing
604 GoTo Exit_Function
605 End Function &apos; Controls
607 REM -----------------------------------------------------------------------------------------------------------------------
608 Public Function CurrentDb() As Object
609 &apos; Returns Database object related to current form
611 Const cstThisSub = &quot;Form.CurrentDb&quot;
612 Utils._SetCalledSub(cstThisSub)
614 Set CurrentDb = Application._CurrentDb(_DocEntry, _DbEntry)
616 Exit_Function:
617 Utils._ResetCalledSub(cstThisSub)
618 Exit Function
619 End Function &apos; CurrentDb V1.1.0
621 REM -----------------------------------------------------------------------------------------------------------------------
622 Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
623 &apos; Return property value of psProperty property name
625 Utils._SetCalledSub(&quot;Form.getProperty&quot;)
626 If IsMissing(pvProperty) Then Call _TraceArguments()
627 getProperty = _PropertyGet(pvProperty)
628 Utils._ResetCalledSub(&quot;Form.getProperty&quot;)
630 End Function &apos; getProperty
632 REM -----------------------------------------------------------------------------------------------------------------------
633 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
634 &apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
636 If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
637 Exit Function
639 End Function &apos; hasProperty
641 REM -----------------------------------------------------------------------------------------------------------------------
642 Public Function Move( ByVal Optional pvLeft As Variant _
643 , ByVal Optional pvTop As Variant _
644 , ByVal Optional pvWidth As Variant _
645 , ByVal Optional pvHeight As Variant _
646 ) As Variant
647 &apos; Execute Move method
648 Utils._SetCalledSub(&quot;Form.Move&quot;)
649 If _ErrorHandler() Then On Local Error Goto Error_Function
650 Move = False
651 Dim iArgNr As Integer
652 Select Case UCase(_A2B_.CalledSub)
653 Case UCase(&quot;Move&quot;) : iArgNr = 1
654 Case UCase(&quot;Form.Move&quot;) : iArgNr = 0
655 End Select
656 If IsMissing(pvLeft) Then pvLeft = -1
657 If IsMissing(pvTop) Then pvTop = -1
658 If IsMissing(pvWidth) Then pvWidth = -1
659 If IsMissing(pvHeight) Then pvHeight = -1
660 If Not Utils._CheckArgument(pvLeft, iArgNr + 1, Utils._AddNumeric()) Then Goto Exit_Function
661 If Not Utils._CheckArgument(pvTop, iArgNr + 2, Utils._AddNumeric()) Then Goto Exit_Function
662 If Not Utils._CheckArgument(pvWidth, iArgNr + 3, Utils._AddNumeric()) Then Goto Exit_Function
663 If Not Utils._CheckArgument(pvHeight, iArgNr + 4, Utils._AddNumeric()) Then Goto Exit_Function
665 Dim iArg As Integer, iWrong As Integer &apos; Check arguments values
666 iArg = 0
667 If pvHeight &lt; -1 Then
668 iArg = 4 : iWrong = pvHeight
669 ElseIf pvWidth &lt; -1 Then
670 iArg = 3 : iWrong = pvWidth
671 ElseIf pvTop &lt; -1 Then
672 iArg = 2 : iWrong = pvTop
673 ElseIf pvLeft &lt; -1 Then
674 iArg = 1 : iWrong = pvLeft
675 End If
676 If iArg &gt; 0 Then
677 TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, 1, Array(iArgNr + iArg, iWrong))
678 Goto Exit_Function
679 End If
681 Dim iPosSize As Integer
682 iPosSize = 0
683 If pvLeft &gt;= 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.X
684 If pvTop &gt;= 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.Y
685 If pvWidth &gt; 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.WIDTH
686 If pvHeight &gt; 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.HEIGHT
687 If iPosSize &gt; 0 Then
688 If Utils._hasUNOProperty(ContainerWindow, &quot;IsMaximized&quot;) Then &apos; Ignored when &lt;= OO3.2
689 ContainerWindow.IsMaximized = False
690 ContainerWindow.IsMinimized = False
691 End If
692 ContainerWindow.setPosSize(pvLeft, pvTop, pvWidth, pvHeight, iPosSize)
693 End If
694 Move = True
696 Exit_Function:
697 Utils._ResetCalledSub(&quot;Form.Move&quot;)
698 Exit Function
699 Error_Function:
700 TraceError(TRACEABORT, Err, &quot;Form.Move&quot;, Erl)
701 GoTo Exit_Function
702 End Function &apos; Move
704 REM -----------------------------------------------------------------------------------------------------------------------
705 Public Function Refresh() As Boolean
706 &apos; Refresh data with its most recent value in the database in a form or subform
707 Utils._SetCalledSub(&quot;Form.Refresh&quot;)
708 If _ErrorHandler() Then On Local Error Goto Error_Function
709 Refresh = False
711 Dim oSet As Object
712 Set oSet = DatabaseForm.createResultSet()
713 If Not IsNull(oSet) Then
714 oSet.refreshRow()
715 Refresh = True
716 End If
718 Exit_Function:
719 Set oSet = Nothing
720 Utils._ResetCalledSub(&quot;Form.Refresh&quot;)
721 Exit Function
722 Error_Function:
723 TraceError(TRACEABORT, Err, &quot;SubForm.Refresh&quot;, Erl)
724 GoTo Exit_Function
725 End Function &apos; Refresh
727 REM -----------------------------------------------------------------------------------------------------------------------
728 Public Function Requery() As Boolean
729 &apos; Refresh data displayed in a form, subform, combobox or listbox
730 Utils._SetCalledSub(&quot;Form.Requery&quot;)
731 If _ErrorHandler() Then On Local Error Goto Error_Function
732 Requery = False
734 DatabaseForm.reload()
735 Requery = True
737 Exit_Function:
738 Utils._ResetCalledSub(&quot;Form.Requery&quot;)
739 Exit Function
740 Error_Function:
741 TraceError(TRACEABORT, Err, &quot;Form.Requery&quot;, Erl)
742 GoTo Exit_Function
743 End Function &apos; Requery
745 REM -----------------------------------------------------------------------------------------------------------------------
746 Public Function setFocus() As Boolean
747 &apos; Execute setFocus method
748 Const cstThisSub = &quot;Form.setFocus&quot;
749 Utils._SetCalledSub(cstThisSub)
750 If _ErrorHandler() Then On Local Error Goto Error_Function
751 setFocus = False
753 With ContainerWindow
754 If .isVisible() = False Then .setVisible(True)
755 .IsMinimized = False
756 .setFocus()
757 .setEnable(True) &apos; Added to try to bypass desynchro issue in Linux
758 .toFront() &apos; Added to force window change in Linux
759 End With
760 setFocus = True
762 Exit_Function:
763 Utils._ResetCalledSub(cstThisSub)
764 Exit Function
765 Error_Function:
766 TraceError(TRACEABORT, Err, cstThisSub, Erl)
767 Goto Exit_Function
768 End Function &apos; setFocus V1.1.0
770 REM -----------------------------------------------------------------------------------------------------------------------
771 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
772 &apos; Return True if property setting OK
773 Utils._SetCalledSub(&quot;Form.setProperty&quot;)
774 setProperty = _PropertySet(psProperty, pvValue)
775 Utils._ResetCalledSub(&quot;Form.setProperty&quot;)
776 End Function
778 REM -----------------------------------------------------------------------------------------------------------------------
779 REM --- PRIVATE FUNCTIONS ---
780 REM -----------------------------------------------------------------------------------------------------------------------
782 REM -----------------------------------------------------------------------------------------------------------------------
783 Private Function _GetListener(ByVal psProperty As String) As String
784 &apos; Return the X...Listener corresponding with the property in argument
786 Select Case UCase(psProperty)
787 Case UCase(&quot;OnApproveCursorMove&quot;)
788 _GetListener = &quot;XRowSetApproveListener&quot;
789 Case UCase(&quot;OnApproveParameter&quot;)
790 _GetListener = &quot;XDatabaseParameterListener&quot;
791 Case UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnResetted&quot;)
792 _GetListener = &quot;XResetListener&quot;
793 Case UCase(&quot;OnApproveRowChange&quot;)
794 _GetListener = &quot;XRowSetApproveListener&quot;
795 Case UCase(&quot;OnApproveSubmit&quot;)
796 _GetListener = &quot;XSubmitListener&quot;
797 Case UCase(&quot;OnConfirmDelete&quot;)
798 _GetListener = &quot;XConfirmDeleteListener&quot;
799 Case UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnRowChanged&quot;)
800 _GetListener = &quot;XRowSetListener&quot;
801 Case UCase(&quot;OnErrorOccurred&quot;)
802 _GetListener = &quot;XSQLErrorListener&quot;
803 Case UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
804 _GetListener = &quot;XLoadListener&quot;
805 End Select
807 End Function &apos; _GetListener V1.7.0
809 REM -----------------------------------------------------------------------------------------------------------------------
810 Public Sub _Initialize(psName As String)
811 &apos; Set pointers to UNO objects
813 Dim oDoc As Object, oDatabase As Object
814 If _ErrorHandler() Then On Local Error Goto Trace_Error
815 _Name = psName
816 _Shortcut = &quot;Forms!&quot; &amp; Utils._Surround(psName)
817 Set oDoc = _A2B_.CurrentDocument()
818 If oDoc.DbConnect = DBCONNECTBASE Then _PersistentName = oDoc.Document.getFormDocuments().getByHierarchicalName(psName).PersistentName
819 If IsLoaded Then
820 Select Case oDoc.DbConnect
821 Case DBCONNECTBASE
822 If Not IsNull(Component.CurrentController) Then &apos; A form opened then closed afterwards keeps a Component attribute
823 Set ContainerWindow = Component.CurrentController.Frame.ContainerWindow
824 Set FormsCollection = Component.getDrawPage.Forms
825 If FormsCollection.Count = 0 Then
826 Set DatabaseForm = Nothing
827 Else
828 &apos;Only first member of the collection can be reached with A2B
829 &apos;Compliant with MSAccess which has 1 datasource by form, while LO might have many
830 _MainForms = FormsCollection.ElementNames()
831 Set DatabaseForm = FormsCollection.getByIndex(0)
832 End If
833 End If
834 Case DBCONNECTFORM
835 Set ContainerWindow = oDoc.Document.CurrentController.Frame.ContainerWindow
836 Set oDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
837 With oDatabase
838 Set DatabaseForm = .Form
839 If IsNull(.Connection) Then
840 Set .Connection = DatabaseForm.ActiveConnection
841 If Not IsNull(.Connection) Then
842 Set .MetaData = .Connection.MetaData
843 oDatabase._ReadOnly = .Connection.isReadOnly()
844 End If
845 End If
846 End With
847 End Select
848 If IsNull(DatabaseForm) Then _OrderBy = &quot;&quot; Else _OrderBy = DatabaseForm.Order
849 Else
850 Set Component = Nothing
851 Set ContainerWindow = Nothing
852 Set DatabaseForm = Nothing
853 End If
855 Exit_Sub:
856 Exit Sub
857 Trace_Error:
858 TraceError(TRACEABORT, Err, &quot;Form.Initialize&quot;, Erl)
859 Goto Exit_Sub
860 Trace_Internal_Error:
861 TraceError(TRACEABORT, ERRFORMNOTIDENTIFIED, Utils._CalledSub(), 0, , _Name)
862 Goto Exit_Sub
863 End Sub &apos; _Initialize V1.1.0
865 REM -----------------------------------------------------------------------------------------------------------------------
866 Private Function _PropertiesList() As Variant
868 If _IsLoaded Then
869 _PropertiesList = Array(&quot;AllowAdditions&quot;, &quot;AllowDeletions&quot;, &quot;AllowEdits&quot;, &quot;Bookmark&quot; _
870 , &quot;Caption&quot;, &quot;CurrentRecord&quot;, &quot;Filter&quot;, &quot;FilterOn&quot;, &quot;Height&quot;, &quot;IsLoaded&quot; _
871 , &quot;Name&quot;, &quot;ObjectType&quot;, &quot;OnApproveCursorMove&quot;, &quot;OnApproveParameter&quot; _
872 , &quot;OnApproveReset&quot;, &quot;OnApproveRowChange&quot;, &quot;OnApproveSubmit&quot;, &quot;OnConfirmDelete&quot; _
873 , &quot;OnCursorMoved&quot;, &quot;OnErrorOccurred&quot;, &quot;OnLoaded&quot;, &quot;OnReloaded&quot;, &quot;OnReloading&quot; _
874 , &quot;OnResetted&quot;, &quot;OnRowChanged&quot;, &quot;OnUnloaded&quot;, &quot;OnUnloading&quot;, &quot;OpenArgs&quot; _
875 , &quot;OrderBy&quot;, &quot;OrderByOn&quot;, &quot;RecordSource&quot;, &quot;Visible&quot;, &quot;Width&quot; _
876 ) &apos; Recordset removed
877 Else
878 _PropertiesList = Array(&quot;IsLoaded&quot;, &quot;Name&quot; _
880 End If
882 End Function &apos; _PropertiesList
884 REM -----------------------------------------------------------------------------------------------------------------------
885 Private Function _PropertyGet(ByVal psProperty As String) As Variant
886 &apos; Return property value of the psProperty property name
888 If _ErrorHandler() Then On Local Error Goto Error_Function
889 Utils._SetCalledSub(&quot;Form.get&quot; &amp; psProperty)
891 &apos;Execute
892 Dim oDatabase As Object, vBookmark As Variant
893 Dim i As Integer, oObject As Object
895 _PropertyGet = EMPTY
897 Select Case UCase(psProperty)
898 Case UCase(&quot;Name&quot;), UCase(&quot;IsLoaded&quot;)
899 Case Else : If Not IsLoaded Then Goto Trace_Error_Form
900 End Select
902 Select Case UCase(psProperty)
903 Case UCase(&quot;AllowAdditions&quot;)
904 If IsNull(DatabaseForm) Then _PropertyGet = False Else _PropertyGet = DatabaseForm.AllowInserts
905 Case UCase(&quot;AllowDeletions&quot;)
906 If IsNull(DatabaseForm) Then _PropertyGet = False Else _PropertyGet = DatabaseForm.AllowDeletes
907 Case UCase(&quot;AllowEdits&quot;)
908 If IsNull(DatabaseForm) Then _PropertyGet = False Else _PropertyGet = DatabaseForm.AllowUpdates
909 Case UCase(&quot;Bookmark&quot;)
910 If IsNull(DatabaseForm) Then
911 _PropertyGet = 0
912 Else
913 On Local Error Resume Next &apos; Disable error handler because bookmarking does not always react well in events ...
914 If DatabaseForm.IsBookmarkable Then vBookmark = DatabaseForm.getBookmark() Else vBookmark = Nothing
915 If _ErrorHandler() Then On Local Error Goto Error_Function Else On Local Error Goto 0
916 If IsNull(vBookmark) Then Goto Trace_Error
917 _PropertyGet = vBookmark
918 End If
919 Case UCase(&quot;Caption&quot;)
920 Set odatabase = Application._CurrentDb(_DocEntry, _DbEntry)
921 Select Case oDatabase._DbConnect
922 Case DBCONNECTFORM : _PropertyGet = oDatabase.Document.CurrentController.Frame.Title
923 Case DBCONNECTBASE : _PropertyGet = Component.CurrentController.Frame.Title
924 End Select
925 Case UCase(&quot;CurrentRecord&quot;)
926 If IsNull(DatabaseForm) Then _PropertyGet = 0 Else _PropertyGet = DatabaseForm.Row
927 Case UCase(&quot;Filter&quot;)
928 If IsNull(DatabaseForm) Then _PropertyGet = &quot;&quot; Else _PropertyGet = DatabaseForm.Filter
929 Case UCase(&quot;FilterOn&quot;)
930 If IsNull(DatabaseForm) Then _PropertyGet = False Else _PropertyGet = DatabaseForm.ApplyFilter
931 Case UCase(&quot;Height&quot;)
932 _PropertyGet = ContainerWindow.getPosSize().Height
933 Case UCase(&quot;IsLoaded&quot;) &apos; Only for indirect access from property object
934 _PropertyGet = IsLoaded
935 Case UCase(&quot;Name&quot;)
936 _PropertyGet = _Name
937 Case UCase(&quot;ObjectType&quot;)
938 _PropertyGet = _Type
939 Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
940 , UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
941 , UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
942 , UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
943 If IsNull(DatabaseForm) Then _PropertyGet = &quot;&quot; Else _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name, True)
944 Case UCase(&quot;OpenArgs&quot;)
945 _PropertyGet = _OpenArgs
946 Case UCase(&quot;OrderBy&quot;)
947 _PropertyGet = _OrderBy
948 Case UCase(&quot;OrderByOn&quot;)
949 If IsNull(DatabaseForm) Then _PropertyGet = False Else _PropertyGet = ( DatabaseForm.Order &lt;&gt; &quot;&quot; )
950 Case UCase(&quot;Recordset&quot;)
951 If IsNull(DatabaseForm) Then Goto Trace_Error
952 If DatabaseForm.Command = &quot;&quot; Then Goto Trace_Error &apos; No underlying data ??
953 Set oObject = New Recordset
954 With DatabaseForm
955 oObject._This = oObject
956 oObject._CommandType = .CommandType
957 oObject._Command = .Command
958 oObject._ParentName = _Name
959 oObject._ParentType = _Type
960 Set oDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
961 Set oObject._ParentDatabase = oDatabase
962 Set oObject._ParentDatabase.Connection = .ActiveConnection
963 oObject._ForwardOnly = ( .ResultSetType = com.sun.star.sdbc.ResultSetType.FORWARD_ONLY )
964 oObject._PassThrough = ( .EscapeProcessing = False )
965 oObject._ReadOnly = ( .ResultSetConcurrency = com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY )
966 Call oObject._Initialize()
967 End With
968 With oDatabase
969 .RecordsetMax = .RecordsetMax + 1
970 oObject._Name = Format(.RecordsetMax, &quot;0000000&quot;)
971 .RecordsetsColl.Add(oObject, UCase(oObject._Name))
972 End With
973 If Not ( oObject._BOF And oObject._EOF ) Then oObject.MoveFirst() &apos; Do nothing if resultset empty
974 Set _PropertyGet = oObject
975 Case UCase(&quot;RecordSource&quot;)
976 If IsNull(DatabaseForm) Then _PropertyGet = &quot;&quot; Else _PropertyGet = DatabaseForm.Command
977 Case UCase(&quot;Visible&quot;)
978 _PropertyGet = ContainerWindow.IsVisible()
979 Case UCase(&quot;Width&quot;)
980 _PropertyGet = ContainerWindow.getPosSize().Width
981 Case Else
982 Goto Trace_Error
983 End Select
985 Exit_Function:
986 Utils._ResetCalledSub(&quot;Form.get&quot; &amp; psProperty)
987 Exit Function
988 Trace_Error:
989 TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
990 _PropertyGet = EMPTY
991 Goto Exit_Function
992 Trace_Error_Form:
993 TraceError(TRACEFATAL, ERRFORMNOTOPEN, Utils._CalledSub(), 0, 1, _Name)
994 _PropertyGet = EMPTY
995 Goto Exit_Function
996 Error_Function:
997 TraceError(TRACEABORT, Err, &quot;Form._PropertyGet&quot;, Erl)
998 _PropertyGet = EMPTY
999 GoTo Exit_Function
1000 End Function &apos; _PropertyGet
1002 REM -----------------------------------------------------------------------------------------------------------------------
1003 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
1005 Utils._SetCalledSub(&quot;Form.set&quot; &amp; psProperty)
1006 If _ErrorHandler() Then On Local Error Goto Error_Function
1007 _PropertySet = True
1009 &apos;Execute
1010 Dim iArgNr As Integer, i As Integer
1011 Dim oDatabase As Object
1013 If _Isleft(_A2B_.CalledSub, &quot;Form.&quot;) Then iArgNr = 1 Else iArgNr = 2
1014 If Not IsLoaded Then Goto Trace_Error_Form
1016 Select Case UCase(psProperty)
1017 Case UCase(&quot;AllowAdditions&quot;)
1018 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1019 If IsNull(DatabaseForm) Then Goto Trace_Error
1020 DatabaseForm.AllowInserts = pvValue
1021 DatabaseForm.reload()
1022 Case UCase(&quot;AllowDeletions&quot;)
1023 If Not Utils._CheckArgument(pvValue,iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1024 If IsNull(DatabaseForm) Then Goto Trace_Error
1025 DatabaseForm.AllowDeletes = pvValue
1026 DatabaseForm.reload()
1027 Case UCase(&quot;AllowEdits&quot;)
1028 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1029 If IsNull(DatabaseForm) Then Goto Trace_Error
1030 DatabaseForm.AllowUpdates = pvValue
1031 DatabaseForm.reload()
1032 Case UCase(&quot;Bookmark&quot;)
1033 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(vbObject), , False) Then Goto Trace_Error_Value
1034 If IsNull(pvValue) Then Goto Trace_Error_Value
1035 If IsNull(DatabaseForm) Then Goto Trace_Error
1036 DatabaseForm.MoveToBookmark(pvValue)
1037 Case UCase(&quot;Caption&quot;)
1038 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1039 Set oDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
1040 Select Case oDatabase._DbConnect
1041 Case DBCONNECTFORM : oDatabase.Document.CurrentController.Frame.Title = pvValue
1042 Case DBCONNECTBASE : Component.CurrentController.Frame.Title = pvValue
1043 End Select
1044 Case UCase(&quot;CurrentRecord&quot;)
1045 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1046 If pvValue &lt; 1 Then Goto Trace_Error_Value
1047 If IsNull(DatabaseForm) Then Goto Trace_Error
1048 DatabaseForm.absolute(pvValue)
1049 Case UCase(&quot;Filter&quot;)
1050 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1051 If IsNull(DatabaseForm) Then Goto Trace_Error
1052 DatabaseForm.Filter = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
1053 Case UCase(&quot;FilterOn&quot;)
1054 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1055 If IsNull(DatabaseForm) Then Goto Trace_Error
1056 DatabaseForm.ApplyFilter = pvValue
1057 DatabaseForm.reload()
1058 Case UCase(&quot;Height&quot;)
1059 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1060 If Utils._hasUNOProperty(ContainerWindow, &quot;IsMaximized&quot;) Then &apos; Ignored when &lt;= OO3.2
1061 ContainerWindow.IsMaximized = False
1062 ContainerWindow.IsMinimized = False
1063 End If
1064 ContainerWindow.setPosSize(0, 0, 0, pvValue, com.sun.star.awt.PosSize.HEIGHT)
1065 Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
1066 , UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
1067 , UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
1068 , UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
1069 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1070 If IsNull(DatabaseForm) Then Goto Trace_Error
1071 If Not Utils._RegisterEventScript(DatabaseForm _
1072 , psProperty _
1073 , _GetListener(psProperty) _
1074 , pvValue, _Name, True _
1075 ) Then GoTo Trace_Error
1076 Case UCase(&quot;OrderBy&quot;)
1077 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1078 If IsNull(DatabaseForm) Then Goto Trace_Error
1079 _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
1080 Case UCase(&quot;OrderByOn&quot;)
1081 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1082 If IsNull(DatabaseForm) Then Goto Trace_Error
1083 If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = &quot;&quot;
1084 DatabaseForm.reload()
1085 Case UCase(&quot;RecordSource&quot;)
1086 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1087 If IsNull(DatabaseForm) Then Goto Trace_Error
1088 DatabaseForm.Command = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
1089 DatabaseForm.CommandType = com.sun.star.sdb.CommandType.COMMAND
1090 DatabaseForm.Filter = &quot;&quot;
1091 DatabaseForm.reload()
1092 Case UCase(&quot;Visible&quot;)
1093 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1094 ContainerWindow.setVisible(pvValue)
1095 Case UCase(&quot;Width&quot;)
1096 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric()) Then Goto Trace_Error_Value
1097 If Utils._hasUNOProperty(ContainerWindow, &quot;IsMaximized&quot;) Then &apos; Ignored when &lt;= OO3.2
1098 ContainerWindow.IsMaximized = False
1099 ContainerWindow.IsMinimized = False
1100 End If
1101 ContainerWindow.setPosSize(0, 0, pvValue, 0, com.sun.star.awt.PosSize.WIDTH)
1102 Case Else
1103 Goto Trace_Error
1104 End Select
1106 Exit_Function:
1107 Utils._ResetCalledSub(&quot;Form.set&quot; &amp; psProperty)
1108 Exit Function
1109 Trace_Error_Form:
1110 TraceError(TRACEFATAL, ERRFORMNOTOPEN, Utils._CalledSub(), 0, 1, _Name)
1111 _PropertySet = False
1112 Goto Exit_Function
1113 Trace_Error:
1114 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
1115 _PropertySet = False
1116 Goto Exit_Function
1117 Trace_Error_Value:
1118 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
1119 _PropertySet = False
1120 Goto Exit_Function
1121 Error_Function:
1122 TraceError(TRACEABORT, Err, &quot;Form._PropertySet&quot;, Erl)
1123 _PropertySet = False
1124 GoTo Exit_Function
1125 End Function &apos; _PropertySet
1127 </script:module>