Control.xba 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501
  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 =======================================================================================================================
  8. Option Compatible
  9. Option ClassModule
  10. Option Explicit
  11. REM -----------------------------------------------------------------------------------------------------------------------
  12. REM --- CLASS ROOT FIELDS ---
  13. REM -----------------------------------------------------------------------------------------------------------------------
  14. Private _Type As String &apos; Must be CONTROL
  15. Private _This As Object &apos; Workaround for absence of This builtin function
  16. Private _Parent As Object
  17. Private _ImplementationName As String
  18. Private _ClassId As Integer
  19. Private _ParentType As String &apos; One of CTLPARENTISxxxx constants
  20. Private _Shortcut As String
  21. Private _Name As String
  22. Private _FormComponent As Object &apos; com.sun.star.text.TextDocument
  23. Private _MainForm As String &apos; To be propagated to all subcontrols
  24. Private _DocEntry As Integer &apos; Doc- and DbContainer entries in Root structure
  25. Private _DbEntry As Integer
  26. Private _ControlType As Integer
  27. Private _ThisProperties As Variant &apos; Buffer for properties list
  28. Private _SubType As String
  29. Private ControlModel As Object &apos; com.sun.star.comp.forms.XXXModel
  30. Private ControlView As Object &apos; com.sun.star.comp.forms.XXXControl (NULL if form open in edit mode)
  31. Private BoundField As Object &apos; com.sun.star.sdb.ODataColumn
  32. Private LabelControl As Object &apos; com.sun.star.form.component.FixedText or com.sun.star.form.component.GroupBox
  33. REM -----------------------------------------------------------------------------------------------------------------------
  34. REM --- CONSTRUCTORS / DESTRUCTORS ---
  35. REM -----------------------------------------------------------------------------------------------------------------------
  36. Private Sub Class_Initialize()
  37. _Type = OBJCONTROL
  38. Set _This = Nothing
  39. Set _Parent = Nothing
  40. _ClassId = -1
  41. _ParentType = &quot;&quot;
  42. _Shortcut = &quot;&quot;
  43. _Name = &quot;&quot;
  44. Set _FormComponent = Nothing
  45. _MainForm = &quot;&quot;
  46. _DocEntry = -1
  47. _DbEntry = -1
  48. _ThisProperties = Array()
  49. _SubType = &quot;&quot;
  50. Set ControlModel = Nothing
  51. Set ControlView = Nothing
  52. Set BoundField = Nothing
  53. Set LabelControl = Nothing
  54. End Sub &apos; Constructor
  55. REM -----------------------------------------------------------------------------------------------------------------------
  56. Private Sub Class_Terminate()
  57. On Local Error Resume Next
  58. Call Class_Initialize()
  59. End Sub &apos; Destructor
  60. REM -----------------------------------------------------------------------------------------------------------------------
  61. Public Sub Dispose()
  62. Call Class_Terminate()
  63. End Sub &apos; Explicit destructor
  64. REM -----------------------------------------------------------------------------------------------------------------------
  65. REM --- CLASS GET/LET/SET PROPERTIES ---
  66. REM -----------------------------------------------------------------------------------------------------------------------
  67. Property Get BackColor() As Variant
  68. BackColor = _PropertyGet(&quot;BackColor&quot;)
  69. End Property &apos; BackColor (get)
  70. Property Let BackColor(ByVal pvValue As Variant)
  71. Call _PropertySet(&quot;BackColor&quot;, pvValue)
  72. End Property &apos; BackColor (set)
  73. REM -----------------------------------------------------------------------------------------------------------------------
  74. Property Get BorderColor() As Variant
  75. BorderColor = _PropertyGet(&quot;BorderColor&quot;)
  76. End Property &apos; BorderColor (get)
  77. Property Let BorderColor(ByVal pvValue As Variant)
  78. Call _PropertySet(&quot;BorderColor&quot;, pvValue)
  79. End Property &apos; BorderColor (set)
  80. REM -----------------------------------------------------------------------------------------------------------------------
  81. Property Get BorderStyle() As Variant
  82. BorderStyle = _PropertyGet(&quot;BorderStyle&quot;)
  83. End Property &apos; BorderStyle (get)
  84. Property Let BorderStyle(ByVal pvValue As Variant)
  85. Call _PropertySet(&quot;BorderStyle&quot;, pvValue)
  86. End Property &apos; BorderStyle (set)
  87. REM -----------------------------------------------------------------------------------------------------------------------
  88. Property Get Cancel() As Variant
  89. Cancel = _PropertyGet(&quot;Cancel&quot;)
  90. End Property &apos; Cancel (get)
  91. Property Let Cancel(ByVal pvValue As Variant)
  92. Call _PropertySet(&quot;Cancel&quot;, pvValue)
  93. End Property &apos; Cancel (set)
  94. REM -----------------------------------------------------------------------------------------------------------------------
  95. Property Get Caption() As Variant
  96. Caption = _PropertyGet(&quot;Caption&quot;)
  97. End Property &apos; Caption (get)
  98. Property Let Caption(ByVal pvValue As Variant)
  99. Call _PropertySet(&quot;Caption&quot;, pvValue)
  100. End Property &apos; Caption (set)
  101. REM -----------------------------------------------------------------------------------------------------------------------
  102. Property Get ControlSource() As Variant
  103. ControlSource = _PropertyGet(&quot;ControlSource&quot;)
  104. End Property &apos; ControlSource (get)
  105. REM -----------------------------------------------------------------------------------------------------------------------
  106. Property Get ControlTipText() As Variant
  107. ControlTipText = _PropertyGet(&quot;ControlTipText&quot;)
  108. End Property &apos; ControlTipText (get)
  109. Property Let ControlTipText(ByVal pvValue As Variant)
  110. Call _PropertySet(&quot;ControlTipText&quot;, pvValue)
  111. End Property &apos; ControlTipText (set)
  112. REM -----------------------------------------------------------------------------------------------------------------------
  113. Property Get ControlType() As Variant
  114. ControlType = _PropertyGet(&quot;ControlType&quot;)
  115. End Property &apos; ControlType (get)
  116. REM -----------------------------------------------------------------------------------------------------------------------
  117. Property Get Default() As Variant
  118. Default = _PropertyGet(&quot;Default&quot;)
  119. End Property &apos; Default (get)
  120. Property Let Default(ByVal pvValue As Variant)
  121. Call _PropertySet(&quot;Default&quot;, pvValue)
  122. End Property &apos; Default (set)
  123. REM -----------------------------------------------------------------------------------------------------------------------
  124. Property Get DefaultValue() As Variant
  125. DefaultValue = _PropertyGet(&quot;DefaultValue&quot;)
  126. End Property &apos; DefaultValue (get)
  127. Property Let DefaultValue(ByVal pvValue As Variant)
  128. Call _PropertySet(&quot;DefaultValue&quot;, pvValue)
  129. End Property &apos; DefaultValue (set)
  130. REM -----------------------------------------------------------------------------------------------------------------------
  131. Property Get Enabled() As Variant
  132. Enabled = _PropertyGet(&quot;Enabled&quot;)
  133. End Property &apos; Enabled (get)
  134. Property Let Enabled(ByVal pvValue As Variant)
  135. Call _PropertySet(&quot;Enabled&quot;, pvValue)
  136. End Property &apos; Enabled (set)
  137. REM -----------------------------------------------------------------------------------------------------------------------
  138. Property Get FontBold() As Variant
  139. FontBold = _PropertyGet(&quot;FontBold&quot;)
  140. End Property &apos; FontBold (get)
  141. Property Let FontBold(ByVal pvValue As Variant)
  142. Call _PropertySet(&quot;FontBold&quot;, pvValue)
  143. End Property &apos; FontBold (set)
  144. REM -----------------------------------------------------------------------------------------------------------------------
  145. Property Get FontItalic() As Variant
  146. FontItalic = _PropertyGet(&quot;FontItalic&quot;)
  147. End Property &apos; FontItalic (get)
  148. Property Let FontItalic(ByVal pvValue As Variant)
  149. Call _PropertySet(&quot;FontItalic&quot;, pvValue)
  150. End Property &apos; FontItalic (set)
  151. REM -----------------------------------------------------------------------------------------------------------------------
  152. Property Get FontName() As Variant
  153. FontName = _PropertyGet(&quot;FontName&quot;)
  154. End Property &apos; FontName (get)
  155. Property Let FontName(ByVal pvValue As Variant)
  156. Call _PropertySet(&quot;FontName&quot;, pvValue)
  157. End Property &apos; FontName (set)
  158. REM -----------------------------------------------------------------------------------------------------------------------
  159. Property Get FontSize() As Variant
  160. FontSize = _PropertyGet(&quot;FontSize&quot;)
  161. End Property &apos; FontSize (get)
  162. Property Let FontSize(ByVal pvValue As Variant)
  163. Call _PropertySet(&quot;FontSize&quot;, pvValue)
  164. End Property &apos; FontSize (set)
  165. REM -----------------------------------------------------------------------------------------------------------------------
  166. Property Get FontUnderline() As Variant
  167. FontUnderline = _PropertyGet(&quot;FontUnderline&quot;)
  168. End Property &apos; FontUnderline (get)
  169. Property Let FontUnderline(ByVal pvValue As Variant)
  170. Call _PropertySet(&quot;FontUnderline&quot;, pvValue)
  171. End Property &apos; FontUnderline (set)
  172. REM -----------------------------------------------------------------------------------------------------------------------
  173. Property Get FontWeight() As Variant
  174. FontWeight = _PropertyGet(&quot;FontWeight&quot;)
  175. End Property &apos; FontWeight (get)
  176. Property Let FontWeight(ByVal pvValue As Variant)
  177. Call _PropertySet(&quot;FontWeight&quot;, pvValue)
  178. End Property &apos; FontWeight (set)
  179. REM -----------------------------------------------------------------------------------------------------------------------
  180. Property Get ForeColor() As Variant
  181. ForeColor = _PropertyGet(&quot;ForeColor&quot;)
  182. End Property &apos; ForeColor (get)
  183. Property Let ForeColor(ByVal pvValue As Variant)
  184. Call _PropertySet(&quot;ForeColor&quot;, pvValue)
  185. End Property &apos; ForeColor (set)
  186. REM -----------------------------------------------------------------------------------------------------------------------
  187. Property Get Form() As Variant
  188. Form = _PropertyGet(&quot;Form&quot;)
  189. End Property &apos; Form (get)
  190. REM -----------------------------------------------------------------------------------------------------------------------
  191. Property Get Format() As Variant
  192. Format = _PropertyGet(&quot;Format&quot;)
  193. End Property &apos; Format (get)
  194. Property Let Format(ByVal pvValue As Variant)
  195. Call _PropertySet(&quot;Format&quot;, pvValue)
  196. End Property &apos; Format (set)
  197. REM -----------------------------------------------------------------------------------------------------------------------
  198. Property Get ItemData(ByVal Optional pvIndex As Variant) As Variant
  199. If IsMissing(pvIndex) Then ItemData = _PropertyGet(&quot;ItemData&quot;) Else ItemData = _PropertyGet(&quot;ItemData&quot;, pvIndex)
  200. End Property &apos; ItemData (get)
  201. REM -----------------------------------------------------------------------------------------------------------------------
  202. Property Get ListCount() As Variant
  203. ListCount = _PropertyGet(&quot;ListCount&quot;)
  204. End Property &apos; ListCount (get)
  205. REM -----------------------------------------------------------------------------------------------------------------------
  206. Property Get ListIndex() As Variant
  207. ListIndex = _PropertyGet(&quot;ListIndex&quot;)
  208. End Property &apos; ListIndex (get)
  209. Property Let ListIndex(ByVal pvValue As Variant)
  210. Call _PropertySet(&quot;ListIndex&quot;, pvValue)
  211. End Property &apos; ListIndex (set)
  212. REM -----------------------------------------------------------------------------------------------------------------------
  213. Property Get Locked() As Variant
  214. Locked = _PropertyGet(&quot;Locked&quot;)
  215. End Property &apos; Locked (get)
  216. Property Let Locked(ByVal pvValue As Variant)
  217. Call _PropertySet(&quot;Locked&quot;, pvValue)
  218. End Property &apos; Locked (set)
  219. REM -----------------------------------------------------------------------------------------------------------------------
  220. Property Get MultiSelect() As Variant
  221. MultiSelect = _PropertyGet(&quot;MultiSelect&quot;)
  222. End Property &apos; MultiSelect (get)
  223. Property Let MultiSelect(ByVal pvValue As Variant)
  224. Call _PropertySet(&quot;MultiSelect&quot;, pvValue)
  225. End Property &apos; MultiSelect (set)
  226. REM -----------------------------------------------------------------------------------------------------------------------
  227. Property Get Name() As String
  228. Name = _PropertyGet(&quot;Name&quot;)
  229. End Property &apos; Name (get)
  230. Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
  231. pName = _PropertyGet(&quot;Name&quot;)
  232. End Function &apos; pName (get)
  233. REM -----------------------------------------------------------------------------------------------------------------------
  234. Property Get ObjectType() As String
  235. ObjectType = _PropertyGet(&quot;ObjectType&quot;)
  236. End Property &apos; ObjectType (get)
  237. REM -----------------------------------------------------------------------------------------------------------------------
  238. Property Get OnActionPerformed() As Variant
  239. OnActionPerformed = _PropertyGet(&quot;OnActionPerformed&quot;)
  240. End Property &apos; OnActionPerformed (get)
  241. Property Let OnActionPerformed(ByVal pvValue As Variant)
  242. Call _PropertySet(&quot;OnActionPerformed&quot;, pvValue)
  243. End Property &apos; OnActionPerformed (set)
  244. REM -----------------------------------------------------------------------------------------------------------------------
  245. Property Get OnAdjustmentValueChanged() As Variant
  246. OnAdjustmentValueChanged = _PropertyGet(&quot;OnAdjustmentValueChanged&quot;)
  247. End Property &apos; OnAdjustmentValueChanged (get)
  248. Property Let OnAdjustmentValueChanged(ByVal pvValue As Variant)
  249. Call _PropertySet(&quot;OnAdjustmentValueChanged&quot;, pvValue)
  250. End Property &apos; OnAdjustmentValueChanged (set)
  251. REM -----------------------------------------------------------------------------------------------------------------------
  252. Property Get OnApproveAction() As Variant
  253. OnApproveAction = _PropertyGet(&quot;OnApproveAction&quot;)
  254. End Property &apos; OnApproveAction (get)
  255. Property Let OnApproveAction(ByVal pvValue As Variant)
  256. Call _PropertySet(&quot;OnApproveAction&quot;, pvValue)
  257. End Property &apos; OnApproveAction (set)
  258. REM -----------------------------------------------------------------------------------------------------------------------
  259. Property Get OnApproveReset() As Variant
  260. OnApproveReset = _PropertyGet(&quot;OnApproveReset&quot;)
  261. End Property &apos; OnApproveReset (get)
  262. Property Let OnApproveReset(ByVal pvValue As Variant)
  263. Call _PropertySet(&quot;OnApproveReset&quot;, pvValue)
  264. End Property &apos; OnApproveReset (set)
  265. REM -----------------------------------------------------------------------------------------------------------------------
  266. Property Get OnApproveUpdate() As Variant
  267. OnApproveUpdate = _PropertyGet(&quot;OnApproveUpdate&quot;)
  268. End Property &apos; OnApproveUpdate (get)
  269. Property Let OnApproveUpdate(ByVal pvValue As Variant)
  270. Call _PropertySet(&quot;OnApproveUpdate&quot;, pvValue)
  271. End Property &apos; OnApproveUpdate (set)
  272. REM -----------------------------------------------------------------------------------------------------------------------
  273. Property Get OnChanged() As Variant
  274. OnChanged = _PropertyGet(&quot;OnChanged&quot;)
  275. End Property &apos; OnChanged (get)
  276. Property Let OnChanged(ByVal pvValue As Variant)
  277. Call _PropertySet(&quot;OnChanged&quot;, pvValue)
  278. End Property &apos; OnChanged (set)
  279. REM -----------------------------------------------------------------------------------------------------------------------
  280. Property Get OnErrorOccurred() As Variant
  281. OnErrorOccurred = _PropertyGet(&quot;OnErrorOccurred&quot;)
  282. End Property &apos; OnErrorOccurred (get)
  283. Property Let OnErrorOccurred(ByVal pvValue As Variant)
  284. Call _PropertySet(&quot;OnErrorOccurred&quot;, pvValue)
  285. End Property &apos; OnErrorOccurred (set)
  286. REM -----------------------------------------------------------------------------------------------------------------------
  287. Property Get OnFocusGained() As Variant
  288. OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
  289. End Property &apos; OnFocusGained (get)
  290. Property Let OnFocusGained(ByVal pvValue As Variant)
  291. Call _PropertySet(&quot;OnFocusGained&quot;, pvValue)
  292. End Property &apos; OnFocusGained (set)
  293. REM -----------------------------------------------------------------------------------------------------------------------
  294. Property Get OnFocusLost() As Variant
  295. OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
  296. End Property &apos; OnFocusLost (get)
  297. Property Let OnFocusLost(ByVal pvValue As Variant)
  298. Call _PropertySet(&quot;OnFocusLost&quot;, pvValue)
  299. End Property &apos; OnFocusLost (set)
  300. REM -----------------------------------------------------------------------------------------------------------------------
  301. Property Get OnItemStateChanged() As Variant
  302. OnItemStateChanged = _PropertyGet(&quot;OnItemStateChanged&quot;)
  303. End Property &apos; OnItemStateChanged (get)
  304. Property Let OnItemStateChanged(ByVal pvValue As Variant)
  305. Call _PropertySet(&quot;OnItemStateChanged&quot;, pvValue)
  306. End Property &apos; OnItemStateChanged (set)
  307. REM -----------------------------------------------------------------------------------------------------------------------
  308. Property Get OnKeyPressed() As Variant
  309. OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
  310. End Property &apos; OnKeyPressed (get)
  311. Property Let OnKeyPressed(ByVal pvValue As Variant)
  312. Call _PropertySet(&quot;OnKeyPressed&quot;, pvValue)
  313. End Property &apos; OnKeyPressed (set)
  314. REM -----------------------------------------------------------------------------------------------------------------------
  315. Property Get OnKeyReleased() As Variant
  316. OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
  317. End Property &apos; OnKeyReleased (get)
  318. Property Let OnKeyReleased(ByVal pvValue As Variant)
  319. Call _PropertySet(&quot;OnKeyReleased&quot;, pvValue)
  320. End Property &apos; OnKeyReleased (set)
  321. REM -----------------------------------------------------------------------------------------------------------------------
  322. Property Get OnMouseDragged() As Variant
  323. OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
  324. End Property &apos; OnMouseDragged (get)
  325. Property Let OnMouseDragged(ByVal pvValue As Variant)
  326. Call _PropertySet(&quot;OnMouseDragged&quot;, pvValue)
  327. End Property &apos; OnMouseDragged (set)
  328. REM -----------------------------------------------------------------------------------------------------------------------
  329. Property Get OnMouseEntered() As Variant
  330. OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
  331. End Property &apos; OnMouseEntered (get)
  332. Property Let OnMouseEntered(ByVal pvValue As Variant)
  333. Call _PropertySet(&quot;OnMouseEntered&quot;, pvValue)
  334. End Property &apos; OnMouseEntered (set)
  335. REM -----------------------------------------------------------------------------------------------------------------------
  336. Property Get OnMouseExited() As Variant
  337. OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
  338. End Property &apos; OnMouseExited (get)
  339. Property Let OnMouseExited(ByVal pvValue As Variant)
  340. Call _PropertySet(&quot;OnMouseExited&quot;, pvValue)
  341. End Property &apos; OnMouseExited (set)
  342. REM -----------------------------------------------------------------------------------------------------------------------
  343. Property Get OnMouseMoved() As Variant
  344. OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
  345. End Property &apos; OnMouseMoved (get)
  346. Property Let OnMouseMoved(ByVal pvValue As Variant)
  347. Call _PropertySet(&quot;OnMouseMoved&quot;, pvValue)
  348. End Property &apos; OnMouseMoved (set)
  349. REM -----------------------------------------------------------------------------------------------------------------------
  350. Property Get OnMousePressed() As Variant
  351. OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
  352. End Property &apos; OnMousePressed (get)
  353. Property Let OnMousePressed(ByVal pvValue As Variant)
  354. Call _PropertySet(&quot;OnMousePressed&quot;, pvValue)
  355. End Property &apos; OnMousePressed (set)
  356. REM -----------------------------------------------------------------------------------------------------------------------
  357. Property Get OnMouseReleased() As Variant
  358. OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
  359. End Property &apos; OnMouseReleased (get)
  360. Property Let OnMouseReleased(ByVal pvValue As Variant)
  361. Call _PropertySet(&quot;OnMouseReleased&quot;, pvValue)
  362. End Property &apos; OnMouseReleased (set)
  363. REM -----------------------------------------------------------------------------------------------------------------------
  364. Property Get OnResetted() As Variant
  365. OnResetted = _PropertyGet(&quot;OnResetted&quot;)
  366. End Property &apos; OnResetted (get)
  367. Property Let OnResetted(ByVal pvValue As Variant)
  368. Call _PropertySet(&quot;OnResetted&quot;, pvValue)
  369. End Property &apos; OnResetted (set)
  370. REM -----------------------------------------------------------------------------------------------------------------------
  371. Property Get OnTextChanged() As Variant
  372. OnTextChanged = _PropertyGet(&quot;OnTextChanged&quot;)
  373. End Property &apos; OnTextChanged (get)
  374. Property Let OnTextChanged(ByVal pvValue As Variant)
  375. Call _PropertySet(&quot;OnTextChanged&quot;, pvValue)
  376. End Property &apos; OnTextChanged (set)
  377. REM -----------------------------------------------------------------------------------------------------------------------
  378. Property Get OnUpdated() As Variant
  379. OnUpdated = _PropertyGet(&quot;OnUpdated&quot;)
  380. End Property &apos; OnUpdated (get)
  381. Property Let OnUpdated(ByVal pvValue As Variant)
  382. Call _PropertySet(&quot;OnUpdated&quot;, pvValue)
  383. End Property &apos; OnUpdated (set)
  384. REM -----------------------------------------------------------------------------------------------------------------------
  385. Property Get OptionValue() As Variant
  386. OptionValue = _PropertyGet(&quot;OptionValue&quot;)
  387. End Property &apos; OptionValue (get)
  388. Property Let OptionValue(ByVal pvValue As Variant)
  389. Call _PropertySet(&quot;OptionValue&quot;, pvValue)
  390. End Property &apos; OptionValue (set)
  391. REM -----------------------------------------------------------------------------------------------------------------------
  392. Property Get Page() As Variant
  393. Page = _PropertyGet(&quot;Page&quot;)
  394. End Property &apos; Page (get)
  395. Property Let Page(ByVal pvValue As Variant)
  396. Call _PropertySet(&quot;Page&quot;, pvValue)
  397. End Property &apos; Page (set)
  398. REM -----------------------------------------------------------------------------------------------------------------------
  399. Public Function Parent() As Object
  400. Parent = _PropertyGet(&quot;Parent&quot;)
  401. End Function &apos; Parent (get) V0.9.1
  402. REM -----------------------------------------------------------------------------------------------------------------------
  403. Property Get Picture() As Variant
  404. Picture = _PropertyGet(&quot;Picture&quot;)
  405. End Property &apos; Picture (get)
  406. Property Let Picture(ByVal pvValue As Variant)
  407. Call _PropertySet(&quot;Picture&quot;, pvValue)
  408. End Property &apos; Picture (set) V1.5.0
  409. REM -----------------------------------------------------------------------------------------------------------------------
  410. Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
  411. &apos; Return
  412. &apos; a Collection object if pvIndex absent
  413. &apos; a Property object otherwise
  414. Utils._SetCalledSub(&quot;Control.Properties&quot;)
  415. Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
  416. vPropertiesList = _PropertiesList()
  417. sObject = Utils._PCase(_Type)
  418. If IsMissing(pvIndex) Then
  419. vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
  420. Else
  421. vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
  422. vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
  423. End If
  424. Exit_Function:
  425. Set Properties = vProperty
  426. Utils._ResetCalledSub(&quot;Control.Properties&quot;)
  427. Exit Function
  428. End Function &apos; Properties
  429. REM -----------------------------------------------------------------------------------------------------------------------
  430. Property Get Required() As Variant
  431. Required = _PropertyGet(&quot;Required&quot;)
  432. End Property &apos; Required (get)
  433. Property Let Required(ByVal pvValue As Variant)
  434. Call _PropertySet(&quot;Required&quot;, pvValue)
  435. End Property &apos; Required (set)
  436. REM -----------------------------------------------------------------------------------------------------------------------
  437. Property Get RowSource() As Variant
  438. RowSource = _PropertyGet(&quot;RowSource&quot;)
  439. End Property &apos; RowSource (get)
  440. Property Let RowSource(ByVal pvValue As Variant)
  441. Call _PropertySet(&quot;RowSource&quot;, pvValue)
  442. End Property &apos; RowSource (set)
  443. REM -----------------------------------------------------------------------------------------------------------------------
  444. Property Get RowSourceType() As Variant
  445. RowSourceType = _PropertyGet(&quot;RowSourceType&quot;)
  446. End Property &apos; RowSourceType (get)
  447. Property Let RowSourceType(ByVal pvValue As Variant)
  448. Call _PropertySet(&quot;RowSourceType&quot;, pvValue)
  449. End Property &apos; RowSourceType (set)
  450. REM -----------------------------------------------------------------------------------------------------------------------
  451. Property Get Selected(ByVal Optional pvIndex As Variant) As Variant
  452. If IsMissing(pvIndex) Then Selected = _PropertyGet(&quot;Selected&quot;) Else Selected = _PropertyGet(&quot;Selected&quot;, pvIndex)
  453. End Property &apos; Selected (get)
  454. Property Let Selected(ByVal pvValue As Variant) &apos; , ByVal Optional pvIndex As Variant)
  455. &apos; If IsMissing(pvIndex) Then Call _PropertySet(&quot;Selected&quot;, pvValue) Else Call _PropertySet(&quot;Selected&quot;, pvValue, pvIndex)
  456. Call _PropertySet(&quot;Selected&quot;, pvValue)
  457. End Property &apos; Selected (set)
  458. Public Function SelectedI(ByVal pvValue As variant, ByVal pvIndex As Variant)
  459. Call _PropertySet(&quot;Selected&quot;, pvValue, pvIndex)
  460. End Function
  461. REM -----------------------------------------------------------------------------------------------------------------------
  462. Property Get SelLength() As Variant
  463. SelLength = _PropertyGet(&quot;SelLength&quot;)
  464. End Property &apos; SelLength (get)
  465. Property Let SelLength(ByVal pvValue As Variant)
  466. Call _PropertySet(&quot;SelLength&quot;, pvValue)
  467. End Property &apos; SelLength (set)
  468. REM -----------------------------------------------------------------------------------------------------------------------
  469. Property Get SelStart() As Variant
  470. SelStart = _PropertyGet(&quot;SelStart&quot;)
  471. End Property &apos; SelStart (get)
  472. Property Let SelStart(ByVal pvValue As Variant)
  473. Call _PropertySet(&quot;SelStart&quot;, pvValue)
  474. End Property &apos; SelStart (set)
  475. REM -----------------------------------------------------------------------------------------------------------------------
  476. Property Get SelText() As Variant
  477. SelText = _PropertyGet(&quot;SelText&quot;)
  478. End Property &apos; SelText (get)
  479. Property Let SelText(ByVal pvValue As Variant)
  480. Call _PropertySet(&quot;SelText&quot;, pvValue)
  481. End Property &apos; SelText (set)
  482. REM -----------------------------------------------------------------------------------------------------------------------
  483. Property Get SpecialEffect() As Variant
  484. SpecialEffect = _PropertyGet(&quot;SpecialEffect&quot;)
  485. End Property &apos; SpecialEffect (get)
  486. Property Let SpecialEffect(ByVal pvValue As Variant)
  487. Call _PropertySet(&quot;SpecialEffect&quot;, pvValue)
  488. End Property &apos; SpecialEffect (set)
  489. REM -----------------------------------------------------------------------------------------------------------------------
  490. Property Get SubType() As Variant
  491. SubType = _PropertyGet(&quot;SubType&quot;)
  492. End Property &apos; SubType (get)
  493. REM -----------------------------------------------------------------------------------------------------------------------
  494. Property Get TabIndex() As Variant
  495. TabIndex = _PropertyGet(&quot;TabIndex&quot;)
  496. End Property &apos; TabIndex (get)
  497. Property Let TabIndex(ByVal pvValue As Variant)
  498. Call _PropertySet(&quot;TabIndex&quot;, pvValue)
  499. End Property &apos; TabIndex (set)
  500. REM -----------------------------------------------------------------------------------------------------------------------
  501. Property Get TabStop() As Variant
  502. TabStop = _PropertyGet(&quot;TabStop&quot;)
  503. End Property &apos; TabStop (get)
  504. Property Let TabStop(ByVal pvValue As Variant)
  505. Call _PropertySet(&quot;TabStop&quot;, pvValue)
  506. End Property &apos; TabStop (set)
  507. REM -----------------------------------------------------------------------------------------------------------------------
  508. Property Get Tag() As Variant
  509. Tag = _PropertyGet(&quot;Tag&quot;)
  510. End Property &apos; Tag (get)
  511. Property Let Tag(ByVal pvValue As Variant)
  512. Call _PropertySet(&quot;Tag&quot;, pvValue)
  513. End Property &apos; Tag (set)
  514. REM -----------------------------------------------------------------------------------------------------------------------
  515. Property Get Text() As Variant
  516. Text = _PropertyGet(&quot;Text&quot;)
  517. End Property &apos; Text (get)
  518. Public Function pText() As Variant
  519. pText = _PropertyGet(&quot;Text&quot;)
  520. End Function &apos; pText (get)
  521. REM -----------------------------------------------------------------------------------------------------------------------
  522. Property Get TextAlign() As Variant
  523. TextAlign = _PropertyGet(&quot;TextAlign&quot;)
  524. End Property &apos; TextAlign (get)
  525. Property Let TextAlign(ByVal pvValue As Variant)
  526. Call _PropertySet(&quot;TextAlign&quot;, pvValue)
  527. End Property &apos; TextAlign (set)
  528. REM -----------------------------------------------------------------------------------------------------------------------
  529. Property Get TripleState() As Variant
  530. TripleState = _PropertyGet(&quot;TripleState&quot;)
  531. End Property &apos; TripleState (get)
  532. Property Let TripleState(ByVal pvValue As Variant)
  533. Call _PropertySet(&quot;TripleState&quot;, pvValue)
  534. End Property &apos; TripleState (set)
  535. REM -----------------------------------------------------------------------------------------------------------------------
  536. Property Get Value() As Variant
  537. Value = _PropertyGet(&quot;Value&quot;)
  538. End Property &apos; Value (get)
  539. Property Let Value(ByVal pvValue As Variant)
  540. Call _PropertySet(&quot;Value&quot;, pvValue)
  541. End Property &apos; Value (set)
  542. REM -----------------------------------------------------------------------------------------------------------------------
  543. Property Get Visible() As Variant
  544. Visible = _PropertyGet(&quot;Visible&quot;)
  545. End Property &apos; Visible (get)
  546. Property Let Visible(ByVal pvValue As Variant)
  547. Call _PropertySet(&quot;Visible&quot;, pvValue)
  548. End Property &apos; Visible (set)
  549. REM -----------------------------------------------------------------------------------------------------------------------
  550. REM --- CLASS METHODS ---
  551. REM -----------------------------------------------------------------------------------------------------------------------
  552. Public Function AddItem(ByVal Optional pvItem As Variant, ByVal Optional pvIndex) As Boolean
  553. &apos; Add an item in a Listbox
  554. Utils._SetCalledSub(&quot;Control.AddItem&quot;)
  555. AddItem = False
  556. If _ErrorHandler() Then On Local Error Goto Error_Function
  557. If IsMissing(pvItem) Then Call _TraceArguments()
  558. If IsMissing(pvIndex) Then pvIndex = -1
  559. Dim iArgNr As Integer
  560. Select Case UCase(_A2B_.CalledSub)
  561. Case UCase(&quot;AddItem&quot;) : iArgNr = 1
  562. Case UCase(&quot;Control.AddItem&quot;) : iArgNr = 0
  563. End Select
  564. If Not Utils._CheckArgument(pvItem, iArgNr + 1, vbString) Then Goto Exit_Function
  565. If Not Utils._CheckArgument(pvIndex, iArgNr + 2, Utils._AddNumeric()) Then Goto Exit_Function
  566. If _SubType &lt;&gt; CTLLISTBOX Then Goto Error_Control
  567. If _ParentType &lt;&gt; CTLPARENTISDIALOG Then
  568. If ControlModel.ListSourceType &lt;&gt; com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
  569. End If
  570. Dim vRowSource() As Variant, iCount As Integer, i As Integer
  571. If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
  572. iCount = UBound(vRowSource)
  573. If pvIndex &lt; -1 Or pvIndex &gt; iCount + 1 Then Goto Error_Index
  574. ReDim Preserve vRowSource(0 To iCount + 1)
  575. If pvIndex = -1 Then pvIndex = iCount + 1
  576. For i = iCount + 1 To pvIndex + 1 Step -1
  577. vRowSource(i) = vRowSource(i - 1)
  578. Next i
  579. vRowSource(pvIndex) = pvItem
  580. If _ParentType &lt;&gt; CTLPARENTISDIALOG Then
  581. ControlModel.ListSource = vRowSource()
  582. End If
  583. ControlModel.StringItemList = vRowSource()
  584. AddItem = True
  585. Exit_Function:
  586. Utils._ResetCalledSub(&quot;Control.AddItem&quot;)
  587. Exit Function
  588. Error_Function:
  589. TraceError(TRACEABORT, Err, &quot;Control.AddItem&quot;, Erl)
  590. AddItem = False
  591. GoTo Exit_Function
  592. Error_Control:
  593. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , &quot;Control.AddItem&quot;)
  594. AddItem = False
  595. Goto Exit_Function
  596. Error_Index:
  597. TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(iArgNr + 2,pvIndex))
  598. AddItem = False
  599. Goto Exit_Function
  600. End Function &apos; AddItem V0.9.1
  601. REM -----------------------------------------------------------------------------------------------------------------------
  602. Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
  603. &apos; Return a Control object with name or index = pvIndex
  604. Const cstThisSub = &quot;Control.Controls&quot;
  605. If _ErrorHandler() Then On Local Error Goto Error_Function
  606. Utils._SetCalledSub(cstThisSub)
  607. Dim ocControl As Variant, sParentShortcut As String, iControlCount As Integer
  608. Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String
  609. Dim j As Integer, oView As Object
  610. If _SubType &lt;&gt; CTLGRIDCONTROL Then Goto Trace_Error_Context
  611. Set ocControl = Nothing
  612. iControlCount = ControlModel.getCount()
  613. If IsMissing(pvIndex) Then &apos; No argument, return Collection pseudo-object
  614. Set oCounter = New Collect
  615. Set oCounter._This = oCounter
  616. oCounter._CollType = COLLCONTROLS
  617. Set oCounter._Parent = _This
  618. oCounter._Count = iControlCount
  619. Set Controls = oCounter
  620. Goto Exit_Function
  621. End If
  622. If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
  623. &apos; Start building the ocControl object
  624. &apos; Determine exact name
  625. Set ocControl = New Control
  626. Set ocControl._This = ocControl
  627. Set ocControl._Parent = _This
  628. ocControl._ParentType = CTLPARENTISGRID
  629. sParentShortcut = _Shortcut
  630. sControls() = ControlModel.getElementNames()
  631. Select Case VarType(pvIndex)
  632. Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
  633. If pvIndex &lt; 0 Or pvIndex &gt; iControlCount - 1 Then Goto Trace_Error_Index
  634. ocControl._Name = sControls(pvIndex)
  635. Case vbString &apos; Check control name validity (non case sensitive)
  636. bFound = False
  637. sIndex = UCase(Utils._Trim(pvIndex))
  638. For i = 0 To iControlCount - 1
  639. If UCase(sControls(i)) = sIndex Then
  640. bFound = True
  641. Exit For
  642. End If
  643. Next i
  644. If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
  645. End Select
  646. With ocControl
  647. ._Shortcut = sParentShortcut &amp; &quot;!&quot; &amp; Utils._Surround(._Name)
  648. Set .ControlModel = ControlModel.getByName(._Name)
  649. ._ImplementationName = .ControlModel.ColumnServiceName &apos; getImplementationName aborts for subcontrols !?
  650. ._FormComponent = ParentComponent
  651. ._MainForm = _MainForm
  652. If Utils._hasUNOProperty(.ControlModel, &quot;ClassId&quot;) Then ._ClassId = .ControlModel.ClassId
  653. &apos; Complex bypass to find View of grid subcontrols !
  654. If Not IsNull(ControlView) Then &apos; Anticipate absence of ControlView in grid controls when edit mode
  655. For i = 0 to ControlView.getCount() - 1
  656. Set oView = ControlView.GetByIndex(i)
  657. If Not IsNull(oView) Then
  658. If oView.getModel.Name = ._Name Then
  659. Set .ControlView = oView
  660. Exit For
  661. End If
  662. End If
  663. Next i
  664. End If
  665. ._Initialize()
  666. ._DocEntry = _DocEntry
  667. ._DbEntry = _DbEntry
  668. End With
  669. Set Controls = ocControl
  670. Exit_Function:
  671. Utils._ResetCalledSub(cstThisSub)
  672. Exit Function
  673. Trace_Error_Index:
  674. TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1)
  675. Set Controls = Nothing
  676. Goto Exit_Function
  677. Trace_NotFound:
  678. TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(), 0, , Array(pvIndex, _Name))
  679. Set Controls = Nothing
  680. Goto Exit_Function
  681. Trace_Error_Context:
  682. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , &quot;Grid.Controls&quot;)
  683. Set Controls = Nothing
  684. Goto Exit_Function
  685. Error_Function:
  686. TraceError(TRACEABORT, Err, cstThisSub, Erl)
  687. Set Controls = Nothing
  688. GoTo Exit_Function
  689. End Function &apos; Controls
  690. REM -----------------------------------------------------------------------------------------------------------------------
  691. Public Function getProperty(Optional ByVal pvProperty As Variant, ByVal Optional pvIndex As Variant) As Variant
  692. &apos; Return property value of psProperty property name
  693. Utils._SetCalledSub(&quot;Control.getProperty&quot;)
  694. If IsMissing(pvProperty) Then Call _TraceArguments()
  695. If IsMissing(pvIndex) Then
  696. getProperty = _PropertyGet(pvProperty)
  697. Else
  698. getProperty = _PropertyGet(pvProperty, pvIndex)
  699. End If
  700. Utils._ResetCalledSub(&quot;Control.getProperty&quot;)
  701. End Function &apos; getProperty
  702. REM -----------------------------------------------------------------------------------------------------------------------
  703. Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
  704. &apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
  705. If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
  706. Exit Function
  707. End Function &apos; hasProperty
  708. REM -----------------------------------------------------------------------------------------------------------------------
  709. Public Function RemoveItem(ByVal Optional pvIndex) As Boolean
  710. &apos; Remove an item from a Listbox
  711. &apos; Index may be a string value or an index-position
  712. Utils._SetCalledSub(&quot;Control.RemoveItem&quot;)
  713. If _ErrorHandler() Then On Local Error Goto Error_Function
  714. If IsMissing(pvIndex) Then Call _TraceArguments()
  715. Dim iArgNr As Integer
  716. Select Case UCase(_A2B_.CalledSub)
  717. Case UCase(&quot;RemoveItem&quot;) : iArgNr = 1
  718. Case UCase(&quot;Control.RemoveItem&quot;) : iArgNr = 0
  719. End Select
  720. If Not Utils._CheckArgument(pvIndex, iArgNr + 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
  721. If _SubType &lt;&gt; CTLLISTBOX Then Goto Error_Control
  722. If _ParentType &lt;&gt; CTLPARENTISDIALOG Then
  723. If ControlModel.ListSourceType &lt;&gt; com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
  724. End If
  725. Dim vRowSource() As Variant, iCount As Integer, i As Integer, j As integer, bFound As Boolean
  726. If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
  727. iCount = UBound(vRowSource)
  728. Select Case VarType(pvIndex)
  729. Case vbString
  730. bFound = False
  731. For i = 0 To iCount
  732. If vRowSource(i) = pvIndex Then
  733. For j = i To iCount - 1
  734. vRowSource(j) = vRowSource(j + 1)
  735. Next j
  736. bFound = True
  737. Exit For &apos; Remove only 1st occurrence of string
  738. End If
  739. Next i
  740. Case Else
  741. If pvIndex &lt; 0 Or pvIndex &gt; iCount Then Goto Error_Index
  742. For i = pvIndex To iCount - 1
  743. vRowSource(i) = vRowSource(i + 1)
  744. Next i
  745. bFound = True
  746. End Select
  747. If bFound Then
  748. If iCount &gt; 0 Then &apos; https://forum.openoffice.org/en/forum/viewtopic.php?f=47&amp;t=75008
  749. ReDim Preserve vRowSource(0 To iCount - 1)
  750. Else
  751. vRowSource = Array()
  752. End If
  753. If _ParentType &lt;&gt; CTLPARENTISDIALOG Then
  754. ControlModel.ListSource = vRowSource()
  755. End If
  756. ControlModel.StringItemList = vRowSource()
  757. RemoveItem = True
  758. Else
  759. RemoveItem = False
  760. End If
  761. Exit_Function:
  762. Utils._ResetCalledSub(&quot;Control.RemoveItem&quot;)
  763. Exit Function
  764. Error_Function:
  765. TraceError(TRACEABORT, Err, &quot;Control.RemoveItem&quot;, Erl)
  766. RemoveItem = False
  767. GoTo Exit_Function
  768. Error_Control:
  769. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, &quot;Control.RemoveItem&quot;)
  770. RemoveItem = False
  771. Goto Exit_Function
  772. Error_Index:
  773. TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(2, pvIndex))
  774. RemoveItem = False
  775. Goto Exit_Function
  776. End Function &apos; RemoveItem V0.9.1
  777. REM -----------------------------------------------------------------------------------------------------------------------
  778. Public Function Requery() As Boolean
  779. &apos; Refresh data displayed in a form, subform, combobox or listbox
  780. Utils._SetCalledSub(&quot;Control.Requery&quot;)
  781. If _ErrorHandler() Then On Local Error Goto Error_Function
  782. Requery = False
  783. Select Case _SubType
  784. Case CTLCOMBOBOX, CTLLISTBOX
  785. If Utils._InList(ControlModel.ListSourceType, Array( _
  786. com.sun.star.form.ListSourceType.QUERY _
  787. , com.sun.star.form.ListSourceType.TABLE _
  788. , com.sun.star.form.ListSourceType.TABLEFIELDS _
  789. , com.sun.star.form.ListSourceType.SQL _
  790. , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
  791. )) Then
  792. ControlModel.refresh()
  793. End If
  794. Case Else
  795. Goto Error_Control
  796. End Select
  797. Requery = True
  798. Exit_Function:
  799. Utils._ResetCalledSub(&quot;Control.Requery&quot;)
  800. Exit Function
  801. Error_Control:
  802. TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, &quot;Control.Requery&quot;)
  803. Requery = False
  804. Goto Exit_Function
  805. Error_Function:
  806. TraceError(TRACEABORT, Err, &quot;Control.Requery&quot;, Erl)
  807. GoTo Exit_Function
  808. End Function &apos; Requery
  809. REM -----------------------------------------------------------------------------------------------------------------------
  810. Public Function SetFocus() As Boolean
  811. &apos; Execute setFocus method
  812. Utils._SetCalledSub(&quot;Control.SetFocus&quot;)
  813. If _ErrorHandler() Then On Local Error Goto Error_Function
  814. SetFocus = False
  815. Dim i As Integer, j As Integer, iColPosition As Integer
  816. Dim ocControl As Object, ocGrid As Variant, oGridModel As Object
  817. If IsNull(ControlView) Then GoTo Exit_Function
  818. If _ParentType = CTLPARENTISGRID Then &apos;setFocus method does not work on controlviews in grid ?!?
  819. &apos; Find column position of control
  820. iColPosition = -1
  821. ocGrid = getObject(_getUpperShortcut(_Shortcut, _Name)) &apos; return containing grid
  822. Set oGridModel = ocGrid.ControlModel
  823. j = -1
  824. For i = 0 To oGridModel.Count - 1
  825. Set ocControl = oGridModel.GetByIndex(i)
  826. If Not ocControl.Hidden Then j = j + 1 &apos; Skip if hidden
  827. If oGridModel.GetByIndex(i).Name = _Name Then
  828. iColPosition = j
  829. Exit For
  830. End If
  831. Next i
  832. If iColPosition &gt;= 0 Then
  833. ocGrid.ControlView.setFocus() &apos;Set first focus on grid itself
  834. ocGrid.ControlView.setCurrentColumnPosition(iColPosition) &apos;Deprecated but no alternative found
  835. Else
  836. Goto Error_Grid
  837. End If
  838. Else
  839. ControlView.setFocus()
  840. End If
  841. SetFocus = True
  842. Exit_Function:
  843. Utils._ResetCalledSub(&quot;Control.SetFocus&quot;)
  844. Exit Function
  845. Error_Function:
  846. TraceError(TRACEABORT, Err, &quot;Control.SetFocus&quot;, Erl)
  847. Goto Exit_Function
  848. Error_Grid:
  849. TraceError(TRACEFATAL, ERRFOCUSINGRID, Utils._CalledSub(), 0, 1, Array(_Name, ocGrid._Name))
  850. Goto Exit_Function
  851. End Function &apos; SetFocus V0.9.0
  852. REM -----------------------------------------------------------------------------------------------------------------------
  853. Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
  854. &apos; Return True if property setting OK
  855. Utils._SetCalledSub(&quot;Control.setProperty&quot;)
  856. If IsMissing(pvIndex) Then
  857. setProperty = _PropertySet(psProperty, pvValue)
  858. Else
  859. setProperty = _PropertySet(psProperty, pvValue, pvIndex)
  860. End If
  861. Utils._ResetCalledSub(&quot;Control.setProperty&quot;)
  862. End Function &apos; setProperty
  863. REM -----------------------------------------------------------------------------------------------------------------------
  864. Public Function SetSelected(ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
  865. &apos; Workaround for limitation of Basic: Property Let does not accept optional arguments
  866. If IsMissing(pvValue) Then Call _TraceArguments()
  867. If IsMissing(pvIndex) Then
  868. SetSelected = _PropertySet(&quot;Selected&quot;, pvValue)
  869. Else
  870. SetSelected = _PropertySet(&quot;Selected&quot;, pvValue, pvIndex)
  871. End If
  872. End Function &apos; SetSelected
  873. REM -----------------------------------------------------------------------------------------------------------------------
  874. REM --- PRIVATE FUNCTIONS ---
  875. REM -----------------------------------------------------------------------------------------------------------------------
  876. Private Function _Formats(ByVal psControlType As String) As Variant
  877. &apos; Return allowed format entries for Date and Time control types
  878. Dim vFormats() As Variant
  879. Select Case psControlType
  880. Case CTLDATEFIELD
  881. vFormats = Array( _
  882. &quot;Standard (short)&quot; _
  883. , &quot;Standard (short YY)&quot; _
  884. , &quot;Standard (short YYYY)&quot; _
  885. , &quot;Standard (long)&quot; _
  886. , &quot;DD/MM/YY&quot; _
  887. , &quot;MM/DD/YY&quot; _
  888. , &quot;YY/MM/DD&quot; _
  889. , &quot;DD/MM/YYYY&quot; _
  890. , &quot;MM/DD/YYYY&quot; _
  891. , &quot;YYYY/MM/DD&quot; _
  892. , &quot;YY-MM-DD&quot; _
  893. , &quot;YYYY-MM-DD&quot; _
  894. )
  895. Case CTLTIMEFIELD
  896. vFormats = Array( _
  897. &quot;24h short&quot; _
  898. , &quot;24h long&quot; _
  899. , &quot;12h short&quot; _
  900. , &quot;12h long&quot; _
  901. )
  902. Case Else
  903. vFormats = Array()
  904. End Select
  905. _Formats = vFormats
  906. End Function &apos; _Formats V0.9.1
  907. REM -----------------------------------------------------------------------------------------------------------------------
  908. Private Function _GetListener(ByVal psProperty As String) As String
  909. &apos; Return the X...Listener corresponding with the property in argument
  910. Select Case UCase(psProperty)
  911. Case UCase(&quot;OnActionPerformed&quot;)
  912. _GetListener = &quot;XActionListener&quot;
  913. Case UCase(&quot;OnAdjustmentValueChanged&quot;)
  914. _GetListener = &quot;XAdjustmentListener&quot;
  915. Case UCase(&quot;OnApproveAction&quot;)
  916. _GetListener = &quot;XApproveActionListener&quot;
  917. Case UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnResetted&quot;)
  918. _GetListener = &quot;XResetListener&quot;
  919. Case UCase(&quot;OnApproveUpdate&quot;), UCase(&quot;OnUpdated&quot;)
  920. _GetListener = &quot;XUpdateListener&quot;
  921. Case UCase(&quot;OnChanged&quot;)
  922. _GetListener = &quot;XChangeListener&quot;
  923. Case UCase(&quot;OnErrorOccurred&quot;)
  924. _GetListener = &quot;XErrorListener&quot;
  925. Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
  926. _GetListener = &quot;XFocusListener&quot;
  927. Case UCase(&quot;OnItemStateChanged&quot;)
  928. _GetListener = &quot;XItemListener&quot;
  929. Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
  930. _GetListener = &quot;XKeyListener&quot;
  931. Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
  932. _GetListener = &quot;XMouseMotionListener&quot;
  933. Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
  934. _GetListener = &quot;XMouseListener&quot;
  935. Case UCase(&quot;OnTextChanged&quot;)
  936. _GetListener = &quot;XTextListener&quot;
  937. End Select
  938. End Function &apos; _GetListener V1.7.0
  939. REM -----------------------------------------------------------------------------------------------------------------------
  940. Public Sub _Initialize()
  941. &apos; Initialize new Control
  942. &apos; ControlModel, ParentType, Name, Shortcut, ControlView, ImplementationName, ClassId (if parent &lt;&gt; dialog)
  943. &apos; are presumed preexisting
  944. &apos; Identify SubType and ControlView
  945. Dim sControlTypes() As Variant, i As Integer, vSplit() As Variant, sTrailer As String
  946. sControlTypes = array( CTLCONTROL _
  947. , CTLCOMMANDBUTTON _
  948. , CTLRADIOBUTTON _
  949. , CTLIMAGEBUTTON _
  950. , CTLCHECKBOX _
  951. , CTLLISTBOX _
  952. , CTLCOMBOBOX _
  953. , CTLGROUPBOX _
  954. , CTLTEXTFIELD _
  955. , CTLFIXEDTEXT _
  956. , CTLGRIDCONTROL _
  957. , CTLFILECONTROL _
  958. , CTLHIDDENCONTROL _
  959. , CTLIMAGECONTROL _
  960. , CTLDATEFIELD _
  961. , CTLTIMEFIELD _
  962. , CTLNUMERICFIELD _
  963. , CTLCURRENCYFIELD _
  964. , CTLPATTERNFIELD _
  965. , CTLSCROLLBAR _
  966. , CTLSPINBUTTON _
  967. , CTLNAVIGATIONBAR _
  968. , CTLPROGRESSBAR _
  969. , CTLFIXEDLINE _
  970. )
  971. Select Case _ParentType
  972. Case CTLPARENTISDIALOG
  973. vSplit = Split(ControlModel.getServiceName(), &quot;.&quot;)
  974. sTrailer = UCase(vSplit(UBound(vSplit)))
  975. &apos; Manage homonyms
  976. Select Case sTrailer
  977. Case &quot;BUTTON&quot; : sTrailer = CTLCOMMANDBUTTON
  978. Case &quot;EDIT&quot; : sTrailer = CTLTEXTFIELD
  979. Case Else
  980. End Select
  981. If sTrailer &lt;&gt; CTLFORMATTEDFIELD Then
  982. For i = 0 To UBound(sControlTypes)
  983. If sControlTypes(i) = sTrailer Then
  984. _ClassId = i + 1
  985. _SubType = sTrailer
  986. _ControlType = _ClassId
  987. Exit For
  988. End If
  989. Next i
  990. Else
  991. _ClassId = acFormattedField
  992. _SubType = CTLFORMATTEDFIELD
  993. _ControlType = _ClassId
  994. End If
  995. Case Else
  996. &apos;Is ClassId one of the properties ?
  997. If _ClassId &gt; 0 Then &apos; All control types have a ClassId except subforms
  998. _SubType = sControlTypes(_ClassId - 1)
  999. _ControlType = _ClassId
  1000. If _SubType = CTLTEXTFIELD Then &apos; Formatted fields belong to the TextField family
  1001. If _ImplementationName = &quot;com.sun.star.comp.forms.OFormattedFieldWrapper&quot; _
  1002. Or _ImplementationName = &quot;com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted&quot; _
  1003. Or _ImplementationName = &quot;com.sun.star.form.component.FormattedField&quot; Then &apos; When in datagrid
  1004. _SubType = CTLFORMATTEDFIELD
  1005. _ControlType = acFormattedField
  1006. End If
  1007. End If
  1008. Else &apos; Initialize subform Control
  1009. If ControlModel.ImplementationName = &quot;com.sun.star.comp.forms.ODatabaseForm&quot; Then
  1010. _SubType = CTLSUBFORM
  1011. _ControlType = acSubform
  1012. End If
  1013. End If
  1014. End Select
  1015. End Sub &apos; _Initialize
  1016. REM -----------------------------------------------------------------------------------------------------------------------
  1017. Public Function _ListboxBound() As Boolean
  1018. &apos; Return True if listbox has a bound column
  1019. Dim bListboxBound As Boolean, j As Integer
  1020. Dim vValue() As variant, vString As Variant
  1021. bListboxBound = False
  1022. If Not IsNull(ControlModel.ValueItemList) _
  1023. And ControlModel.DataField &lt;&gt; &quot;&quot; _
  1024. And Not IsNull(ControlModel.BoundField) _
  1025. And Utils._InList(ControlModel.ListSourceType, Array( _
  1026. com.sun.star.form.ListSourceType.TABLE _
  1027. , com.sun.star.form.ListSourceType.QUERY _
  1028. , com.sun.star.form.ListSourceType.SQL _
  1029. , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
  1030. )) Then &apos; MultiSelect behaviour changed in OpenOffice &gt;= 3.3
  1031. If IsArray(ControlModel.ValueItemList) Then
  1032. vValue = ControlModel.ValueItemList
  1033. vString = ControlModel.StringItemList
  1034. For j = 0 To UBound(vValue)
  1035. If VarType(vValue(j)) &lt;&gt; VarType(vString(j)) Then
  1036. bListboxBound = True
  1037. ElseIf vValue(j) &lt;&gt; vString(j) Then
  1038. bListboxBound = True
  1039. End If
  1040. If bListboxBound Then Exit For
  1041. Next j
  1042. End If
  1043. End If
  1044. _ListboxBound = bListboxBound
  1045. End Function &apos; _ListboxBound V0.9.0
  1046. REM -----------------------------------------------------------------------------------------------------------------------
  1047. Private Function _PropertiesList() As Variant
  1048. &apos; Based on ControlProperties.ods analysis
  1049. Dim vFullPropertiesList() As Variant
  1050. &apos;List established only once
  1051. If UBound(_ThisProperties) &gt; -1 Then
  1052. _PropertiesList = _ThisProperties
  1053. Exit Function
  1054. End If
  1055. vFullPropertiesList = Array( _
  1056. &quot;BackColor&quot; _
  1057. , &quot;BorderColor&quot; _
  1058. , &quot;BorderStyle&quot; _
  1059. , &quot;Cancel&quot; _
  1060. , &quot;Caption&quot; _
  1061. , &quot;ControlSource&quot; _
  1062. , &quot;ControlTipText&quot; _
  1063. , &quot;ControlType&quot; _
  1064. , &quot;Default&quot; _
  1065. , &quot;DefaultValue&quot; _
  1066. , &quot;Enabled&quot; _
  1067. , &quot;FontBold&quot; _
  1068. , &quot;FontItalic&quot; _
  1069. , &quot;FontName&quot; _
  1070. , &quot;FontSize&quot; _
  1071. , &quot;FontUnderline&quot; _
  1072. , &quot;FontWeight&quot; _
  1073. , &quot;ForeColor&quot; _
  1074. , &quot;Form&quot; _
  1075. , &quot;Format&quot; _
  1076. , &quot;ItemData&quot; _
  1077. , &quot;LinkChildFields&quot; _
  1078. , &quot;LinkMasterFields&quot; _
  1079. , &quot;ListCount&quot; _
  1080. , &quot;ListIndex&quot; _
  1081. , &quot;Locked&quot; _
  1082. , &quot;MultiSelect&quot; _
  1083. , &quot;Name&quot; _
  1084. , &quot;ObjectType&quot; _
  1085. , &quot;OnActionPerformed&quot; _
  1086. , &quot;OnAdjustmentValueChanged&quot; _
  1087. , &quot;OnApproveAction&quot; _
  1088. , &quot;OnApproveReset&quot; _
  1089. , &quot;OnApproveUpdate&quot; _
  1090. , &quot;OnChanged&quot; _
  1091. , &quot;OnErrorOccurred&quot; _
  1092. , &quot;OnFocusGained&quot; _
  1093. , &quot;OnFocusLost&quot; _
  1094. , &quot;OnItemStateChanged&quot; _
  1095. , &quot;OnKeyPressed&quot; _
  1096. , &quot;OnKeyReleased&quot; _
  1097. , &quot;OnMouseDragged&quot; _
  1098. , &quot;OnMouseEntered&quot; _
  1099. , &quot;OnMouseExited&quot; _
  1100. , &quot;OnMouseMoved&quot; _
  1101. , &quot;OnMousePressed&quot; _
  1102. , &quot;OnMouseReleased&quot; _
  1103. , &quot;OnResetted&quot; _
  1104. , &quot;OnTextChanged&quot; _
  1105. , &quot;OnUpdated&quot; _
  1106. , &quot;OptionValue&quot; _
  1107. , &quot;Page&quot; _
  1108. , &quot;Parent&quot; _
  1109. , &quot;Picture&quot; _
  1110. , &quot;Required&quot; _
  1111. , &quot;RowSource&quot; _
  1112. , &quot;RowSourceType&quot; _
  1113. , &quot;Selected&quot; _
  1114. , &quot;SelLength&quot; _
  1115. , &quot;SelStart&quot; _
  1116. , &quot;Seltext&quot; _
  1117. , &quot;SpecialEffect&quot; _
  1118. , &quot;SubType&quot; _
  1119. , &quot;TabIndex&quot; _
  1120. , &quot;TabStop&quot; _
  1121. , &quot;Tag&quot; _
  1122. , &quot;Text&quot; _
  1123. , &quot;TextAlign&quot; _
  1124. , &quot;TripleState&quot; _
  1125. , &quot;Value&quot; _
  1126. , &quot;Visible&quot; _
  1127. )
  1128. Dim vPropertiesMatrix(25) As Variant
  1129. Select Case _ParentType
  1130. Case CTLPARENTISFORM, CTLPARENTISSUBFORM
  1131. 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)
  1132. 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)
  1133. 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)
  1134. 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)
  1135. 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)
  1136. 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)
  1137. 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)
  1138. 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)
  1139. 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)
  1140. 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)
  1141. vPropertiesMatrix(acHiddenControl) = Array(7,27,28,52,62,65,69,70)
  1142. 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)
  1143. 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)
  1144. 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)
  1145. 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)
  1146. 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)
  1147. 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)
  1148. 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)
  1149. 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)
  1150. 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)
  1151. vPropertiesMatrix(0) = Array(7,18,21,22,27,28,52,62)
  1152. 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)
  1153. 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)
  1154. Case CTLPARENTISGROUP
  1155. &apos; To be duplicated from above !!!
  1156. 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)
  1157. Case CTLPARENTISGRID
  1158. 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)
  1159. 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)
  1160. 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)
  1161. 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)
  1162. 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)
  1163. 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)
  1164. 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)
  1165. 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)
  1166. 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)
  1167. 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)
  1168. Case CTLPARENTISDIALOG
  1169. 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)
  1170. 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)
  1171. 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)
  1172. 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)
  1173. 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)
  1174. 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)
  1175. 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)
  1176. 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)
  1177. 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)
  1178. 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)
  1179. 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)
  1180. 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)
  1181. vPropertiesMatrix(acNavigationBar) = Array(36,37,39,40,41,42,43,44,45,46)
  1182. 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)
  1183. 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)
  1184. 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)
  1185. 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)
  1186. 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)
  1187. 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)
  1188. 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)
  1189. End Select
  1190. Dim i As Integer, iIndex As Integer
  1191. If _ControlType = acSubForm Then iIndex = 0 Else iIndex = _ControlType
  1192. If IsEmpty(vPropertiesMatrix(iIndex)) Then
  1193. _ThisProperties = Array()
  1194. Else
  1195. ReDim _ThisProperties(0 To UBound(vPropertiesMatrix(iIndex)))
  1196. For i = 0 To UBound(_ThisProperties)
  1197. _ThisProperties(i) = vFullPropertiesList(vPropertiesMatrix(iIndex)(i))
  1198. Next i
  1199. End If
  1200. _PropertiesList = _ThisProperties()
  1201. End Function &apos; _PropertiesList
  1202. REM -----------------------------------------------------------------------------------------------------------------------
  1203. Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
  1204. &apos; Return property value of the psProperty property name
  1205. Dim iArg As Integer
  1206. If _ErrorHandler() Then On Local Error Goto Error_Function
  1207. Utils._SetCalledSub(&quot;Control.get&quot; &amp; psProperty)
  1208. _PropertyGet = EMPTY
  1209. &apos;Check Index argument
  1210. Dim iArgNr As Integer
  1211. If Not IsMissing(pvIndex) Then
  1212. Select Case UCase(_A2B_.CalledSub)
  1213. Case UCase(&quot;getProperty&quot;) : iArgNr = 3
  1214. Case UCase(&quot;Control.getProperty&quot;) : iArgNr = 2
  1215. Case UCase(&quot;Control.get&quot; &amp; psProperty) : iArgNr = 1
  1216. End Select
  1217. If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
  1218. End If
  1219. Dim vDefaultValue As Variant, oDefaultValue As Object, vValue As Variant, oValue As Object, iIndex As Integer
  1220. Dim lListIndex As Long, i As Integer, j As Integer, vCurrentValue As Variant, lListCount As Long
  1221. Dim vListboxValue As Variant, vListSource, bSelected() As Boolean, bListboxBound As Boolean
  1222. Dim vGet As Variant, vDate As Variant
  1223. Dim ofSubForm As Object
  1224. Dim vFormats() As Variant
  1225. Dim vSelection As Variant, sSelectedText As String
  1226. Dim oControlEvents As Object, sEventName As String
  1227. If Not hasProperty(psProperty) Then Goto Trace_Error
  1228. Select Case UCase(psProperty)
  1229. Case UCase(&quot;BackColor&quot;)
  1230. If Utils._hasUNOProperty(ControlModel, &quot;BackgroundColor&quot;) Then _PropertyGet = ControlModel.BackgroundColor
  1231. Case UCase(&quot;BorderColor&quot;)
  1232. If Utils._hasUNOProperty(ControlModel, &quot;BorderColor&quot;) Then _PropertyGet = ControlModel.BorderColor
  1233. Case UCase(&quot;BorderStyle&quot;)
  1234. If Utils._hasUNOProperty(ControlModel, &quot;Border&quot;) Then _PropertyGet = ControlModel.Border
  1235. Case UCase(&quot;Cancel&quot;)
  1236. If Utils._hasUNOProperty(ControlModel, &quot;PushButtonType&quot;) Then _PropertyGet = ( ControlModel.PushButtonType = com.sun.star.awt.PushButtonType.CANCEL )
  1237. Case UCase(&quot;Caption&quot;)
  1238. If Utils._hasUNOProperty(ControlModel, &quot;Label&quot;) Then _PropertyGet = ControlModel.Label
  1239. Case UCase(&quot;ControlSource&quot;)
  1240. If Utils._hasUNOProperty(ControlModel, &quot;DataField&quot;) Then _PropertyGet = ControlModel.DataField
  1241. Case UCase(&quot;ControlTipText&quot;)
  1242. If Utils._hasUNOProperty(ControlModel, &quot;HelpText&quot;) Then _PropertyGet = ControlModel.HelpText
  1243. Case UCase(&quot;ControlType&quot;)
  1244. _PropertyGet = _ControlType
  1245. Case UCase(&quot;Default&quot;)
  1246. If Utils._hasUNOProperty(ControlModel, &quot;DefaultButton&quot;) Then _PropertyGet = ControlModel.DefaultButton
  1247. Case UCase(&quot;DefaultValue&quot;)
  1248. Select Case _SubType
  1249. Case CTLCHECKBOX, CTLRADIOBUTTON
  1250. If Utils._hasUNOProperty(ControlModel, &quot;DefaultState&quot;) Then _PropertyGet = ControlModel.DefaultState
  1251. Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
  1252. If Utils._hasUNOProperty(ControlModel, &quot;DefaultText&quot;) Then _PropertyGet = ControlModel.DefaultText
  1253. Case CTLCURRENCYFIELD, CTLNUMERICFIELD
  1254. If Utils._hasUNOProperty(ControlModel, &quot;DefaultValue&quot;) Then _PropertyGet = ControlModel.DefaultValue
  1255. Case CTLDATEFIELD
  1256. If Utils._hasUNOProperty(ControlModel, &quot;DefaultDate&quot;) Then
  1257. Select Case VarType(ControlModel.DefaultDate)
  1258. Case vbLong &apos; AOO and LO &lt;= 4.1
  1259. vDefaultValue = ControlModel.DefaultDate
  1260. _PropertyGet = DateSerial(Left(vDefaultValue, 4), Mid(vDefaultValue, 5, 2), Right(vDefaultValue, 2))
  1261. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Date
  1262. Set oDefaultValue = ControlModel.DefaultDate
  1263. _PropertyGet = DateSerial(oDefaultValue.Year,oDefaultValue.Month, oDefaultValue.Day)
  1264. Case vbEmpty
  1265. End Select
  1266. End If
  1267. Case CTLFORMATTEDFIELD
  1268. If Utils._hasUNOProperty(ControlModel, &quot;EffectiveDefault&quot;) Then _PropertyGet = ControlModel.EffectiveDefault
  1269. Case CTLLISTBOX
  1270. If Utils._hasUNOProperty(ControlModel, &quot;DefaultSelection&quot;) And Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then
  1271. vDefaultValue = ControlModel.DefaultSelection
  1272. If IsArray(vDefaultValue) Then
  1273. If UBound(vDefaultValue) &gt;= LBound(vDefaultValue) Then &apos; Is array initialized ?
  1274. iIndex = UBound(ControlModel.StringItemList)
  1275. If vDefaultValue(0) &gt;= 0 And vDefaultValue(0) &lt;= iIndex Then _PropertyGet = ControlModel.StringItemList(vDefaultValue(0))
  1276. &apos; Only first default value is considered
  1277. End If
  1278. End If
  1279. End If
  1280. Case CTLSPINBUTTON
  1281. If Utils._hasUNOProperty(ControlModel, &quot;DefaultSpinValue&quot;) Then _PropertyGet = ControlModel.DefaultSpinValue
  1282. Case CTLTIMEFIELD
  1283. If Utils._hasUNOProperty(ControlModel, &quot;DefaultTime&quot;) Then
  1284. Select Case VarType(ControlModel.DefaultTime)
  1285. Case vbLong &apos; AOO and LO &lt;= 4.1
  1286. _PropertyGet = ControlModel.DefaultTime
  1287. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Time
  1288. Set oDefaultValue = ControlModel.DefaultTime
  1289. _PropertyGet = TimeSerial(oDefaultValue.Hours, oDefaultValue.Minutes, oDefaultValue.Seconds)
  1290. Case vbEmpty
  1291. End Select
  1292. End If
  1293. Case Else
  1294. Goto Trace_Error
  1295. End Select
  1296. Case UCase(&quot;Enabled&quot;)
  1297. If Utils._hasUNOProperty(ControlModel, &quot;Enabled&quot;) Then _PropertyGet = ControlModel.Enabled
  1298. Case UCase(&quot;FontBold&quot;)
  1299. If Utils._hasUNOProperty(ControlModel, &quot;FontWeight&quot;) Then _PropertyGet = ( ControlModel.FontWeight &gt;= com.sun.star.awt.FontWeight.BOLD )
  1300. Case UCase(&quot;FontItalic&quot;)
  1301. If Utils._hasUNOProperty(ControlModel, &quot;FontSlant&quot;) Then _PropertyGet = ( ControlModel.FontSlant = com.sun.star.awt.FontSlant.ITALIC )
  1302. Case UCase(&quot;FontName&quot;)
  1303. If Utils._hasUNOProperty(ControlModel, &quot;FontName&quot;) Then _PropertyGet = ControlModel.FontName
  1304. Case UCase(&quot;FontSize&quot;)
  1305. If Utils._hasUNOProperty(ControlModel, &quot;FontHeight&quot;) Then _PropertyGet = ControlModel.FontHeight
  1306. Case UCase(&quot;FontUnderline&quot;)
  1307. If Utils._hasUNOProperty(ControlModel, &quot;FontUnderline&quot;) Then _PropertyGet = _
  1308. Not ( ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.NONE _
  1309. Or ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.DONTKNOW )
  1310. Case UCase(&quot;FontWeight&quot;)
  1311. If Utils._hasUNOProperty(ControlModel, &quot;FontWeight&quot;) Then _PropertyGet = ControlModel.FontWeight
  1312. Case UCase(&quot;ForeColor&quot;)
  1313. If Utils._hasUNOProperty(ControlModel, &quot;TextColor&quot;) Then _PropertyGet = ControlModel.TextColor
  1314. Case UCase(&quot;Form&quot;)
  1315. Set ofSubForm = New SubForm &apos; Start building the SUBFORM object
  1316. With ofSubForm
  1317. Set ._This = ofSubForm
  1318. Set .DatabaseForm = ControlModel
  1319. ._Name = _Name
  1320. ._Shortcut = _Shortcut &amp; &quot;.Form&quot;
  1321. ._MainForm = _MainForm
  1322. .ParentComponent = _FormComponent
  1323. ._DocEntry = _DocEntry
  1324. ._DbEntry = _DbEntry
  1325. ._OrderBy = ControlModel.Order
  1326. End With
  1327. set _PropertyGet = ofSubForm
  1328. Case UCase(&quot;Format&quot;)
  1329. vFormats = _Formats(_Subtype)
  1330. Select Case _SubType
  1331. Case CTLDATEFIELD
  1332. If Utils._hasUNOProperty(ControlModel, &quot;DateFormat&quot;) Then
  1333. If ControlModel.DateFormat &lt;= UBound(vFormats) Then _PropertyGet = vFormats(ControlModel.DateFormat)
  1334. End If
  1335. Case CTLTIMEFIELD
  1336. If Utils._hasUNOProperty(ControlModel, &quot;TimeFormat&quot;) Then
  1337. If ControlModel.TimeFormat &lt;= UBound(vFormats) Then _PropertyGet = vFormats(ControlModel.TimeFormat)
  1338. End If
  1339. Case Else
  1340. If Utils._hasUNOProperty(ControlModel, &quot;FormatKey&quot;) Then
  1341. If Utils._hasUNOProperty(ControlModel, &quot;FormatsSupplier&quot;) Then
  1342. _PropertyGet = ControlModel.FormatsSupplier.getNumberFormats.getByKey(ControlModel.FormatKey).FormatString
  1343. End If
  1344. End If
  1345. End Select
  1346. Case UCase(&quot;ItemData&quot;)
  1347. If Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then
  1348. If IsMissing(pvIndex) Then
  1349. _PropertyGet = ControlModel.StringItemList
  1350. Else
  1351. If pvIndex &lt; 0 Or pvIndex &gt; UBound(ControlModel.StringItemList) Then Goto Trace_Error_Index
  1352. _PropertyGet = ControlModel.StringItemList(pvIndex)
  1353. End If
  1354. End If
  1355. Case UCase(&quot;ListCount&quot;)
  1356. If Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then _PropertyGet = UBound(ControlModel.StringItemList) + 1
  1357. Case UCase(&quot;ListIndex&quot;)
  1358. If Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then
  1359. lListIndex = -1 &apos; Either Multiple selections or no selection at all
  1360. Select Case _SubType
  1361. Case CTLCOMBOBOX
  1362. If Not Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then Goto Trace_Error
  1363. iIndex = 0
  1364. If ControlModel.Text &lt;&gt; &quot;&quot; Then
  1365. For j = 0 To UBound(ControlModel.StringItemList)
  1366. If ControlModel.StringItemList(j) = ControlModel.Text Then
  1367. lListIndex = j
  1368. iIndex = iIndex + 1
  1369. End If
  1370. Next j
  1371. If iIndex &lt;&gt; 1 Then lListIndex = -1 &apos; Multiselection or synonyms rejected
  1372. End If
  1373. Case CTLLISTBOX &apos; No mean found to access bound column !! See mail Lionel 10/5/2013 for improvement
  1374. If Not Utils._hasUNOProperty(ControlModel, &quot;SelectedItems&quot;) Then Goto Trace_Error
  1375. If UBound(ControlModel.SelectedItems) &gt; 0 Then &apos; Several items selected
  1376. Else &apos; Mono selection
  1377. If _ParentType &lt;&gt; CTLPARENTISDIALOG Then &apos; getCurrentValue not found in dialog listboxes ??
  1378. vCurrentValue = ControlModel.getCurrentValue() &apos; Space or uninitialized array if no selection at all
  1379. If IsArray(vCurrentValue) Then &apos; Is an array if MultiSelect
  1380. vListboxValue = &quot;&quot;
  1381. If UBound(vCurrentValue) = 0 Then vListboxValue = vCurrentValue(0)
  1382. Else
  1383. vListboxValue = vCurrentValue
  1384. End If
  1385. If vListboxValue &lt;&gt; &quot;&quot; Then &apos; Speed up search PM Pastim 12/02/2013
  1386. If Ubound(ControlModel.SelectedItems) &gt;= 0 Then lListIndex = Controlmodel.Selecteditems(0)
  1387. End If
  1388. Else
  1389. If Ubound(ControlModel.SelectedItems) &gt;= 0 Then lListIndex = Controlmodel.Selecteditems(0)
  1390. End If
  1391. End If
  1392. End Select
  1393. _PropertyGet = lListIndex
  1394. End If
  1395. Case UCase(&quot;Locked&quot;)
  1396. If Utils._hasUNOProperty(ControlModel, &quot;ReadOnly&quot;) Then _PropertyGet = ControlModel.ReadOnly
  1397. Case UCase(&quot;MultiSelect&quot;)
  1398. If Utils._hasUNOProperty(ControlModel, &quot;MultiSelection&quot;) Then
  1399. _PropertyGet = ControlModel.MultiSelection &apos; Boolean in OO, Integer (0, 1 or 2) in VBA
  1400. ElseIf Utils._hasUNOProperty(ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then &apos; Not documented: only for GridControls !? Changed in OO &gt;= 3,3 !?
  1401. _PropertyGet = ControlModel.MultiSelectionSimpleMode
  1402. Else
  1403. _PropertyGet = False
  1404. End If
  1405. Case UCase(&quot;Name&quot;)
  1406. _PropertyGet = _Name
  1407. Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnApproveAction&quot;), UCase(&quot;OnApproveReset&quot;) _
  1408. , UCase(&quot;OnApproveUpdate&quot;), UCase(&quot;OnChanged&quot;), UCase(&quot;OnErrorOccurred&quot;), UCase(&quot;OnFocusGained&quot;) _
  1409. , UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
  1410. , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
  1411. , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnTextChanged&quot;) _
  1412. , UCase(&quot;OnUpdated&quot;)
  1413. Select Case _ParentType
  1414. Case CTLPARENTISDIALOG
  1415. Set oControlEvents = ControlModel.getEvents()
  1416. sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; Utils._GetEventName(psProperty)
  1417. If oControlEvents.hasByName(sEventName) Then
  1418. _PropertyGet = oControlEvents.getByName(sEventName).ScriptCode
  1419. Else
  1420. _PropertyGet = &quot;&quot;
  1421. End If
  1422. Case Else
  1423. _PropertyGet = Utils._GetEventScriptCode(ControlModel, psProperty, _Name)
  1424. End Select
  1425. Case UCase(&quot;OptionValue&quot;)
  1426. If Utils._hasUNOProperty(ControlModel, &quot;RefValue&quot;) Then
  1427. If ControlModel.RefValue &lt;&gt; &quot;&quot; Then
  1428. _PropertyGet = ControlModel.RefValue
  1429. ElseIf Utils._hasUNOProperty(ControlModel, &quot;Label&quot;) Then
  1430. _PropertyGet = ControlModel.Label
  1431. End If
  1432. End If
  1433. Case UCase(&quot;ObjectType&quot;)
  1434. _PropertyGet = _Type
  1435. Case UCase(&quot;Page&quot;)
  1436. If Utils._hasUNOProperty(ControlModel, &quot;Step&quot;) Then _PropertyGet = ControlModel.Step
  1437. Case UCase(&quot;Parent&quot;)
  1438. Set _PropertyGet = _Parent
  1439. Case UCase(&quot;Picture&quot;)
  1440. _PropertyGet = ConvertToUrl(ControlModel.ImageURL)
  1441. Case UCase(&quot;Required&quot;)
  1442. If Utils._hasUNOProperty(ControlModel, &quot;InputRequired&quot;) Then _PropertyGet = ControlModel.InputRequired
  1443. Case UCase(&quot;RowSource&quot;)
  1444. Select Case _ParentType
  1445. Case CTLPARENTISDIALOG
  1446. If Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then
  1447. If IsArray(ControlModel.StringItemList) Then vListSource = ControlModel.StringItemList Else vListSource = Array(ControlModel.StringItemList)
  1448. _PropertyGet = Join(vListSource, &quot;;&quot;)
  1449. End If
  1450. Case Else
  1451. If Utils._hasUNOProperty(ControlModel, &quot;ListSource&quot;) Then
  1452. Select Case ControlModel.ListSourceType
  1453. Case com.sun.star.form.ListSourceType.VALUELIST _
  1454. , com.sun.star.form.ListSourceType.TABLEFIELDS
  1455. If IsArray(ControlModel.StringItemList) Then vListSource = ControlModel.StringItemList Else vListSource = Array(ControlModel.StringItemList)
  1456. Case com.sun.star.form.ListSourceType.TABLE _
  1457. , com.sun.star.form.ListSourceType.QUERY _
  1458. , com.sun.star.form.ListSourceType.SQL _
  1459. , com.sun.star.form.ListSourceType.SQLPASSTHROUGH
  1460. If IsArray(ControlModel.ListSource) Then vListSource = ControlModel.ListSource Else vListSource = Array(ControlModel.ListSource)
  1461. End Select
  1462. _PropertyGet = Join(vListSource, &quot;;&quot;)
  1463. End If
  1464. End Select
  1465. Case UCase(&quot;RowSourceType&quot;)
  1466. If Utils._hasUNOProperty(ControlModel, &quot;ListSourceType&quot;) Then _PropertyGet = ControlModel.ListSourceType
  1467. Case UCase(&quot;Selected&quot;)
  1468. If Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then
  1469. lListIndex = UBound(ControlModel.StringItemList)
  1470. If Not IsMissing(pvIndex) Then
  1471. If pvIndex &lt; 0 Or pvIndex &gt; lListIndex Then Goto Trace_Error_Index
  1472. End If
  1473. If lListIndex &lt; 0 Then &apos; Do nothing if listbox empty
  1474. _PropertyGet = Array()
  1475. Else
  1476. Redim bSelected(0 To lListIndex)
  1477. For j = 0 To lListIndex
  1478. bSelected(j) = False
  1479. Next j
  1480. For j = 0 To UBound(ControlModel.SelectedItems)
  1481. iIndex = ControlModel.SelectedItems(j)
  1482. If iIndex &gt;= 0 And iIndex &lt;= lListIndex Then bSelected(iIndex) = True
  1483. Next j
  1484. If IsMissing(pvIndex) Then _PropertyGet = bSelected Else _PropertyGet = bSelected(pvIndex)
  1485. End If
  1486. End If
  1487. Case UCase(&quot;SelLength&quot;)
  1488. If Utils._hasUNOProperty(ControlView, &quot;Selection&quot;) Then
  1489. vSelection = ControlView.getSelection()
  1490. If vSelection.Max &gt;= vSelection.Min Then
  1491. _PropertyGet = vSelection.Max - vSelection.Min
  1492. Else
  1493. _PropertyGet = 0 &apos; probably control does not have focus
  1494. End If
  1495. Else
  1496. _PropertyGet = 0
  1497. End If
  1498. Case UCase(&quot;SelStart&quot;)
  1499. If Utils._hasUNOProperty(ControlView, &quot;Selection&quot;) Then
  1500. vSelection = ControlView.getSelection()
  1501. If vSelection.Max &gt;= vSelection.Min Then
  1502. _PropertyGet = vSelection.Min + 1
  1503. Else
  1504. _PropertyGet = 1 &apos; probably control does not have focus
  1505. End If
  1506. Else
  1507. _PropertyGet = 1
  1508. End If
  1509. Case UCase(&quot;SelText&quot;)
  1510. If Utils._hasUNOProperty(ControlView, &quot;SelectedText&quot;) Then
  1511. _PropertyGet = ControlView.getSelectedText()
  1512. Else
  1513. _PropertyGet = &quot;&quot;
  1514. End If
  1515. Case UCase(&quot;SpecialEffect&quot;)
  1516. If Utils._hasUNOProperty(ControlModel, &quot;VisualEffect&quot;) Then _PropertyGet = ControlModel.VisualEffect
  1517. Case UCase(&quot;SubType&quot;)
  1518. _PropertyGet = _SubType
  1519. Case UCase(&quot;TabIndex&quot;)
  1520. If Utils._hasUNOProperty(ControlModel, &quot;TabIndex&quot;) Then _PropertyGet = ControlModel.TabIndex
  1521. Case UCase(&quot;TabStop&quot;)
  1522. If Utils._hasUNOProperty(ControlModel, &quot;Tabstop&quot;) Then _PropertyGet = ControlModel.Tabstop
  1523. Case UCase(&quot;Tag&quot;)
  1524. If Utils._hasUNOProperty(ControlModel, &quot;Tag&quot;) Then _PropertyGet = ControlModel.Tag
  1525. Case UCase(&quot;Text&quot;)
  1526. Select Case _SubType
  1527. Case CTLDATEFIELD
  1528. If Utils._hasUNOProperty(ControlModel, &quot;Date&quot;) Then
  1529. If Utils._hasUNOProperty(ControlModel, &quot;FormatKey&quot;) Then
  1530. If Utils._hasUNOProperty(ControlModel, &quot;FormatsSupplier&quot;) Then
  1531. Select Case VarType(ControlModel.Date)
  1532. Case vbLong &apos; AOO and LO &lt;= 4.1
  1533. vDate = DateSerial(Left(ControlModel.Date, 4), Mid(ControlModel.Date, 5, 2), Right(ControlModel.Date, 2))
  1534. Case vbObject &apos; LO &gt;= 4.2
  1535. vDate = DateSerial(ControlModel.Date.Year, ControlModel.Date.Month, ControlModel.Date.Day)
  1536. Case vbEmpty
  1537. End Select
  1538. _PropertyGet = Format(vDate, ControlModel.FormatsSupplier.getNumberFormats.getByKey(ControlModel.FormatKey).FormatString)
  1539. End If
  1540. End If
  1541. End If
  1542. Case CTLTIMEFIELD
  1543. If Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then
  1544. Select Case VarType(ControlModel.Time)
  1545. Case vbLong &apos; AOO and LO &lt;= 4.1
  1546. _PropertyGet = Format(ControlModel.Time, &quot;HH:MM:SS&quot;)
  1547. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Time
  1548. Set oValue = ControlModel.Time
  1549. _PropertyGet = Format(TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds), &quot;HH:MM:SS&quot;)
  1550. Case vbEmpty
  1551. End Select
  1552. End If
  1553. Case Else
  1554. If Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then _PropertyGet = ControlModel.Text
  1555. End Select
  1556. Case UCase(&quot;TextAlign&quot;)
  1557. If Utils._hasUNOProperty(ControlModel, &quot;Tag&quot;) Then _PropertyGet = ControlModel.Tag
  1558. Case UCase(&quot;TripleState&quot;)
  1559. If Utils._hasUNOProperty(ControlModel, &quot;TriState&quot;) Then _PropertyGet = ControlModel.TriState
  1560. Case UCase(&quot;Value&quot;)
  1561. Select Case _SubType
  1562. Case CTLCHECKBOX
  1563. If Utils._hasUNOProperty(ControlModel, &quot;State&quot;) Then vGet = ControlModel.State
  1564. Case CTLCOMMANDBUTTON
  1565. vGet = False
  1566. If Utils._hasUNOProperty(ControlModel, &quot;Toggle&quot;) Then
  1567. If Utils._hasUNOProperty(ControlModel, &quot;State&quot;) Then vGet = ( ControlModel.State = 1 )
  1568. End If
  1569. Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
  1570. If Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then vGet = ControlModel.Text
  1571. Case CTLCURRENCYFIELD
  1572. If Utils._hasUNOProperty(ControlModel, &quot;Value&quot;) Then vGet = ControlModel.Value
  1573. Case CTLDATEFIELD
  1574. If Utils._hasUNOProperty(ControlModel, &quot;Date&quot;) Then
  1575. Select Case VarType(ControlModel.Date)
  1576. Case vbLong &apos; AOO and LO &lt;= 4.1
  1577. vValue = ControlModel.Date
  1578. vGet = DateSerial(Left(vValue, 4), Mid(vValue, 5, 2), Right(vValue, 2))
  1579. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Date
  1580. Set oValue = ControlModel.Date
  1581. vGet = DateSerial(oValue.Year, oValue.Month, oValue.Day)
  1582. Case vbEmpty
  1583. End Select
  1584. End If
  1585. Case CTLFORMATTEDFIELD
  1586. If Utils._hasUNOProperty(ControlModel, &quot;EffectiveValue&quot;) Then vGet = ControlModel.EffectiveValue
  1587. Case CTLHIDDENCONTROL
  1588. If Utils._hasUNOProperty(ControlModel, &quot;HiddenValue&quot;) Then vGet = ControlModel.HiddenValue
  1589. Case CTLLISTBOX
  1590. If Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then Goto Trace_Error
  1591. If Not Utils._hasUNOProperty(ControlModel, &quot;SelectedItems&quot;) Then Goto Trace_Error
  1592. If UBound(ControlModel.SelectedItems) &gt; 0 Then &apos; Several items selected
  1593. vGet = EMPTY &apos; Listbox has no value, only an array of Selected flags to identify values
  1594. Else &apos; Mono selection
  1595. Select Case _ParentType
  1596. Case CTLPARENTISDIALOG
  1597. If Ubound(ControlModel.SelectedItems) &gt;= 0 Then
  1598. lListIndex = Controlmodel.Selecteditems(0)
  1599. If lListIndex &gt; -1 And lListIndex &lt;= UBound(ControlModel.StringItemList) Then
  1600. vGet = ControlModel.StringItemList(lListIndex)
  1601. Else
  1602. vGet = EMPTY
  1603. End If
  1604. End If
  1605. Case Else
  1606. &apos;getCurrentValue does not return any significant value anymore
  1607. &apos; Speed up getting value PM PASTIM 12/02/2013
  1608. If Ubound(ControlModel.SelectedItems) &gt;= 0 Then lListIndex = Controlmodel.Selecteditems(0) Else lListIndex = -1
  1609. &apos; If listbox has hidden column = real bound field, then explore ValueItemList
  1610. If _ListboxBound() Then
  1611. If lListIndex &gt; -1 Then vGet = ControlModel.ValueItemList(lListIndex) &apos; PASTIM
  1612. Else
  1613. If lListIndex &gt; -1 Then vGet = ControlModel.getItemText(lListIndex)
  1614. End If
  1615. End Select
  1616. End If
  1617. Case CTLNUMERICFIELD
  1618. If Utils._hasUNOProperty(ControlModel, &quot;Value&quot;) Then vGet = ControlModel.Value
  1619. Case CTLPROGRESSBAR
  1620. If Utils._hasUNOProperty(ControlModel, &quot;ProgressValue&quot;) Then vGet = ControlModel.ProgressValue
  1621. Case CTLSCROLLBAR
  1622. If Utils._hasUNOProperty(ControlModel, &quot;ScrollValue&quot;) Then vGet = ControlModel.ScrollValue
  1623. Case CTLSPINBUTTON
  1624. If Utils._hasUNOProperty(ControlModel, &quot;SpinValue&quot;) Then vGet = ControlModel.SpinValue
  1625. Case CTLTIMEFIELD
  1626. If Utils._hasUNOProperty(ControlModel, &quot;Time&quot;) Then
  1627. Select Case VarType(ControlModel.Time)
  1628. Case vbLong &apos; AOO and LO &lt;= 4.1
  1629. vGet = ControlModel.Time
  1630. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Time
  1631. Set oValue = ControlModel.Time
  1632. vGet = TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)
  1633. Case vbEmpty
  1634. End Select
  1635. End If
  1636. Case Else
  1637. End Select
  1638. If _SubType &lt;&gt; CTLLISTBOX Then &apos; Give getCurrentValue an additional try
  1639. If IsEmpty(vGet) And Utils._hasUNOMethod(ControlModel, &quot;getCurrentValue&quot;) Then vGet = ControlModel.getCurrentValue()
  1640. End If
  1641. _PropertyGet = vGet
  1642. Case UCase(&quot;Visible&quot;)
  1643. Select Case _SubType
  1644. Case CTLHIDDENCONTROL
  1645. _PropertyGet = False
  1646. Case Else
  1647. If Utils._hasUNOMethod(ControlView, &quot;isVisible&quot;) Then _PropertyGet = CBool(ControlView.isVisible())
  1648. End Select
  1649. Case Else
  1650. Goto Trace_Error
  1651. End Select
  1652. If IsEmpty(_PropertyGet) Then TraceError(TRACEINFO, ERRPROPERTYINIT, Utils._CalledSub(), 0, , psProperty)
  1653. Exit_Function:
  1654. Utils._ResetCalledSub(&quot;Control.get&quot; &amp; psProperty)
  1655. Exit Function
  1656. Trace_Error:
  1657. TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
  1658. _PropertyGet = EMPTY
  1659. Goto Exit_Function
  1660. Trace_Error_Index:
  1661. TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
  1662. _PropertyGet = EMPTY
  1663. Goto Exit_Function
  1664. Error_Function:
  1665. TraceError(TRACEABORT, Err, &quot;Control._PropertyGet&quot;, Erl)
  1666. _PropertyGet = EMPTY
  1667. GoTo Exit_Function
  1668. End Function &apos; _PropertyGet V0.9.1
  1669. REM -----------------------------------------------------------------------------------------------------------------------
  1670. Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
  1671. &apos; Return True if property setting OK
  1672. If _ErrorHandler() Then On Local Error Goto Error_Function
  1673. Utils._SetCalledSub(&quot;Control.set&quot; &amp; psProperty)
  1674. _PropertySet = True
  1675. &apos;Check Index argument
  1676. If Not IsMissing(pvIndex) Then
  1677. If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric()) Then Goto Exit_Function
  1678. End If
  1679. &apos;Execute
  1680. Dim iArgNr As Integer, vButton As Variant, i As Integer
  1681. Dim odbDatabase As Object, vNames() As Variant, bFound As Boolean, sName As String
  1682. Dim bMultiSelect As Boolean, iCount As Integer, iSelectedItems() As Integer, lListCount As Long, bSelected() As Boolean
  1683. Dim vItemList() As Variant, vFormats() As Variant
  1684. Dim oStruct As Object, sValue As String
  1685. Dim vSelection As Variant, sText As String, lStart As long
  1686. Dim oControlEvents As Object, sListener As String, sEvent As String, sEventName As String, oEvent As Object
  1687. _PropertySet = True
  1688. Select Case UCase(_A2B_.CalledSub)
  1689. Case UCase(&quot;setProperty&quot;) : iArgNr = 3
  1690. Case UCase(&quot;Control.setProperty&quot;) : iArgNr = 2
  1691. Case UCase(&quot;Control.set&quot; &amp; psProperty) : iArgNr = 1
  1692. End Select
  1693. If Not hasProperty(psProperty) Then Goto Trace_Error
  1694. Select Case UCase(psProperty)
  1695. Case UCase(&quot;BackColor&quot;)
  1696. If Not Utils._hasUNOProperty(ControlModel, &quot;BackgroundColor&quot;) Then Goto Trace_Error
  1697. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1698. ControlModel.BackgroundColor = CLng(pvValue)
  1699. Case UCase(&quot;BorderColor&quot;)
  1700. If Not Utils._hasUNOProperty(ControlModel, &quot;BorderColor&quot;) Then Goto Trace_Error
  1701. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1702. ControlModel.BorderColor = CLng(pvValue)
  1703. Case UCase(&quot;BorderStyle&quot;)
  1704. If Not Utils._hasUNOProperty(ControlModel, &quot;BorderColor&quot;) Then Goto Trace_Error
  1705. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1706. If pvValue &lt; 0 Or pvValue &gt; 2 Then Goto Trace_Error_Value &apos; 0 = No border, 1 = 3D border, 2 = Normal border
  1707. ControlModel.Border = CLng(pvValue)
  1708. Case UCase(&quot;Cancel&quot;)
  1709. If Not Utils._hasUNOProperty(ControlModel, &quot;PushButtonType&quot;) Then Goto Trace_Error
  1710. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1711. If pvValue Then vButton = com.sun.star.awt.PushButtonType.CANCEL Else vButton = com.sun.star.awt.PushButtonType.STANDARD
  1712. ControlModel.PushButtonType = vButton
  1713. Case UCase(&quot;Caption&quot;)
  1714. If Not Utils._hasUNOProperty(ControlModel, &quot;Label&quot;) Then Goto Trace_Error
  1715. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1716. ControlModel.Label = pvValue
  1717. Case UCase(&quot;ControlTipText&quot;)
  1718. If Not Utils._hasUNOProperty(ControlModel, &quot;HelpText&quot;) Then Goto Trace_Error
  1719. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1720. ControlModel.HelpText = pvValue
  1721. Case UCase(&quot;Default&quot;)
  1722. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultButton&quot;) Then Goto Trace_Error
  1723. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1724. ControlModel.DefaultButton = pvValue
  1725. Case UCase(&quot;DefaultValue&quot;)
  1726. Select Case _SubType
  1727. Case CTLDATEFIELD
  1728. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultDate&quot;) Then Goto Trace_Error
  1729. If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
  1730. Select Case VarType(ControlModel.DefaultDate)
  1731. Case vbEmpty, vbLong &apos; AOO and LO &lt;= 4.1
  1732. ControlModel.DefaultDate = Year(pvValue) * 10000 + Month(pvValue) * 100 + Day(pvValue)
  1733. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Date
  1734. ControlModel.DefaultDate.Year = Year(pvValue)
  1735. ControlModel.DefaultDate.Month = Month(pvValue)
  1736. ControlModel.DefaultDate.Day = Day(pvValue)
  1737. End Select
  1738. Case CTLLISTBOX
  1739. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultSelection&quot;) Or Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then Goto Trace_Error
  1740. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1741. For i = 0 To UBound(ControlModel.StringItemList)
  1742. If UCase(pvValue) = UCase(ControlModel.StringItemList(i)) Then
  1743. ControlModel.DefaultSelection = Array(i)
  1744. Exit For
  1745. End If
  1746. Next i
  1747. Case CTLSPINBUTTON
  1748. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultSpinValue&quot;) Then Goto Trace_Error
  1749. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1750. ControlModel.DefaultSpinValue = pvValue
  1751. Case CTLCHECKBOX
  1752. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultState&quot;) Then Goto Trace_Error
  1753. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1754. If pvValue &lt; 0 Or pvValue &gt; 2 Then Goto Trace_Error_Value &apos; 0 = Not checked 1 = Checked 2 = don&apos;t know
  1755. ControlModel.DefaultState = pvValue
  1756. Case CTLRADIOBUTTON
  1757. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultState&quot;) Then Goto Trace_Error
  1758. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1759. If pvValue &lt; 0 Or pvValue &gt; 1 Then Goto Trace_Error_Value &apos; 0 = Not checked 1 = Checked
  1760. ControlModel.DefaultState = pvValue
  1761. Case CTLCOMBOBOX, CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
  1762. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultText&quot;) Then Goto Trace_Error
  1763. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1764. ControlModel.DefaultText = pvValue
  1765. Case CTLTIMEFIELD
  1766. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultTime&quot;) Then Goto Trace_Error
  1767. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1768. If pvValue &gt;= 0 And pvValue &lt;= 23595999 Then
  1769. Select Case VarType(ControlModel.DefaultTime)
  1770. Case vbEmpty, vbLong &apos; AOO and LO &lt;= 4.1
  1771. ControlModel.DefaultTime = pvValue
  1772. Case vbObject &apos; LO &gt;= 4.2 com.sun.star.Util.Time
  1773. ControlModel.DefaultDate.Hours = Hour(pvValue)
  1774. ControlModel.DefaultDate.Minutes = Minute(pvValue)
  1775. ControlModel.DefaultDate.Seconds = Second(pvValue)
  1776. End Select
  1777. Else Goto Trace_Error_Value
  1778. End If
  1779. Case CTLCURRENCYFIELD, CTLNUMERICFIELD
  1780. If Not Utils._hasUNOProperty(ControlModel, &quot;DefaultValue&quot;) Then Goto Trace_Error
  1781. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1782. ControlModel.DefaultValue = pvValue
  1783. Case CTLFORMATTEDFIELD
  1784. If Not Utils._hasUNOProperty(ControlModel, &quot;EffectiveDefault&quot;) Then Goto Trace_Error
  1785. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1786. ControlModel.EffectiveDefault = pvValue &apos; Thanks, PASTIM
  1787. Case Else
  1788. Goto Trace_Error
  1789. End Select
  1790. Case UCase(&quot;Enabled&quot;)
  1791. If Not Utils._hasUNOProperty(ControlModel, &quot;Enabled&quot;) Then Goto Trace_Error
  1792. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1793. ControlModel.Enabled = pvValue
  1794. Case UCase(&quot;FontBold&quot;)
  1795. If Not Utils._hasUNOProperty(ControlModel, &quot;FontWeight&quot;) Then Goto Trace_Error
  1796. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1797. If pvValue Then &apos; Iif construction does not work !
  1798. ControlModel.FontWeight = com.sun.star.awt.FontWeight.BOLD
  1799. Else
  1800. ControlModel.FontWeight = com.sun.star.awt.FontWeight.NORMAL
  1801. End If
  1802. Case UCase(&quot;FontItalic&quot;)
  1803. If Not Utils._hasUNOProperty(ControlModel, &quot;FontSlant&quot;) Then Goto Trace_Error
  1804. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1805. If pvValue Then &apos; Iif construction does not work !
  1806. ControlModel.FontSlant = com.sun.star.awt.FontSlant.ITALIC
  1807. Else
  1808. ControlModel.FontSlant = com.sun.star.awt.FontSlant.NONE
  1809. End If
  1810. Case UCase(&quot;FontName&quot;)
  1811. If Not Utils._hasUNOProperty(ControlModel, &quot;FontName&quot;) Then Goto Trace_Error
  1812. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1813. ControlModel.FontName = pvValue
  1814. Case UCase(&quot;FontSize&quot;)
  1815. If Not Utils._hasUNOProperty(ControlModel, &quot;FontHeight&quot;) Then Goto Trace_Error
  1816. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1817. If pvValue &lt; 1 Or pvValue &gt; 127 Then Goto Trace_Error_Value
  1818. ControlModel.FontHeight = pvValue
  1819. Case UCase(&quot;FontUnderline&quot;)
  1820. If Not Utils._hasUNOProperty(ControlModel, &quot;FontUnderline&quot;) Then Goto Trace_Error
  1821. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1822. If pvValue Then &apos; Iif construction does not work !
  1823. ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.SINGLE
  1824. Else
  1825. ControlModel.FontUnderline = com.sun.star.awt.FontUnderline.NONE
  1826. End If
  1827. Case UCase(&quot;FontWeight&quot;)
  1828. If Not Utils._hasUNOProperty(ControlModel, &quot;FontWeight&quot;) Then Goto Trace_Error
  1829. If Not Utils._IsScalar(CSng(pvValue), vbSingle, Array( _
  1830. com.sun.star.awt.FontWeight.THIN _
  1831. , com.sun.star.awt.FontWeight.ULTRALIGHT _
  1832. , com.sun.star.awt.FontWeight.LIGHT _
  1833. , com.sun.star.awt.FontWeight.SEMILIGHT _
  1834. , com.sun.star.awt.FontWeight.NORMAL _
  1835. , com.sun.star.awt.FontWeight.SEMIBOLD _
  1836. , com.sun.star.awt.FontWeight.BOLD _
  1837. , com.sun.star.awt.FontWeight.ULTRABOLD _
  1838. , com.sun.star.awt.FontWeight.BLACK _
  1839. )) Then Goto Trace_Error_Value
  1840. ControlModel.FontWeight = pvValue
  1841. Case UCase(&quot;Format&quot;)
  1842. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1843. vFormats = _Formats(_SubType)
  1844. Select Case _SubType
  1845. Case CTLDATEFIELD, CTLTIMEFIELD
  1846. bFound = False
  1847. For i = 0 To UBound(vFormats)
  1848. If UCase(pvValue) = UCase(vFormats(i)) Then
  1849. If _SubType = CTLDATEFIELD Then
  1850. If Utils._hasUNOProperty(ControlModel, &quot;DateFormat&quot;) Then ControlModel.DateFormat = i Else Goto Trace_Error
  1851. Else
  1852. If Utils._hasUNOProperty(ControlModel, &quot;TimeFormat&quot;) Then ControlModel.TimeFormat = i Else Goto Trace_Error
  1853. End If
  1854. bFound = True
  1855. Exit For
  1856. End If
  1857. Next i
  1858. If Not bFound Then Goto Trace_Error_Value
  1859. Case Else
  1860. Goto Trace_Error
  1861. End Select
  1862. Case UCase(&quot;ForeColor&quot;)
  1863. If Not Utils._hasUNOProperty(ControlModel, &quot;TextColor&quot;) Then Goto Trace_Error
  1864. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1865. ControlModel.TextColor = CLng(pvValue)
  1866. Case UCase(&quot;ListIndex&quot;)
  1867. If Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then Goto Trace_Error
  1868. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1869. If pvValue &lt; 0 Or pvValue &gt; UBound(ControlModel.StringItemList) Then Goto Trace_Error_Value
  1870. Select Case _SubType
  1871. Case CTLCOMBOBOX
  1872. ControlModel.Text = ControlModel.StringItemList(pvValue)
  1873. Case CTLLISTBOX
  1874. ControlModel.SelectedItems = Array(pvValue)
  1875. End Select
  1876. Case UCase(&quot;Locked&quot;)
  1877. If Not Utils._hasUNOProperty(ControlModel, &quot;ReadOnly&quot;) Then Goto Trace_Error
  1878. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1879. ControlModel.ReadOnly = pvValue
  1880. Case UCase(&quot;MultiSelect&quot;)
  1881. If Not Utils._hasUNOProperty(ControlModel, &quot;MultiSelection&quot;) And Not Utils._hasUNOProperty(ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then Goto Trace_Error
  1882. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1883. If Utils._hasUNOProperty(ControlModel, &quot;MultiSelection&quot;) Then
  1884. ControlModel.MultiSelection = pvValue
  1885. ElseIf Utils._hasUNOProperty(ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then
  1886. ControlModel.MultiSelectionSimpleMode = pvValue
  1887. End If
  1888. If Not pvValue Then ControlModel.SelectedItems = Array() &apos; Cancel selections when MultiSelect becomes False
  1889. Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnApproveAction&quot;), UCase(&quot;OnApproveReset&quot;) _
  1890. , UCase(&quot;OnApproveUpdate&quot;), UCase(&quot;OnChanged&quot;), UCase(&quot;OnErrorOccurred&quot;), UCase(&quot;OnFocusGained&quot;) _
  1891. , UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
  1892. , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
  1893. , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnTextChanged&quot;) _
  1894. , UCase(&quot;OnUpdated&quot;)
  1895. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1896. Select Case _ParentType
  1897. Case CTLPARENTISDIALOG
  1898. If Not Utils._RegisterDialogEventScript(ControlModel _
  1899. , psProperty _
  1900. , _GetListener(psProperty) _
  1901. , pvValue _
  1902. ) Then GoTo Trace_Error
  1903. Case Else
  1904. If Not Utils._RegisterEventScript(ControlModel _
  1905. , psProperty _
  1906. , _GetListener(psProperty) _
  1907. , pvValue _
  1908. , _Name _
  1909. ) Then GoTo Trace_Error
  1910. End Select
  1911. Case UCase(&quot;OptionValue&quot;)
  1912. If Not Utils._hasUNOProperty(ControlModel, &quot;RefValue&quot;) Then Goto Trace_Error
  1913. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1914. If Not Utils._hasUNOProperty(ControlModel, &quot;Label&quot;) Then
  1915. If pvValue = &quot;&quot; Then Goto Trace_Error_Value
  1916. If ControlModel.RefValue &lt;&gt; &quot;&quot; Then ControlModel.RefValue = pvValue
  1917. Else
  1918. ControlModel.Label = pvValue
  1919. End If
  1920. Case UCase(&quot;Page&quot;)
  1921. If Not Utils._hasUNOProperty(ControlModel, &quot;Step&quot;) Then Goto Trace_Error
  1922. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1923. If pvValue &lt; 0 Then Goto Trace_Error_Value
  1924. ControlModel.Step = pvValue
  1925. Case UCase(&quot;Picture&quot;)
  1926. If Not Utils._hasUNOProperty(ControlModel, &quot;ImageURL&quot;) Then Goto Trace_Error
  1927. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1928. ControlModel.ImageURL = ConvertToUrl(pvValue)
  1929. Case UCase(&quot;Required&quot;)
  1930. If Not Utils._hasUNOProperty(ControlModel, &quot;InputRequired&quot;) Then Goto Trace_Error
  1931. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1932. ControlModel.InputRequired = pvValue
  1933. Case UCase(&quot;RowSource&quot;)
  1934. Select Case _ParentType
  1935. Case CTLPARENTISDIALOG
  1936. If Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then Goto Trace_Error
  1937. ControlModel.StringItemList = Split(pvValue, &quot;;&quot;)
  1938. Case Else
  1939. If Not Utils._hasUNOProperty(ControlModel, &quot;ListSource&quot;) Then Goto Trace_Error
  1940. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  1941. Select Case ControlModel.ListSourceType
  1942. Case com.sun.star.form.ListSourceType.QUERY _
  1943. , com.sun.star.form.ListSourceType.TABLE _
  1944. , com.sun.star.form.ListSourceType.TABLEFIELDS
  1945. Set odbDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
  1946. If ControlModel.ListSourceType = com.sun.star.form.ListSourceType.QUERY Then vNames = odbDatabase.Connection.getQueries.GetElementNames _
  1947. Else vNames = odbDatabase.Connection.getTables.GetElementNames
  1948. bFound = False &apos; Check existence of table or query and find its correct (case-sensitive) name
  1949. For i = 0 To UBound(vNames)
  1950. If UCase(vNames(i)) = UCase(pvValue) Then
  1951. bFound = True
  1952. sName = vNames(i)
  1953. Exit For
  1954. End If
  1955. Next i
  1956. If Not bFound Then Goto Trace_Error_Value
  1957. If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = sName Else ControlModel.ListSource = Array(sName)
  1958. ControlModel.refresh()
  1959. Case com.sun.star.form.ListSourceType.SQL
  1960. Set odbDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
  1961. If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = odbDatabase._ReplaceSquareBrackets(pvValue) Else ControlModel.ListSource = Array(odbDatabase._ReplaceSquareBrackets(pvValue))
  1962. ControlModel.refresh()
  1963. Case com.sun.star.form.ListSourceType.VALUELIST &apos; Forbidden for COMBOBOX !
  1964. If _SubType = CTLCOMBOBOX Then Goto Trace_Error
  1965. ControlModel.ListSource = Split(pvValue, &quot;;&quot;)
  1966. ControlModel.StringItemList = ControlModel.ListSource
  1967. Case com.sun.star.form.ListSourceType.SQLPASSTHROUGH
  1968. If _SubType = CTLCOMBOBOX Then ControlModel.ListSource = pvValue Else ControlModel.ListSource = Array(pvValue)
  1969. ControlModel.refresh()
  1970. End Select
  1971. End Select
  1972. If _SubType = CTLLISTBOX Then ControlModel.SelectedItems = Array()
  1973. Case UCase(&quot;RowSourceType&quot;) &apos; Refresh done when RowSource changes, not RowSourceType
  1974. If Not Utils._hasUNOProperty(ControlModel, &quot;ListSourceType&quot;) Then Goto Trace_Error
  1975. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  1976. If Not Utils._IsScalar(pvValue, Utils._AddNumeric(), Array( _
  1977. com.sun.star.form.ListSourceType.VALUELIST _
  1978. , com.sun.star.form.ListSourceType.TABLE _
  1979. , com.sun.star.form.ListSourceType.QUERY _
  1980. , com.sun.star.form.ListSourceType.SQL _
  1981. , com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
  1982. , com.sun.star.form.ListSourceType.TABLEFIELDS _
  1983. )) Then Goto Trace_Error_Value
  1984. ControlModel.ListSourceType = pvValue
  1985. Case UCase(&quot;Selected&quot;)
  1986. If Not Utils._hasUNOProperty(ControlModel, &quot;SelectedItems&quot;) Then Goto Trace_Error
  1987. If Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) Then Goto Trace_Error
  1988. If Utils._hasUNOProperty(ControlModel, &quot;MultiSelection&quot;) Then
  1989. bMultiSelect = ControlModel.MultiSelection
  1990. ElseIf Utils._hasUNOProperty(ControlModel, &quot;MultiSelectionSimpleMode&quot;) Then
  1991. bMultiSelect = ControlModel.MultiSelectionSimpleMode
  1992. Else: Goto Trace_Error
  1993. End If
  1994. lListCount = UBound(ControlModel.StringItemList) + 1
  1995. If IsMissing(pvIndex) Then &apos; Full boolean array passed
  1996. If Not IsArray(pvValue) Then Goto Trace_Error_Array
  1997. If LBound(pvValue) &lt;&gt; 0 Or UBound(pvValue) &lt; 0 Then Goto Trace_Error_Array
  1998. If Not Utils._CheckArgument(pvValue(0), iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  1999. If UBound(pvValue) &lt;&gt; lListCount - 1 Then Goto Trace_Error_Index
  2000. iCount = 0
  2001. For i = 0 To UBound(pvValue) &apos; Count True values
  2002. If pvValue(i) Then iCount = iCount + 1
  2003. Next i
  2004. If iCount &gt; 0 Then
  2005. Redim iSelectedItems(0 To iCount - 1)
  2006. iCount = 0
  2007. For i = 0 To UBound(pvValue)
  2008. If pvValue(i) Then
  2009. iSelectedItems(iCount) = i
  2010. iCount = iCount + 1
  2011. End If
  2012. Next i
  2013. ControlModel.SelectedItems = iSelectedItems &apos; iSelectedItems maps OO internals (size = # of selected items)
  2014. Else
  2015. ControlModel.SelectedItems = Array()
  2016. End If
  2017. Else &apos; Single boolean value passed
  2018. If Not Utils._CheckArgument(pvIndex, iArgNr + 1, Utils._AddNumeric()) Then Goto Exit_Function
  2019. If pvIndex &lt; 0 Or pvIndex &gt;= lListCount Then Goto Trace_Error_Index
  2020. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  2021. ReDim bSelected(0 To lListCount - 1) &apos; bSelected maps VBA internals (size = # of displayed items)
  2022. If Not bMultiSelect Then &apos; Set all other values to False
  2023. For i = 0 To lListCount - 1
  2024. If i = pvIndex Then
  2025. bSelected(i) = pvValue &apos; All entries = False except one
  2026. Else
  2027. bSelected(i) = False
  2028. End If
  2029. Next i
  2030. Else
  2031. For i = 0 To lListCount - 1
  2032. bSelected(i) = False
  2033. Next i
  2034. iSelectedItems = ControlModel.SelectedItems
  2035. iCount = UBound(iSelectedItems)
  2036. For i = 0 To iCount
  2037. bSelected(iSelectedItems(i)) = True
  2038. Next i
  2039. bSelected(pvIndex) = pvValue
  2040. End If
  2041. iCount = 0 &apos; Rebuild SelectedItems
  2042. For i = 0 To lListCount - 1
  2043. If bSelected(i) Then iCount = iCount + 1
  2044. Next i
  2045. If iCount &gt; 0 Then
  2046. Redim iSelectedItems(0 To iCount - 1)
  2047. iCount = 0
  2048. For i = 0 To lListCount - 1
  2049. If bSelected(i) Then
  2050. iSelectedItems(iCount) = i
  2051. iCount = iCount + 1
  2052. End If
  2053. Next i
  2054. ControlModel.SelectedItems = iSelectedItems
  2055. Else
  2056. ControlModel.SelectedItems = Array()
  2057. End If
  2058. End If
  2059. Case UCase(&quot;SelLength&quot;)
  2060. If Not Utils._hasUNOProperty(ControlView, &quot;Selection&quot;) Then Goto trace_Error
  2061. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2062. If pvValue &lt; 0 Then Goto Trace_Error_Value
  2063. vSelection = ControlView.getSelection()
  2064. vSelection.Max = vSelection.Min + pvValue
  2065. ControlView.setSelection(vSelection)
  2066. Case UCase(&quot;SelStart&quot;)
  2067. If Not Utils._hasUNOProperty(ControlView, &quot;Selection&quot;) Then Goto trace_Error
  2068. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2069. If pvValue &lt; 1 Or pvValue &gt; Len(ControlModel.Text) + 1 Then Goto Trace_Error_Value
  2070. vSelection = ControlView.getSelection()
  2071. vSelection.Min = pvValue - 1
  2072. vSelection.Max = pvValue - 1 &apos; Also reset length to 0
  2073. ControlView.setSelection(vSelection)
  2074. Case UCase(&quot;SelText&quot;)
  2075. If Not Utils._hasUNOProperty(ControlView, &quot;Selection&quot;) Then Goto trace_Error
  2076. If Not Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then Goto trace_Error
  2077. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  2078. If Len(pvValue) &gt; 0 Then
  2079. vSelection = ControlView.getSelection()
  2080. sText = ControlModel.Text
  2081. lStart = InStr(1, sText, pvValue, 0) &apos; Case sensitive !
  2082. If lStart &gt; 0 Then
  2083. vSelection.Min = lStart - 1
  2084. vSelection.Max = lStart + Len(pvValue) - 1
  2085. ControlView.setSelection(vSelection)
  2086. End If
  2087. End If
  2088. Case UCase(&quot;SpecialEffect&quot;)
  2089. If Not Utils._hasUNOProperty(ControlModel, &quot;VisualEffect&quot;) Then Goto Trace_Error
  2090. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2091. If pvValue &lt; 0 Or pvValue &gt; 2 Then Goto Trace_Error_Value &apos; 0 = None, 1 = Look3D, 2 = Flat
  2092. ControlModel.VisualEffect = pvValue
  2093. Case UCase(&quot;TabIndex&quot;)
  2094. If Not Utils._hasUNOProperty(ControlModel, &quot;TabIndex&quot;) Then Goto Trace_Error
  2095. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2096. If pvValue &lt; -1 Then Goto Trace_Error_Value
  2097. ControlModel.TabIndex = pvValue
  2098. Case UCase(&quot;TabStop&quot;)
  2099. If Not Utils._hasUNOProperty(ControlModel, &quot;Tabstop&quot;) Then Goto Trace_Error
  2100. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  2101. ControlModel.Tabstop = pvValue
  2102. Case UCase(&quot;Tag&quot;)
  2103. If Not Utils._hasUNOProperty(ControlModel, &quot;Tag&quot;) Then Goto Trace_Error
  2104. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  2105. ControlModel.Tag = pvValue
  2106. Case UCase(&quot;TextAlign&quot;)
  2107. If Not Utils._hasUNOProperty(ControlModel, &quot;Align&quot;) Then Goto Trace_Error
  2108. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2109. If pvValue &lt; 0 Or pvValue &gt; 2 Then Goto Trace_Error_Value &apos; 0 = Left, 1 = Center, 2 = Right
  2110. ControlModel.Align = pvValue
  2111. Case UCase(&quot;TripleState&quot;)
  2112. If Not Utils._hasUNOProperty(ControlModel, &quot;TriState&quot;) Then Goto Trace_Error
  2113. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  2114. ControlModel.TriState = pvValue
  2115. Case UCase(&quot;Value&quot;)
  2116. Select Case _SubType
  2117. Case CTLCHECKBOX
  2118. If Not Utils._hasUNOProperty(ControlModel, &quot;State&quot;) Then Goto Trace_Error
  2119. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(vbBoolean), , False) Then Goto Trace_Error_Value
  2120. If VarType(pvValue) = vbBoolean Then pvValue = Iif(pvValue, 1, 0)
  2121. If pvValue &lt; 0 Or pvValue &gt; 2 Then Goto Trace_Error_Value &apos; 0 = Not checked 1 = Checked 2 = don&apos;t know
  2122. ControlModel.State = pvValue
  2123. Case CTLCOMMANDBUTTON
  2124. If Not Utils._hasUNOProperty(ControlModel, &quot;State&quot;) Then Goto Trace_Error
  2125. If Not Utils._hasUNOProperty(ControlModel, &quot;Toggle&quot;) Then Goto Trace_Error
  2126. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  2127. If pvValue Then ControlModel.State = 1 Else ControlModel.State = 0
  2128. Case CTLCOMBOBOX
  2129. If Not Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Or Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) _
  2130. Then Goto Trace_Error
  2131. If pvValue &lt;&gt; &quot;&quot; Then
  2132. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, ControlModel.StringItemList, False) Then Goto Trace_Error_Value
  2133. End If
  2134. ControlModel.Text = pvValue
  2135. Case CTLCURRENCYFIELD, CTLNUMERICFIELD
  2136. If Not Utils._hasUNOProperty(ControlModel, &quot;Value&quot;) Then Goto Trace_Error
  2137. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2138. ControlModel.Value = pvValue
  2139. Case CTLDATEFIELD
  2140. If Not Utils._hasUNOProperty(ControlModel, &quot;Date&quot;) Then Goto Trace_Error
  2141. If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
  2142. Select Case _InspectPropertyType(ControlModel, &quot;Date&quot;)
  2143. Case &quot;long&quot; &apos; AOO and LO &lt;= 4.1
  2144. &apos;ControlModel.Date = Year(pvValue) * 10000 + Month(pvValue) * 100 + Day(pvValue) &apos; Gives error in dialogs ?!?
  2145. ControlModel.setPropertyValue(&quot;Date&quot;, Year(pvValue) * 10000 + Month(pvValue) * 100 + Day(pvValue))
  2146. Case &quot;com.sun.star.util.Date&quot; &apos; LO &gt;= 4.2
  2147. &apos;Direct assignment of ControlModel.Date.Xxx has no effect ?!?
  2148. Set oStruct = CreateUnoStruct(&quot;com.sun.star.util.Date&quot;)
  2149. oStruct.Year = Year(pvValue)
  2150. oStruct.Month = Month(pvValue)
  2151. oStruct.Day = Day(pvValue)
  2152. Set ControlModel.Date = oStruct
  2153. End Select
  2154. Case CTLFILECONTROL, CTLPATTERNFIELD, CTLTEXTFIELD
  2155. If Not Utils._hasUNOProperty(ControlModel, &quot;Text&quot;) Then Goto Trace_Error
  2156. If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
  2157. ControlModel.Text = pvValue
  2158. Case CTLFORMATTEDFIELD
  2159. If Not Utils._hasUNOProperty(ControlModel, &quot;EffectiveValue&quot;) Then Goto Trace_Error
  2160. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(vbString), , False) Then Goto Trace_Error_Value
  2161. ControlModel.EffectiveValue = pvValue
  2162. Case CTLHIDDENCONTROL
  2163. If Not Utils._hasUNOProperty(ControlModel, &quot;HiddenValue&quot;) Then Goto Trace_Error
  2164. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(Array(vbString, vbBoolean, vbDate)), , False) Then Goto Trace_Error_Value
  2165. ControlModel.HiddenValue = pvValue
  2166. Case CTLLISTBOX
  2167. If Not Utils._hasUNOProperty(ControlModel, &quot;SelectedItems&quot;) Or Not Utils._hasUNOProperty(ControlModel, &quot;StringItemList&quot;) _
  2168. Then Goto Trace_Error
  2169. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(Array(vbString, vbDate)), , False) Then Goto Trace_Error_Value &apos; PASTIM
  2170. If IsArray(pvValue) Then Goto Trace_Error_Value &apos; Setting the value on a listbox is allowed only if single value and value in the list
  2171. &apos; Check ValueItemList
  2172. bFound = False
  2173. Select Case _ParentType
  2174. Case CTLPARENTISDIALOG
  2175. vItemList = ControlModel.StringItemList
  2176. Case Else
  2177. If _ListboxBound() Then &apos; Performance improvement (PASTIM PM 9 Feb 2013)
  2178. If Not Utils._hasUNOProperty(ControlModel, &quot;ValueItemList&quot;) Then Goto Trace_Error
  2179. vItemList = ControlModel.ValueItemList
  2180. Else
  2181. vItemList = ControlModel.StringItemList
  2182. End If
  2183. End Select
  2184. For i = 0 To UBound(vItemList)
  2185. If pvValue = vItemList(i) Then
  2186. bFound = True
  2187. Exit For
  2188. End If
  2189. Next i
  2190. If bFound Then ControlModel.SelectedItems = Array(i) Else Goto Trace_Error_Value
  2191. Case CTLPROGRESSBAR
  2192. If Not Utils._hasUNOProperty(ControlModel, &quot;ProgressValue&quot;) Then Goto Trace_Error
  2193. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2194. If Utils._hasUNOProperty(ControlModel, &quot;ProgressValueMin&quot;) Then
  2195. If pvValue &lt; ControlModel.ProgressValueMin Then Goto Trace_Error_Value
  2196. End If
  2197. If Utils._hasUNOProperty(ControlModel, &quot;ProgressValueMax&quot;) Then
  2198. If pvValue &gt; ControlModel.ProgressValueMax Then Goto Trace_Error_Value
  2199. End If
  2200. ControlModel.ProgressValue = pvValue
  2201. Case CTLSCROLLBAR
  2202. If Not Utils._hasUNOProperty(ControlModel, &quot;ScrollValue&quot;) Then Goto Trace_Error
  2203. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2204. If Utils._hasUNOProperty(ControlModel, &quot;ScrollValueMin&quot;) Then
  2205. If pvValue &lt; ControlModel.ScrollValueMin Then Goto Trace_Error_Value
  2206. End If
  2207. If Utils._hasUNOProperty(ControlModel, &quot;ScrollValueMax&quot;) Then
  2208. If pvValue &gt; ControlModel.ScrollValueMax Then Goto Trace_Error_Value
  2209. End If
  2210. ControlModel.ScrollValue = pvValue
  2211. Case CTLSPINBUTTON
  2212. If Not Utils._hasUNOProperty(ControlModel, &quot;SpinValue&quot;) Then Goto Trace_Error
  2213. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2214. If Utils._hasUNOProperty(ControlModel, &quot;SpinValueMin&quot;) Then
  2215. If pvValue &lt; ControlModel.SpinValueMin Then Goto Trace_Error_Value
  2216. End If
  2217. If Utils._hasUNOProperty(ControlModel, &quot;SpinValueMax&quot;) Then
  2218. If pvValue &gt; ControlModel.SpinValueMax Then Goto Trace_Error_Value
  2219. End If
  2220. ControlModel.SpinValue = pvValue
  2221. Case CTLTIMEFIELD
  2222. If Not Utils._hasUNOProperty(ControlModel, &quot;Time&quot;) Then Goto Trace_Error
  2223. If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
  2224. Select Case _InspectPropertyType(ControlModel, &quot;Time&quot;)
  2225. Case &quot;long&quot; &apos; AOO and LO &lt;= 4.0
  2226. ControlModel.Time = CLng(pvValue)
  2227. Case &quot;com.sun.star.util.Time&quot; &apos; LO &gt;= 4.1
  2228. &apos;Direct assignment of ControlModel.Time.Xxx gives error ?!?
  2229. Set oStruct = CreateUnoStruct(&quot;com.sun.star.util.Time&quot;)
  2230. sValue = Right(&quot;00000000&quot; &amp; Str(CLng(pvValue)), 8)
  2231. oStruct.Hours = Val(Left(sValue, 2))
  2232. oStruct.Minutes = Val(Mid(sValue, 3, 2))
  2233. oStruct.Seconds = Val(Mid(sValue, 5, 2))
  2234. Set ControlModel.Time = oStruct
  2235. End Select
  2236. Case Else
  2237. Goto Trace_Error
  2238. End Select
  2239. &apos; FINAL COMMITMENT
  2240. If Utils._hasUNOMethod(ControlModel, &quot;commit&quot;) Then ControlModel.commit() &apos; f.i. checkboxes have no commit method ?? [PASTIM]
  2241. Case UCase(&quot;Visible&quot;)
  2242. If _SubType = CTLHIDDENCONTROL Then Goto Trace_Error &apos; Hidden remains hidden !!
  2243. If Not Utils._hasUNOMethod(ControlView, &quot;setVisible&quot;) Then Goto Trace_Error
  2244. If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
  2245. If pvValue Then ControlModel.EnableVisible = True
  2246. ControlView.setVisible(pvValue)
  2247. Case Else
  2248. Goto Trace_Error
  2249. End Select
  2250. Exit_Function:
  2251. Utils._ResetCalledSub(&quot;Control.set&quot; &amp; psProperty)
  2252. Exit Function
  2253. Trace_Error:
  2254. TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
  2255. _PropertySet = False
  2256. Goto Exit_Function
  2257. Trace_Error_Value:
  2258. TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
  2259. _PropertySet = False
  2260. Goto Exit_Function
  2261. Trace_Error_Index:
  2262. TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
  2263. _PropertySet = False
  2264. Goto Exit_Function
  2265. Trace_Error_Array:
  2266. TraceError(TRACEFATAL, ERRPROPERTYNOTARRAY, Utils._CalledSub(), 0, 1, iArgNr)
  2267. _PropertySet = False
  2268. Goto Exit_Function
  2269. Error_Function:
  2270. TraceError(TRACEABORT, Err, &quot;Control._PropertySet&quot;, Erl)
  2271. _PropertySet = False
  2272. GoTo Exit_Function
  2273. End Function &apos; _PropertySet V1.1.0
  2274. </script:module>