Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / wizards / source / access2base / SubForm.xba
blob8045ed1559f7fb9f40165d0471b39b43b3f0350f
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="SubForm" script:language="StarBasic">REM =======================================================================================================================
4 REM === The Access2Base library is a part of the LibreOffice project. ===
5 REM === Full documentation is available on http://www.access2base.com ===
6 REM =======================================================================================================================
8 Option Compatible
9 Option ClassModule
11 Option Explicit
13 REM -----------------------------------------------------------------------------------------------------------------------
14 REM --- CLASS ROOT FIELDS ---
15 REM -----------------------------------------------------------------------------------------------------------------------
17 Private _Type As String &apos; Must be SUBFORM
18 Private _Shortcut As String
19 Private _Name As String
20 Private _MainForm As String
21 Private _DocEntry As Integer
22 Private _DbEntry As Integer
23 Private _OrderBy As String
24 Public ParentComponent As Object &apos; com.sun.star.text.TextDocument
25 Public DatabaseForm As Object &apos; com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.)
27 REM -----------------------------------------------------------------------------------------------------------------------
28 REM --- CONSTRUCTORS / DESTRUCTORS ---
29 REM -----------------------------------------------------------------------------------------------------------------------
30 Private Sub Class_Initialize()
31 _Type = OBJSUBFORM
32 _Shortcut = &quot;&quot;
33 _Name = &quot;&quot;
34 _MainForm = &quot;&quot;
35 _DocEntry = -1
36 _DbEntry = -1
37 _OrderBy = &quot;&quot;
38 Set ParentComponent = Nothing
39 Set DatabaseForm = Nothing
40 End Sub &apos; Constructor
42 REM -----------------------------------------------------------------------------------------------------------------------
43 Private Sub Class_Terminate()
44 On Local Error Resume Next
45 Call Class_Initialize()
46 End Sub &apos; Destructor
48 REM -----------------------------------------------------------------------------------------------------------------------
49 Public Sub Dispose()
50 Call Class_Terminate()
51 End Sub &apos; Explicit destructor
53 REM -----------------------------------------------------------------------------------------------------------------------
54 REM --- CLASS GET/LET/SET PROPERTIES ---
55 REM -----------------------------------------------------------------------------------------------------------------------
56 Property Get AllowAdditions() As Variant
57 AllowAdditions = _PropertyGet(&quot;AllowAdditions&quot;)
58 End Property &apos; AllowAdditions (get)
60 Property Let AllowAdditions(ByVal pvValue As Variant)
61 Call _PropertySet(&quot;AllowAdditions&quot;, pvValue)
62 End Property &apos; AllowAdditions (set)
64 REM -----------------------------------------------------------------------------------------------------------------------
65 Property Get AllowDeletions() As Variant
66 AllowDeletions = _PropertyGet(&quot;AllowDeletions&quot;)
67 End Property &apos; AllowDeletions (get)
69 Property Let AllowDeletions(ByVal pvValue As Variant)
70 Call _PropertySet(&quot;AllowDeletions&quot;, pvValue)
71 End Property &apos; AllowDeletions (set)
73 REM -----------------------------------------------------------------------------------------------------------------------
74 Property Get AllowEdits() As Variant
75 AllowEdits = _PropertyGet(&quot;AllowEdits&quot;)
76 End Property &apos; AllowEdits (get)
78 Property Let AllowEdits(ByVal pvValue As Variant)
79 Call _PropertySet(&quot;AllowEdits&quot;, pvValue)
80 End Property &apos; AllowEdits (set)
82 REM -----------------------------------------------------------------------------------------------------------------------
83 Property Get CurrentRecord() As Variant
84 CurrentRecord = _PropertyGet(&quot;CurrentRecord&quot;)
85 End Property &apos; CurrentRecord (get)
87 Property Let CurrentRecord(ByVal pvValue As Variant)
88 Call _PropertySet(&quot;CurrentRecord&quot;, pvValue)
89 End Property &apos; CurrentRecord (set)
91 REM -----------------------------------------------------------------------------------------------------------------------
92 Property Get Filter() As Variant
93 Filter = _PropertyGet(&quot;Filter&quot;)
94 End Property &apos; Filter (get)
96 Property Let Filter(ByVal pvValue As Variant)
97 Call _PropertySet(&quot;Filter&quot;, pvValue)
98 End Property &apos; Filter (set)
100 REM -----------------------------------------------------------------------------------------------------------------------
101 Property Get FilterOn() As Variant
102 FilterOn = _PropertyGet(&quot;FilterOn&quot;)
103 End Property &apos; FilterOn (get)
105 Property Let FilterOn(ByVal pvValue As Variant)
106 Call _PropertySet(&quot;FilterOn&quot;, pvValue)
107 End Property &apos; FilterOn (set)
109 REM -----------------------------------------------------------------------------------------------------------------------
110 Property Get LinkChildFields(ByVal Optional pvIndex As Variant) As Variant
111 If IsMissing(pvIndex) Then LinkChildFields = _PropertyGet(&quot;LinkChildFields&quot;) Else LinkChildFields = _PropertyGet(&quot;LinkChildFields&quot;, pvIndex)
112 End Property &apos; LinkChildFields (get)
114 REM -----------------------------------------------------------------------------------------------------------------------
115 Property Get LinkMasterFields(ByVal Optional pvIndex As Variant) As Variant
116 If IsMissing(pvIndex) Then LinkMasterFields = _PropertyGet(&quot;LinkMasterFields&quot;) Else LinkMasterFields = _PropertyGet(&quot;LinkMasterFields&quot;, pvIndex)
117 End Property &apos; LinkMasterFields (get)
119 REM -----------------------------------------------------------------------------------------------------------------------
120 Property Get Name() As String
121 Name = _PropertyGet(&quot;Name&quot;)
122 End Property &apos; Name (get)
124 Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
125 pName = _PropertyGet(&quot;Name&quot;)
126 End Function &apos; pName (get)
128 REM -----------------------------------------------------------------------------------------------------------------------
129 Property Get ObjectType() As String
130 ObjectType = _PropertyGet(&quot;ObjectType&quot;)
131 End Property &apos; ObjectType (get)
133 REM -----------------------------------------------------------------------------------------------------------------------
134 Property Get OnApproveCursorMove() As Variant
135 OnApproveCursorMove = _PropertyGet(&quot;OnApproveCursorMove&quot;)
136 End Property &apos; OnApproveCursorMove (get)
138 Property Let OnApproveCursorMove(ByVal pvValue As Variant)
139 Call _PropertySet(&quot;OnApproveCursorMove&quot;, pvValue)
140 End Property &apos; OnApproveCursorMove (set)
142 REM -----------------------------------------------------------------------------------------------------------------------
143 Property Get OnApproveParameter() As Variant
144 OnApproveParameter = _PropertyGet(&quot;OnApproveParameter&quot;)
145 End Property &apos; OnApproveParameter (get)
147 Property Let OnApproveParameter(ByVal pvValue As Variant)
148 Call _PropertySet(&quot;OnApproveParameter&quot;, pvValue)
149 End Property &apos; OnApproveParameter (set)
151 REM -----------------------------------------------------------------------------------------------------------------------
152 Property Get OnApproveReset() As Variant
153 OnApproveReset = _PropertyGet(&quot;OnApproveReset&quot;)
154 End Property &apos; OnApproveReset (get)
156 Property Let OnApproveReset(ByVal pvValue As Variant)
157 Call _PropertySet(&quot;OnApproveReset&quot;, pvValue)
158 End Property &apos; OnApproveReset (set)
160 REM -----------------------------------------------------------------------------------------------------------------------
161 Property Get OnApproveRowChange() As Variant
162 OnApproveRowChange = _PropertyGet(&quot;OnApproveRowChange&quot;)
163 End Property &apos; OnApproveRowChange (get)
165 Property Let OnApproveRowChange(ByVal pvValue As Variant)
166 Call _PropertySet(&quot;OnApproveRowChange&quot;, pvValue)
167 End Property &apos; OnApproveRowChange (set)
169 REM -----------------------------------------------------------------------------------------------------------------------
170 Property Get OnApproveSubmit() As Variant
171 OnApproveSubmit = _PropertyGet(&quot;OnApproveSubmit&quot;)
172 End Property &apos; OnApproveSubmit (get)
174 Property Let OnApproveSubmit(ByVal pvValue As Variant)
175 Call _PropertySet(&quot;OnApproveSubmit&quot;, pvValue)
176 End Property &apos; OnApproveSubmit (set)
178 REM -----------------------------------------------------------------------------------------------------------------------
179 Property Get OnConfirmDelete() As Variant
180 OnConfirmDelete = _PropertyGet(&quot;OnConfirmDelete&quot;)
181 End Property &apos; OnConfirmDelete (get)
183 Property Let OnConfirmDelete(ByVal pvValue As Variant)
184 Call _PropertySet(&quot;OnConfirmDelete&quot;, pvValue)
185 End Property &apos; OnConfirmDelete (set)
187 REM -----------------------------------------------------------------------------------------------------------------------
188 Property Get OnCursorMoved() As Variant
189 OnCursorMoved = _PropertyGet(&quot;OnCursorMoved&quot;)
190 End Property &apos; OnCursorMoved (get)
192 Property Let OnCursorMoved(ByVal pvValue As Variant)
193 Call _PropertySet(&quot;OnCursorMoved&quot;, pvValue)
194 End Property &apos; OnCursorMoved (set)
196 REM -----------------------------------------------------------------------------------------------------------------------
197 Property Get OnErrorOccurred() As Variant
198 OnErrorOccurred = _PropertyGet(&quot;OnErrorOccurred&quot;)
199 End Property &apos; OnErrorOccurred (get)
201 Property Let OnErrorOccurred(ByVal pvValue As Variant)
202 Call _PropertySet(&quot;OnErrorOccurred&quot;, pvValue)
203 End Property &apos; OnErrorOccurred (set)
205 REM -----------------------------------------------------------------------------------------------------------------------
206 Property Get OnLoaded() As Variant
207 OnLoaded = _PropertyGet(&quot;OnLoaded&quot;)
208 End Property &apos; OnLoaded (get)
210 Property Let OnLoaded(ByVal pvValue As Variant)
211 Call _PropertySet(&quot;OnLoaded&quot;, pvValue)
212 End Property &apos; OnLoaded (set)
214 REM -----------------------------------------------------------------------------------------------------------------------
215 Property Get OnReloaded() As Variant
216 OnReloaded = _PropertyGet(&quot;OnReloaded&quot;)
217 End Property &apos; OnReloaded (get)
219 Property Let OnReloaded(ByVal pvValue As Variant)
220 Call _PropertySet(&quot;OnReloaded&quot;, pvValue)
221 End Property &apos; OnReloaded (set)
223 REM -----------------------------------------------------------------------------------------------------------------------
224 Property Get OnReloading() As Variant
225 OnReloading = _PropertyGet(&quot;OnReloading&quot;)
226 End Property &apos; OnReloading (get)
228 Property Let OnReloading(ByVal pvValue As Variant)
229 Call _PropertySet(&quot;OnReloading&quot;, pvValue)
230 End Property &apos; OnReloading (set)
232 REM -----------------------------------------------------------------------------------------------------------------------
233 Property Get OnResetted() As Variant
234 OnResetted = _PropertyGet(&quot;OnResetted&quot;)
235 End Property &apos; OnResetted (get)
237 Property Let OnResetted(ByVal pvValue As Variant)
238 Call _PropertySet(&quot;OnResetted&quot;, pvValue)
239 End Property &apos; OnResetted (set)
241 REM -----------------------------------------------------------------------------------------------------------------------
242 Property Get OnRowChanged() As Variant
243 OnRowChanged = _PropertyGet(&quot;OnRowChanged&quot;)
244 End Property &apos; OnRowChanged (get)
246 Property Let OnRowChanged(ByVal pvValue As Variant)
247 Call _PropertySet(&quot;OnRowChanged&quot;, pvValue)
248 End Property &apos; OnRowChanged (set)
250 REM -----------------------------------------------------------------------------------------------------------------------
251 Property Get OnUnloaded() As Variant
252 OnUnloaded = _PropertyGet(&quot;OnUnloaded&quot;)
253 End Property &apos; OnUnloaded (get)
255 Property Let OnUnloaded(ByVal pvValue As Variant)
256 Call _PropertySet(&quot;OnUnloaded&quot;, pvValue)
257 End Property &apos; OnUnloaded (set)
259 REM -----------------------------------------------------------------------------------------------------------------------
260 Property Get OnUnloading() As Variant
261 OnUnloading = _PropertyGet(&quot;OnUnloading&quot;)
262 End Property &apos; OnUnloading (get)
264 Property Let OnUnloading(ByVal pvValue As Variant)
265 Call _PropertySet(&quot;OnUnloading&quot;, pvValue)
266 End Property &apos; OnUnloading (set)
268 REM -----------------------------------------------------------------------------------------------------------------------
269 Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
270 &apos; Return either an error or an object of type OPTIONGROUP based on its name
272 Const cstThisSub = &quot;SubForm.OptionGroup&quot;
273 Dim ogGroup As Object
274 Utils._SetCalledSub(cstThisSub)
275 If IsMissing(pvGroupName) Then Call _TraceArguments()
276 If _ErrorHandler() Then On Local Error Goto Error_Function
278 Set ogGroup = _OptionGroup(pvGroupName, CTLPARENTISSUBFORM, ParentComponent, DatabaseForm)
279 If Not IsNull(ogGroup) Then
280 ogGroup._DocEntry = _DocEntry
281 ogGroup._DbEntry = _DbEntry
282 End If
283 Set OptionGroup = ogGroup
285 Exit_Function:
286 Utils._ResetCalledSub(cstThisSub)
287 Exit Function
288 Error_Function:
289 TraceError(TRACEABORT, Err, cstThisSub, Erl)
290 GoTo Exit_Function
291 End Function &apos; OptionGroup V1.1.0
293 REM -----------------------------------------------------------------------------------------------------------------------
294 Property Get OrderBy() As Variant
295 OrderBy = _PropertyGet(&quot;OrderBy&quot;)
296 End Property &apos; OrderBy (get) V1.2.0
298 Property Let OrderBy(ByVal pvValue As Variant)
299 Call _PropertySet(&quot;OrderBy&quot;, pvValue)
300 End Property &apos; OrderBy (set)
302 REM -----------------------------------------------------------------------------------------------------------------------
303 Property Get OrderByOn() As Variant
304 OrderByOn = _PropertyGet(&quot;OrderByOn&quot;)
305 End Property &apos; OrderByOn (get) V1.2.0
307 Property Let OrderByOn(ByVal pvValue As Variant)
308 Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
309 End Property &apos; OrderByOn (set)
311 REM -----------------------------------------------------------------------------------------------------------------------
312 Public Function Parent() As Object
314 Utils._SetCalledSub(&quot;SubForm.getParent&quot;)
315 On Error Goto Error_Function
317 Set Parent = PropertiesGet._ParentObject(_Shortcut)
319 Exit_Function:
320 Utils._ResetCalledSub(&quot;SubForm.getParent&quot;)
321 Exit Function
322 Error_Function:
323 TraceError(TRACEABORT, Err, &quot;SubForm.getParent&quot;, Erl)
324 Set Parent = Nothing
325 GoTo Exit_Function
326 End Function &apos; Parent
328 REM -----------------------------------------------------------------------------------------------------------------------
329 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
330 &apos; Return
331 &apos; a Collection object if pvIndex absent
332 &apos; a Property object otherwise
334 Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
335 vPropertiesList = _PropertiesList()
336 sObject = Utils._PCase(_Type)
337 If IsMissing(pvIndex) Then
338 vProperty = PropertiesGet._Properties(sObject, _Shortcut, vPropertiesList)
339 Else
340 vProperty = PropertiesGet._Properties(sObject, _Shortcut, vPropertiesList, pvIndex)
341 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
342 End If
344 Exit_Function:
345 Set Properties = vProperty
346 Exit Function
347 End Function &apos; Properties
349 REM -----------------------------------------------------------------------------------------------------------------------
350 Property Get Recordset() As Object
351 Recordset = _PropertyGet(&quot;Recordset&quot;)
352 End Property &apos; Recordset (get) V0.9.5
354 REM -----------------------------------------------------------------------------------------------------------------------
355 Property Get RecordSource() As Variant
356 RecordSource = _PropertyGet(&quot;RecordSource&quot;)
357 End Property &apos; RecordSource (get)
359 Property Let RecordSource(ByVal pvValue As Variant)
360 Call _PropertySet(&quot;RecordSource&quot;, pvValue)
361 End Property &apos; RecordSource (set)
363 REM -----------------------------------------------------------------------------------------------------------------------
364 REM --- CLASS METHODS ---
365 REM -----------------------------------------------------------------------------------------------------------------------
366 Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
367 &apos; Return a Control object with name or index = pvIndex
369 If _ErrorHandler() Then On Local Error Goto Error_Function
370 Utils._SetCalledSub(&quot;SubForm.Controls&quot;)
372 Dim ocControl As Variant, sParentShortcut As String, iControlCount As Integer
373 Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String
374 Dim j As Integer
376 Set ocControl = Nothing
377 iControlCount = DatabaseForm.getCount()
379 If IsMissing(pvIndex) Then &apos; No argument, return Collection pseudo-object
380 Set oCounter = New Collect
381 oCounter._CollType = COLLCONTROLS
382 oCounter._ParentType = OBJSUBFORM
383 oCounter._ParentName = _Shortcut
384 oCounter._Count = iControlCount
385 Set Controls = oCounter
386 Goto Exit_Function
387 End If
389 If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
391 &apos; Start building the ocControl object
392 &apos; Determine exact name
393 Set ocControl = New Control
394 ocControl._ParentType = CTLPARENTISSUBFORM
395 sParentShortcut = _Shortcut
396 sControls() = DatabaseForm.getElementNames()
398 Select Case VarType(pvIndex)
399 Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
400 If pvIndex &lt; 0 Or pvIndex &gt; iControlCount - 1 Then Goto Trace_Error_Index
401 ocControl._Name = sControls(pvIndex)
402 Case vbString &apos; Check control name validity (non case sensitive)
403 bFound = False
404 sIndex = UCase(Utils._Trim(pvIndex))
405 For i = 0 To iControlCount - 1
406 If UCase(sControls(i)) = sIndex Then
407 bFound = True
408 Exit For
409 End If
410 Next i
411 If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
412 End Select
414 With ocControl
415 ._Shortcut = sParentShortcut &amp; &quot;!&quot; &amp; Utils._Surround(._Name)
416 Set .ControlModel = DatabaseForm.getByName(._Name)
417 ._ImplementationName = .ControlModel.getImplementationName()
418 ._FormComponent = ParentComponent
419 If Utils._hasUNOProperty(.ControlModel, &quot;ClassId&quot;) Then ._ClassId = .ControlModel.ClassId
420 If ._ClassId &gt; 0 And ._ClassId &lt;&gt; acHiddenControl Then
421 Set .ControlView = ParentComponent.CurrentController.getControl(.ControlModel)
422 End If
424 ._Initialize()
425 ._DocEntry = _DocEntry
426 ._DbEntry = _DbEntry
427 End With
428 Set Controls = ocControl
430 Exit_Function:
431 Utils._ResetCalledSub(&quot;SubForm.Controls&quot;)
432 Exit Function
433 Trace_Error_Index:
434 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1)
435 Set Controls = Nothing
436 Goto Exit_Function
437 Trace_NotFound:
438 TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(), 0, , Array(pvIndex, _Name))
439 Set Controls = Nothing
440 Goto Exit_Function
441 Error_Function:
442 TraceError(TRACEABORT, Err, &quot;SubForm.Controls&quot;, Erl)
443 Set Controls = Nothing
444 GoTo Exit_Function
445 End Function &apos; Controls V1.1.0
447 REM -----------------------------------------------------------------------------------------------------------------------
448 Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
449 &apos; Return property value of psProperty property name
451 Utils._SetCalledSub(&quot;SubForm.getProperty&quot;)
452 If IsMissing(pvProperty) Then Call _TraceArguments()
453 getProperty = _PropertyGet(pvProperty)
454 Utils._ResetCalledSub(&quot;SubForm.getProperty&quot;)
456 End Function &apos; getProperty
458 REM -----------------------------------------------------------------------------------------------------------------------
459 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
460 &apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
462 If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
463 Exit Function
465 End Function &apos; hasProperty
467 REM -----------------------------------------------------------------------------------------------------------------------
468 Public Function Refresh() As Boolean
469 &apos; Refresh data with its most recent value in the database in a form or subform
470 Utils._SetCalledSub(&quot;SubForm.Refresh&quot;)
471 If _ErrorHandler() Then On Local Error Goto Error_Function
472 Refresh = False
474 Dim oSet As Object
475 Set oSet = DatabaseForm.createResultSet()
476 If Not IsNull(oSet) Then
477 oSet.refreshRow()
478 Refresh = True
479 End If
481 Exit_Function:
482 Set oSet = Nothing
483 Utils._ResetCalledSub(&quot;SubForm.Refresh&quot;)
484 Exit Function
485 Error_Function:
486 TraceError(TRACEABORT, Err, &quot;SubForm.Refresh&quot;, Erl)
487 GoTo Exit_Function
488 End Function &apos; Refresh
490 REM -----------------------------------------------------------------------------------------------------------------------
491 Public Function Requery() As Boolean
492 &apos; Refresh data displayed in a form, subform, combobox or listbox
493 Utils._SetCalledSub(&quot;SubForm.Requery&quot;)
494 If _ErrorHandler() Then On Local Error Goto Error_Function
495 Requery = False
497 DatabaseForm.reload()
498 Requery = True
500 Exit_Function:
501 Utils._ResetCalledSub(&quot;SubForm.Requery&quot;)
502 Exit Function
503 Error_Function:
504 TraceError(TRACEABORT, Err, &quot;SubForm.Requery&quot;, Erl)
505 GoTo Exit_Function
506 End Function &apos; Requery
508 REM -----------------------------------------------------------------------------------------------------------------------
509 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
510 &apos; Return True if property setting OK
511 Utils._SetCalledSub(&quot;SubForm.setProperty&quot;)
512 setProperty = _PropertySet(psProperty, pvValue)
513 Utils._ResetCalledSub(&quot;SubForm.setProperty&quot;)
514 End Function
516 REM -----------------------------------------------------------------------------------------------------------------------
517 REM --- PRIVATE FUNCTIONS ---
518 REM -----------------------------------------------------------------------------------------------------------------------
520 Private Function _GetListener(ByVal psProperty As String) As String
521 &apos; Return the X...Listener corresponding with the property in argument
523 Select Case UCase(psProperty)
524 Case UCase(&quot;OnApproveCursorMove&quot;)
525 _GetListener = &quot;XRowSetApproveListener&quot;
526 Case UCase(&quot;OnApproveParameter&quot;)
527 _GetListener = &quot;XDatabaseParameterListener&quot;
528 Case UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnResetted&quot;)
529 _GetListener = &quot;XResetListener&quot;
530 Case UCase(&quot;OnApproveRowChange&quot;)
531 _GetListener = &quot;XRowSetApproveListener&quot;
532 Case UCase(&quot;OnApproveSubmit&quot;)
533 _GetListener = &quot;XSubmitListener&quot;
534 Case UCase(&quot;OnConfirmDelete&quot;)
535 _GetListener = &quot;XConfirmDeleteListener&quot;
536 Case UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnRowChanged&quot;)
537 _GetListener = &quot;XRowSetListener&quot;
538 Case UCase(&quot;OnErrorOccurred&quot;)
539 _GetListener = &quot;XSQLErrorListener&quot;
540 Case UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
541 _GetListener = &quot;XLoadListener&quot;
542 End Select
544 End Function &apos; _GetListener V1.7.0
546 REM -----------------------------------------------------------------------------------------------------------------------
547 Private Function _PropertiesList() As Variant
549 _PropertiesList = Array(&quot;AllowAdditions&quot;, &quot;AllowDeletions&quot;, &quot;AllowEdits&quot;, &quot;CurrentRecord&quot; _
550 , &quot;Filter&quot;, &quot;FilterOn&quot;, &quot;LinkChildFields&quot;, &quot;LinkMasterFields&quot;, &quot;Name&quot; _
551 , &quot;ObjectType&quot;, &quot;OnApproveCursorMove&quot;, &quot;OnApproveParameter&quot; _
552 , &quot;OnApproveReset&quot;, &quot;OnApproveRowChange&quot;, &quot;OnApproveSubmit&quot;, &quot;OnConfirmDelete&quot; _
553 , &quot;OnCursorMoved&quot;, &quot;OnErrorOccurred&quot;, &quot;OnLoaded&quot;, &quot;OnReloaded&quot;, &quot;OnReloading&quot; _
554 , &quot;OnResetted&quot;, &quot;OnRowChanged&quot;, &quot;OnUnloaded&quot;, &quot;OnUnloading&quot;, &quot;OrderBy&quot; _
555 , &quot;OrderByOn&quot;, &quot;Parent&quot;, &quot;RecordSource&quot; _
556 ) &apos; Recordset removed
558 End Function &apos; _PropertiesList
560 REM -----------------------------------------------------------------------------------------------------------------------
561 Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
562 &apos; Return property value of the psProperty property name
564 If _ErrorHandler() Then On Local Error Goto Error_Function
565 Utils._SetCalledSub(&quot;SubForm.get&quot; &amp; psProperty)
566 Dim iArgNr As Integer
567 If Not IsMissing(pvIndex) Then
568 Select Case UCase(_A2B_.CalledSub)
569 Case UCase(&quot;getProperty&quot;) : iArgNr = 3
570 Case UCase(&quot;SubForm.getProperty&quot;) : iArgNr = 2
571 Case UCase(&quot;SubForm.get&quot; &amp; psProperty) : iArgNr = 1
572 End Select
573 If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
574 End If
576 &apos;Execute
577 Dim oDatabase As Object, vBookmark As Variant, oObject As Object
578 _PropertyGet = EMPTY
580 Select Case UCase(psProperty)
581 Case UCase(&quot;AllowAdditions&quot;)
582 _PropertyGet = DatabaseForm.AllowInserts
583 Case UCase(&quot;AllowDeletions&quot;)
584 _PropertyGet = DatabaseForm.AllowDeletes
585 Case UCase(&quot;AllowEdits&quot;)
586 _PropertyGet = DatabaseForm.AllowUpdates
587 Case UCase(&quot;CurrentRecord&quot;)
588 _PropertyGet = DatabaseForm.Row
589 Case UCase(&quot;Filter&quot;)
590 _PropertyGet = DatabaseForm.Filter
591 Case UCase(&quot;FilterOn&quot;)
592 _PropertyGet = DatabaseForm.ApplyFilter
593 Case UCase(&quot;LinkChildFields&quot;)
594 If Utils._hasUNOProperty(DatabaseForm, &quot;DetailFields&quot;) Then
595 If IsMissing(pvIndex) Then
596 _PropertyGet = DatabaseForm.DetailFields
597 Else
598 If pvIndex &lt; 0 Or pvIndex &gt; UBound(DatabaseForm.DetailFields) Then Goto trace_Error_Index
599 _PropertyGet = DatabaseForm.DetailFields(pvIndex)
600 End If
601 End If
602 Case UCase(&quot;LinkMasterFields&quot;)
603 If Utils._hasUNOProperty(DatabaseForm, &quot;MasterFields&quot;) Then
604 If IsMissing(pvIndex) Then
605 _PropertyGet = DatabaseForm.MasterFields
606 Else
607 If pvIndex &lt; 0 Or pvIndex &gt; UBound(DatabaseForm.MasterFields) Then Goto trace_Error_Index
608 _PropertyGet = DatabaseForm.MasterFields(pvIndex)
609 End If
610 End If
611 Case UCase(&quot;Name&quot;)
612 _PropertyGet = _Name
613 Case UCase(&quot;ObjectType&quot;)
614 _PropertyGet = _Type
615 Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
616 , UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
617 , UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
618 , UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
619 _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name)
620 Case UCase(&quot;OrderBy&quot;)
621 _PropertyGet = _OrderBy
622 Case UCase(&quot;OrderByOn&quot;)
623 If DatabaseForm.Order = &quot;&quot; Then _PropertyGet = False Else _PropertyGet = True
624 Case UCase(&quot;Parent&quot;) &apos; Only for indirect access from property object
625 _PropertyGet = Parent
626 Case UCase(&quot;Recordset&quot;)
627 If DatabaseForm.Command = &quot;&quot; Then Goto Trace_Error &apos; No underlying data ??
628 Set oObject = New Recordset
629 With DatabaseForm
630 oObject._CommandType = .CommandType
631 oObject._Command = .Command
632 oObject._ParentName = _Name
633 oObject._ParentType = _Type
634 Set oDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
635 Set oObject._ParentDatabase = oDatabase
636 Set oObject._ParentDatabase.Connection = .ActiveConnection
637 oObject._ForwardOnly = ( .ResultSetType = com.sun.star.sdbc.ResultSetType.FORWARD_ONLY )
638 oObject._PassThrough = ( .EscapeProcessing = False )
639 oObject._ReadOnly = ( .ResultSetConcurrency = com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY )
640 Call oObject._Initialize()
641 End With
642 With oDatabase
643 .RecordsetMax = .RecordsetMax + 1
644 oObject._Name = Format(.RecordsetMax, &quot;0000000&quot;)
645 .RecordsetsColl.Add(oObject, UCase(oObject._Name))
646 End With
647 Set _PropertyGet = oObject
648 Case UCase(&quot;RecordSource&quot;)
649 _PropertyGet = DatabaseForm.Command
650 Case Else
651 Goto Trace_Error
652 End Select
654 Exit_Function:
655 Utils._ResetCalledSub(&quot;SubForm.get&quot; &amp; psProperty)
656 Exit Function
657 Trace_Error:
658 TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
659 _PropertyGet = EMPTY
660 Goto Exit_Function
661 Trace_Error_Index:
662 TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
663 _PropertyGet = EMPTY
664 Goto Exit_Function
665 Error_Function:
666 TraceError(TRACEABORT, Err, &quot;SubForm._PropertyGet&quot;, Erl)
667 _PropertyGet = EMPTY
668 GoTo Exit_Function
669 End Function &apos; _PropertyGet
671 REM -----------------------------------------------------------------------------------------------------------------------
672 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
674 Utils._SetCalledSub(&quot;SubForm.set&quot; &amp; psProperty)
675 If _ErrorHandler() Then On Local Error Goto Error_Function
676 _PropertySet = True
678 &apos;Execute
679 Dim iArgNr As Integer
681 If _IsLeft(_A2B_.CalledSub, &quot;SubForm.&quot;) Then iArgNr = 1 Else iArgNr = 2
682 Select Case UCase(psProperty)
683 Case UCase(&quot;AllowAdditions&quot;)
684 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
685 DatabaseForm.AllowInserts = pvValue
686 DatabaseForm.reload()
687 Case UCase(&quot;AllowDeletions&quot;)
688 If Not Utils._CheckArgument(pvValue,iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
689 DatabaseForm.AllowDeletes = pvValue
690 DatabaseForm.reload()
691 Case UCase(&quot;AllowEdits&quot;)
692 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
693 DatabaseForm.AllowUpdates = pvValue
694 DatabaseForm.reload()
695 Case UCase(&quot;CurrentRecord&quot;)
696 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
697 DatabaseForm.absolute(pvValue)
698 Case UCase(&quot;Filter&quot;)
699 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
700 DatabaseForm.Filter = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
701 Case UCase(&quot;FilterOn&quot;)
702 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
703 DatabaseForm.ApplyFilter = pvValue
704 DatabaseForm.reload()
705 Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
706 , UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
707 , UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
708 , UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
709 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
710 If Not Utils._RegisterEventScript(DatabaseForm _
711 , psProperty _
712 , _GetListener(psProperty) _
713 , pvValue, _Name _
714 ) Then GoTo Trace_Error
715 Case UCase(&quot;OrderBy&quot;)
716 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
717 _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
718 Case UCase(&quot;OrderByOn&quot;)
719 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
720 If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = &quot;&quot;
721 DatabaseForm.reload()
722 Case UCase(&quot;RecordSource&quot;)
723 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
724 DatabaseForm.Command = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
725 DatabaseForm.CommandType = com.sun.star.sdb.CommandType.COMMAND
726 DatabaseForm.Filter = &quot;&quot;
727 DatabaseForm.reload()
728 Case Else
729 Goto Trace_Error
730 End Select
732 Exit_Function:
733 Utils._ResetCalledSub(&quot;SubForm.set&quot; &amp; psProperty)
734 Exit Function
735 Trace_Error:
736 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
737 _PropertySet = False
738 Goto Exit_Function
739 Trace_Error_Value:
740 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
741 _PropertySet = False
742 Goto Exit_Function
743 Error_Function:
744 TraceError(TRACEABORT, Err, &quot;SubForm._PropertySet&quot;, Erl)
745 _PropertySet = False
746 GoTo Exit_Function
747 End Function &apos; _PropertySet
749 </script:module>