Language.xba 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <!--
  4. * This file is part of the LibreOffice project.
  5. *
  6. * This Source Code Form is subject to the terms of the Mozilla Public
  7. * License, v. 2.0. If a copy of the MPL was not distributed with this
  8. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. *
  10. * This file incorporates work covered by the following license notice:
  11. *
  12. * Licensed to the Apache Software Foundation (ASF) under one or more
  13. * contributor license agreements. See the NOTICE file distributed
  14. * with this work for additional information regarding copyright
  15. * ownership. The ASF licenses this file to you under the Apache
  16. * License, Version 2.0 (the "License"); you may not use this file
  17. * except in compliance with the License. You may obtain a copy of
  18. * the License at http://www.apache.org/licenses/LICENSE-2.0 .
  19. -->
  20. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
  21. Public Const SBCANCEL = 2
  22. Public Const SBREPEAT = 4
  23. Public LabelDiffHeight as Long
  24. Public BasicLabelDiffHeight as Long
  25. Public WizardTitle(1 To 3) as String
  26. Public DlgFormDB as Object
  27. Public DialogModel as Object
  28. Dim sMsgWizardName as String
  29. Dim sMsgErrMsg as String
  30. Dim sMsgErrNoDatabase as String
  31. Dim sMsgErrNoTableInDatabase as String
  32. Dim sMsgErrTitleSuggestedExist as String
  33. Dim sMsgErrTitleSyntaxError as String
  34. Dim sMsgErrTitleAsTableExist as String
  35. Dim sMsgProgressText as String
  36. Dim sMsgCreatedForm as String
  37. Dim sMsgErrCouldNotOpenObject as String
  38. Dim sMsgErrNameToLong as String
  39. Dim sTimeAppendix as String
  40. Dim sDateAppendix as String
  41. Public sGoOn as String
  42. Public sReady as String
  43. Public sMsgNoConnection as String
  44. Public XPixelFactor as Long
  45. Public YPixelFactor as Long
  46. Public sSelectDatasource as String
  47. Public sSelectDBTable as String
  48. Sub LoadLanguage ()
  49. sMsgWizardName = GetResText(&quot;RID_FORM_0&quot;)
  50. sMsgErrMsg = GetResText(&quot;RID_DB_COMMON_6&quot;)
  51. sMsgErrNoDatabase = GetResText(&quot;RID_DB_COMMON_8&quot;)
  52. sMsgErrNoTableInDatabase = GetResText(&quot;RID_DB_COMMON_9&quot;)
  53. sMsgErrTitleSuggestedExist = GetResText(&quot;RID_DB_COMMON_10&quot;)
  54. sMsgErrTitleAsTableExist = GetResText(&quot;RID_DB_COMMON_10&quot;)
  55. sMsgErrTitleSyntaxError = GetResText(&quot;RID_DB_COMMON_11&quot;)
  56. sMsgNoConnection = GetResText(&quot;RID_DB_COMMON_14&quot;)
  57. sMsgProgressText = GetResText(&quot;RID_FORM_2&quot;)
  58. sMsgCreatedForm = GetResText(&quot;RID_FORM_26&quot;)
  59. sMsgErrNameToLong = GetResText(&quot;RID_FORM_27&quot;)
  60. sMsgErrCouldNotOpenObject = GetResText(&quot;RID_DB_COMMON_13&quot;)
  61. &apos; Internal Logic
  62. sDateAppendix = GetResText(&quot;RID_FORM_4&quot;)
  63. sTimeAppendix = GetResText(&quot;RID_FORM_5&quot;)
  64. sReady = GetResText(&quot;RID_DB_COMMON_0&quot;)
  65. End Sub
  66. Sub SetDialogLanguage ()
  67. Dim i as Integer
  68. Dim ButtonHelpText as String
  69. Dim CmdButton as Object
  70. Dim IDArray as Variant
  71. Dim FNameAddOn as String
  72. Dim slblSelFields as String
  73. Dim slblFields as String
  74. DlgFormDB = LoadDialog(&quot;FormWizard&quot;, &quot;DlgFormDB&quot;)
  75. DialogModel = DlgFormDB.Model
  76. With DialogModel
  77. .cmdCancel.Label = GetResText(&quot;RID_DB_COMMON_1&quot;)
  78. .cmdBack.Label = GetResText(&quot;RID_DB_COMMON_2&quot;)
  79. .cmdHelp.Label = GetResText(&quot;RID_DB_COMMON_20&quot;)
  80. sGoOn = GetResText(&quot;RID_DB_COMMON_3&quot;)
  81. .cmdGoOn.Label = sGoOn
  82. .lblTables.Label = GetResText(&quot;RID_FORM_6&quot;)
  83. slblFields = GetResText(&quot;RID_FORM_12&quot;)
  84. slblSelFields = GetResText(&quot;RID_FORM_13&quot;)
  85. .lblFields.Label = slblFields
  86. .lblSelFields.Label = slblSelFields
  87. .lblStyles.Label = GetResText(&quot;RID_FORM_21&quot;)
  88. .hlnBorderLayout.Label = GetResText(&quot;RID_FORM_28&quot;)
  89. .hlnAlign.Label = GetResText(&quot;RID_FORM_32&quot;)
  90. .hlnArrangements.Label = GetResText(&quot;RID_FORM_35&quot;)
  91. WizardTitle(1) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_45&quot;)
  92. WizardTitle(2) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_46&quot;)
  93. WizardTitle(3) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_47&quot;)
  94. .hlnBinaries.Label = GetResText(&quot;RID_FORM_50&quot;)
  95. .optIgnoreBinaries.Label = GetResText(&quot;RID_FORM_51&quot;)
  96. .optBinariesasGraphics.Label = GetResText(&quot;RID_FORM_52&quot;)
  97. .hlnBackground.Label = GetResText(&quot;RID_FORM_55&quot;)
  98. .optTiled.Label = GetResText(&quot;RID_FORM_56&quot;)
  99. .optArea.Label = GetResText(&quot;RID_FORM_57&quot;)
  100. .optBorder0.Label = GetResText(&quot;RID_FORM_29&quot;)
  101. .optBorder1.Label = GetResText(&quot;RID_FORM_30&quot;)
  102. .optBorder2.Label = GetResText(&quot;RID_FORM_31&quot;)
  103. .optBorder1.State = 1
  104. .optAlign0.Label = GetResText(&quot;RID_FORM_33&quot;)
  105. .optAlign2.Label = GetResText(&quot;RID_FORM_34&quot;)
  106. .optAlign0.State = 1
  107. REM//FIXME: Remove this unused FNameAddOn through the file
  108. FNameAddOn = &quot;&quot;
  109. IDArray = Array(&quot;RID_FORM_36&quot;, &quot;RID_FORM_37&quot;, &quot;RID_FORM_40&quot;, &quot;RID_FORM_38&quot;, &quot;RID_FORM_39&quot;)
  110. For i = 1 To 5
  111. ButtonHelpText = GetResText(IDArray(i-1))
  112. cmdButton = DlgFormDB.getControl(&quot;cmdArrange&quot; &amp; i)
  113. cmdButton.Model.ImageURL = FormPath &amp; &quot;Arrange_&quot; &amp; i &amp; FNameAddOn &amp; &quot;.gif&quot;
  114. cmdButton.Model.HelpText = ButtonHelpText
  115. cmdButton.getPeer().setProperty(&quot;AccessibleName&quot;, ButtonHelpText)
  116. Next i
  117. &apos; .cmdArrange1.ImageURL = FormPath &amp; &quot;Arrange_1&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
  118. &apos; .cmdArrange1.HelpText = GetResText(&quot;RID_FORM_36&quot;)
  119. &apos;
  120. &apos; .cmdArrange2.ImageURL = FormPath &amp; &quot;Arrange_2&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
  121. &apos; .cmdArrange2.HelpText = GetResText(&quot;RID_FORM_37&quot;)
  122. &apos;
  123. &apos; .cmdArrange3.ImageURL = FormPath &amp; &quot;Arrange_3&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
  124. &apos; .cmdArrange3.HelpText = GetResText(&quot;RID_FORM_40&quot;)
  125. &apos;
  126. &apos; .cmdArrange4.ImageURL = FormPath &amp; &quot;Arrange_4&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
  127. &apos; .cmdArrange4.HelpText = GetResText(&quot;RID_FORM_38&quot;)
  128. &apos;
  129. &apos; .cmdArrange5.ImageURL = FormPath &amp; &quot;Arrange_5&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
  130. &apos; .cmdArrange5.HelpText = GetResText(&quot;RID_FORM_39&quot;)
  131. End With
  132. DlgFormDB.GetControl(&quot;cmdMoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_39&quot;))
  133. DlgFormDB.GetControl(&quot;cmdRemoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_40&quot;))
  134. DlgFormDB.GetControl(&quot;cmdMoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_41&quot;))
  135. DlgFormDB.GetControl(&quot;cmdRemoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_42&quot;))
  136. DlgFormDB.getControl(&quot;lstFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblFields, &quot;~&quot;))
  137. DlgFormDB.getControl(&quot;lstSelFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblSelFields, &quot;~&quot;))
  138. sSelectDatasource = GetResText(&quot;RID_DB_COMMON_37&quot;)
  139. sSelectDBTable = GetResText(&quot;RID_DB_COMMON_38&quot;)
  140. End Sub
  141. Sub InitializeWidthList()
  142. If Ubound(WidthList(),1) &gt; 16 Then
  143. ReDim WidthList(16,4)
  144. End If
  145. WidthList(0,0) = com.sun.star.sdbc.DataType.BIT &apos; = -7;
  146. WidthList(0,1) = cCheckbox
  147. WidthList(0,2) = False
  148. WidthList(0,3) = &quot;CheckBox&quot;
  149. WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT &apos; = -6;
  150. WidthList(1,1) = cNumericBox
  151. WidthList(1,2) = False
  152. WidthList(1,3) = &quot;FormattedField&quot;
  153. WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT &apos; = 5;
  154. WidthList(2,1) = cNumericBox
  155. WidthList(2,2) = False
  156. WidthList(2,3) = &quot;FormattedField&quot;
  157. WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER &apos; = 4;
  158. WidthList(3,1) = cNumericBox
  159. WidthList(3,2) = False
  160. WidthList(3,3) = &quot;FormattedField&quot;
  161. WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT &apos; = -5;
  162. WidthList(4,1) = cNumericBox
  163. WidthList(4,2) = False
  164. WidthList(4,3) = &quot;FormattedField&quot;
  165. WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT &apos; = 6;
  166. WidthList(5,1) = cNumericBox
  167. WidthList(5,2) = False
  168. WidthList(5,3) = &quot;FormattedField&quot;
  169. WidthList(6,0) = com.sun.star.sdbc.DataType.REAL &apos; = 7;
  170. WidthList(6,1) = cNumericBox
  171. WidthList(6,2) = False
  172. WidthList(6,3) = &quot;FormattedField&quot;
  173. WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE &apos; = 8;
  174. WidthList(7,1) = cNumericBox
  175. WidthList(7,2) = False
  176. WidthList(7,3) = &quot;FormattedField&quot;
  177. WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC &apos; = 2;
  178. WidthList(8,1) = cNumericBox
  179. WidthList(8,2) = False
  180. WidthList(8,3) = &quot;FormattedField&quot;
  181. WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL &apos; = 3; (including decimal places)
  182. WidthList(9,1) = cNumericBox
  183. WidthList(9,2) = False
  184. WidthList(9,3) = &quot;FormattedField&quot;
  185. WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR &apos; = 1;
  186. WidthList(10,1) = cTextBox
  187. WidthList(10,2) = False
  188. WidthList(10,3) = &quot;TextField&quot;
  189. WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR &apos; = 12;
  190. WidthList(11,1) = cTextBox
  191. WidthList(11,2) = True
  192. WidthList(11,3) = &quot;TextField&quot;
  193. WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR &apos; = -1;
  194. WidthList(12,1) = cTextBox
  195. WidthList(12,2) = True
  196. WidthList(12,3) = &quot;TextField&quot;
  197. WidthList(13,0) = com.sun.star.sdbc.DataType.DATE &apos; = 91;
  198. WidthList(13,1) = cDateBox
  199. WidthList(13,2) = False
  200. WidthList(13,3) = &quot;DateField&quot;
  201. WidthList(14,0) = com.sun.star.sdbc.DataType.TIME &apos; = 92;
  202. WidthList(14,1) = cTimeBox
  203. WidthList(14,2) = False
  204. WidthList(14,3) = &quot;TimeField&quot;
  205. WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP &apos; = 93;
  206. WidthList(15,1) = cDateBox
  207. WidthList(15,2) = False
  208. WidthList(15,3) = &quot;DateField&quot;
  209. WidthList(16,0) = com.sun.star.sdbc.DataType.BOOLEAN &apos; = 16;
  210. WidthList(16,1) = cCheckbox
  211. WidthList(16,2) = False
  212. WidthList(16,3) = &quot;CheckBox&quot;
  213. ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY &apos; = -2;
  214. ImgWidthList(0,1) = cImageControl
  215. ImgWidthList(0,2) = False
  216. ImgWidthList(0,3) = &quot;ImageControl&quot;
  217. ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY &apos; = -3;
  218. ImgWidthList(1,1) = cImageControl
  219. ImgWidthList(1,2) = False
  220. ImgWidthList(1,3) = &quot;ImageControl&quot;
  221. ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY &apos; = -4;
  222. ImgWidthList(2,1) = cImageControl
  223. ImgWidthList(2,2) = False
  224. ImgWidthList(2,3) = &quot;ImageControl&quot;
  225. ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB &apos; = 2004;
  226. ImgWidthList(3,1) = cImageControl
  227. ImgWidthList(3,2) = False
  228. ImgWidthList(3,3) = &quot;ImageControl&quot;
  229. &apos; Note: the following Fieldtypes are ignored
  230. &apos;ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL
  231. &apos;ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER
  232. &apos;ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT
  233. &apos;ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT
  234. &apos;ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT
  235. &apos;ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY
  236. &apos;ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB
  237. &apos;ExcludeList(7) = com.sun.star.sdbc.DataType.REF
  238. oModelService(cLabel) = &quot;com.sun.star.form.component.FixedText&quot;
  239. oModelService(cTextBox) = &quot;com.sun.star.form.component.TextField&quot;
  240. oModelService(cCheckBox) = &quot;com.sun.star.form.component.CheckBox&quot;
  241. oModelService(cDateBox) = &quot;com.sun.star.form.component.DateField&quot;
  242. oModelService(cTimeBox) = &quot;com.sun.star.form.component.TimeField&quot;
  243. oModelService(cNumericBox) = &quot;com.sun.star.form.component.FormattedField&quot;
  244. oModelService(cGridControl) = &quot;com.sun.star.form.component.GridControl&quot;
  245. oModelService(cImageControl) = &quot;com.sun.star.form.component.DatabaseImageControl&quot;
  246. End Sub
  247. </script:module>