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 =======================================================================================================================
14 REM -----------------------------------------------------------------------------------------------------------------------
15 REM --- CLASS ROOT FIELDS ---
16 REM -----------------------------------------------------------------------------------------------------------------------
18 Private _Type As String
' Must be SUBFORM
19 Private _This As Object
' 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
' com.sun.star.text.TextDocument
28 Public DatabaseForm As Object
' 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()
37 _Shortcut =
""
39 _MainForm =
""
42 _OrderBy =
""
43 Set ParentComponent = Nothing
44 Set DatabaseForm = Nothing
45 End Sub
' Constructor
47 REM -----------------------------------------------------------------------------------------------------------------------
48 Private Sub Class_Terminate()
49 On Local Error Resume Next
50 Call Class_Initialize()
51 End Sub
' Destructor
53 REM -----------------------------------------------------------------------------------------------------------------------
55 Call Class_Terminate()
56 End Sub
' Explicit destructor
58 REM -----------------------------------------------------------------------------------------------------------------------
59 REM --- CLASS GET/LET/SET PROPERTIES ---
60 REM -----------------------------------------------------------------------------------------------------------------------
61 Property Get AllowAdditions() As Variant
62 AllowAdditions = _PropertyGet(
"AllowAdditions
")
63 End Property
' AllowAdditions (get)
65 Property Let AllowAdditions(ByVal pvValue As Variant)
66 Call _PropertySet(
"AllowAdditions
", pvValue)
67 End Property
' AllowAdditions (set)
69 REM -----------------------------------------------------------------------------------------------------------------------
70 Property Get AllowDeletions() As Variant
71 AllowDeletions = _PropertyGet(
"AllowDeletions
")
72 End Property
' AllowDeletions (get)
74 Property Let AllowDeletions(ByVal pvValue As Variant)
75 Call _PropertySet(
"AllowDeletions
", pvValue)
76 End Property
' AllowDeletions (set)
78 REM -----------------------------------------------------------------------------------------------------------------------
79 Property Get AllowEdits() As Variant
80 AllowEdits = _PropertyGet(
"AllowEdits
")
81 End Property
' AllowEdits (get)
83 Property Let AllowEdits(ByVal pvValue As Variant)
84 Call _PropertySet(
"AllowEdits
", pvValue)
85 End Property
' AllowEdits (set)
87 REM -----------------------------------------------------------------------------------------------------------------------
88 Property Get CurrentRecord() As Variant
89 CurrentRecord = _PropertyGet(
"CurrentRecord
")
90 End Property
' CurrentRecord (get)
92 Property Let CurrentRecord(ByVal pvValue As Variant)
93 Call _PropertySet(
"CurrentRecord
", pvValue)
94 End Property
' CurrentRecord (set)
96 REM -----------------------------------------------------------------------------------------------------------------------
97 Property Get Filter() As Variant
98 Filter = _PropertyGet(
"Filter
")
99 End Property
' Filter (get)
101 Property Let Filter(ByVal pvValue As Variant)
102 Call _PropertySet(
"Filter
", pvValue)
103 End Property
' Filter (set)
105 REM -----------------------------------------------------------------------------------------------------------------------
106 Property Get FilterOn() As Variant
107 FilterOn = _PropertyGet(
"FilterOn
")
108 End Property
' FilterOn (get)
110 Property Let FilterOn(ByVal pvValue As Variant)
111 Call _PropertySet(
"FilterOn
", pvValue)
112 End Property
' FilterOn (set)
114 REM -----------------------------------------------------------------------------------------------------------------------
115 Property Get LinkChildFields(ByVal Optional pvIndex As Variant) As Variant
116 If IsMissing(pvIndex) Then LinkChildFields = _PropertyGet(
"LinkChildFields
") Else LinkChildFields = _PropertyGet(
"LinkChildFields
", pvIndex)
117 End Property
' LinkChildFields (get)
119 REM -----------------------------------------------------------------------------------------------------------------------
120 Property Get LinkMasterFields(ByVal Optional pvIndex As Variant) As Variant
121 If IsMissing(pvIndex) Then LinkMasterFields = _PropertyGet(
"LinkMasterFields
") Else LinkMasterFields = _PropertyGet(
"LinkMasterFields
", pvIndex)
122 End Property
' LinkMasterFields (get)
124 REM -----------------------------------------------------------------------------------------------------------------------
125 Property Get Name() As String
126 Name = _PropertyGet(
"Name
")
127 End Property
' Name (get)
129 Public Function pName() As String
' For compatibility with
< V0.9
.0
130 pName = _PropertyGet(
"Name
")
131 End Function
' pName (get)
133 REM -----------------------------------------------------------------------------------------------------------------------
134 Property Get ObjectType() As String
135 ObjectType = _PropertyGet(
"ObjectType
")
136 End Property
' ObjectType (get)
138 REM -----------------------------------------------------------------------------------------------------------------------
139 Property Get OnApproveCursorMove() As Variant
140 OnApproveCursorMove = _PropertyGet(
"OnApproveCursorMove
")
141 End Property
' OnApproveCursorMove (get)
143 Property Let OnApproveCursorMove(ByVal pvValue As Variant)
144 Call _PropertySet(
"OnApproveCursorMove
", pvValue)
145 End Property
' OnApproveCursorMove (set)
147 REM -----------------------------------------------------------------------------------------------------------------------
148 Property Get OnApproveParameter() As Variant
149 OnApproveParameter = _PropertyGet(
"OnApproveParameter
")
150 End Property
' OnApproveParameter (get)
152 Property Let OnApproveParameter(ByVal pvValue As Variant)
153 Call _PropertySet(
"OnApproveParameter
", pvValue)
154 End Property
' OnApproveParameter (set)
156 REM -----------------------------------------------------------------------------------------------------------------------
157 Property Get OnApproveReset() As Variant
158 OnApproveReset = _PropertyGet(
"OnApproveReset
")
159 End Property
' OnApproveReset (get)
161 Property Let OnApproveReset(ByVal pvValue As Variant)
162 Call _PropertySet(
"OnApproveReset
", pvValue)
163 End Property
' OnApproveReset (set)
165 REM -----------------------------------------------------------------------------------------------------------------------
166 Property Get OnApproveRowChange() As Variant
167 OnApproveRowChange = _PropertyGet(
"OnApproveRowChange
")
168 End Property
' OnApproveRowChange (get)
170 Property Let OnApproveRowChange(ByVal pvValue As Variant)
171 Call _PropertySet(
"OnApproveRowChange
", pvValue)
172 End Property
' OnApproveRowChange (set)
174 REM -----------------------------------------------------------------------------------------------------------------------
175 Property Get OnApproveSubmit() As Variant
176 OnApproveSubmit = _PropertyGet(
"OnApproveSubmit
")
177 End Property
' OnApproveSubmit (get)
179 Property Let OnApproveSubmit(ByVal pvValue As Variant)
180 Call _PropertySet(
"OnApproveSubmit
", pvValue)
181 End Property
' OnApproveSubmit (set)
183 REM -----------------------------------------------------------------------------------------------------------------------
184 Property Get OnConfirmDelete() As Variant
185 OnConfirmDelete = _PropertyGet(
"OnConfirmDelete
")
186 End Property
' OnConfirmDelete (get)
188 Property Let OnConfirmDelete(ByVal pvValue As Variant)
189 Call _PropertySet(
"OnConfirmDelete
", pvValue)
190 End Property
' OnConfirmDelete (set)
192 REM -----------------------------------------------------------------------------------------------------------------------
193 Property Get OnCursorMoved() As Variant
194 OnCursorMoved = _PropertyGet(
"OnCursorMoved
")
195 End Property
' OnCursorMoved (get)
197 Property Let OnCursorMoved(ByVal pvValue As Variant)
198 Call _PropertySet(
"OnCursorMoved
", pvValue)
199 End Property
' OnCursorMoved (set)
201 REM -----------------------------------------------------------------------------------------------------------------------
202 Property Get OnErrorOccurred() As Variant
203 OnErrorOccurred = _PropertyGet(
"OnErrorOccurred
")
204 End Property
' OnErrorOccurred (get)
206 Property Let OnErrorOccurred(ByVal pvValue As Variant)
207 Call _PropertySet(
"OnErrorOccurred
", pvValue)
208 End Property
' OnErrorOccurred (set)
210 REM -----------------------------------------------------------------------------------------------------------------------
211 Property Get OnLoaded() As Variant
212 OnLoaded = _PropertyGet(
"OnLoaded
")
213 End Property
' OnLoaded (get)
215 Property Let OnLoaded(ByVal pvValue As Variant)
216 Call _PropertySet(
"OnLoaded
", pvValue)
217 End Property
' OnLoaded (set)
219 REM -----------------------------------------------------------------------------------------------------------------------
220 Property Get OnReloaded() As Variant
221 OnReloaded = _PropertyGet(
"OnReloaded
")
222 End Property
' OnReloaded (get)
224 Property Let OnReloaded(ByVal pvValue As Variant)
225 Call _PropertySet(
"OnReloaded
", pvValue)
226 End Property
' OnReloaded (set)
228 REM -----------------------------------------------------------------------------------------------------------------------
229 Property Get OnReloading() As Variant
230 OnReloading = _PropertyGet(
"OnReloading
")
231 End Property
' OnReloading (get)
233 Property Let OnReloading(ByVal pvValue As Variant)
234 Call _PropertySet(
"OnReloading
", pvValue)
235 End Property
' OnReloading (set)
237 REM -----------------------------------------------------------------------------------------------------------------------
238 Property Get OnResetted() As Variant
239 OnResetted = _PropertyGet(
"OnResetted
")
240 End Property
' OnResetted (get)
242 Property Let OnResetted(ByVal pvValue As Variant)
243 Call _PropertySet(
"OnResetted
", pvValue)
244 End Property
' OnResetted (set)
246 REM -----------------------------------------------------------------------------------------------------------------------
247 Property Get OnRowChanged() As Variant
248 OnRowChanged = _PropertyGet(
"OnRowChanged
")
249 End Property
' OnRowChanged (get)
251 Property Let OnRowChanged(ByVal pvValue As Variant)
252 Call _PropertySet(
"OnRowChanged
", pvValue)
253 End Property
' OnRowChanged (set)
255 REM -----------------------------------------------------------------------------------------------------------------------
256 Property Get OnUnloaded() As Variant
257 OnUnloaded = _PropertyGet(
"OnUnloaded
")
258 End Property
' OnUnloaded (get)
260 Property Let OnUnloaded(ByVal pvValue As Variant)
261 Call _PropertySet(
"OnUnloaded
", pvValue)
262 End Property
' OnUnloaded (set)
264 REM -----------------------------------------------------------------------------------------------------------------------
265 Property Get OnUnloading() As Variant
266 OnUnloading = _PropertyGet(
"OnUnloading
")
267 End Property
' OnUnloading (get)
269 Property Let OnUnloading(ByVal pvValue As Variant)
270 Call _PropertySet(
"OnUnloading
", pvValue)
271 End Property
' OnUnloading (set)
273 REM -----------------------------------------------------------------------------------------------------------------------
274 Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
275 ' Return either an error or an object of type OPTIONGROUP based on its name
277 Const cstThisSub =
"SubForm.OptionGroup
"
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
288 Set OptionGroup = ogGroup
291 Utils._ResetCalledSub(cstThisSub)
294 TraceError(TRACEABORT, Err, cstThisSub, Erl)
296 End Function
' OptionGroup V1.1
.0
298 REM -----------------------------------------------------------------------------------------------------------------------
299 Property Get OrderBy() As Variant
300 OrderBy = _PropertyGet(
"OrderBy
")
301 End Property
' OrderBy (get) V1.2
.0
303 Property Let OrderBy(ByVal pvValue As Variant)
304 Call _PropertySet(
"OrderBy
", pvValue)
305 End Property
' OrderBy (set)
307 REM -----------------------------------------------------------------------------------------------------------------------
308 Property Get OrderByOn() As Variant
309 OrderByOn = _PropertyGet(
"OrderByOn
")
310 End Property
' OrderByOn (get) V1.2
.0
312 Property Let OrderByOn(ByVal pvValue As Variant)
313 Call _PropertySet(
"OrderByOn
", pvValue)
314 End Property
' OrderByOn (set)
316 REM -----------------------------------------------------------------------------------------------------------------------
317 Public Function Parent() As Object
319 Utils._SetCalledSub(
"SubForm.getParent
")
320 On Error Goto Error_Function
325 Utils._ResetCalledSub(
"SubForm.getParent
")
328 TraceError(TRACEABORT, Err,
"SubForm.getParent
", Erl)
331 End Function
' Parent
333 REM -----------------------------------------------------------------------------------------------------------------------
334 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
336 ' a Collection object if pvIndex absent
337 ' 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)
345 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
346 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
350 Set Properties = vProperty
352 End Function
' Properties
354 REM -----------------------------------------------------------------------------------------------------------------------
355 Property Get Recordset() As Object
356 Recordset = _PropertyGet(
"Recordset
")
357 End Property
' Recordset (get) V0.9
.5
359 REM -----------------------------------------------------------------------------------------------------------------------
360 Property Get RecordSource() As Variant
361 RecordSource = _PropertyGet(
"RecordSource
")
362 End Property
' RecordSource (get)
364 Property Let RecordSource(ByVal pvValue As Variant)
365 Call _PropertySet(
"RecordSource
", pvValue)
366 End Property
' RecordSource (set)
368 REM -----------------------------------------------------------------------------------------------------------------------
369 REM --- CLASS METHODS ---
370 REM -----------------------------------------------------------------------------------------------------------------------
371 Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
372 ' Return a Control object with name or index = pvIndex
374 If _ErrorHandler() Then On Local Error Goto Error_Function
375 Utils._SetCalledSub(
"SubForm.Controls
")
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
381 Set ocControl = Nothing
382 iControlCount = DatabaseForm.getCount()
384 If IsMissing(pvIndex) Then
' 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
394 If Not Utils._CheckArgument(pvIndex,
1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
396 ' Start building the ocControl object
397 ' 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
< 0 Or pvIndex
> iControlCount -
1 Then Goto Trace_Error_Index
408 ocControl._Name = sControls(pvIndex)
409 Case vbString
' Check control name validity (non case sensitive)
411 sIndex = UCase(Utils._Trim(pvIndex))
412 For i =
0 To iControlCount -
1
413 If UCase(sControls(i)) = sIndex Then
418 If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
422 ._Shortcut = sParentShortcut
& "!
" & Utils._Surround(._Name)
423 Set .ControlModel = DatabaseForm.getByName(._Name)
424 ._ImplementationName = .ControlModel.getImplementationName()
425 ._FormComponent = ParentComponent
426 If Utils._hasUNOProperty(.ControlModel,
"ClassId
") Then ._ClassId = .ControlModel.ClassId
427 If ._ClassId
> 0 And ._ClassId
<> acHiddenControl Then
428 Set .ControlView = ParentComponent.CurrentController.getControl(.ControlModel)
432 ._DocEntry = _DocEntry
435 Set Controls = ocControl
438 Utils._ResetCalledSub(
"SubForm.Controls
")
441 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(),
0,
1)
442 Set Controls = Nothing
445 TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(),
0, , Array(pvIndex, _Name))
446 Set Controls = Nothing
449 TraceError(TRACEABORT, Err,
"SubForm.Controls
", Erl)
450 Set Controls = Nothing
452 End Function
' Controls V1.1
.0
454 REM -----------------------------------------------------------------------------------------------------------------------
455 Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
456 ' Return property value of psProperty property name
458 Utils._SetCalledSub(
"SubForm.getProperty
")
459 If IsMissing(pvProperty) Then Call _TraceArguments()
460 getProperty = _PropertyGet(pvProperty)
461 Utils._ResetCalledSub(
"SubForm.getProperty
")
463 End Function
' getProperty
465 REM -----------------------------------------------------------------------------------------------------------------------
466 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
467 ' 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)
472 End Function
' hasProperty
474 REM -----------------------------------------------------------------------------------------------------------------------
475 Public Function Refresh() As Boolean
476 ' Refresh data with its most recent value in the database in a form or subform
477 Utils._SetCalledSub(
"SubForm.Refresh
")
478 If _ErrorHandler() Then On Local Error Goto Error_Function
482 Set oSet = DatabaseForm.createResultSet()
483 If Not IsNull(oSet) Then
490 Utils._ResetCalledSub(
"SubForm.Refresh
")
493 TraceError(TRACEABORT, Err,
"SubForm.Refresh
", Erl)
495 End Function
' Refresh
497 REM -----------------------------------------------------------------------------------------------------------------------
498 Public Function Requery() As Boolean
499 ' Refresh data displayed in a form, subform, combobox or listbox
500 Utils._SetCalledSub(
"SubForm.Requery
")
501 If _ErrorHandler() Then On Local Error Goto Error_Function
504 DatabaseForm.reload()
508 Utils._ResetCalledSub(
"SubForm.Requery
")
511 TraceError(TRACEABORT, Err,
"SubForm.Requery
", Erl)
513 End Function
' Requery
515 REM -----------------------------------------------------------------------------------------------------------------------
516 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
517 ' Return True if property setting OK
518 Utils._SetCalledSub(
"SubForm.setProperty
")
519 setProperty = _PropertySet(psProperty, pvValue)
520 Utils._ResetCalledSub(
"SubForm.setProperty
")
523 REM -----------------------------------------------------------------------------------------------------------------------
524 REM --- PRIVATE FUNCTIONS ---
525 REM -----------------------------------------------------------------------------------------------------------------------
527 Private Function _GetListener(ByVal psProperty As String) As String
528 ' Return the X...Listener corresponding with the property in argument
530 Select Case UCase(psProperty)
531 Case UCase(
"OnApproveCursorMove
")
532 _GetListener =
"XRowSetApproveListener
"
533 Case UCase(
"OnApproveParameter
")
534 _GetListener =
"XDatabaseParameterListener
"
535 Case UCase(
"OnApproveReset
"), UCase(
"OnResetted
")
536 _GetListener =
"XResetListener
"
537 Case UCase(
"OnApproveRowChange
")
538 _GetListener =
"XRowSetApproveListener
"
539 Case UCase(
"OnApproveSubmit
")
540 _GetListener =
"XSubmitListener
"
541 Case UCase(
"OnConfirmDelete
")
542 _GetListener =
"XConfirmDeleteListener
"
543 Case UCase(
"OnCursorMoved
"), UCase(
"OnRowChanged
")
544 _GetListener =
"XRowSetListener
"
545 Case UCase(
"OnErrorOccurred
")
546 _GetListener =
"XSQLErrorListener
"
547 Case UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
548 _GetListener =
"XLoadListener
"
551 End Function
' _GetListener V1.7
.0
553 REM -----------------------------------------------------------------------------------------------------------------------
554 Private Function _PropertiesList() As Variant
556 _PropertiesList = Array(
"AllowAdditions
",
"AllowDeletions
",
"AllowEdits
",
"CurrentRecord
" _
557 ,
"Filter
",
"FilterOn
",
"LinkChildFields
",
"LinkMasterFields
",
"Name
" _
558 ,
"ObjectType
",
"OnApproveCursorMove
",
"OnApproveParameter
" _
559 ,
"OnApproveReset
",
"OnApproveRowChange
",
"OnApproveSubmit
",
"OnConfirmDelete
" _
560 ,
"OnCursorMoved
",
"OnErrorOccurred
",
"OnLoaded
",
"OnReloaded
",
"OnReloading
" _
561 ,
"OnResetted
",
"OnRowChanged
",
"OnUnloaded
",
"OnUnloading
",
"OrderBy
" _
562 ,
"OrderByOn
",
"Parent
",
"RecordSource
" _
563 )
' Recordset removed
565 End Function
' _PropertiesList
567 REM -----------------------------------------------------------------------------------------------------------------------
568 Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
569 ' Return property value of the psProperty property name
571 If _ErrorHandler() Then On Local Error Goto Error_Function
572 Utils._SetCalledSub(
"SubForm.get
" & psProperty)
573 Dim iArgNr As Integer
574 If Not IsMissing(pvIndex) Then
575 Select Case UCase(_A2B_.CalledSub)
576 Case UCase(
"getProperty
") : iArgNr =
3
577 Case UCase(
"SubForm.getProperty
") : iArgNr =
2
578 Case UCase(
"SubForm.get
" & psProperty) : iArgNr =
1
580 If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
584 Dim oDatabase As Object, vBookmark As Variant, oObject As Object
587 Select Case UCase(psProperty)
588 Case UCase(
"AllowAdditions
")
589 _PropertyGet = DatabaseForm.AllowInserts
590 Case UCase(
"AllowDeletions
")
591 _PropertyGet = DatabaseForm.AllowDeletes
592 Case UCase(
"AllowEdits
")
593 _PropertyGet = DatabaseForm.AllowUpdates
594 Case UCase(
"CurrentRecord
")
595 _PropertyGet = DatabaseForm.Row
596 Case UCase(
"Filter
")
597 _PropertyGet = DatabaseForm.Filter
598 Case UCase(
"FilterOn
")
599 _PropertyGet = DatabaseForm.ApplyFilter
600 Case UCase(
"LinkChildFields
")
601 If Utils._hasUNOProperty(DatabaseForm,
"DetailFields
") Then
602 If IsMissing(pvIndex) Then
603 _PropertyGet = DatabaseForm.DetailFields
605 If pvIndex
< 0 Or pvIndex
> UBound(DatabaseForm.DetailFields) Then Goto trace_Error_Index
606 _PropertyGet = DatabaseForm.DetailFields(pvIndex)
609 Case UCase(
"LinkMasterFields
")
610 If Utils._hasUNOProperty(DatabaseForm,
"MasterFields
") Then
611 If IsMissing(pvIndex) Then
612 _PropertyGet = DatabaseForm.MasterFields
614 If pvIndex
< 0 Or pvIndex
> UBound(DatabaseForm.MasterFields) Then Goto trace_Error_Index
615 _PropertyGet = DatabaseForm.MasterFields(pvIndex)
618 Case UCase(
"Name
")
620 Case UCase(
"ObjectType
")
622 Case UCase(
"OnApproveCursorMove
"), UCase(
"OnApproveParameter
"), UCase(
"OnApproveReset
"), UCase(
"OnApproveRowChange
") _
623 , UCase(
"OnApproveSubmit
"), UCase(
"OnConfirmDelete
"), UCase(
"OnCursorMoved
"), UCase(
"OnErrorOccurred
") _
624 , UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnResetted
"), UCase(
"OnRowChanged
") _
625 , UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
626 _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name)
627 Case UCase(
"OrderBy
")
628 _PropertyGet = _OrderBy
629 Case UCase(
"OrderByOn
")
630 If DatabaseForm.Order =
"" Then _PropertyGet = False Else _PropertyGet = True
631 Case UCase(
"Parent
")
' Only for indirect access from property object
632 _PropertyGet = Parent
633 Case UCase(
"Recordset
")
634 If DatabaseForm.Command =
"" Then Goto Trace_Error
' No underlying data ??
635 Set oObject = New Recordset
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()
651 .RecordsetMax = .RecordsetMax +
1
652 oObject._Name = Format(.RecordsetMax,
"0000000")
653 .RecordsetsColl.Add(oObject, UCase(oObject._Name))
655 Set _PropertyGet = oObject
656 Case UCase(
"RecordSource
")
657 _PropertyGet = DatabaseForm.Command
663 Utils._ResetCalledSub(
"SubForm.get
" & psProperty)
666 TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(),
0,
1, psProperty)
670 TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(),
0,
1, psProperty)
674 TraceError(TRACEABORT, Err,
"SubForm._PropertyGet
", Erl)
677 End Function
' _PropertyGet
679 REM -----------------------------------------------------------------------------------------------------------------------
680 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
682 Utils._SetCalledSub(
"SubForm.set
" & psProperty)
683 If _ErrorHandler() Then On Local Error Goto Error_Function
687 Dim iArgNr As Integer
689 If _IsLeft(_A2B_.CalledSub,
"SubForm.
") Then iArgNr =
1 Else iArgNr =
2
690 Select Case UCase(psProperty)
691 Case UCase(
"AllowAdditions
")
692 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
693 DatabaseForm.AllowInserts = pvValue
694 DatabaseForm.reload()
695 Case UCase(
"AllowDeletions
")
696 If Not Utils._CheckArgument(pvValue,iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
697 DatabaseForm.AllowDeletes = pvValue
698 DatabaseForm.reload()
699 Case UCase(
"AllowEdits
")
700 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
701 DatabaseForm.AllowUpdates = pvValue
702 DatabaseForm.reload()
703 Case UCase(
"CurrentRecord
")
704 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
705 DatabaseForm.absolute(pvValue)
706 Case UCase(
"Filter
")
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(
"FilterOn
")
710 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
711 DatabaseForm.ApplyFilter = pvValue
712 DatabaseForm.reload()
713 Case UCase(
"OnApproveCursorMove
"), UCase(
"OnApproveParameter
"), UCase(
"OnApproveReset
"), UCase(
"OnApproveRowChange
") _
714 , UCase(
"OnApproveSubmit
"), UCase(
"OnConfirmDelete
"), UCase(
"OnCursorMoved
"), UCase(
"OnErrorOccurred
") _
715 , UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnResetted
"), UCase(
"OnRowChanged
") _
716 , UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
717 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
718 If Not Utils._RegisterEventScript(DatabaseForm _
720 , _GetListener(psProperty) _
722 ) Then GoTo Trace_Error
723 Case UCase(
"OrderBy
")
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(
"OrderByOn
")
727 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
728 If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order =
""
729 DatabaseForm.reload()
730 Case UCase(
"RecordSource
")
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 =
""
735 DatabaseForm.reload()
741 Utils._ResetCalledSub(
"SubForm.set
" & psProperty)
744 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(),
0,
1, psProperty)
748 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(),
0,
1, Array(pvValue, psProperty))
752 TraceError(TRACEABORT, Err,
"SubForm._PropertySet
", Erl)
755 End Function
' _PropertySet