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