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 =======================================================================================================================
13 REM -----------------------------------------------------------------------------------------------------------------------
14 REM --- CLASS ROOT FIELDS ---
15 REM -----------------------------------------------------------------------------------------------------------------------
17 Private _Type As String
' 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
' com.sun.star.text.TextDocument
25 Public DatabaseForm As Object
' 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()
32 _Shortcut =
""
34 _MainForm =
""
37 _OrderBy =
""
38 Set ParentComponent = Nothing
39 Set DatabaseForm = Nothing
40 End Sub
' Constructor
42 REM -----------------------------------------------------------------------------------------------------------------------
43 Private Sub Class_Terminate()
44 On Local Error Resume Next
45 Call Class_Initialize()
46 End Sub
' Destructor
48 REM -----------------------------------------------------------------------------------------------------------------------
50 Call Class_Terminate()
51 End Sub
' Explicit destructor
53 REM -----------------------------------------------------------------------------------------------------------------------
54 REM --- CLASS GET/LET/SET PROPERTIES ---
55 REM -----------------------------------------------------------------------------------------------------------------------
56 Property Get AllowAdditions() As Variant
57 AllowAdditions = _PropertyGet(
"AllowAdditions
")
58 End Property
' AllowAdditions (get)
60 Property Let AllowAdditions(ByVal pvValue As Variant)
61 Call _PropertySet(
"AllowAdditions
", pvValue)
62 End Property
' AllowAdditions (set)
64 REM -----------------------------------------------------------------------------------------------------------------------
65 Property Get AllowDeletions() As Variant
66 AllowDeletions = _PropertyGet(
"AllowDeletions
")
67 End Property
' AllowDeletions (get)
69 Property Let AllowDeletions(ByVal pvValue As Variant)
70 Call _PropertySet(
"AllowDeletions
", pvValue)
71 End Property
' AllowDeletions (set)
73 REM -----------------------------------------------------------------------------------------------------------------------
74 Property Get AllowEdits() As Variant
75 AllowEdits = _PropertyGet(
"AllowEdits
")
76 End Property
' AllowEdits (get)
78 Property Let AllowEdits(ByVal pvValue As Variant)
79 Call _PropertySet(
"AllowEdits
", pvValue)
80 End Property
' AllowEdits (set)
82 REM -----------------------------------------------------------------------------------------------------------------------
83 Property Get CurrentRecord() As Variant
84 CurrentRecord = _PropertyGet(
"CurrentRecord
")
85 End Property
' CurrentRecord (get)
87 Property Let CurrentRecord(ByVal pvValue As Variant)
88 Call _PropertySet(
"CurrentRecord
", pvValue)
89 End Property
' CurrentRecord (set)
91 REM -----------------------------------------------------------------------------------------------------------------------
92 Property Get Filter() As Variant
93 Filter = _PropertyGet(
"Filter
")
94 End Property
' Filter (get)
96 Property Let Filter(ByVal pvValue As Variant)
97 Call _PropertySet(
"Filter
", pvValue)
98 End Property
' Filter (set)
100 REM -----------------------------------------------------------------------------------------------------------------------
101 Property Get FilterOn() As Variant
102 FilterOn = _PropertyGet(
"FilterOn
")
103 End Property
' FilterOn (get)
105 Property Let FilterOn(ByVal pvValue As Variant)
106 Call _PropertySet(
"FilterOn
", pvValue)
107 End Property
' FilterOn (set)
109 REM -----------------------------------------------------------------------------------------------------------------------
110 Property Get LinkChildFields(ByVal Optional pvIndex As Variant) As Variant
111 If IsMissing(pvIndex) Then LinkChildFields = _PropertyGet(
"LinkChildFields
") Else LinkChildFields = _PropertyGet(
"LinkChildFields
", pvIndex)
112 End Property
' LinkChildFields (get)
114 REM -----------------------------------------------------------------------------------------------------------------------
115 Property Get LinkMasterFields(ByVal Optional pvIndex As Variant) As Variant
116 If IsMissing(pvIndex) Then LinkMasterFields = _PropertyGet(
"LinkMasterFields
") Else LinkMasterFields = _PropertyGet(
"LinkMasterFields
", pvIndex)
117 End Property
' LinkMasterFields (get)
119 REM -----------------------------------------------------------------------------------------------------------------------
120 Property Get Name() As String
121 Name = _PropertyGet(
"Name
")
122 End Property
' Name (get)
124 Public Function pName() As String
' For compatibility with
< V0.9
.0
125 pName = _PropertyGet(
"Name
")
126 End Function
' pName (get)
128 REM -----------------------------------------------------------------------------------------------------------------------
129 Property Get ObjectType() As String
130 ObjectType = _PropertyGet(
"ObjectType
")
131 End Property
' ObjectType (get)
133 REM -----------------------------------------------------------------------------------------------------------------------
134 Property Get OnApproveCursorMove() As Variant
135 OnApproveCursorMove = _PropertyGet(
"OnApproveCursorMove
")
136 End Property
' OnApproveCursorMove (get)
138 Property Let OnApproveCursorMove(ByVal pvValue As Variant)
139 Call _PropertySet(
"OnApproveCursorMove
", pvValue)
140 End Property
' OnApproveCursorMove (set)
142 REM -----------------------------------------------------------------------------------------------------------------------
143 Property Get OnApproveParameter() As Variant
144 OnApproveParameter = _PropertyGet(
"OnApproveParameter
")
145 End Property
' OnApproveParameter (get)
147 Property Let OnApproveParameter(ByVal pvValue As Variant)
148 Call _PropertySet(
"OnApproveParameter
", pvValue)
149 End Property
' OnApproveParameter (set)
151 REM -----------------------------------------------------------------------------------------------------------------------
152 Property Get OnApproveReset() As Variant
153 OnApproveReset = _PropertyGet(
"OnApproveReset
")
154 End Property
' OnApproveReset (get)
156 Property Let OnApproveReset(ByVal pvValue As Variant)
157 Call _PropertySet(
"OnApproveReset
", pvValue)
158 End Property
' OnApproveReset (set)
160 REM -----------------------------------------------------------------------------------------------------------------------
161 Property Get OnApproveRowChange() As Variant
162 OnApproveRowChange = _PropertyGet(
"OnApproveRowChange
")
163 End Property
' OnApproveRowChange (get)
165 Property Let OnApproveRowChange(ByVal pvValue As Variant)
166 Call _PropertySet(
"OnApproveRowChange
", pvValue)
167 End Property
' OnApproveRowChange (set)
169 REM -----------------------------------------------------------------------------------------------------------------------
170 Property Get OnApproveSubmit() As Variant
171 OnApproveSubmit = _PropertyGet(
"OnApproveSubmit
")
172 End Property
' OnApproveSubmit (get)
174 Property Let OnApproveSubmit(ByVal pvValue As Variant)
175 Call _PropertySet(
"OnApproveSubmit
", pvValue)
176 End Property
' OnApproveSubmit (set)
178 REM -----------------------------------------------------------------------------------------------------------------------
179 Property Get OnConfirmDelete() As Variant
180 OnConfirmDelete = _PropertyGet(
"OnConfirmDelete
")
181 End Property
' OnConfirmDelete (get)
183 Property Let OnConfirmDelete(ByVal pvValue As Variant)
184 Call _PropertySet(
"OnConfirmDelete
", pvValue)
185 End Property
' OnConfirmDelete (set)
187 REM -----------------------------------------------------------------------------------------------------------------------
188 Property Get OnCursorMoved() As Variant
189 OnCursorMoved = _PropertyGet(
"OnCursorMoved
")
190 End Property
' OnCursorMoved (get)
192 Property Let OnCursorMoved(ByVal pvValue As Variant)
193 Call _PropertySet(
"OnCursorMoved
", pvValue)
194 End Property
' OnCursorMoved (set)
196 REM -----------------------------------------------------------------------------------------------------------------------
197 Property Get OnErrorOccurred() As Variant
198 OnErrorOccurred = _PropertyGet(
"OnErrorOccurred
")
199 End Property
' OnErrorOccurred (get)
201 Property Let OnErrorOccurred(ByVal pvValue As Variant)
202 Call _PropertySet(
"OnErrorOccurred
", pvValue)
203 End Property
' OnErrorOccurred (set)
205 REM -----------------------------------------------------------------------------------------------------------------------
206 Property Get OnLoaded() As Variant
207 OnLoaded = _PropertyGet(
"OnLoaded
")
208 End Property
' OnLoaded (get)
210 Property Let OnLoaded(ByVal pvValue As Variant)
211 Call _PropertySet(
"OnLoaded
", pvValue)
212 End Property
' OnLoaded (set)
214 REM -----------------------------------------------------------------------------------------------------------------------
215 Property Get OnReloaded() As Variant
216 OnReloaded = _PropertyGet(
"OnReloaded
")
217 End Property
' OnReloaded (get)
219 Property Let OnReloaded(ByVal pvValue As Variant)
220 Call _PropertySet(
"OnReloaded
", pvValue)
221 End Property
' OnReloaded (set)
223 REM -----------------------------------------------------------------------------------------------------------------------
224 Property Get OnReloading() As Variant
225 OnReloading = _PropertyGet(
"OnReloading
")
226 End Property
' OnReloading (get)
228 Property Let OnReloading(ByVal pvValue As Variant)
229 Call _PropertySet(
"OnReloading
", pvValue)
230 End Property
' OnReloading (set)
232 REM -----------------------------------------------------------------------------------------------------------------------
233 Property Get OnResetted() As Variant
234 OnResetted = _PropertyGet(
"OnResetted
")
235 End Property
' OnResetted (get)
237 Property Let OnResetted(ByVal pvValue As Variant)
238 Call _PropertySet(
"OnResetted
", pvValue)
239 End Property
' OnResetted (set)
241 REM -----------------------------------------------------------------------------------------------------------------------
242 Property Get OnRowChanged() As Variant
243 OnRowChanged = _PropertyGet(
"OnRowChanged
")
244 End Property
' OnRowChanged (get)
246 Property Let OnRowChanged(ByVal pvValue As Variant)
247 Call _PropertySet(
"OnRowChanged
", pvValue)
248 End Property
' OnRowChanged (set)
250 REM -----------------------------------------------------------------------------------------------------------------------
251 Property Get OnUnloaded() As Variant
252 OnUnloaded = _PropertyGet(
"OnUnloaded
")
253 End Property
' OnUnloaded (get)
255 Property Let OnUnloaded(ByVal pvValue As Variant)
256 Call _PropertySet(
"OnUnloaded
", pvValue)
257 End Property
' OnUnloaded (set)
259 REM -----------------------------------------------------------------------------------------------------------------------
260 Property Get OnUnloading() As Variant
261 OnUnloading = _PropertyGet(
"OnUnloading
")
262 End Property
' OnUnloading (get)
264 Property Let OnUnloading(ByVal pvValue As Variant)
265 Call _PropertySet(
"OnUnloading
", pvValue)
266 End Property
' OnUnloading (set)
268 REM -----------------------------------------------------------------------------------------------------------------------
269 Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
270 ' Return either an error or an object of type OPTIONGROUP based on its name
272 Const cstThisSub =
"SubForm.OptionGroup
"
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
283 Set OptionGroup = ogGroup
286 Utils._ResetCalledSub(cstThisSub)
289 TraceError(TRACEABORT, Err, cstThisSub, Erl)
291 End Function
' OptionGroup V1.1
.0
293 REM -----------------------------------------------------------------------------------------------------------------------
294 Property Get OrderBy() As Variant
295 OrderBy = _PropertyGet(
"OrderBy
")
296 End Property
' OrderBy (get) V1.2
.0
298 Property Let OrderBy(ByVal pvValue As Variant)
299 Call _PropertySet(
"OrderBy
", pvValue)
300 End Property
' OrderBy (set)
302 REM -----------------------------------------------------------------------------------------------------------------------
303 Property Get OrderByOn() As Variant
304 OrderByOn = _PropertyGet(
"OrderByOn
")
305 End Property
' OrderByOn (get) V1.2
.0
307 Property Let OrderByOn(ByVal pvValue As Variant)
308 Call _PropertySet(
"OrderByOn
", pvValue)
309 End Property
' OrderByOn (set)
311 REM -----------------------------------------------------------------------------------------------------------------------
312 Public Function Parent() As Object
314 Utils._SetCalledSub(
"SubForm.getParent
")
315 On Error Goto Error_Function
317 Set Parent = PropertiesGet._ParentObject(_Shortcut)
320 Utils._ResetCalledSub(
"SubForm.getParent
")
323 TraceError(TRACEABORT, Err,
"SubForm.getParent
", Erl)
326 End Function
' Parent
328 REM -----------------------------------------------------------------------------------------------------------------------
329 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
331 ' a Collection object if pvIndex absent
332 ' 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)
340 vProperty = PropertiesGet._Properties(sObject, _Shortcut, vPropertiesList, pvIndex)
341 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
345 Set Properties = vProperty
347 End Function
' Properties
349 REM -----------------------------------------------------------------------------------------------------------------------
350 Property Get Recordset() As Object
351 Recordset = _PropertyGet(
"Recordset
")
352 End Property
' Recordset (get) V0.9
.5
354 REM -----------------------------------------------------------------------------------------------------------------------
355 Property Get RecordSource() As Variant
356 RecordSource = _PropertyGet(
"RecordSource
")
357 End Property
' RecordSource (get)
359 Property Let RecordSource(ByVal pvValue As Variant)
360 Call _PropertySet(
"RecordSource
", pvValue)
361 End Property
' RecordSource (set)
363 REM -----------------------------------------------------------------------------------------------------------------------
364 REM --- CLASS METHODS ---
365 REM -----------------------------------------------------------------------------------------------------------------------
366 Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
367 ' Return a Control object with name or index = pvIndex
369 If _ErrorHandler() Then On Local Error Goto Error_Function
370 Utils._SetCalledSub(
"SubForm.Controls
")
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
376 Set ocControl = Nothing
377 iControlCount = DatabaseForm.getCount()
379 If IsMissing(pvIndex) Then
' 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
389 If Not Utils._CheckArgument(pvIndex,
1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
391 ' Start building the ocControl object
392 ' 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
< 0 Or pvIndex
> iControlCount -
1 Then Goto Trace_Error_Index
401 ocControl._Name = sControls(pvIndex)
402 Case vbString
' Check control name validity (non case sensitive)
404 sIndex = UCase(Utils._Trim(pvIndex))
405 For i =
0 To iControlCount -
1
406 If UCase(sControls(i)) = sIndex Then
411 If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
415 ._Shortcut = sParentShortcut
& "!
" & Utils._Surround(._Name)
416 Set .ControlModel = DatabaseForm.getByName(._Name)
417 ._ImplementationName = .ControlModel.getImplementationName()
418 ._FormComponent = ParentComponent
419 If Utils._hasUNOProperty(.ControlModel,
"ClassId
") Then ._ClassId = .ControlModel.ClassId
420 If ._ClassId
> 0 And ._ClassId
<> acHiddenControl Then
421 Set .ControlView = ParentComponent.CurrentController.getControl(.ControlModel)
425 ._DocEntry = _DocEntry
428 Set Controls = ocControl
431 Utils._ResetCalledSub(
"SubForm.Controls
")
434 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(),
0,
1)
435 Set Controls = Nothing
438 TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(),
0, , Array(pvIndex, _Name))
439 Set Controls = Nothing
442 TraceError(TRACEABORT, Err,
"SubForm.Controls
", Erl)
443 Set Controls = Nothing
445 End Function
' Controls V1.1
.0
447 REM -----------------------------------------------------------------------------------------------------------------------
448 Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
449 ' Return property value of psProperty property name
451 Utils._SetCalledSub(
"SubForm.getProperty
")
452 If IsMissing(pvProperty) Then Call _TraceArguments()
453 getProperty = _PropertyGet(pvProperty)
454 Utils._ResetCalledSub(
"SubForm.getProperty
")
456 End Function
' getProperty
458 REM -----------------------------------------------------------------------------------------------------------------------
459 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
460 ' 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)
465 End Function
' hasProperty
467 REM -----------------------------------------------------------------------------------------------------------------------
468 Public Function Refresh() As Boolean
469 ' Refresh data with its most recent value in the database in a form or subform
470 Utils._SetCalledSub(
"SubForm.Refresh
")
471 If _ErrorHandler() Then On Local Error Goto Error_Function
475 Set oSet = DatabaseForm.createResultSet()
476 If Not IsNull(oSet) Then
483 Utils._ResetCalledSub(
"SubForm.Refresh
")
486 TraceError(TRACEABORT, Err,
"SubForm.Refresh
", Erl)
488 End Function
' Refresh
490 REM -----------------------------------------------------------------------------------------------------------------------
491 Public Function Requery() As Boolean
492 ' Refresh data displayed in a form, subform, combobox or listbox
493 Utils._SetCalledSub(
"SubForm.Requery
")
494 If _ErrorHandler() Then On Local Error Goto Error_Function
497 DatabaseForm.reload()
501 Utils._ResetCalledSub(
"SubForm.Requery
")
504 TraceError(TRACEABORT, Err,
"SubForm.Requery
", Erl)
506 End Function
' Requery
508 REM -----------------------------------------------------------------------------------------------------------------------
509 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
510 ' Return True if property setting OK
511 Utils._SetCalledSub(
"SubForm.setProperty
")
512 setProperty = _PropertySet(psProperty, pvValue)
513 Utils._ResetCalledSub(
"SubForm.setProperty
")
516 REM -----------------------------------------------------------------------------------------------------------------------
517 REM --- PRIVATE FUNCTIONS ---
518 REM -----------------------------------------------------------------------------------------------------------------------
520 Private Function _GetListener(ByVal psProperty As String) As String
521 ' Return the X...Listener corresponding with the property in argument
523 Select Case UCase(psProperty)
524 Case UCase(
"OnApproveCursorMove
")
525 _GetListener =
"XRowSetApproveListener
"
526 Case UCase(
"OnApproveParameter
")
527 _GetListener =
"XDatabaseParameterListener
"
528 Case UCase(
"OnApproveReset
"), UCase(
"OnResetted
")
529 _GetListener =
"XResetListener
"
530 Case UCase(
"OnApproveRowChange
")
531 _GetListener =
"XRowSetApproveListener
"
532 Case UCase(
"OnApproveSubmit
")
533 _GetListener =
"XSubmitListener
"
534 Case UCase(
"OnConfirmDelete
")
535 _GetListener =
"XConfirmDeleteListener
"
536 Case UCase(
"OnCursorMoved
"), UCase(
"OnRowChanged
")
537 _GetListener =
"XRowSetListener
"
538 Case UCase(
"OnErrorOccurred
")
539 _GetListener =
"XSQLErrorListener
"
540 Case UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
541 _GetListener =
"XLoadListener
"
544 End Function
' _GetListener V1.7
.0
546 REM -----------------------------------------------------------------------------------------------------------------------
547 Private Function _PropertiesList() As Variant
549 _PropertiesList = Array(
"AllowAdditions
",
"AllowDeletions
",
"AllowEdits
",
"CurrentRecord
" _
550 ,
"Filter
",
"FilterOn
",
"LinkChildFields
",
"LinkMasterFields
",
"Name
" _
551 ,
"ObjectType
",
"OnApproveCursorMove
",
"OnApproveParameter
" _
552 ,
"OnApproveReset
",
"OnApproveRowChange
",
"OnApproveSubmit
",
"OnConfirmDelete
" _
553 ,
"OnCursorMoved
",
"OnErrorOccurred
",
"OnLoaded
",
"OnReloaded
",
"OnReloading
" _
554 ,
"OnResetted
",
"OnRowChanged
",
"OnUnloaded
",
"OnUnloading
",
"OrderBy
" _
555 ,
"OrderByOn
",
"Parent
",
"RecordSource
" _
556 )
' Recordset removed
558 End Function
' _PropertiesList
560 REM -----------------------------------------------------------------------------------------------------------------------
561 Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
562 ' Return property value of the psProperty property name
564 If _ErrorHandler() Then On Local Error Goto Error_Function
565 Utils._SetCalledSub(
"SubForm.get
" & psProperty)
566 Dim iArgNr As Integer
567 If Not IsMissing(pvIndex) Then
568 Select Case UCase(_A2B_.CalledSub)
569 Case UCase(
"getProperty
") : iArgNr =
3
570 Case UCase(
"SubForm.getProperty
") : iArgNr =
2
571 Case UCase(
"SubForm.get
" & psProperty) : iArgNr =
1
573 If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
577 Dim oDatabase As Object, vBookmark As Variant, oObject As Object
580 Select Case UCase(psProperty)
581 Case UCase(
"AllowAdditions
")
582 _PropertyGet = DatabaseForm.AllowInserts
583 Case UCase(
"AllowDeletions
")
584 _PropertyGet = DatabaseForm.AllowDeletes
585 Case UCase(
"AllowEdits
")
586 _PropertyGet = DatabaseForm.AllowUpdates
587 Case UCase(
"CurrentRecord
")
588 _PropertyGet = DatabaseForm.Row
589 Case UCase(
"Filter
")
590 _PropertyGet = DatabaseForm.Filter
591 Case UCase(
"FilterOn
")
592 _PropertyGet = DatabaseForm.ApplyFilter
593 Case UCase(
"LinkChildFields
")
594 If Utils._hasUNOProperty(DatabaseForm,
"DetailFields
") Then
595 If IsMissing(pvIndex) Then
596 _PropertyGet = DatabaseForm.DetailFields
598 If pvIndex
< 0 Or pvIndex
> UBound(DatabaseForm.DetailFields) Then Goto trace_Error_Index
599 _PropertyGet = DatabaseForm.DetailFields(pvIndex)
602 Case UCase(
"LinkMasterFields
")
603 If Utils._hasUNOProperty(DatabaseForm,
"MasterFields
") Then
604 If IsMissing(pvIndex) Then
605 _PropertyGet = DatabaseForm.MasterFields
607 If pvIndex
< 0 Or pvIndex
> UBound(DatabaseForm.MasterFields) Then Goto trace_Error_Index
608 _PropertyGet = DatabaseForm.MasterFields(pvIndex)
611 Case UCase(
"Name
")
613 Case UCase(
"ObjectType
")
615 Case UCase(
"OnApproveCursorMove
"), UCase(
"OnApproveParameter
"), UCase(
"OnApproveReset
"), UCase(
"OnApproveRowChange
") _
616 , UCase(
"OnApproveSubmit
"), UCase(
"OnConfirmDelete
"), UCase(
"OnCursorMoved
"), UCase(
"OnErrorOccurred
") _
617 , UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnResetted
"), UCase(
"OnRowChanged
") _
618 , UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
619 _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name)
620 Case UCase(
"OrderBy
")
621 _PropertyGet = _OrderBy
622 Case UCase(
"OrderByOn
")
623 If DatabaseForm.Order =
"" Then _PropertyGet = False Else _PropertyGet = True
624 Case UCase(
"Parent
")
' Only for indirect access from property object
625 _PropertyGet = Parent
626 Case UCase(
"Recordset
")
627 If DatabaseForm.Command =
"" Then Goto Trace_Error
' No underlying data ??
628 Set oObject = New Recordset
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()
643 .RecordsetMax = .RecordsetMax +
1
644 oObject._Name = Format(.RecordsetMax,
"0000000")
645 .RecordsetsColl.Add(oObject, UCase(oObject._Name))
647 Set _PropertyGet = oObject
648 Case UCase(
"RecordSource
")
649 _PropertyGet = DatabaseForm.Command
655 Utils._ResetCalledSub(
"SubForm.get
" & psProperty)
658 TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(),
0,
1, psProperty)
662 TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(),
0,
1, psProperty)
666 TraceError(TRACEABORT, Err,
"SubForm._PropertyGet
", Erl)
669 End Function
' _PropertyGet
671 REM -----------------------------------------------------------------------------------------------------------------------
672 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
674 Utils._SetCalledSub(
"SubForm.set
" & psProperty)
675 If _ErrorHandler() Then On Local Error Goto Error_Function
679 Dim iArgNr As Integer
681 If _IsLeft(_A2B_.CalledSub,
"SubForm.
") Then iArgNr =
1 Else iArgNr =
2
682 Select Case UCase(psProperty)
683 Case UCase(
"AllowAdditions
")
684 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
685 DatabaseForm.AllowInserts = pvValue
686 DatabaseForm.reload()
687 Case UCase(
"AllowDeletions
")
688 If Not Utils._CheckArgument(pvValue,iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
689 DatabaseForm.AllowDeletes = pvValue
690 DatabaseForm.reload()
691 Case UCase(
"AllowEdits
")
692 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
693 DatabaseForm.AllowUpdates = pvValue
694 DatabaseForm.reload()
695 Case UCase(
"CurrentRecord
")
696 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
697 DatabaseForm.absolute(pvValue)
698 Case UCase(
"Filter
")
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(
"FilterOn
")
702 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
703 DatabaseForm.ApplyFilter = pvValue
704 DatabaseForm.reload()
705 Case UCase(
"OnApproveCursorMove
"), UCase(
"OnApproveParameter
"), UCase(
"OnApproveReset
"), UCase(
"OnApproveRowChange
") _
706 , UCase(
"OnApproveSubmit
"), UCase(
"OnConfirmDelete
"), UCase(
"OnCursorMoved
"), UCase(
"OnErrorOccurred
") _
707 , UCase(
"OnLoaded
"), UCase(
"OnReloaded
"), UCase(
"OnReloading
"), UCase(
"OnResetted
"), UCase(
"OnRowChanged
") _
708 , UCase(
"OnUnloaded
"), UCase(
"OnUnloading
")
709 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
710 If Not Utils._RegisterEventScript(DatabaseForm _
712 , _GetListener(psProperty) _
714 ) Then GoTo Trace_Error
715 Case UCase(
"OrderBy
")
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(
"OrderByOn
")
719 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
720 If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order =
""
721 DatabaseForm.reload()
722 Case UCase(
"RecordSource
")
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 =
""
727 DatabaseForm.reload()
733 Utils._ResetCalledSub(
"SubForm.set
" & psProperty)
736 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(),
0,
1, psProperty)
740 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(),
0,
1, Array(pvValue, psProperty))
744 TraceError(TRACEABORT, Err,
"SubForm._PropertySet
", Erl)
747 End Function
' _PropertySet