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=
"Control" 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 CONTROL
19 Private _This As Object
' Workaround for absence of This builtin function
20 Private _Parent As Object
21 Private _ImplementationName As String
22 Private _ClassId As Integer
23 Private _ParentType As String
' One of CTLPARENTISxxxx constants
24 Private _Shortcut As String
25 Private _Name As String
26 Private _FormComponent As Object
' com.sun.star.text.TextDocument
27 Private _MainForm As String
' To be propagated to all subcontrols
28 Private _DocEntry As Integer
' Doc- and DbContainer entries in Root structure
29 Private _DbEntry As Integer
30 Private _ControlType As Integer
31 Private _ThisProperties As Variant
' Buffer for properties list
32 Private _SubType As String
33 Private ControlModel As Object
' com.sun.star.comp.forms.XXXModel
34 Private ControlView As Object
' com.sun.star.comp.forms.XXXControl (NULL if form open in edit mode)
35 Private BoundField As Object
' com.sun.star.sdb.ODataColumn
36 Private LabelControl As Object
' com.sun.star.form.component.FixedText or com.sun.star.form.component.GroupBox
38 REM -----------------------------------------------------------------------------------------------------------------------
39 REM --- CONSTRUCTORS / DESTRUCTORS ---
40 REM -----------------------------------------------------------------------------------------------------------------------
41 Private Sub Class_Initialize()
46 _ParentType =
""
47 _Shortcut =
""
49 Set _FormComponent = Nothing
50 _MainForm =
""
53 _ThisProperties = Array()
54 _SubType =
""
55 Set ControlModel = Nothing
56 Set ControlView = Nothing
57 Set BoundField = Nothing
58 Set LabelControl = Nothing
60 End Sub
' Constructor
62 REM -----------------------------------------------------------------------------------------------------------------------
63 Private Sub Class_Terminate()
64 On Local Error Resume Next
65 Call Class_Initialize()
66 End Sub
' Destructor
68 REM -----------------------------------------------------------------------------------------------------------------------
70 Call Class_Terminate()
71 End Sub
' Explicit destructor
73 REM -----------------------------------------------------------------------------------------------------------------------
74 REM --- CLASS GET/LET/SET PROPERTIES ---
75 REM -----------------------------------------------------------------------------------------------------------------------
77 Property Get BackColor() As Variant
78 BackColor = _PropertyGet(
"BackColor
")
79 End Property
' BackColor (get)
81 Property Let BackColor(ByVal pvValue As Variant)
82 Call _PropertySet(
"BackColor
", pvValue)
83 End Property
' BackColor (set)
85 REM -----------------------------------------------------------------------------------------------------------------------
86 Property Get BorderColor() As Variant
87 BorderColor = _PropertyGet(
"BorderColor
")
88 End Property
' BorderColor (get)
90 Property Let BorderColor(ByVal pvValue As Variant)
91 Call _PropertySet(
"BorderColor
", pvValue)
92 End Property
' BorderColor (set)
94 REM -----------------------------------------------------------------------------------------------------------------------
95 Property Get BorderStyle() As Variant
96 BorderStyle = _PropertyGet(
"BorderStyle
")
97 End Property
' BorderStyle (get)
99 Property Let BorderStyle(ByVal pvValue As Variant)
100 Call _PropertySet(
"BorderStyle
", pvValue)
101 End Property
' BorderStyle (set)
103 REM -----------------------------------------------------------------------------------------------------------------------
104 Property Get Cancel() As Variant
105 Cancel = _PropertyGet(
"Cancel
")
106 End Property
' Cancel (get)
108 Property Let Cancel(ByVal pvValue As Variant)
109 Call _PropertySet(
"Cancel
", pvValue)
110 End Property
' Cancel (set)
112 REM -----------------------------------------------------------------------------------------------------------------------
113 Property Get Caption() As Variant
114 Caption = _PropertyGet(
"Caption
")
115 End Property
' Caption (get)
117 Property Let Caption(ByVal pvValue As Variant)
118 Call _PropertySet(
"Caption
", pvValue)
119 End Property
' Caption (set)
121 REM -----------------------------------------------------------------------------------------------------------------------
122 Property Get ControlSource() As Variant
123 ControlSource = _PropertyGet(
"ControlSource
")
124 End Property
' ControlSource (get)
126 REM -----------------------------------------------------------------------------------------------------------------------
127 Property Get ControlTipText() As Variant
128 ControlTipText = _PropertyGet(
"ControlTipText
")
129 End Property
' ControlTipText (get)
131 Property Let ControlTipText(ByVal pvValue As Variant)
132 Call _PropertySet(
"ControlTipText
", pvValue)
133 End Property
' ControlTipText (set)
135 REM -----------------------------------------------------------------------------------------------------------------------
136 Property Get ControlType() As Variant
137 ControlType = _PropertyGet(
"ControlType
")
138 End Property
' ControlType (get)
140 REM -----------------------------------------------------------------------------------------------------------------------
141 Property Get Default() As Variant
142 Default = _PropertyGet(
"Default
")
143 End Property
' Default (get)
145 Property Let Default(ByVal pvValue As Variant)
146 Call _PropertySet(
"Default
", pvValue)
147 End Property
' Default (set)
149 REM -----------------------------------------------------------------------------------------------------------------------
150 Property Get DefaultValue() As Variant
151 DefaultValue = _PropertyGet(
"DefaultValue
")
152 End Property
' DefaultValue (get)
154 Property Let DefaultValue(ByVal pvValue As Variant)
155 Call _PropertySet(
"DefaultValue
", pvValue)
156 End Property
' DefaultValue (set)
158 REM -----------------------------------------------------------------------------------------------------------------------
159 Property Get Enabled() As Variant
160 Enabled = _PropertyGet(
"Enabled
")
161 End Property
' Enabled (get)
163 Property Let Enabled(ByVal pvValue As Variant)
164 Call _PropertySet(
"Enabled
", pvValue)
165 End Property
' Enabled (set)
167 REM -----------------------------------------------------------------------------------------------------------------------
168 Property Get FontBold() As Variant
169 FontBold = _PropertyGet(
"FontBold
")
170 End Property
' FontBold (get)
172 Property Let FontBold(ByVal pvValue As Variant)
173 Call _PropertySet(
"FontBold
", pvValue)
174 End Property
' FontBold (set)
176 REM -----------------------------------------------------------------------------------------------------------------------
177 Property Get FontItalic() As Variant
178 FontItalic = _PropertyGet(
"FontItalic
")
179 End Property
' FontItalic (get)
181 Property Let FontItalic(ByVal pvValue As Variant)
182 Call _PropertySet(
"FontItalic
", pvValue)
183 End Property
' FontItalic (set)
185 REM -----------------------------------------------------------------------------------------------------------------------
186 Property Get FontName() As Variant
187 FontName = _PropertyGet(
"FontName
")
188 End Property
' FontName (get)
190 Property Let FontName(ByVal pvValue As Variant)
191 Call _PropertySet(
"FontName
", pvValue)
192 End Property
' FontName (set)
194 REM -----------------------------------------------------------------------------------------------------------------------
195 Property Get FontSize() As Variant
196 FontSize = _PropertyGet(
"FontSize
")
197 End Property
' FontSize (get)
199 Property Let FontSize(ByVal pvValue As Variant)
200 Call _PropertySet(
"FontSize
", pvValue)
201 End Property
' FontSize (set)
203 REM -----------------------------------------------------------------------------------------------------------------------
204 Property Get FontUnderline() As Variant
205 FontUnderline = _PropertyGet(
"FontUnderline
")
206 End Property
' FontUnderline (get)
208 Property Let FontUnderline(ByVal pvValue As Variant)
209 Call _PropertySet(
"FontUnderline
", pvValue)
210 End Property
' FontUnderline (set)
212 REM -----------------------------------------------------------------------------------------------------------------------
213 Property Get FontWeight() As Variant
214 FontWeight = _PropertyGet(
"FontWeight
")
215 End Property
' FontWeight (get)
217 Property Let FontWeight(ByVal pvValue As Variant)
218 Call _PropertySet(
"FontWeight
", pvValue)
219 End Property
' FontWeight (set)
221 REM -----------------------------------------------------------------------------------------------------------------------
222 Property Get ForeColor() As Variant
223 ForeColor = _PropertyGet(
"ForeColor
")
224 End Property
' ForeColor (get)
226 Property Let ForeColor(ByVal pvValue As Variant)
227 Call _PropertySet(
"ForeColor
", pvValue)
228 End Property
' ForeColor (set)
230 REM -----------------------------------------------------------------------------------------------------------------------
231 Property Get Form() As Variant
232 Form = _PropertyGet(
"Form
")
233 End Property
' Form (get)
235 REM -----------------------------------------------------------------------------------------------------------------------
236 Property Get Format() As Variant
237 Format = _PropertyGet(
"Format
")
238 End Property
' Format (get)
240 Property Let Format(ByVal pvValue As Variant)
241 Call _PropertySet(
"Format
", pvValue)
242 End Property
' Format (set)
244 REM -----------------------------------------------------------------------------------------------------------------------
245 Property Get ItemData(ByVal Optional pvIndex As Variant) As Variant
246 If IsMissing(pvIndex) Then ItemData = _PropertyGet(
"ItemData
") Else ItemData = _PropertyGet(
"ItemData
", pvIndex)
247 End Property
' ItemData (get)
249 REM -----------------------------------------------------------------------------------------------------------------------
250 Property Get ListCount() As Variant
251 ListCount = _PropertyGet(
"ListCount
")
252 End Property
' ListCount (get)
254 REM -----------------------------------------------------------------------------------------------------------------------
255 Property Get ListIndex() As Variant
256 ListIndex = _PropertyGet(
"ListIndex
")
257 End Property
' ListIndex (get)
259 Property Let ListIndex(ByVal pvValue As Variant)
260 Call _PropertySet(
"ListIndex
", pvValue)
261 End Property
' ListIndex (set)
263 REM -----------------------------------------------------------------------------------------------------------------------
264 Property Get Locked() As Variant
265 Locked = _PropertyGet(
"Locked
")
266 End Property
' Locked (get)
268 Property Let Locked(ByVal pvValue As Variant)
269 Call _PropertySet(
"Locked
", pvValue)
270 End Property
' Locked (set)
272 REM -----------------------------------------------------------------------------------------------------------------------
273 Property Get MultiSelect() As Variant
274 MultiSelect = _PropertyGet(
"MultiSelect
")
275 End Property
' MultiSelect (get)
277 Property Let MultiSelect(ByVal pvValue As Variant)
278 Call _PropertySet(
"MultiSelect
", pvValue)
279 End Property
' MultiSelect (set)
281 REM -----------------------------------------------------------------------------------------------------------------------
282 Property Get Name() As String
283 Name = _PropertyGet(
"Name
")
284 End Property
' Name (get)
286 Public Function pName() As String
' For compatibility with
< V0.9
.0
287 pName = _PropertyGet(
"Name
")
288 End Function
' pName (get)
290 REM -----------------------------------------------------------------------------------------------------------------------
291 Property Get ObjectType() As String
292 ObjectType = _PropertyGet(
"ObjectType
")
293 End Property
' ObjectType (get)
295 REM -----------------------------------------------------------------------------------------------------------------------
296 Property Get OnActionPerformed() As Variant
297 OnActionPerformed = _PropertyGet(
"OnActionPerformed
")
298 End Property
' OnActionPerformed (get)
300 Property Let OnActionPerformed(ByVal pvValue As Variant)
301 Call _PropertySet(
"OnActionPerformed
", pvValue)
302 End Property
' OnActionPerformed (set)
304 REM -----------------------------------------------------------------------------------------------------------------------
305 Property Get OnAdjustmentValueChanged() As Variant
306 OnAdjustmentValueChanged = _PropertyGet(
"OnAdjustmentValueChanged
")
307 End Property
' OnAdjustmentValueChanged (get)
309 Property Let OnAdjustmentValueChanged(ByVal pvValue As Variant)
310 Call _PropertySet(
"OnAdjustmentValueChanged
", pvValue)
311 End Property
' OnAdjustmentValueChanged (set)
313 REM -----------------------------------------------------------------------------------------------------------------------
314 Property Get OnApproveAction() As Variant
315 OnApproveAction = _PropertyGet(
"OnApproveAction
")
316 End Property
' OnApproveAction (get)
318 Property Let OnApproveAction(ByVal pvValue As Variant)
319 Call _PropertySet(
"OnApproveAction
", pvValue)
320 End Property
' OnApproveAction (set)
322 REM -----------------------------------------------------------------------------------------------------------------------
323 Property Get OnApproveReset() As Variant
324 OnApproveReset = _PropertyGet(
"OnApproveReset
")
325 End Property
' OnApproveReset (get)
327 Property Let OnApproveReset(ByVal pvValue As Variant)
328 Call _PropertySet(
"OnApproveReset
", pvValue)
329 End Property
' OnApproveReset (set)
331 REM -----------------------------------------------------------------------------------------------------------------------
332 Property Get OnApproveUpdate() As Variant
333 OnApproveUpdate = _PropertyGet(
"OnApproveUpdate
")
334 End Property
' OnApproveUpdate (get)
336 Property Let OnApproveUpdate(ByVal pvValue As Variant)
337 Call _PropertySet(
"OnApproveUpdate
", pvValue)
338 End Property
' OnApproveUpdate (set)
340 REM -----------------------------------------------------------------------------------------------------------------------
341 Property Get OnChanged() As Variant
342 OnChanged = _PropertyGet(
"OnChanged
")
343 End Property
' OnChanged (get)
345 Property Let OnChanged(ByVal pvValue As Variant)
346 Call _PropertySet(
"OnChanged
", pvValue)
347 End Property
' OnChanged (set)
349 REM -----------------------------------------------------------------------------------------------------------------------
350 Property Get OnErrorOccurred() As Variant
351 OnErrorOccurred = _PropertyGet(
"OnErrorOccurred
")
352 End Property
' OnErrorOccurred (get)
354 Property Let OnErrorOccurred(ByVal pvValue As Variant)
355 Call _PropertySet(
"OnErrorOccurred
", pvValue)
356 End Property
' OnErrorOccurred (set)
358 REM -----------------------------------------------------------------------------------------------------------------------
359 Property Get OnFocusGained() As Variant
360 OnFocusGained = _PropertyGet(
"OnFocusGained
")
361 End Property
' OnFocusGained (get)
363 Property Let OnFocusGained(ByVal pvValue As Variant)
364 Call _PropertySet(
"OnFocusGained
", pvValue)
365 End Property
' OnFocusGained (set)
367 REM -----------------------------------------------------------------------------------------------------------------------
368 Property Get OnFocusLost() As Variant
369 OnFocusLost = _PropertyGet(
"OnFocusLost
")
370 End Property
' OnFocusLost (get)
372 Property Let OnFocusLost(ByVal pvValue As Variant)
373 Call _PropertySet(
"OnFocusLost
", pvValue)
374 End Property
' OnFocusLost (set)
376 REM -----------------------------------------------------------------------------------------------------------------------
377 Property Get OnItemStateChanged() As Variant
378 OnItemStateChanged = _PropertyGet(
"OnItemStateChanged
")
379 End Property
' OnItemStateChanged (get)
381 Property Let OnItemStateChanged(ByVal pvValue As Variant)
382 Call _PropertySet(
"OnItemStateChanged
", pvValue)
383 End Property
' OnItemStateChanged (set)
385 REM -----------------------------------------------------------------------------------------------------------------------
386 Property Get OnKeyPressed() As Variant
387 OnKeyPressed = _PropertyGet(
"OnKeyPressed
")
388 End Property
' OnKeyPressed (get)
390 Property Let OnKeyPressed(ByVal pvValue As Variant)
391 Call _PropertySet(
"OnKeyPressed
", pvValue)
392 End Property
' OnKeyPressed (set)
394 REM -----------------------------------------------------------------------------------------------------------------------
395 Property Get OnKeyReleased() As Variant
396 OnKeyReleased = _PropertyGet(
"OnKeyReleased
")
397 End Property
' OnKeyReleased (get)
399 Property Let OnKeyReleased(ByVal pvValue As Variant)
400 Call _PropertySet(
"OnKeyReleased
", pvValue)
401 End Property
' OnKeyReleased (set)
403 REM -----------------------------------------------------------------------------------------------------------------------
404 Property Get OnMouseDragged() As Variant
405 OnMouseDragged = _PropertyGet(
"OnMouseDragged
")
406 End Property
' OnMouseDragged (get)
408 Property Let OnMouseDragged(ByVal pvValue As Variant)
409 Call _PropertySet(
"OnMouseDragged
", pvValue)
410 End Property
' OnMouseDragged (set)
412 REM -----------------------------------------------------------------------------------------------------------------------
413 Property Get OnMouseEntered() As Variant
414 OnMouseEntered = _PropertyGet(
"OnMouseEntered
")
415 End Property
' OnMouseEntered (get)
417 Property Let OnMouseEntered(ByVal pvValue As Variant)
418 Call _PropertySet(
"OnMouseEntered
", pvValue)
419 End Property
' OnMouseEntered (set)
421 REM -----------------------------------------------------------------------------------------------------------------------
422 Property Get OnMouseExited() As Variant
423 OnMouseExited = _PropertyGet(
"OnMouseExited
")
424 End Property
' OnMouseExited (get)
426 Property Let OnMouseExited(ByVal pvValue As Variant)
427 Call _PropertySet(
"OnMouseExited
", pvValue)
428 End Property
' OnMouseExited (set)
430 REM -----------------------------------------------------------------------------------------------------------------------
431 Property Get OnMouseMoved() As Variant
432 OnMouseMoved = _PropertyGet(
"OnMouseMoved
")
433 End Property
' OnMouseMoved (get)
435 Property Let OnMouseMoved(ByVal pvValue As Variant)
436 Call _PropertySet(
"OnMouseMoved
", pvValue)
437 End Property
' OnMouseMoved (set)
439 REM -----------------------------------------------------------------------------------------------------------------------
440 Property Get OnMousePressed() As Variant
441 OnMousePressed = _PropertyGet(
"OnMousePressed
")
442 End Property
' OnMousePressed (get)
444 Property Let OnMousePressed(ByVal pvValue As Variant)
445 Call _PropertySet(
"OnMousePressed
", pvValue)
446 End Property
' OnMousePressed (set)
448 REM -----------------------------------------------------------------------------------------------------------------------
449 Property Get OnMouseReleased() As Variant
450 OnMouseReleased = _PropertyGet(
"OnMouseReleased
")
451 End Property
' OnMouseReleased (get)
453 Property Let OnMouseReleased(ByVal pvValue As Variant)
454 Call _PropertySet(
"OnMouseReleased
", pvValue)
455 End Property
' OnMouseReleased (set)
457 REM -----------------------------------------------------------------------------------------------------------------------
458 Property Get OnResetted() As Variant
459 OnResetted = _PropertyGet(
"OnResetted
")
460 End Property
' OnResetted (get)
462 Property Let OnResetted(ByVal pvValue As Variant)
463 Call _PropertySet(
"OnResetted
", pvValue)
464 End Property
' OnResetted (set)
466 REM -----------------------------------------------------------------------------------------------------------------------
467 Property Get OnTextChanged() As Variant
468 OnTextChanged = _PropertyGet(
"OnTextChanged
")
469 End Property
' OnTextChanged (get)
471 Property Let OnTextChanged(ByVal pvValue As Variant)
472 Call _PropertySet(
"OnTextChanged
", pvValue)
473 End Property
' OnTextChanged (set)
475 REM -----------------------------------------------------------------------------------------------------------------------
476 Property Get OnUpdated() As Variant
477 OnUpdated = _PropertyGet(
"OnUpdated
")
478 End Property
' OnUpdated (get)
480 Property Let OnUpdated(ByVal pvValue As Variant)
481 Call _PropertySet(
"OnUpdated
", pvValue)
482 End Property
' OnUpdated (set)
484 REM -----------------------------------------------------------------------------------------------------------------------
485 Property Get OptionValue() As Variant
486 OptionValue = _PropertyGet(
"OptionValue
")
487 End Property
' OptionValue (get)
489 Property Let OptionValue(ByVal pvValue As Variant)
490 Call _PropertySet(
"OptionValue
", pvValue)
491 End Property
' OptionValue (set)
493 REM -----------------------------------------------------------------------------------------------------------------------
494 Property Get Page() As Variant
495 Page = _PropertyGet(
"Page
")
496 End Property
' Page (get)
498 Property Let Page(ByVal pvValue As Variant)
499 Call _PropertySet(
"Page
", pvValue)
500 End Property
' Page (set)
502 REM -----------------------------------------------------------------------------------------------------------------------
503 Public Function Parent() As Object
504 Parent = _PropertyGet(
"Parent
")
505 End Function
' Parent (get) V0.9
.1
507 REM -----------------------------------------------------------------------------------------------------------------------
508 Property Get Picture() As Variant
509 Picture = _PropertyGet(
"Picture
")
510 End Property
' Picture (get)
512 Property Let Picture(ByVal pvValue As Variant)
513 Call _PropertySet(
"Picture
", pvValue)
514 End Property
' Picture (set) V1.5
.0
516 REM -----------------------------------------------------------------------------------------------------------------------
517 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
519 ' a Collection object if pvIndex absent
520 ' a Property object otherwise
522 Utils._SetCalledSub(
"Control.Properties
")
523 Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
524 vPropertiesList = _PropertiesList()
525 sObject = Utils._PCase(_Type)
526 If IsMissing(pvIndex) Then
527 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
529 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
530 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
534 Set Properties = vProperty
535 Utils._ResetCalledSub(
"Control.Properties
")
537 End Function
' Properties
539 REM -----------------------------------------------------------------------------------------------------------------------
540 Property Get Required() As Variant
541 Required = _PropertyGet(
"Required
")
542 End Property
' Required (get)
544 Property Let Required(ByVal pvValue As Variant)
545 Call _PropertySet(
"Required
", pvValue)
546 End Property
' Required (set)
548 REM -----------------------------------------------------------------------------------------------------------------------
549 Property Get RowSource() As Variant
550 RowSource = _PropertyGet(
"RowSource
")
551 End Property
' RowSource (get)
553 Property Let RowSource(ByVal pvValue As Variant)
554 Call _PropertySet(
"RowSource
", pvValue)
555 End Property
' RowSource (set)
557 REM -----------------------------------------------------------------------------------------------------------------------
558 Property Get RowSourceType() As Variant
559 RowSourceType = _PropertyGet(
"RowSourceType
")
560 End Property
' RowSourceType (get)
562 Property Let RowSourceType(ByVal pvValue As Variant)
563 Call _PropertySet(
"RowSourceType
", pvValue)
564 End Property
' RowSourceType (set)
566 REM -----------------------------------------------------------------------------------------------------------------------
567 Property Get Selected(ByVal Optional pvIndex As Variant) As Variant
568 If IsMissing(pvIndex) Then Selected = _PropertyGet(
"Selected
") Else Selected = _PropertyGet(
"Selected
", pvIndex)
569 End Property
' Selected (get)
571 Property Let Selected(ByVal pvValue As Variant)
' , ByVal Optional pvIndex As Variant)
572 ' If IsMissing(pvIndex) Then Call _PropertySet(
"Selected
", pvValue) Else Call _PropertySet(
"Selected
", pvValue, pvIndex)
573 Call _PropertySet(
"Selected
", pvValue)
574 End Property
' Selected (set)
576 Public Function SelectedI(ByVal pvValue As variant, ByVal pvIndex As Variant)
577 Call _PropertySet(
"Selected
", pvValue, pvIndex)
580 REM -----------------------------------------------------------------------------------------------------------------------
581 Property Get SelLength() As Variant
582 SelLength = _PropertyGet(
"SelLength
")
583 End Property
' SelLength (get)
585 Property Let SelLength(ByVal pvValue As Variant)
586 Call _PropertySet(
"SelLength
", pvValue)
587 End Property
' SelLength (set)
589 REM -----------------------------------------------------------------------------------------------------------------------
590 Property Get SelStart() As Variant
591 SelStart = _PropertyGet(
"SelStart
")
592 End Property
' SelStart (get)
594 Property Let SelStart(ByVal pvValue As Variant)
595 Call _PropertySet(
"SelStart
", pvValue)
596 End Property
' SelStart (set)
598 REM -----------------------------------------------------------------------------------------------------------------------
599 Property Get SelText() As Variant
600 SelText = _PropertyGet(
"SelText
")
601 End Property
' SelText (get)
603 Property Let SelText(ByVal pvValue As Variant)
604 Call _PropertySet(
"SelText
", pvValue)
605 End Property
' SelText (set)
607 REM -----------------------------------------------------------------------------------------------------------------------
608 Property Get SpecialEffect() As Variant
609 SpecialEffect = _PropertyGet(
"SpecialEffect
")
610 End Property
' SpecialEffect (get)
612 Property Let SpecialEffect(ByVal pvValue As Variant)
613 Call _PropertySet(
"SpecialEffect
", pvValue)
614 End Property
' SpecialEffect (set)
616 REM -----------------------------------------------------------------------------------------------------------------------
617 Property Get SubType() As Variant
618 SubType = _PropertyGet(
"SubType
")
619 End Property
' SubType (get)
621 REM -----------------------------------------------------------------------------------------------------------------------
622 Property Get TabIndex() As Variant
623 TabIndex = _PropertyGet(
"TabIndex
")
624 End Property
' TabIndex (get)
626 Property Let TabIndex(ByVal pvValue As Variant)
627 Call _PropertySet(
"TabIndex
", pvValue)
628 End Property
' TabIndex (set)
630 REM -----------------------------------------------------------------------------------------------------------------------
631 Property Get TabStop() As Variant
632 TabStop = _PropertyGet(
"TabStop
")
633 End Property
' TabStop (get)
635 Property Let TabStop(ByVal pvValue As Variant)
636 Call _PropertySet(
"TabStop
", pvValue)
637 End Property
' TabStop (set)
639 REM -----------------------------------------------------------------------------------------------------------------------
640 Property Get Tag() As Variant
641 Tag = _PropertyGet(
"Tag
")
642 End Property
' Tag (get)
644 Property Let Tag(ByVal pvValue As Variant)
645 Call _PropertySet(
"Tag
", pvValue)
646 End Property
' Tag (set)
648 REM -----------------------------------------------------------------------------------------------------------------------
649 Property Get Text() As Variant
650 Text = _PropertyGet(
"Text
")
651 End Property
' Text (get)
653 Public Function pText() As Variant
654 pText = _PropertyGet(
"Text
")
655 End Function
' pText (get)
657 REM -----------------------------------------------------------------------------------------------------------------------
658 Property Get TextAlign() As Variant
659 TextAlign = _PropertyGet(
"TextAlign
")
660 End Property
' TextAlign (get)
662 Property Let TextAlign(ByVal pvValue As Variant)
663 Call _PropertySet(
"TextAlign
", pvValue)
664 End Property
' TextAlign (set)
666 REM -----------------------------------------------------------------------------------------------------------------------
667 Property Get TripleState() As Variant
668 TripleState = _PropertyGet(
"TripleState
")
669 End Property
' TripleState (get)
671 Property Let TripleState(ByVal pvValue As Variant)
672 Call _PropertySet(
"TripleState
", pvValue)
673 End Property
' TripleState (set)
675 REM -----------------------------------------------------------------------------------------------------------------------
676 Property Get Value() As Variant
677 Value = _PropertyGet(
"Value
")
678 End Property
' Value (get)
680 Property Let Value(ByVal pvValue As Variant)
681 Call _PropertySet(
"Value
", pvValue)
682 End Property
' Value (set)
684 REM -----------------------------------------------------------------------------------------------------------------------
685 Property Get Visible() As Variant
686 Visible = _PropertyGet(
"Visible
")
687 End Property
' Visible (get)
689 Property Let Visible(ByVal pvValue As Variant)
690 Call _PropertySet(
"Visible
", pvValue)
691 End Property
' Visible (set)
693 REM -----------------------------------------------------------------------------------------------------------------------
694 REM --- CLASS METHODS ---
695 REM -----------------------------------------------------------------------------------------------------------------------
697 Public Function AddItem(ByVal Optional pvItem As Variant, ByVal Optional pvIndex) As Boolean
698 ' Add an item in a Listbox
700 Utils._SetCalledSub(
"Control.AddItem
")
702 If _ErrorHandler() Then On Local Error Goto Error_Function
704 If IsMissing(pvItem) Then Call _TraceArguments()
705 If IsMissing(pvIndex) Then pvIndex = -
1
707 Dim iArgNr As Integer
708 Select Case UCase(_A2B_.CalledSub)
709 Case UCase(
"AddItem
") : iArgNr =
1
710 Case UCase(
"Control.AddItem
") : iArgNr =
0
713 If Not Utils._CheckArgument(pvItem, iArgNr +
1, vbString) Then Goto Exit_Function
714 If Not Utils._CheckArgument(pvIndex, iArgNr +
2, Utils._AddNumeric()) Then Goto Exit_Function
715 If _SubType
<> CTLLISTBOX Then Goto Error_Control
716 If _ParentType
<> CTLPARENTISDIALOG Then
717 If ControlModel.ListSourceType
<> com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
720 Dim vRowSource() As Variant, iCount As Integer, i As Integer
721 If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
722 iCount = UBound(vRowSource)
723 If pvIndex
< -
1 Or pvIndex
> iCount +
1 Then Goto Error_Index
724 ReDim Preserve vRowSource(
0 To iCount +
1)
725 If pvIndex = -
1 Then pvIndex = iCount +
1
726 For i = iCount +
1 To pvIndex +
1 Step -
1
727 vRowSource(i) = vRowSource(i -
1)
729 vRowSource(pvIndex) = pvItem
731 If _ParentType
<> CTLPARENTISDIALOG Then
732 ControlModel.ListSource = vRowSource()
734 ControlModel.StringItemList = vRowSource()
738 Utils._ResetCalledSub(
"Control.AddItem
")
741 TraceError(TRACEABORT, Err,
"Control.AddItem
", Erl)
745 TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(),
0, ,
"Control.AddItem
")
749 TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(iArgNr +
2,pvIndex))
752 End Function
' AddItem V0.9
.1
754 REM -----------------------------------------------------------------------------------------------------------------------
755 Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
756 ' Return a Control object with name or index = pvIndex
758 Const cstThisSub =
"Control.Controls
"
759 If _ErrorHandler() Then On Local Error Goto Error_Function
760 Utils._SetCalledSub(cstThisSub)
762 Dim ocControl As Variant, sParentShortcut As String, iControlCount As Integer
763 Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String
764 Dim j As Integer, oView As Object
766 If _SubType
<> CTLGRIDCONTROL Then Goto Trace_Error_Context
767 Set ocControl = Nothing
768 iControlCount = ControlModel.getCount()
770 If IsMissing(pvIndex) Then
' No argument, return Collection pseudo-object
771 Set oCounter = New Collect
772 Set oCounter._This = oCounter
773 oCounter._CollType = COLLCONTROLS
774 Set oCounter._Parent = _This
775 oCounter._Count = iControlCount
776 Set Controls = oCounter
780 If Not Utils._CheckArgument(pvIndex,
1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
782 ' Start building the ocControl object
783 ' Determine exact name
784 Set ocControl = New Control
785 Set ocControl._This = ocControl
786 Set ocControl._Parent = _This
787 ocControl._ParentType = CTLPARENTISGRID
788 sParentShortcut = _Shortcut
789 sControls() = ControlModel.getElementNames()
791 Select Case VarType(pvIndex)
792 Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
793 If pvIndex
< 0 Or pvIndex
> iControlCount -
1 Then Goto Trace_Error_Index
794 ocControl._Name = sControls(pvIndex)
795 Case vbString
' Check control name validity (non case sensitive)
797 sIndex = UCase(Utils._Trim(pvIndex))
798 For i =
0 To iControlCount -
1
799 If UCase(sControls(i)) = sIndex Then
804 If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
808 ._Shortcut = sParentShortcut
& "!
" & Utils._Surround(._Name)
809 Set .ControlModel = ControlModel.getByName(._Name)
810 ._ImplementationName = .ControlModel.ColumnServiceName
' getImplementationName aborts for subcontrols !?
811 ._FormComponent = ParentComponent
812 ._MainForm = _MainForm
813 If Utils._hasUNOProperty(.ControlModel,
"ClassId
") Then ._ClassId = .ControlModel.ClassId
814 ' Complex bypass to find View of grid subcontrols !
815 If Not IsNull(ControlView) Then
' Anticipate absence of ControlView in grid controls when edit mode
816 For i =
0 to ControlView.getCount() -
1
817 Set oView = ControlView.GetByIndex(i)
818 If Not IsNull(oView) Then
819 If oView.getModel.Name = ._Name Then
820 Set .ControlView = oView
828 ._DocEntry = _DocEntry
831 Set Controls = ocControl
834 Utils._ResetCalledSub(cstThisSub)
837 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(),
0,
1)
838 Set Controls = Nothing
841 TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(),
0, , Array(pvIndex, _Name))
842 Set Controls = Nothing
845 TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(),
0, ,
"Grid.Controls
")
846 Set Controls = Nothing
849 TraceError(TRACEABORT, Err, cstThisSub, Erl)
850 Set Controls = Nothing
852 End Function
' Controls
854 REM -----------------------------------------------------------------------------------------------------------------------
855 Public Function getProperty(Optional ByVal pvProperty As Variant, ByVal Optional pvIndex As Variant) As Variant
856 ' Return property value of psProperty property name
858 Utils._SetCalledSub(
"Control.getProperty
")
859 If IsMissing(pvProperty) Then Call _TraceArguments()
860 If IsMissing(pvIndex) Then
861 getProperty = _PropertyGet(pvProperty)
863 getProperty = _PropertyGet(pvProperty, pvIndex)
865 Utils._ResetCalledSub(
"Control.getProperty
")
867 End Function
' getProperty
869 REM -----------------------------------------------------------------------------------------------------------------------
870 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
871 ' Return True if object has a valid property called pvProperty (case-insensitive comparison !)
873 If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
876 End Function
' hasProperty
878 REM -----------------------------------------------------------------------------------------------------------------------
879 Public Function RemoveItem(ByVal Optional pvIndex) As Boolean
880 ' Remove an item from a Listbox
881 ' Index may be a string value or an index-position
883 Utils._SetCalledSub(
"Control.RemoveItem
")
884 If _ErrorHandler() Then On Local Error Goto Error_Function
886 If IsMissing(pvIndex) Then Call _TraceArguments()
887 Dim iArgNr As Integer
888 Select Case UCase(_A2B_.CalledSub)
889 Case UCase(
"RemoveItem
") : iArgNr =
1
890 Case UCase(
"Control.RemoveItem
") : iArgNr =
0
892 If Not Utils._CheckArgument(pvIndex, iArgNr +
1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
893 If _SubType
<> CTLLISTBOX Then Goto Error_Control
894 If _ParentType
<> CTLPARENTISDIALOG Then
895 If ControlModel.ListSourceType
<> com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
898 Dim vRowSource() As Variant, iCount As Integer, i As Integer, j As integer, bFound As Boolean
899 If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
900 iCount = UBound(vRowSource)
902 Select Case VarType(pvIndex)
906 If vRowSource(i) = pvIndex Then
907 For j = i To iCount -
1
908 vRowSource(j) = vRowSource(j +
1)
911 Exit For
' Remove only
1st occurrence of string
915 If pvIndex
< 0 Or pvIndex
> iCount Then Goto Error_Index
916 For i = pvIndex To iCount -
1
917 vRowSource(i) = vRowSource(i +
1)
923 If iCount
> 0 Then
' https://forum.openoffice.org/en/forum/viewtopic.php?f=
47&t=
75008
924 ReDim Preserve vRowSource(
0 To iCount -
1)
928 If _ParentType
<> CTLPARENTISDIALOG Then
929 ControlModel.ListSource = vRowSource()
931 ControlModel.StringItemList = vRowSource()
938 Utils._ResetCalledSub(
"Control.RemoveItem
")
941 TraceError(TRACEABORT, Err,
"Control.RemoveItem
", Erl)
945 TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(),
0,
1,
"Control.RemoveItem
")
949 TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(
2, pvIndex))
952 End Function
' RemoveItem V0.9
.1
954 REM -----------------------------------------------------------------------------------------------------------------------
955 Public Function Requery() As Boolean
956 ' Refresh data displayed in a form, subform, combobox or listbox
957 Utils._SetCalledSub(
"Control.Requery
")
958 If _ErrorHandler() Then On Local Error Goto Error_Function
962 Case CTLCOMBOBOX, CTLLISTBOX
963 If Utils._InList(ControlModel.ListSourceType, Array( _
964 com.sun.star.form.ListSourceType.QUERY _
965 , com.sun.star.form.ListSourceType.TABLE _
966 , com.sun.star.form.ListSourceType.TABLEFIELDS _
967 , com.sun.star.form.ListSourceType.SQL _
968 , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
970 ControlModel.refresh()
978 Utils._ResetCalledSub(
"Control.Requery
")
981 TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(),
0,
1,
"Control.Requery
")
985 TraceError(TRACEABORT, Err,
"Control.Requery
", Erl)
987 End Function
' Requery
989 REM -----------------------------------------------------------------------------------------------------------------------
990 Public Function SetFocus() As Boolean
991 ' Execute setFocus method
992 Utils._SetCalledSub(
"Control.SetFocus
")
993 If _ErrorHandler() Then On Local Error Goto Error_Function
996 Dim i As Integer, j As Integer, iColPosition As Integer
997 Dim ocControl As Object, ocGrid As Variant, oGridModel As Object
999 If IsNull(ControlView) Then GoTo Exit_Function
1000 If _ParentType = CTLPARENTISGRID Then
'setFocus method does not work on controlviews in grid ?!?
1001 ' Find column position of control
1003 ocGrid = getObject(_getUpperShortcut(_Shortcut, _Name))
' return containing grid
1004 Set oGridModel = ocGrid.ControlModel
1006 For i =
0 To oGridModel.Count -
1
1007 Set ocControl = oGridModel.GetByIndex(i)
1008 If Not ocControl.Hidden Then j = j +
1 ' Skip if hidden
1009 If oGridModel.GetByIndex(i).Name = _Name Then
1014 If iColPosition
>=
0 Then
1015 ocGrid.ControlView.setFocus()
'Set first focus on grid itself
1016 ocGrid.ControlView.setCurrentColumnPosition(iColPosition)
'Deprecated but no alternative found
1021 ControlView.setFocus()
1026 Utils._ResetCalledSub(
"Control.SetFocus
")
1029 TraceError(TRACEABORT, Err,
"Control.SetFocus
", Erl)
1032 TraceError(TRACEFATAL, ERRFOCUSINGRID, Utils._CalledSub(),
0,
1, Array(_Name, ocGrid._Name))
1034 End Function
' SetFocus V0.9
.0
1036 REM -----------------------------------------------------------------------------------------------------------------------
1037 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
1038 ' Return True if property setting OK
1039 Utils._SetCalledSub(
"Control.setProperty
")
1040 If IsMissing(pvIndex) Then
1041 setProperty = _PropertySet(psProperty, pvValue)
1043 setProperty = _PropertySet(psProperty, pvValue, pvIndex)
1045 Utils._ResetCalledSub(
"Control.setProperty
")
1046 End Function
' setProperty
1048 REM -----------------------------------------------------------------------------------------------------------------------
1049 Public Function SetSelected(ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
1050 ' Workaround for limitation of Basic: Property Let does not accept optional arguments
1052 If IsMissing(pvValue) Then Call _TraceArguments()
1053 If IsMissing(pvIndex) Then
1054 SetSelected = _PropertySet(
"Selected
", pvValue)
1056 SetSelected = _PropertySet(
"Selected
", pvValue, pvIndex)
1059 End Function
' SetSelected
1061 REM -----------------------------------------------------------------------------------------------------------------------
1062 REM --- PRIVATE FUNCTIONS ---
1063 REM -----------------------------------------------------------------------------------------------------------------------
1064 Private Function _Formats(ByVal psControlType As String) As Variant
1065 ' Return allowed format entries for Date and Time control types
1067 Dim vFormats() As Variant
1068 Select Case psControlType
1071 "Standard (short)
" _
1072 ,
"Standard (short YY)
" _
1073 ,
"Standard (short YYYY)
" _
1074 ,
"Standard (long)
" _
1075 ,
"DD/MM/YY
" _
1076 ,
"MM/DD/YY
" _
1077 ,
"YY/MM/DD
" _
1078 ,
"DD/MM/YYYY
" _
1079 ,
"MM/DD/YYYY
" _
1080 ,
"YYYY/MM/DD
" _
1081 ,
"YY-MM-DD
" _
1082 ,
"YYYY-MM-DD
" _
1086 "24h short
" _
1087 ,
"24h long
" _
1088 ,
"12h short
" _
1089 ,
"12h long
" _
1097 End Function
' _Formats V0.9
.1
1099 REM -----------------------------------------------------------------------------------------------------------------------
1100 Private Function _GetListener(ByVal psProperty As String) As String
1101 ' Return the X...Listener corresponding with the property in argument
1103 Select Case UCase(psProperty)
1104 Case UCase(
"OnActionPerformed
")
1105 _GetListener =
"XActionListener
"
1106 Case UCase(
"OnAdjustmentValueChanged
")
1107 _GetListener =
"XAdjustmentListener
"
1108 Case UCase(
"OnApproveAction
")
1109 _GetListener =
"XApproveActionListener
"
1110 Case UCase(
"OnApproveReset
"), UCase(
"OnResetted
")
1111 _GetListener =
"XResetListener
"
1112 Case UCase(
"OnApproveUpdate
"), UCase(
"OnUpdated
")
1113 _GetListener =
"XUpdateListener
"
1114 Case UCase(
"OnChanged
")
1115 _GetListener =
"XChangeListener
"
1116 Case UCase(
"OnErrorOccurred
")
1117 _GetListener =
"XErrorListener
"
1118 Case UCase(
"OnFocusGained
"), UCase(
"OnFocusLost
")
1119 _GetListener =
"XFocusListener
"
1120 Case UCase(
"OnItemStateChanged
")
1121 _GetListener =
"XItemListener
"
1122 Case UCase(
"OnKeyPressed
"), UCase(
"OnKeyReleased
")
1123 _GetListener =
"XKeyListener
"
1124 Case UCase(
"OnMouseDragged
"), UCase(
"OnMouseMoved
")
1125 _GetListener =
"XMouseMotionListener
"
1126 Case UCase(
"OnMouseEntered
"), UCase(
"OnMouseExited
"), UCase(
"OnMousePressed
"), UCase(
"OnMouseReleased
")
1127 _GetListener =
"XMouseListener
"
1128 Case UCase(
"OnTextChanged
")
1129 _GetListener =
"XTextListener
"
1132 End Function
' _GetListener V1.7
.0
1134 REM -----------------------------------------------------------------------------------------------------------------------
1135 Public Sub _Initialize()
1136 ' Initialize new Control
1137 ' ControlModel, ParentType, Name, Shortcut, ControlView, ImplementationName, ClassId (if parent
<> dialog)
1138 ' are presumed preexisting
1140 ' Identify SubType and ControlView
1141 Dim sControlTypes() As Variant, i As Integer, vSplit() As Variant, sTrailer As String
1142 sControlTypes = array( CTLCONTROL _
1143 , CTLCOMMANDBUTTON _
1154 , CTLHIDDENCONTROL _
1159 , CTLCURRENCYFIELD _
1163 , CTLNAVIGATIONBAR _
1168 Select Case _ParentType
1169 Case CTLPARENTISDIALOG
1170 vSplit = Split(ControlModel.getServiceName(),
".
")
1171 sTrailer = UCase(vSplit(UBound(vSplit)))
1172 ' Manage homonyms
1173 Select Case sTrailer
1174 Case
"BUTTON
" : sTrailer = CTLCOMMANDBUTTON
1175 Case
"EDIT
" : sTrailer = CTLTEXTFIELD
1178 If sTrailer
<> CTLFORMATTEDFIELD Then
1179 For i =
0 To UBound(sControlTypes)
1180 If sControlTypes(i) = sTrailer Then
1183 _ControlType = _ClassId
1188 _ClassId = acFormattedField
1189 _SubType = CTLFORMATTEDFIELD
1190 _ControlType = _ClassId
1193 'Is ClassId one of the properties ?
1194 If _ClassId
> 0 Then
' All control types have a ClassId except subforms
1195 _SubType = sControlTypes(_ClassId -
1)
1196 _ControlType = _ClassId
1197 If _SubType = CTLTEXTFIELD Then
' Formatted fields belong to the TextField family
1198 If _ImplementationName =
"com.sun.star.comp.forms.OFormattedFieldWrapper
" _
1199 Or _ImplementationName =
"com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted
" _
1200 Or _ImplementationName =
"com.sun.star.form.component.FormattedField
" Then
' When in datagrid
1201 _SubType = CTLFORMATTEDFIELD
1202 _ControlType = acFormattedField
1205 Else
' Initialize subform Control
1206 If ControlModel.ImplementationName =
"com.sun.star.comp.forms.ODatabaseForm
" Then
1207 _SubType = CTLSUBFORM
1208 _ControlType = acSubform
1213 End Sub
' _Initialize
1215 REM -----------------------------------------------------------------------------------------------------------------------
1216 Public Function _ListboxBound() As Boolean
1217 ' Return True if listbox has a bound column
1219 Dim bListboxBound As Boolean, j As Integer
1220 Dim vValue() As variant, vString As Variant
1222 bListboxBound = False
1224 If Not IsNull(ControlModel.ValueItemList) _
1225 And ControlModel.DataField
<> "" _
1226 And Not IsNull(ControlModel.BoundField) _
1227 And Utils._InList(ControlModel.ListSourceType, Array( _
1228 com.sun.star.form.ListSourceType.TABLE _
1229 , com.sun.star.form.ListSourceType.QUERY _
1230 , com.sun.star.form.ListSourceType.SQL _
1231 , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
1232 )) Then
' MultiSelect behaviour changed in OpenOffice
>=
3.3
1233 If IsArray(ControlModel.ValueItemList) Then
1234 vValue = ControlModel.ValueItemList
1235 vString = ControlModel.StringItemList
1236 For j =
0 To UBound(vValue)
1237 If VarType(vValue(j))
<> VarType(vString(j)) Then
1238 bListboxBound = True
1239 ElseIf vValue(j)
<> vString(j) Then
1240 bListboxBound = True
1242 If bListboxBound Then Exit For
1247 _ListboxBound = bListboxBound
1249 End Function
' _ListboxBound V0.9
.0
1251 REM -----------------------------------------------------------------------------------------------------------------------
1252 Private Function _PropertiesList() As Variant
1253 ' Based on ControlProperties.ods analysis
1255 Dim vFullPropertiesList() As Variant
1257 'List established only once
1258 If UBound(_ThisProperties)
> -
1 Then
1259 _PropertiesList = _ThisProperties
1263 vFullPropertiesList = Array( _
1264 "BackColor
" _
1265 ,
"BorderColor
" _
1266 ,
"BorderStyle
" _
1267 ,
"Cancel
" _
1268 ,
"Caption
" _
1269 ,
"ControlSource
" _
1270 ,
"ControlTipText
" _
1271 ,
"ControlType
" _
1272 ,
"Default
" _
1273 ,
"DefaultValue
" _
1274 ,
"Enabled
" _
1275 ,
"FontBold
" _
1276 ,
"FontItalic
" _
1277 ,
"FontName
" _
1278 ,
"FontSize
" _
1279 ,
"FontUnderline
" _
1280 ,
"FontWeight
" _
1281 ,
"ForeColor
" _
1282 ,
"Form
" _
1283 ,
"Format
" _
1284 ,
"ItemData
" _
1285 ,
"LinkChildFields
" _
1286 ,
"LinkMasterFields
" _
1287 ,
"ListCount
" _
1288 ,
"ListIndex
" _
1289 ,
"Locked
" _
1290 ,
"MultiSelect
" _
1291 ,
"Name
" _
1292 ,
"ObjectType
" _
1293 ,
"OnActionPerformed
" _
1294 ,
"OnAdjustmentValueChanged
" _
1295 ,
"OnApproveAction
" _
1296 ,
"OnApproveReset
" _
1297 ,
"OnApproveUpdate
" _
1298 ,
"OnChanged
" _
1299 ,
"OnErrorOccurred
" _
1300 ,
"OnFocusGained
" _
1301 ,
"OnFocusLost
" _
1302 ,
"OnItemStateChanged
" _
1303 ,
"OnKeyPressed
" _
1304 ,
"OnKeyReleased
" _
1305 ,
"OnMouseDragged
" _
1306 ,
"OnMouseEntered
" _
1307 ,
"OnMouseExited
" _
1308 ,
"OnMouseMoved
" _
1309 ,
"OnMousePressed
" _
1310 ,
"OnMouseReleased
" _
1311 ,
"OnResetted
" _
1312 ,
"OnTextChanged
" _
1313 ,
"OnUpdated
" _
1314 ,
"OptionValue
" _
1315 ,
"Page
" _
1316 ,
"Parent
" _
1317 ,
"Picture
" _
1318 ,
"Required
" _
1319 ,
"RowSource
" _
1320 ,
"RowSourceType
" _
1321 ,
"Selected
" _
1322 ,
"SelLength
" _
1323 ,
"SelStart
" _
1324 ,
"Seltext
" _
1325 ,
"SpecialEffect
" _
1326 ,
"SubType
" _
1327 ,
"TabIndex
" _
1328 ,
"TabStop
" _
1330 ,
"Text
" _
1331 ,
"TextAlign
" _
1332 ,
"TripleState
" _
1333 ,
"Value
" _
1334 ,
"Visible
" _
1336 Dim vPropertiesMatrix(
25) As Variant
1337 Select Case _ParentType
1338 Case CTLPARENTISFORM, CTLPARENTISSUBFORM
1339 vPropertiesMatrix(acCheckBox) = Array(
0,
4,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
32,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
52,
54,
61,
62,
63,
64,
65,
67,
68,
69,
70)
1340 vPropertiesMatrix(acComboBox) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
20,
23,
24,
25,
27,
28,
29,
32,
33,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
55,
56,
62,
63,
64,
65,
66,
67,
69,
70)
1341 vPropertiesMatrix(acCommandButton) = Array(
0,
3,
4,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
31,
32,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
52,
53,
62,
63,
64,
65,
67,
69,
70)
1342 vPropertiesMatrix(acCurrencyField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
63,
64,
65,
67,
69,
70)
1343 vPropertiesMatrix(acDateField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
63,
64,
65,
66,
67,
69,
70)
1344 vPropertiesMatrix(acFileControl) = Array(
0,
1,
2,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
32,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
52,
62,
63,
64,
65,
66,
69,
70)
1345 vPropertiesMatrix(acFixedText) = Array(
0,
1,
2,
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
52,
62,
65,
67,
70)
1346 vPropertiesMatrix(acFormattedField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
32,
33,
35,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
63,
64,
65,
66,
67,
69,
70)
1347 vPropertiesMatrix(acGridControl) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
32,
33,
35,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
49,
52,
62,
63,
64,
65,
70)
1348 vPropertiesMatrix(acGroupBox) = Array(
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
32,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
52,
62,
65,
70)
1349 vPropertiesMatrix(acHiddenControl) = Array(
7,
27,
28,
52,
62,
65,
69,
70)
1350 vPropertiesMatrix(acImageButton) = Array(
0,
1,
2,
6,
7,
10,
27,
28,
31,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
52,
53,
62,
63,
64,
65,
70)
1351 vPropertiesMatrix(acImageControl) = Array(
0,
1,
2,
5,
6,
7,
10,
25,
27,
28,
32,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
52,
53,
54,
62,
63,
64,
65,
70)
1352 vPropertiesMatrix(acListBox) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
20,
23,
24,
25,
26,
27,
28,
29,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
49,
52,
54,
55,
56,
57,
62,
63,
64,
65,
67,
69,
70)
1353 vPropertiesMatrix(acNavigationBar) = Array(
0,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
52,
62,
63,
64,
65,
70)
1354 vPropertiesMatrix(acNumericField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
63,
64,
65,
67,
69,
70)
1355 vPropertiesMatrix(acPatternField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
58,
59,
60,
62,
63,
64,
65,
66,
67,
69,
70)
1356 vPropertiesMatrix(acRadioButton) = Array(
0,
4,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
32,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
50,
52,
54,
61,
62,
63,
64,
65,
67,
69,
70)
1357 vPropertiesMatrix(acScrollBar) = Array(
0,
1,
2,
6,
7,
10,
27,
28,
30,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
49,
52,
62,
63,
64,
65,
69,
70)
1358 vPropertiesMatrix(acSpinButton) = Array(
0,
1,
2,
6,
7,
9,
10,
27,
28,
30,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
49,
52,
62,
63,
64,
65,
69,
70)
1359 vPropertiesMatrix(
0) = Array(
7,
18,
21,
22,
27,
28,
52,
62)
1360 vPropertiesMatrix(acTextField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
32,
33,
34,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
58,
59,
60,
62,
63,
64,
65,
66,
67,
69,
70)
1361 vPropertiesMatrix(acTimeField) = Array(
0,
1,
2,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
63,
64,
65,
66,
67,
69,
70)
1362 Case CTLPARENTISGROUP
1363 ' To be duplicated from above !!!
1364 vPropertiesMatrix(acRadioButton) = Array(
0,
4,
5,
6,
7,
9,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
32,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
50,
52,
54,
61,
62,
63,
64,
65,
67,
69,
70)
1365 Case CTLPARENTISGRID
1366 vPropertiesMatrix(acCheckBox) = Array(
4,
5,
6,
7,
9,
10,
27,
28,
29,
32,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
52,
54,
61,
62,
65,
67,
68,
69)
1367 vPropertiesMatrix(acComboBox) = Array(
4,
5,
6,
7,
9,
10,
20,
23,
24,
25,
27,
28,
32,
33,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
55,
56,
62,
65,
66,
67,
69)
1368 vPropertiesMatrix(acCurrencyField) = Array(
4,
5,
6,
7,
9,
10,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
65,
67,
69)
1369 vPropertiesMatrix(acDateField) = Array(
4,
5,
6,
7,
9,
10,
19,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
65,
66,
67,
69)
1370 vPropertiesMatrix(acFormattedField) = Array(
4,
5,
6,
7,
9,
10,
19,
25,
27,
28,
32,
33,
35,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
65,
66,
67,
69)
1371 vPropertiesMatrix(acListBox) = Array(
4,
5,
6,
7,
9,
10,
20,
23,
24,
25,
26,
27,
28,
32,
33,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
49,
52,
54,
55,
56,
57,
62,
65,
67,
69)
1372 vPropertiesMatrix(acNumericField) = Array(
4,
5,
6,
7,
9,
10,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
65,
67,
69)
1373 vPropertiesMatrix(acPatternField) = Array(
4,
5,
6,
7,
9,
10,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
58,
59,
60,
62,
65,
66,
67,
69)
1374 vPropertiesMatrix(acTextField) = Array(
4,
5,
6,
7,
9,
10,
25,
27,
28,
32,
33,
34,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
58,
59,
60,
62,
65,
66,
67,
69)
1375 vPropertiesMatrix(acTimeField) = Array(
4,
5,
6,
7,
9,
10,
19,
25,
27,
28,
32,
33,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
52,
54,
62,
65,
66,
67,
69)
1376 Case CTLPARENTISDIALOG
1377 vPropertiesMatrix(acCheckBox) = Array(
0,
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
61,
62,
63,
64,
65,
67,
68,
69,
70)
1378 vPropertiesMatrix(acComboBox) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
20,
23,
24,
25,
27,
28,
29,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
55,
62,
63,
64,
65,
66,
67,
69,
70)
1379 vPropertiesMatrix(acCommandButton) = Array(
0,
3,
4,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
53,
62,
63,
64,
65,
67,
70)
1380 vPropertiesMatrix(acCurrencyField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
67,
69,
70)
1381 vPropertiesMatrix(acDateField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
66,
67,
69,
70)
1382 vPropertiesMatrix(acFileControl) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
66,
67,
69,
70)
1383 vPropertiesMatrix(acFixedLine) = Array(
0,
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
62,
63,
65,
70)
1384 vPropertiesMatrix(acFixedText) = Array(
0,
1,
2,
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
62,
63,
64,
65,
67,
70)
1385 vPropertiesMatrix(acFormattedField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
66,
67,
69,
70)
1386 vPropertiesMatrix(acGroupBox) = Array(
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
62,
63,
65,
70)
1387 vPropertiesMatrix(acImageControl) = Array(
0,
1,
2,
6,
7,
10,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
53,
62,
63,
64,
65,
70)
1388 vPropertiesMatrix(acListBox) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
20,
23,
24,
25,
26,
27,
28,
29,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
55,
57,
62,
63,
64,
65,
67,
69,
70)
1389 vPropertiesMatrix(acNavigationBar) = Array(
36,
37,
39,
40,
41,
42,
43,
44,
45,
46)
1390 vPropertiesMatrix(acNumericField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
67,
69,
70)
1391 vPropertiesMatrix(acPatternField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
58,
59,
60,
62,
63,
64,
65,
66,
67,
69,
70)
1392 vPropertiesMatrix(acProgressBar) = Array(
0,
1,
2,
6,
7,
10,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
62,
63,
65,
69,
70)
1393 vPropertiesMatrix(acRadioButton) = Array(
0,
4,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
27,
28,
29,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
50,
51,
52,
61,
62,
63,
64,
65,
67,
69,
70)
1394 vPropertiesMatrix(acScrollBar) = Array(
0,
1,
2,
6,
7,
10,
27,
28,
30,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
51,
52,
62,
63,
64,
65,
69,
70)
1395 vPropertiesMatrix(acTextField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
58,
59,
60,
62,
63,
64,
65,
66,
67,
69,
70)
1396 vPropertiesMatrix(acTimeField) = Array(
0,
1,
2,
6,
7,
10,
11,
12,
13,
14,
15,
16,
17,
19,
25,
27,
28,
36,
37,
39,
40,
41,
42,
43,
44,
45,
46,
48,
51,
52,
62,
63,
64,
65,
66,
67,
69,
70)
1399 Dim i As Integer, iIndex As Integer
1400 If _ControlType = acSubForm Then iIndex =
0 Else iIndex = _ControlType
1401 If IsEmpty(vPropertiesMatrix(iIndex)) Then
1402 _ThisProperties = Array()
1404 ReDim _ThisProperties(
0 To UBound(vPropertiesMatrix(iIndex)))
1405 For i =
0 To UBound(_ThisProperties)
1406 _ThisProperties(i) = vFullPropertiesList(vPropertiesMatrix(iIndex)(i))
1410 _PropertiesList = _ThisProperties()
1412 End Function
' _PropertiesList
1414 REM -----------------------------------------------------------------------------------------------------------------------
1415 Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
1416 ' Return property value of the psProperty property name
1419 If _ErrorHandler() Then On Local Error Goto Error_Function
1420 Utils._SetCalledSub(
"Control.get
" & psProperty)
1421 _PropertyGet = EMPTY
1423 'Check Index argument
1424 Dim iArgNr As Integer
1425 If Not IsMissing(pvIndex) Then
1426 Select Case UCase(_A2B_.CalledSub)
1427 Case UCase(
"getProperty
") : iArgNr =
3
1428 Case UCase(
"Control.getProperty
") : iArgNr =
2
1429 Case UCase(
"Control.get
" & psProperty) : iArgNr =
1
1431 If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
1434 Dim vDefaultValue As Variant, oDefaultValue As Object, vValue As Variant, oValue As Object, iIndex As Integer
1435 Dim lListIndex As Long, i As Integer, j As Integer, vCurrentValue As Variant, lListCount As Long
1436 Dim vListboxValue As Variant, vListSource, bSelected() As Boolean, bListboxBound As Boolean
1437 Dim vGet As Variant, vDate As Variant
1438 Dim ofSubForm As Object
1439 Dim vFormats() As Variant
1440 Dim vSelection As Variant, sSelectedText As String
1441 Dim oControlEvents As Object, sEventName As String
1443 If Not hasProperty(psProperty) Then Goto Trace_Error
1445 Select Case UCase(psProperty)
1446 Case UCase(
"BackColor
")
1447 If Utils._hasUNOProperty(ControlModel,
"BackgroundColor
") Then _PropertyGet = ControlModel.BackgroundColor
1448 Case UCase(
"BorderColor
")
1449 If Utils._hasUNOProperty(ControlModel,
"BorderColor
") Then _PropertyGet = ControlModel.BorderColor
1450 Case UCase(
"BorderStyle
")
1451 If Utils._hasUNOProperty(ControlModel,
"Border
") Then _PropertyGet = ControlModel.Border
1452 Case UCase(
"Cancel
")
1453 If Utils._hasUNOProperty(ControlModel,
"PushButtonType
") Then _PropertyGet = ( ControlModel.PushButtonType = com.sun.star.awt.PushButtonType.CANCEL )
1454 Case UCase(
"Caption
")
1455 If Utils._hasUNOProperty(ControlModel,
"Label
") Then _PropertyGet = ControlModel.Label
1456 Case UCase(
"ControlSource
")
1457 If Utils._hasUNOProperty(ControlModel,
"DataField
") Then _PropertyGet = ControlModel.DataField
1458 Case UCase(
"ControlTipText
")
1459 If Utils._hasUNOProperty(ControlModel,
"HelpText
") Then _PropertyGet = ControlModel.HelpText
1460 Case UCase(
"ControlType
")
1461 _PropertyGet = _ControlType
1462 Case UCase(
"Default
")
1463 If Utils._hasUNOProperty(ControlModel,
"DefaultButton
") Then _PropertyGet = ControlModel.DefaultButton
1464 Case UCase(
"DefaultValue
")
1465 Select Case _SubType
1466 Case CTLCHECKBOX, CTLRADIOBUTTON
1467 If Utils._hasUNOProperty(ControlModel,
"DefaultState
") Then _PropertyGet = ControlModel.DefaultState
1468 Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
1469 If Utils._hasUNOProperty(ControlModel,
"DefaultText
") Then _PropertyGet = ControlModel.DefaultText
1470 Case CTLCURRENCYFIELD, CTLNUMERICFIELD
1471 If Utils._hasUNOProperty(ControlModel,
"DefaultValue
") Then _PropertyGet = ControlModel.DefaultValue
1473 If Utils._hasUNOProperty(ControlModel,
"DefaultDate
") Then
1474 Select Case VarType(ControlModel.DefaultDate)
1475 Case vbLong
' AOO and LO
<=
4.1
1476 vDefaultValue = ControlModel.DefaultDate
1477 _PropertyGet = DateSerial(Left(vDefaultValue,
4), Mid(vDefaultValue,
5,
2), Right(vDefaultValue,
2))
1478 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Date
1479 Set oDefaultValue = ControlModel.DefaultDate
1480 _PropertyGet = DateSerial(oDefaultValue.Year,oDefaultValue.Month, oDefaultValue.Day)
1484 Case CTLFORMATTEDFIELD
1485 If Utils._hasUNOProperty(ControlModel,
"EffectiveDefault
") Then _PropertyGet = ControlModel.EffectiveDefault
1487 If Utils._hasUNOProperty(ControlModel,
"DefaultSelection
") And Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then
1488 vDefaultValue = ControlModel.DefaultSelection
1489 If IsArray(vDefaultValue) Then
1490 If UBound(vDefaultValue)
>= LBound(vDefaultValue) Then
' Is array initialized ?
1491 iIndex = UBound(ControlModel.StringItemList)
1492 If vDefaultValue(
0)
>=
0 And vDefaultValue(
0)
<= iIndex Then _PropertyGet = ControlModel.StringItemList(vDefaultValue(
0))
1493 ' Only first default value is considered
1498 If Utils._hasUNOProperty(ControlModel,
"DefaultSpinValue
") Then _PropertyGet = ControlModel.DefaultSpinValue
1500 If Utils._hasUNOProperty(ControlModel,
"DefaultTime
") Then
1501 Select Case VarType(ControlModel.DefaultTime)
1502 Case vbLong
' AOO and LO
<=
4.1
1503 _PropertyGet = ControlModel.DefaultTime
1504 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Time
1505 Set oDefaultValue = ControlModel.DefaultTime
1506 _PropertyGet = TimeSerial(oDefaultValue.Hours, oDefaultValue.Minutes, oDefaultValue.Seconds)
1513 Case UCase(
"Enabled
")
1514 If Utils._hasUNOProperty(ControlModel,
"Enabled
") Then _PropertyGet = ControlModel.Enabled
1515 Case UCase(
"FontBold
")
1516 If Utils._hasUNOProperty(ControlModel,
"FontWeight
") Then _PropertyGet = ( ControlModel.FontWeight
>= com.sun.star.awt.FontWeight.BOLD )
1517 Case UCase(
"FontItalic
")
1518 If Utils._hasUNOProperty(ControlModel,
"FontSlant
") Then _PropertyGet = ( ControlModel.FontSlant = com.sun.star.awt.FontSlant.ITALIC )
1519 Case UCase(
"FontName
")
1520 If Utils._hasUNOProperty(ControlModel,
"FontName
") Then _PropertyGet = ControlModel.FontName
1521 Case UCase(
"FontSize
")
1522 If Utils._hasUNOProperty(ControlModel,
"FontHeight
") Then _PropertyGet = ControlModel.FontHeight
1523 Case UCase(
"FontUnderline
")
1524 If Utils._hasUNOProperty(ControlModel,
"FontUnderline
") Then _PropertyGet = _
1525 Not ( ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.NONE _
1526 Or ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.DONTKNOW )
1527 Case UCase(
"FontWeight
")
1528 If Utils._hasUNOProperty(ControlModel,
"FontWeight
") Then _PropertyGet = ControlModel.FontWeight
1529 Case UCase(
"ForeColor
")
1530 If Utils._hasUNOProperty(ControlModel,
"TextColor
") Then _PropertyGet = ControlModel.TextColor
1531 Case UCase(
"Form
")
1532 Set ofSubForm = New SubForm
' Start building the SUBFORM object
1534 Set ._This = ofSubForm
1535 Set .DatabaseForm = ControlModel
1537 ._Shortcut = _Shortcut
& ".Form
"
1538 ._MainForm = _MainForm
1539 .ParentComponent = _FormComponent
1540 ._DocEntry = _DocEntry
1541 ._DbEntry = _DbEntry
1542 ._OrderBy = ControlModel.Order
1544 set _PropertyGet = ofSubForm
1545 Case UCase(
"Format
")
1546 vFormats = _Formats(_Subtype)
1547 Select Case _SubType
1549 If Utils._hasUNOProperty(ControlModel,
"DateFormat
") Then
1550 If ControlModel.DateFormat
<= UBound(vFormats) Then _PropertyGet = vFormats(ControlModel.DateFormat)
1553 If Utils._hasUNOProperty(ControlModel,
"TimeFormat
") Then
1554 If ControlModel.TimeFormat
<= UBound(vFormats) Then _PropertyGet = vFormats(ControlModel.TimeFormat)
1557 If Utils._hasUNOProperty(ControlModel,
"FormatKey
") Then
1558 If Utils._hasUNOProperty(ControlModel,
"FormatsSupplier
") Then
1559 _PropertyGet = ControlModel.FormatsSupplier.getNumberFormats.getByKey(ControlModel.FormatKey).FormatString
1563 Case UCase(
"ItemData
")
1564 If Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then
1565 If IsMissing(pvIndex) Then
1566 _PropertyGet = ControlModel.StringItemList
1568 If pvIndex
< 0 Or pvIndex
> UBound(ControlModel.StringItemList) Then Goto Trace_Error_Index
1569 _PropertyGet = ControlModel.StringItemList(pvIndex)
1572 Case UCase(
"ListCount
")
1573 If Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then _PropertyGet = UBound(ControlModel.StringItemList) +
1
1574 Case UCase(
"ListIndex
")
1575 If Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then
1576 lListIndex = -
1 ' Either Multiple selections or no selection at all
1577 Select Case _SubType
1579 If Not Utils._hasUNOProperty(ControlModel,
"Text
") Then Goto Trace_Error
1581 If ControlModel.Text
<> "" Then
1582 For j =
0 To UBound(ControlModel.StringItemList)
1583 If ControlModel.StringItemList(j) = ControlModel.Text Then
1588 If iIndex
<> 1 Then lListIndex = -
1 ' Multiselection or synonyms rejected
1590 Case CTLLISTBOX
' No mean found to access bound column !! See mail Lionel
10/
5/
2013 for improvement
1591 If Not Utils._hasUNOProperty(ControlModel,
"SelectedItems
") Then Goto Trace_Error
1592 If UBound(ControlModel.SelectedItems)
> 0 Then
' Several items selected
1593 Else
' Mono selection
1594 If _ParentType
<> CTLPARENTISDIALOG Then
' getCurrentValue not found in dialog listboxes ??
1595 vCurrentValue = ControlModel.getCurrentValue()
' Space or uninitialized array if no selection at all
1596 If IsArray(vCurrentValue) Then
' Is an array if MultiSelect
1597 vListboxValue =
""
1598 If UBound(vCurrentValue) =
0 Then vListboxValue = vCurrentValue(
0)
1600 vListboxValue = vCurrentValue
1602 If vListboxValue
<> "" Then
' Speed up search PM Pastim
12/
02/
2013
1603 If Ubound(ControlModel.SelectedItems)
>=
0 Then lListIndex = Controlmodel.Selecteditems(
0)
1606 If Ubound(ControlModel.SelectedItems)
>=
0 Then lListIndex = Controlmodel.Selecteditems(
0)
1610 _PropertyGet = lListIndex
1612 Case UCase(
"Locked
")
1613 If Utils._hasUNOProperty(ControlModel,
"ReadOnly
") Then _PropertyGet = ControlModel.ReadOnly
1614 Case UCase(
"MultiSelect
")
1615 If Utils._hasUNOProperty(ControlModel,
"MultiSelection
") Then
1616 _PropertyGet = ControlModel.MultiSelection
' Boolean in OO, Integer (
0,
1 or
2) in VBA
1617 ElseIf Utils._hasUNOProperty(ControlModel,
"MultiSelectionSimpleMode
") Then
' Not documented: only for GridControls !? Changed in OO
>=
3,
3 !?
1618 _PropertyGet = ControlModel.MultiSelectionSimpleMode
1620 _PropertyGet = False
1622 Case UCase(
"Name
")
1623 _PropertyGet = _Name
1624 Case UCase(
"OnActionPerformed
"), UCase(
"OnAdjustmentValueChanged
"), UCase(
"OnApproveAction
"), UCase(
"OnApproveReset
") _
1625 , UCase(
"OnApproveUpdate
"), UCase(
"OnChanged
"), UCase(
"OnErrorOccurred
"), UCase(
"OnFocusGained
") _
1626 , UCase(
"OnFocusLost
"), UCase(
"OnItemStateChanged
"), UCase(
"OnKeyPressed
"), UCase(
"OnKeyReleased
") _
1627 , UCase(
"OnMouseDragged
"), UCase(
"OnMouseEntered
"), UCase(
"OnMouseExited
"), UCase(
"OnMouseMoved
") _
1628 , UCase(
"OnMousePressed
"), UCase(
"OnMouseReleased
"), UCase(
"OnResetted
"), UCase(
"OnTextChanged
") _
1629 , UCase(
"OnUpdated
")
1630 Select Case _ParentType
1631 Case CTLPARENTISDIALOG
1632 Set oControlEvents = ControlModel.getEvents()
1633 sEventName =
"com.sun.star.awt.
" & _GetListener(psProperty)
& "::
" & Utils._GetEventName(psProperty)
1634 If oControlEvents.hasByName(sEventName) Then
1635 _PropertyGet = oControlEvents.getByName(sEventName).ScriptCode
1637 _PropertyGet =
""
1640 _PropertyGet = Utils._GetEventScriptCode(ControlModel, psProperty, _Name)
1642 Case UCase(
"OptionValue
")
1643 If Utils._hasUNOProperty(ControlModel,
"RefValue
") Then
1644 If ControlModel.RefValue
<> "" Then
1645 _PropertyGet = ControlModel.RefValue
1646 ElseIf Utils._hasUNOProperty(ControlModel,
"Label
") Then
1647 _PropertyGet = ControlModel.Label
1650 Case UCase(
"ObjectType
")
1651 _PropertyGet = _Type
1652 Case UCase(
"Page
")
1653 If Utils._hasUNOProperty(ControlModel,
"Step
") Then _PropertyGet = ControlModel.Step
1654 Case UCase(
"Parent
")
1655 Set _PropertyGet = _Parent
1656 Case UCase(
"Picture
")
1657 _PropertyGet = ConvertToUrl(ControlModel.ImageURL)
1658 Case UCase(
"Required
")
1659 If Utils._hasUNOProperty(ControlModel,
"InputRequired
") Then _PropertyGet = ControlModel.InputRequired
1660 Case UCase(
"RowSource
")
1661 Select Case _ParentType
1662 Case CTLPARENTISDIALOG
1663 If Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then
1664 If IsArray(ControlModel.StringItemList) Then vListSource = ControlModel.StringItemList Else vListSource = Array(ControlModel.StringItemList)
1665 _PropertyGet = Join(vListSource,
";
")
1668 If Utils._hasUNOProperty(ControlModel,
"ListSource
") Then
1669 Select Case ControlModel.ListSourceType
1670 Case com.sun.star.form.ListSourceType.VALUELIST _
1671 , com.sun.star.form.ListSourceType.TABLEFIELDS
1672 If IsArray(ControlModel.StringItemList) Then vListSource = ControlModel.StringItemList Else vListSource = Array(ControlModel.StringItemList)
1673 Case com.sun.star.form.ListSourceType.TABLE _
1674 , com.sun.star.form.ListSourceType.QUERY _
1675 , com.sun.star.form.ListSourceType.SQL _
1676 , com.sun.star.form.ListSourceType.SQLPASSTHROUGH
1677 If IsArray(ControlModel.ListSource) Then vListSource = ControlModel.ListSource Else vListSource = Array(ControlModel.ListSource)
1679 _PropertyGet = Join(vListSource,
";
")
1682 Case UCase(
"RowSourceType
")
1683 If Utils._hasUNOProperty(ControlModel,
"ListSourceType
") Then _PropertyGet = ControlModel.ListSourceType
1684 Case UCase(
"Selected
")
1685 If Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then
1686 lListIndex = UBound(ControlModel.StringItemList)
1687 If Not IsMissing(pvIndex) Then
1688 If pvIndex
< 0 Or pvIndex
> lListIndex Then Goto Trace_Error_Index
1690 If lListIndex
< 0 Then
' Do nothing if listbox empty
1691 _PropertyGet = Array()
1693 Redim bSelected(
0 To lListIndex)
1694 For j =
0 To lListIndex
1695 bSelected(j) = False
1697 For j =
0 To UBound(ControlModel.SelectedItems)
1698 iIndex = ControlModel.SelectedItems(j)
1699 If iIndex
>=
0 And iIndex
<= lListIndex Then bSelected(iIndex) = True
1701 If IsMissing(pvIndex) Then _PropertyGet = bSelected Else _PropertyGet = bSelected(pvIndex)
1704 Case UCase(
"SelLength
")
1705 If Utils._hasUNOProperty(ControlView,
"Selection
") Then
1706 vSelection = ControlView.getSelection()
1707 If vSelection.Max
>= vSelection.Min Then
1708 _PropertyGet = vSelection.Max - vSelection.Min
1710 _PropertyGet =
0 ' probably control does not have focus
1715 Case UCase(
"SelStart
")
1716 If Utils._hasUNOProperty(ControlView,
"Selection
") Then
1717 vSelection = ControlView.getSelection()
1718 If vSelection.Max
>= vSelection.Min Then
1719 _PropertyGet = vSelection.Min +
1
1721 _PropertyGet =
1 ' probably control does not have focus
1726 Case UCase(
"SelText
")
1727 If Utils._hasUNOProperty(ControlView,
"SelectedText
") Then
1728 _PropertyGet = ControlView.getSelectedText()
1730 _PropertyGet =
""
1732 Case UCase(
"SpecialEffect
")
1733 If Utils._hasUNOProperty(ControlModel,
"VisualEffect
") Then _PropertyGet = ControlModel.VisualEffect
1734 Case UCase(
"SubType
")
1735 _PropertyGet = _SubType
1736 Case UCase(
"TabIndex
")
1737 If Utils._hasUNOProperty(ControlModel,
"TabIndex
") Then _PropertyGet = ControlModel.TabIndex
1738 Case UCase(
"TabStop
")
1739 If Utils._hasUNOProperty(ControlModel,
"Tabstop
") Then _PropertyGet = ControlModel.Tabstop
1740 Case UCase(
"Tag
")
1741 If Utils._hasUNOProperty(ControlModel,
"Tag
") Then _PropertyGet = ControlModel.Tag
1742 Case UCase(
"Text
")
1743 Select Case _SubType
1745 If Utils._hasUNOProperty(ControlModel,
"Date
") Then
1746 If Utils._hasUNOProperty(ControlModel,
"FormatKey
") Then
1747 If Utils._hasUNOProperty(ControlModel,
"FormatsSupplier
") Then
1748 Select Case VarType(ControlModel.Date)
1749 Case vbLong
' AOO and LO
<=
4.1
1750 vDate = DateSerial(Left(ControlModel.Date,
4), Mid(ControlModel.Date,
5,
2), Right(ControlModel.Date,
2))
1751 Case vbObject
' LO
>=
4.2
1752 vDate = DateSerial(ControlModel.Date.Year, ControlModel.Date.Month, ControlModel.Date.Day)
1755 _PropertyGet = Format(vDate, ControlModel.FormatsSupplier.getNumberFormats.getByKey(ControlModel.FormatKey).FormatString)
1760 If Utils._hasUNOProperty(ControlModel,
"Text
") Then
1761 Select Case VarType(ControlModel.Time)
1762 Case vbLong
' AOO and LO
<=
4.1
1763 _PropertyGet = Format(ControlModel.Time,
"HH:MM:SS
")
1764 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Time
1765 Set oValue = ControlModel.Time
1766 _PropertyGet = Format(TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds),
"HH:MM:SS
")
1771 If Utils._hasUNOProperty(ControlModel,
"Text
") Then _PropertyGet = ControlModel.Text
1773 Case UCase(
"TextAlign
")
1774 If Utils._hasUNOProperty(ControlModel,
"Tag
") Then _PropertyGet = ControlModel.Tag
1775 Case UCase(
"TripleState
")
1776 If Utils._hasUNOProperty(ControlModel,
"TriState
") Then _PropertyGet = ControlModel.TriState
1777 Case UCase(
"Value
")
1778 Select Case _SubType
1780 If Utils._hasUNOProperty(ControlModel,
"State
") Then vGet = ControlModel.State
1781 Case CTLCOMMANDBUTTON
1783 If Utils._hasUNOProperty(ControlModel,
"Toggle
") Then
1784 If Utils._hasUNOProperty(ControlModel,
"State
") Then vGet = ( ControlModel.State =
1 )
1786 Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
1787 If Utils._hasUNOProperty(ControlModel,
"Text
") Then vGet = ControlModel.Text
1788 Case CTLCURRENCYFIELD
1789 If Utils._hasUNOProperty(ControlModel,
"Value
") Then vGet = ControlModel.Value
1791 If Utils._hasUNOProperty(ControlModel,
"Date
") Then
1792 Select Case VarType(ControlModel.Date)
1793 Case vbLong
' AOO and LO
<=
4.1
1794 vValue = ControlModel.Date
1795 vGet = DateSerial(Left(vValue,
4), Mid(vValue,
5,
2), Right(vValue,
2))
1796 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Date
1797 Set oValue = ControlModel.Date
1798 vGet = DateSerial(oValue.Year, oValue.Month, oValue.Day)
1802 Case CTLFORMATTEDFIELD
1803 If Utils._hasUNOProperty(ControlModel,
"EffectiveValue
") Then vGet = ControlModel.EffectiveValue
1804 Case CTLHIDDENCONTROL
1805 If Utils._hasUNOProperty(ControlModel,
"HiddenValue
") Then vGet = ControlModel.HiddenValue
1807 If Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then Goto Trace_Error
1808 If Not Utils._hasUNOProperty(ControlModel,
"SelectedItems
") Then Goto Trace_Error
1809 If UBound(ControlModel.SelectedItems)
> 0 Then
' Several items selected
1810 vGet = EMPTY
' Listbox has no value, only an array of Selected flags to identify values
1811 Else
' Mono selection
1812 Select Case _ParentType
1813 Case CTLPARENTISDIALOG
1814 If Ubound(ControlModel.SelectedItems)
>=
0 Then
1815 lListIndex = Controlmodel.Selecteditems(
0)
1816 If lListIndex
> -
1 And lListIndex
<= UBound(ControlModel.StringItemList) Then
1817 vGet = ControlModel.StringItemList(lListIndex)
1823 'getCurrentValue does not return any significant value anymore
1824 ' Speed up getting value PM PASTIM
12/
02/
2013
1825 If Ubound(ControlModel.SelectedItems)
>=
0 Then lListIndex = Controlmodel.Selecteditems(
0) Else lListIndex = -
1
1826 ' If listbox has hidden column = real bound field, then explore ValueItemList
1827 If _ListboxBound() Then
1828 If lListIndex
> -
1 Then vGet = ControlModel.ValueItemList(lListIndex)
' PASTIM
1830 If lListIndex
> -
1 Then vGet = ControlModel.getItemText(lListIndex)
1834 Case CTLNUMERICFIELD
1835 If Utils._hasUNOProperty(ControlModel,
"Value
") Then vGet = ControlModel.Value
1837 If Utils._hasUNOProperty(ControlModel,
"ProgressValue
") Then vGet = ControlModel.ProgressValue
1839 If Utils._hasUNOProperty(ControlModel,
"ScrollValue
") Then vGet = ControlModel.ScrollValue
1841 If Utils._hasUNOProperty(ControlModel,
"SpinValue
") Then vGet = ControlModel.SpinValue
1843 If Utils._hasUNOProperty(ControlModel,
"Time
") Then
1844 Select Case VarType(ControlModel.Time)
1845 Case vbLong
' AOO and LO
<=
4.1
1846 vGet = ControlModel.Time
1847 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Time
1848 Set oValue = ControlModel.Time
1849 vGet = TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)
1855 If _SubType
<> CTLLISTBOX Then
' Give getCurrentValue an additional try
1856 If IsEmpty(vGet) And Utils._hasUNOMethod(ControlModel,
"getCurrentValue
") Then vGet = ControlModel.getCurrentValue()
1859 Case UCase(
"Visible
")
1860 Select Case _SubType
1861 Case CTLHIDDENCONTROL
1862 _PropertyGet = False
1864 If Utils._hasUNOMethod(ControlView,
"isVisible
") Then _PropertyGet = CBool(ControlView.isVisible())
1870 If IsEmpty(_PropertyGet) Then TraceError(TRACEINFO, ERRPROPERTYINIT, Utils._CalledSub(),
0, , psProperty)
1873 Utils._ResetCalledSub(
"Control.get
" & psProperty)
1876 TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(),
0, , psProperty)
1877 _PropertyGet = EMPTY
1880 TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(),
0,
1, psProperty)
1881 _PropertyGet = EMPTY
1884 TraceError(TRACEABORT, Err,
"Control._PropertyGet
", Erl)
1885 _PropertyGet = EMPTY
1887 End Function
' _PropertyGet V0.9
.1
1889 REM -----------------------------------------------------------------------------------------------------------------------
1890 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
1891 ' Return True if property setting OK
1893 If _ErrorHandler() Then On Local Error Goto Error_Function
1894 Utils._SetCalledSub(
"Control.set
" & psProperty)
1897 'Check Index argument
1898 If Not IsMissing(pvIndex) Then
1899 If Not Utils._CheckArgument(pvIndex,
1, Utils._AddNumeric()) Then Goto Exit_Function
1902 Dim iArgNr As Integer, vButton As Variant, i As Integer
1903 Dim odbDatabase As Object, vNames() As Variant, bFound As Boolean, sName As String
1904 Dim bMultiSelect As Boolean, iCount As Integer, iSelectedItems() As Integer, lListCount As Long, bSelected() As Boolean
1905 Dim vItemList() As Variant, vFormats() As Variant
1906 Dim oStruct As Object, sValue As String
1907 Dim vSelection As Variant, sText As String, lStart As long
1908 Dim oControlEvents As Object, sListener As String, sEvent As String, sEventName As String, oEvent As Object
1911 Select Case UCase(_A2B_.CalledSub)
1912 Case UCase(
"setProperty
") : iArgNr =
3
1913 Case UCase(
"Control.setProperty
") : iArgNr =
2
1914 Case UCase(
"Control.set
" & psProperty) : iArgNr =
1
1917 If Not hasProperty(psProperty) Then Goto Trace_Error
1919 Select Case UCase(psProperty)
1920 Case UCase(
"BackColor
")
1921 If Not Utils._hasUNOProperty(ControlModel,
"BackgroundColor
") Then Goto Trace_Error
1922 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1923 ControlModel.BackgroundColor = CLng(pvValue)
1924 Case UCase(
"BorderColor
")
1925 If Not Utils._hasUNOProperty(ControlModel,
"BorderColor
") Then Goto Trace_Error
1926 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1927 ControlModel.BorderColor = CLng(pvValue)
1928 Case UCase(
"BorderStyle
")
1929 If Not Utils._hasUNOProperty(ControlModel,
"BorderColor
") Then Goto Trace_Error
1930 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1931 If pvValue
< 0 Or pvValue
> 2 Then Goto Trace_Error_Value
' 0 = No border,
1 =
3D border,
2 = Normal border
1932 ControlModel.Border = CLng(pvValue)
1933 Case UCase(
"Cancel
")
1934 If Not Utils._hasUNOProperty(ControlModel,
"PushButtonType
") Then Goto Trace_Error
1935 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1936 If pvValue Then vButton = com.sun.star.awt.PushButtonType.CANCEL Else vButton = com.sun.star.awt.PushButtonType.STANDARD
1937 ControlModel.PushButtonType = vButton
1938 Case UCase(
"Caption
")
1939 If Not Utils._hasUNOProperty(ControlModel,
"Label
") Then Goto Trace_Error
1940 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1941 ControlModel.Label = pvValue
1942 Case UCase(
"ControlTipText
")
1943 If Not Utils._hasUNOProperty(ControlModel,
"HelpText
") Then Goto Trace_Error
1944 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1945 ControlModel.HelpText = pvValue
1946 Case UCase(
"Default
")
1947 If Not Utils._hasUNOProperty(ControlModel,
"DefaultButton
") Then Goto Trace_Error
1948 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
1949 ControlModel.DefaultButton = pvValue
1950 Case UCase(
"DefaultValue
")
1951 Select Case _SubType
1953 If Not Utils._hasUNOProperty(ControlModel,
"DefaultDate
") Then Goto Trace_Error
1954 If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
1955 Select Case VarType(ControlModel.DefaultDate)
1956 Case vbEmpty, vbLong
' AOO and LO
<=
4.1
1957 ControlModel.DefaultDate = Year(pvValue) *
10000 + Month(pvValue) *
100 + Day(pvValue)
1958 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Date
1959 ControlModel.DefaultDate.Year = Year(pvValue)
1960 ControlModel.DefaultDate.Month = Month(pvValue)
1961 ControlModel.DefaultDate.Day = Day(pvValue)
1964 If Not Utils._hasUNOProperty(ControlModel,
"DefaultSelection
") Or Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then Goto Trace_Error
1965 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1966 For i =
0 To UBound(ControlModel.StringItemList)
1967 If UCase(pvValue) = UCase(ControlModel.StringItemList(i)) Then
1968 ControlModel.DefaultSelection = Array(i)
1973 If Not Utils._hasUNOProperty(ControlModel,
"DefaultSpinValue
") Then Goto Trace_Error
1974 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1975 ControlModel.DefaultSpinValue = pvValue
1977 If Not Utils._hasUNOProperty(ControlModel,
"DefaultState
") Then Goto Trace_Error
1978 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1979 If pvValue
< 0 Or pvValue
> 2 Then Goto Trace_Error_Value
' 0 = Not checked
1 = Checked
2 = don
't know
1980 ControlModel.DefaultState = pvValue
1982 If Not Utils._hasUNOProperty(ControlModel,
"DefaultState
") Then Goto Trace_Error
1983 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1984 If pvValue
< 0 Or pvValue
> 1 Then Goto Trace_Error_Value
' 0 = Not checked
1 = Checked
1985 ControlModel.DefaultState = pvValue
1986 Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
1987 If Not Utils._hasUNOProperty(ControlModel,
"DefaultText
") Then Goto Trace_Error
1988 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1989 ControlModel.DefaultText = pvValue
1991 If Not Utils._hasUNOProperty(ControlModel,
"DefaultTime
") Then Goto Trace_Error
1992 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1993 If pvValue
>=
0 And pvValue
<=
23595999 Then
1994 Select Case VarType(ControlModel.DefaultTime)
1995 Case vbEmpty, vbLong
' AOO and LO
<=
4.1
1996 ControlModel.DefaultTime = pvValue
1997 Case vbObject
' LO
>=
4.2 com.sun.star.Util.Time
1998 ControlModel.DefaultDate.Hours = Hour(pvValue)
1999 ControlModel.DefaultDate.Minutes = Minute(pvValue)
2000 ControlModel.DefaultDate.Seconds = Second(pvValue)
2002 Else Goto Trace_Error_Value
2004 Case CTLCURRENCYFIELD, CTLNUMERICFIELD
2005 If Not Utils._hasUNOProperty(ControlModel,
"DefaultValue
") Then Goto Trace_Error
2006 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2007 ControlModel.DefaultValue = pvValue
2008 Case CTLFORMATTEDFIELD
2009 If Not Utils._hasUNOProperty(ControlModel,
"EffectiveDefault
") Then Goto Trace_Error
2010 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2011 ControlModel.EffectiveDefault = pvValue
' Thanks, PASTIM
2015 Case UCase(
"Enabled
")
2016 If Not Utils._hasUNOProperty(ControlModel,
"Enabled
") Then Goto Trace_Error
2017 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2018 ControlModel.Enabled = pvValue
2019 Case UCase(
"FontBold
")
2020 If Not Utils._hasUNOProperty(ControlModel,
"FontWeight
") Then Goto Trace_Error
2021 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2022 If pvValue Then
' Iif construction does not work !
2023 ControlModel.FontWeight = com.sun.star.awt.FontWeight.BOLD
2025 ControlModel.FontWeight = com.sun.star.awt.FontWeight.NORMAL
2027 Case UCase(
"FontItalic
")
2028 If Not Utils._hasUNOProperty(ControlModel,
"FontSlant
") Then Goto Trace_Error
2029 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2030 If pvValue Then
' Iif construction does not work !
2031 ControlModel.FontSlant = com.sun.star.awt.FontSlant.ITALIC
2033 ControlModel.FontSlant = com.sun.star.awt.FontSlant.NONE
2035 Case UCase(
"FontName
")
2036 If Not Utils._hasUNOProperty(ControlModel,
"FontName
") Then Goto Trace_Error
2037 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2038 ControlModel.FontName = pvValue
2039 Case UCase(
"FontSize
")
2040 If Not Utils._hasUNOProperty(ControlModel,
"FontHeight
") Then Goto Trace_Error
2041 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2042 If pvValue
< 1 Or pvValue
> 127 Then Goto Trace_Error_Value
2043 ControlModel.FontHeight = pvValue
2044 Case UCase(
"FontUnderline
")
2045 If Not Utils._hasUNOProperty(ControlModel,
"FontUnderline
") Then Goto Trace_Error
2046 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2047 If pvValue Then
' Iif construction does not work !
2048 ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.SINGLE
2050 ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.NONE
2052 Case UCase(
"FontWeight
")
2053 If Not Utils._hasUNOProperty(ControlModel,
"FontWeight
") Then Goto Trace_Error
2054 If Not Utils._IsScalar(CSng(pvValue), vbSingle, Array( _
2055 com.sun.star.awt.FontWeight.THIN _
2056 , com.sun.star.awt.FontWeight.ULTRALIGHT _
2057 , com.sun.star.awt.FontWeight.LIGHT _
2058 , com.sun.star.awt.FontWeight.SEMILIGHT _
2059 , com.sun.star.awt.FontWeight.NORMAL _
2060 , com.sun.star.awt.FontWeight.SEMIBOLD _
2061 , com.sun.star.awt.FontWeight.BOLD _
2062 , com.sun.star.awt.FontWeight.ULTRABOLD _
2063 , com.sun.star.awt.FontWeight.BLACK _
2064 )) Then Goto Trace_Error_Value
2065 ControlModel.FontWeight = pvValue
2066 Case UCase(
"Format
")
2067 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2068 vFormats = _Formats(_SubType)
2069 Select Case _SubType
2070 Case CTLDATEFIELD, CTLTIMEFIELD
2072 For i =
0 To UBound(vFormats)
2073 If UCase(pvValue) = UCase(vFormats(i)) Then
2074 If _SubType = CTLDATEFIELD Then
2075 If Utils._hasUNOProperty(ControlModel,
"DateFormat
") Then ControlModel.DateFormat = i Else Goto Trace_Error
2077 If Utils._hasUNOProperty(ControlModel,
"TimeFormat
") Then ControlModel.TimeFormat = i Else Goto Trace_Error
2083 If Not bFound Then Goto Trace_Error_Value
2087 Case UCase(
"ForeColor
")
2088 If Not Utils._hasUNOProperty(ControlModel,
"TextColor
") Then Goto Trace_Error
2089 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2090 ControlModel.TextColor = CLng(pvValue)
2091 Case UCase(
"ListIndex
")
2092 If Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then Goto Trace_Error
2093 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2094 If pvValue
< 0 Or pvValue
> UBound(ControlModel.StringItemList) Then Goto Trace_Error_Value
2095 Select Case _SubType
2097 ControlModel.Text = ControlModel.StringItemList(pvValue)
2099 ControlModel.SelectedItems = Array(pvValue)
2101 Case UCase(
"Locked
")
2102 If Not Utils._hasUNOProperty(ControlModel,
"ReadOnly
") Then Goto Trace_Error
2103 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2104 ControlModel.ReadOnly = pvValue
2105 Case UCase(
"MultiSelect
")
2106 If Not Utils._hasUNOProperty(ControlModel,
"MultiSelection
") And Not Utils._hasUNOProperty(ControlModel,
"MultiSelectionSimpleMode
") Then Goto Trace_Error
2107 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2108 If Utils._hasUNOProperty(ControlModel,
"MultiSelection
") Then
2109 ControlModel.MultiSelection = pvValue
2110 ElseIf Utils._hasUNOProperty(ControlModel,
"MultiSelectionSimpleMode
") Then
2111 ControlModel.MultiSelectionSimpleMode = pvValue
2113 If Not pvValue Then ControlModel.SelectedItems = Array()
' Cancel selections when MultiSelect becomes False
2114 Case UCase(
"OnActionPerformed
"), UCase(
"OnAdjustmentValueChanged
"), UCase(
"OnApproveAction
"), UCase(
"OnApproveReset
") _
2115 , UCase(
"OnApproveUpdate
"), UCase(
"OnChanged
"), UCase(
"OnErrorOccurred
"), UCase(
"OnFocusGained
") _
2116 , UCase(
"OnFocusLost
"), UCase(
"OnItemStateChanged
"), UCase(
"OnKeyPressed
"), UCase(
"OnKeyReleased
") _
2117 , UCase(
"OnMouseDragged
"), UCase(
"OnMouseEntered
"), UCase(
"OnMouseExited
"), UCase(
"OnMouseMoved
") _
2118 , UCase(
"OnMousePressed
"), UCase(
"OnMouseReleased
"), UCase(
"OnResetted
"), UCase(
"OnTextChanged
") _
2119 , UCase(
"OnUpdated
")
2120 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2121 Select Case _ParentType
2122 Case CTLPARENTISDIALOG
2123 If Not Utils._RegisterDialogEventScript(ControlModel _
2125 , _GetListener(psProperty) _
2127 ) Then GoTo Trace_Error
2129 If Not Utils._RegisterEventScript(ControlModel _
2131 , _GetListener(psProperty) _
2134 ) Then GoTo Trace_Error
2136 Case UCase(
"OptionValue
")
2137 If Not Utils._hasUNOProperty(ControlModel,
"RefValue
") Then Goto Trace_Error
2138 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2139 If Not Utils._hasUNOProperty(ControlModel,
"Label
") Then
2140 If pvValue =
"" Then Goto Trace_Error_Value
2141 If ControlModel.RefValue
<> "" Then ControlModel.RefValue = pvValue
2143 ControlModel.Label = pvValue
2145 Case UCase(
"Page
")
2146 If Not Utils._hasUNOProperty(ControlModel,
"Step
") Then Goto Trace_Error
2147 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2148 If pvValue
< 0 Then Goto Trace_Error_Value
2149 ControlModel.Step = pvValue
2150 Case UCase(
"Picture
")
2151 If Not Utils._hasUNOProperty(ControlModel,
"ImageURL
") Then Goto Trace_Error
2152 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2153 ControlModel.ImageURL = ConvertToUrl(pvValue)
2154 Case UCase(
"Required
")
2155 If Not Utils._hasUNOProperty(ControlModel,
"InputRequired
") Then Goto Trace_Error
2156 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2157 ControlModel.InputRequired = pvValue
2158 Case UCase(
"RowSource
")
2159 Select Case _ParentType
2160 Case CTLPARENTISDIALOG
2161 If Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then Goto Trace_Error
2162 ControlModel.StringItemList = Split(pvValue,
";
")
2164 If Not Utils._hasUNOProperty(ControlModel,
"ListSource
") Then Goto Trace_Error
2165 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2166 Select Case ControlModel.ListSourceType
2167 Case com.sun.star.form.ListSourceType.QUERY _
2168 , com.sun.star.form.ListSourceType.TABLE _
2169 , com.sun.star.form.ListSourceType.TABLEFIELDS
2170 Set odbDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
2171 If ControlModel.ListSourceType = com.sun.star.form.ListSourceType.QUERY Then vNames = odbDatabase.Connection.getQueries.GetElementNames _
2172 Else vNames = odbDatabase.Connection.getTables.GetElementNames
2173 bFound = False
' Check existence of table or query and find its correct (case-sensitive) name
2174 For i =
0 To UBound(vNames)
2175 If UCase(vNames(i)) = UCase(pvValue) Then
2181 If Not bFound Then Goto Trace_Error_Value
2182 If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = sName Else ControlModel.ListSource = Array(sName)
2183 ControlModel.refresh()
2184 Case com.sun.star.form.ListSourceType.SQL
2185 Set odbDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
2186 If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = odbDatabase._ReplaceSquareBrackets(pvValue) Else ControlModel.ListSource = Array(odbDatabase._ReplaceSquareBrackets(pvValue))
2187 ControlModel.refresh()
2188 Case com.sun.star.form.ListSourceType.VALUELIST
' Forbidden for COMBOBOX !
2189 If _SubType = CTLCOMBOBOX Then Goto Trace_Error
2190 ControlModel.ListSource = Split(pvValue,
";
")
2191 ControlModel.StringItemList = ControlModel.ListSource
2192 Case com.sun.star.form.ListSourceType.SQLPASSTHROUGH
2193 If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = pvValue Else ControlModel.ListSource = Array(pvValue)
2194 ControlModel.refresh()
2197 If _SubType = CTLLISTBOX Then ControlModel.SelectedItems = Array()
2198 Case UCase(
"RowSourceType
")
' Refresh done when RowSource changes, not RowSourceType
2199 If Not Utils._hasUNOProperty(ControlModel,
"ListSourceType
") Then Goto Trace_Error
2200 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2201 If Not Utils._IsScalar(pvValue, Utils._AddNumeric(), Array( _
2202 com.sun.star.form.ListSourceType.VALUELIST _
2203 , com.sun.star.form.ListSourceType.TABLE _
2204 , com.sun.star.form.ListSourceType.QUERY _
2205 , com.sun.star.form.ListSourceType.SQL _
2206 , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
2207 , com.sun.star.form.ListSourceType.TABLEFIELDS _
2208 )) Then Goto Trace_Error_Value
2209 ControlModel.ListSourceType = pvValue
2210 Case UCase(
"Selected
")
2211 If Not Utils._hasUNOProperty(ControlModel,
"SelectedItems
") Then Goto Trace_Error
2212 If Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") Then Goto Trace_Error
2213 If Utils._hasUNOProperty(ControlModel,
"MultiSelection
") Then
2214 bMultiSelect = ControlModel.MultiSelection
2215 ElseIf Utils._hasUNOProperty(ControlModel,
"MultiSelectionSimpleMode
") Then
2216 bMultiSelect = ControlModel.MultiSelectionSimpleMode
2217 Else: Goto Trace_Error
2219 lListCount = UBound(ControlModel.StringItemList) +
1
2220 If IsMissing(pvIndex) Then
' Full boolean array passed
2221 If Not IsArray(pvValue) Then Goto Trace_Error_Array
2222 If LBound(pvValue)
<> 0 Or UBound(pvValue)
< 0 Then Goto Trace_Error_Array
2223 If Not Utils._CheckArgument(pvValue(
0), iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2224 If UBound(pvValue)
<> lListCount -
1 Then Goto Trace_Error_Index
2226 For i =
0 To UBound(pvValue)
' Count True values
2227 If pvValue(i) Then iCount = iCount +
1
2229 If iCount
> 0 Then
2230 Redim iSelectedItems(
0 To iCount -
1)
2232 For i =
0 To UBound(pvValue)
2234 iSelectedItems(iCount) = i
2238 ControlModel.SelectedItems = iSelectedItems
' iSelectedItems maps OO internals (size = # of selected items)
2240 ControlModel.SelectedItems = Array()
2242 Else
' Single boolean value passed
2243 If Not Utils._CheckArgument(pvIndex, iArgNr +
1, Utils._AddNumeric()) Then Goto Exit_Function
2244 If pvIndex
< 0 Or pvIndex
>= lListCount Then Goto Trace_Error_Index
2245 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2246 ReDim bSelected(
0 To lListCount -
1)
' bSelected maps VBA internals (size = # of displayed items)
2247 If Not bMultiSelect Then
' Set all other values to False
2248 For i =
0 To lListCount -
1
2250 bSelected(i) = pvValue
' All entries = False except one
2252 bSelected(i) = False
2256 For i =
0 To lListCount -
1
2257 bSelected(i) = False
2259 iSelectedItems = ControlModel.SelectedItems
2260 iCount = UBound(iSelectedItems)
2262 bSelected(iSelectedItems(i)) = True
2264 bSelected(pvIndex) = pvValue
2266 iCount =
0 ' Rebuild SelectedItems
2267 For i =
0 To lListCount -
1
2268 If bSelected(i) Then iCount = iCount +
1
2270 If iCount
> 0 Then
2271 Redim iSelectedItems(
0 To iCount -
1)
2273 For i =
0 To lListCount -
1
2274 If bSelected(i) Then
2275 iSelectedItems(iCount) = i
2279 ControlModel.SelectedItems = iSelectedItems
2281 ControlModel.SelectedItems = Array()
2284 Case UCase(
"SelLength
")
2285 If Not Utils._hasUNOProperty(ControlView,
"Selection
") Then Goto trace_Error
2286 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2287 If pvValue
< 0 Then Goto Trace_Error_Value
2288 vSelection = ControlView.getSelection()
2289 vSelection.Max = vSelection.Min + pvValue
2290 ControlView.setSelection(vSelection)
2291 Case UCase(
"SelStart
")
2292 If Not Utils._hasUNOProperty(ControlView,
"Selection
") Then Goto trace_Error
2293 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2294 If pvValue
< 1 Or pvValue
> Len(ControlModel.Text) +
1 Then Goto Trace_Error_Value
2295 vSelection = ControlView.getSelection()
2296 vSelection.Min = pvValue -
1
2297 vSelection.Max = pvValue -
1 ' Also reset length to
0
2298 ControlView.setSelection(vSelection)
2299 Case UCase(
"SelText
")
2300 If Not Utils._hasUNOProperty(ControlView,
"Selection
") Then Goto trace_Error
2301 If Not Utils._hasUNOProperty(ControlModel,
"Text
") Then Goto trace_Error
2302 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2303 If Len(pvValue)
> 0 Then
2304 vSelection = ControlView.getSelection()
2305 sText = ControlModel.Text
2306 lStart = InStr(
1, sText, pvValue,
0)
' Case sensitive !
2307 If lStart
> 0 Then
2308 vSelection.Min = lStart -
1
2309 vSelection.Max = lStart + Len(pvValue) -
1
2310 ControlView.setSelection(vSelection)
2313 Case UCase(
"SpecialEffect
")
2314 If Not Utils._hasUNOProperty(ControlModel,
"VisualEffect
") Then Goto Trace_Error
2315 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2316 If pvValue
< 0 Or pvValue
> 2 Then Goto Trace_Error_Value
' 0 = None,
1 = Look3D,
2 = Flat
2317 ControlModel.VisualEffect = pvValue
2318 Case UCase(
"TabIndex
")
2319 If Not Utils._hasUNOProperty(ControlModel,
"TabIndex
") Then Goto Trace_Error
2320 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2321 If pvValue
< -
1 Then Goto Trace_Error_Value
2322 ControlModel.TabIndex = pvValue
2323 Case UCase(
"TabStop
")
2324 If Not Utils._hasUNOProperty(ControlModel,
"Tabstop
") Then Goto Trace_Error
2325 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2326 ControlModel.Tabstop = pvValue
2327 Case UCase(
"Tag
")
2328 If Not Utils._hasUNOProperty(ControlModel,
"Tag
") Then Goto Trace_Error
2329 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2330 ControlModel.Tag = pvValue
2331 Case UCase(
"TextAlign
")
2332 If Not Utils._hasUNOProperty(ControlModel,
"Align
") Then Goto Trace_Error
2333 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2334 If pvValue
< 0 Or pvValue
> 2 Then Goto Trace_Error_Value
' 0 = Left,
1 = Center,
2 = Right
2335 ControlModel.Align = pvValue
2336 Case UCase(
"TripleState
")
2337 If Not Utils._hasUNOProperty(ControlModel,
"TriState
") Then Goto Trace_Error
2338 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2339 ControlModel.TriState = pvValue
2340 Case UCase(
"Value
")
2341 Select Case _SubType
2343 If Not Utils._hasUNOProperty(ControlModel,
"State
") Then Goto Trace_Error
2344 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(vbBoolean), , False) Then Goto Trace_Error_Value
2345 If VarType(pvValue) = vbBoolean Then pvValue = Iif(pvValue,
1,
0)
2346 If pvValue
< 0 Or pvValue
> 2 Then Goto Trace_Error_Value
' 0 = Not checked
1 = Checked
2 = don
't know
2347 ControlModel.State = pvValue
2348 Case CTLCOMMANDBUTTON
2349 If Not Utils._hasUNOProperty(ControlModel,
"State
") Then Goto Trace_Error
2350 If Not Utils._hasUNOProperty(ControlModel,
"Toggle
") Then Goto Trace_Error
2351 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2352 If pvValue Then ControlModel.State =
1 Else ControlModel.State =
0
2354 If Not Utils._hasUNOProperty(ControlModel,
"Text
") Or Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") _
2355 Then Goto Trace_Error
2356 If pvValue
<> "" Then
2357 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, ControlModel.StringItemList, False) Then Goto Trace_Error_Value
2359 ControlModel.Text = pvValue
2360 Case CTLCURRENCYFIELD, CTLNUMERICFIELD
2361 If Not Utils._hasUNOProperty(ControlModel,
"Value
") Then Goto Trace_Error
2362 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2363 ControlModel.Value = pvValue
2365 If Not Utils._hasUNOProperty(ControlModel,
"Date
") Then Goto Trace_Error
2366 If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
2367 Select Case _InspectPropertyType(ControlModel,
"Date
")
2368 Case
"long
" ' AOO and LO
<=
4.1
2369 'ControlModel.Date = Year(pvValue) *
10000 + Month(pvValue) *
100 + Day(pvValue)
' Gives error in dialogs ?!?
2370 ControlModel.setPropertyValue(
"Date
", Year(pvValue) *
10000 + Month(pvValue) *
100 + Day(pvValue))
2371 Case
"com.sun.star.util.Date
" ' LO
>=
4.2
2372 'Direct assignment of ControlModel.Date.Xxx has no effect ?!?
2373 Set oStruct = CreateUnoStruct(
"com.sun.star.util.Date
")
2374 oStruct.Year = Year(pvValue)
2375 oStruct.Month = Month(pvValue)
2376 oStruct.Day = Day(pvValue)
2377 Set ControlModel.Date = oStruct
2379 Case CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
2380 If Not Utils._hasUNOProperty(ControlModel,
"Text
") Then Goto Trace_Error
2381 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
2382 ControlModel.Text = pvValue
2383 Case CTLFORMATTEDFIELD
2384 If Not Utils._hasUNOProperty(ControlModel,
"EffectiveValue
") Then Goto Trace_Error
2385 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(vbString), , False) Then Goto Trace_Error_Value
2386 ControlModel.EffectiveValue = pvValue
2387 Case CTLHIDDENCONTROL
2388 If Not Utils._hasUNOProperty(ControlModel,
"HiddenValue
") Then Goto Trace_Error
2389 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(Array(vbString, vbBoolean, vbDate)), , False) Then Goto Trace_Error_Value
2390 ControlModel.HiddenValue = pvValue
2392 If Not Utils._hasUNOProperty(ControlModel,
"SelectedItems
") Or Not Utils._hasUNOProperty(ControlModel,
"StringItemList
") _
2393 Then Goto Trace_Error
2394 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(Array(vbString, vbDate)), , False) Then Goto Trace_Error_Value
' PASTIM
2395 If IsArray(pvValue) Then Goto Trace_Error_Value
' Setting the value on a listbox is allowed only if single value and value in the list
2396 ' Check ValueItemList
2398 Select Case _ParentType
2399 Case CTLPARENTISDIALOG
2400 vItemList = ControlModel.StringItemList
2402 If _ListboxBound() Then
' Performance improvement (PASTIM PM
9 Feb
2013)
2403 If Not Utils._hasUNOProperty(ControlModel,
"ValueItemList
") Then Goto Trace_Error
2404 vItemList = ControlModel.ValueItemList
2406 vItemList = ControlModel.StringItemList
2409 For i =
0 To UBound(vItemList)
2410 If pvValue = vItemList(i) Then
2415 If bFound Then ControlModel.SelectedItems = Array(i) Else Goto Trace_Error_Value
2417 If Not Utils._hasUNOProperty(ControlModel,
"ProgressValue
") Then Goto Trace_Error
2418 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2419 If Utils._hasUNOProperty(ControlModel,
"ProgressValueMin
") Then
2420 If pvValue
< ControlModel.ProgressValueMin Then Goto Trace_Error_Value
2422 If Utils._hasUNOProperty(ControlModel,
"ProgressValueMax
") Then
2423 If pvValue
> ControlModel.ProgressValueMax Then Goto Trace_Error_Value
2425 ControlModel.ProgressValue = pvValue
2427 If Not Utils._hasUNOProperty(ControlModel,
"ScrollValue
") Then Goto Trace_Error
2428 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2429 If Utils._hasUNOProperty(ControlModel,
"ScrollValueMin
") Then
2430 If pvValue
< ControlModel.ScrollValueMin Then Goto Trace_Error_Value
2432 If Utils._hasUNOProperty(ControlModel,
"ScrollValueMax
") Then
2433 If pvValue
> ControlModel.ScrollValueMax Then Goto Trace_Error_Value
2435 ControlModel.ScrollValue = pvValue
2437 If Not Utils._hasUNOProperty(ControlModel,
"SpinValue
") Then Goto Trace_Error
2438 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2439 If Utils._hasUNOProperty(ControlModel,
"SpinValueMin
") Then
2440 If pvValue
< ControlModel.SpinValueMin Then Goto Trace_Error_Value
2442 If Utils._hasUNOProperty(ControlModel,
"SpinValueMax
") Then
2443 If pvValue
> ControlModel.SpinValueMax Then Goto Trace_Error_Value
2445 ControlModel.SpinValue = pvValue
2447 If Not Utils._hasUNOProperty(ControlModel,
"Time
") Then Goto Trace_Error
2448 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
2449 Select Case _InspectPropertyType(ControlModel,
"Time
")
2450 Case
"long
" ' AOO and LO
<=
4.0
2451 ControlModel.Time = CLng(pvValue)
2452 Case
"com.sun.star.util.Time
" ' LO
>=
4.1
2453 'Direct assignment of ControlModel.Time.Xxx gives error ?!?
2454 Set oStruct = CreateUnoStruct(
"com.sun.star.util.Time
")
2455 sValue = Right(
"00000000" & Str(CLng(pvValue)),
8)
2456 oStruct.Hours = Val(Left(sValue,
2))
2457 oStruct.Minutes = Val(Mid(sValue,
3,
2))
2458 oStruct.Seconds = Val(Mid(sValue,
5,
2))
2459 Set ControlModel.Time = oStruct
2464 ' FINAL COMMITMENT
2465 If Utils._hasUNOMethod(ControlModel,
"commit
") Then ControlModel.commit()
' f.i. checkboxes have no commit method ?? [PASTIM]
2466 Case UCase(
"Visible
")
2467 If _SubType = CTLHIDDENCONTROL Then Goto Trace_Error
' Hidden remains hidden !!
2468 If Not Utils._hasUNOMethod(ControlView,
"setVisible
") Then Goto Trace_Error
2469 If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
2470 If pvValue Then ControlModel.EnableVisible = True
2471 ControlView.setVisible(pvValue)
2477 Utils._ResetCalledSub(
"Control.set
" & psProperty)
2480 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(),
0, , psProperty)
2481 _PropertySet = False
2484 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(),
0,
1, Array(pvValue, psProperty))
2485 _PropertySet = False
2488 TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(),
0,
1, psProperty)
2489 _PropertySet = False
2492 TraceError(TRACEFATAL, ERRPROPERTYNOTARRAY, Utils._CalledSub(),
0,
1, iArgNr)
2493 _PropertySet = False
2496 TraceError(TRACEABORT, Err,
"Control._PropertySet
", Erl)
2497 _PropertySet = False
2499 End Function
' _PropertySet V1.1
.0