1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * 22 ***********************************************************--> 23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit 24 25 26Global Const RID_COMMON = 1000 27Global Const RID_FORM = 2200 28 29Public Const SBCANCEL = 2 30Public Const SBREPEAT = 4 31Public LabelDiffHeight as Long 32Public BasicLabelDiffHeight as Long 33 34Public WizardTitle(1 To 3) as String 35Public DlgFormDB as Object 36Public DialogModel as Object 37 38Dim sMsgWizardName as String 39Dim sMsgErrMsg as String 40Dim sMsgErrNoDatabase as String 41Dim sMsgErrNoTableInDatabase as String 42Dim sMsgErrTitleSuggestedExist as String 43Dim sMsgErrTitleSyntaxError as String 44Dim sMsgErrTitleAsTableExist as String 45Dim sMsgProgressText as String 46Dim sMsgCreatedForm as String 47Dim sMsgErrCouldNotOpenObject as String 48Dim sMsgErrNameToLong as String 49Dim sTimeAppendix as String 50Dim sDateAppendix as String 51Public sGoOn as String 52Public sReady as String 53Public sMsgNoConnection as String 54Public sWriterFilterName as String 55Public XPixelFactor as Long 56Public YPixelFactor as Long 57Public sSelectDatasource as String 58Public sSelectDBTable as String 59 60 61 62Sub LoadLanguage () 63 sMsgWizardName = GetResText(RID_FORM + 0) 64 sMsgErrMsg = GetResText(RID_COMMON + 6) 65 sMsgErrNoDatabase = GetResText(RID_COMMON + 8) 66 sMsgErrNoTableInDatabase = GetResText(RID_COMMON + 9) 67 sMsgErrTitleSuggestedExist = GetResText(RID_COMMON + 10) 68 sMsgErrTitleAsTableExist = GetResText(RID_COMMON + 10) 69 sMsgErrTitleSyntaxError = GetResText(RID_COMMON + 11) 70 sMsgNoConnection = GetResText(RID_COMMON + 14 71 sMsgProgressText = GetResText(RID_FORM + 2) 72 sMsgCreatedForm = GetResText(RID_FORM + 26) 73 sMsgErrNameToLong = GetResText (RID_FORM + 27) 74 sMsgErrCouldNotOpenObject = GetResText (RID_COMMON + 13) 75 76 ' Internal Logic 77 sDateAppendix = GetResText(RID_FORM + 4) 78 sTimeAppendix = GetResText(RID_FORM + 5) 79 80 sReady = GetResText(RID_COMMON + 0) 81End Sub 82 83 84Sub SetDialogLanguage () 85Dim i as Integer 86Dim ButtonHelpText as String 87Dim CmdButton as Object 88Dim IDArray as Variant 89Dim FNameAddOn as String 90Dim slblSelFields as String 91Dim slblFields as String 92 93 DlgFormDB = LoadDialog("FormWizard", "DlgFormDB") 94 DialogModel = DlgFormDB.Model 95 96 With DialogModel 97 .cmdCancel.Label = GetResText(RID_COMMON + 1) 98 .cmdBack.Label = GetResText(RID_COMMON + 2) 99 .cmdHelp.Label = GetResText(RID_COMMON + 20) 100 sGoOn = GetResText(RID_COMMON + 3) 101 .cmdGoOn.Label = sGoOn 102 .lblTables.Label = GetResText(RID_FORM + 6) 103 104 slblFields = GetResText(RID_FORM + 12) 105 slblSelFields = GetResText(RID_FORM + 13) 106 .lblFields.Label = slblFields 107 .lblSelFields.Label = slblSelFields 108 109 .lblStyles.Label = GetResText(RID_FORM + 21) 110 .hlnBorderLayout.Label = GetResText(RID_FORM + 28) 111 .hlnAlign.Label = GetResText(RID_FORM + 32) 112 .hlnArrangements.Label = GetResText(RID_FORM + 35) 113 114 WizardTitle(1) = sMsgWizardName & " - " & GetResText(RID_FORM + 45) 115 WizardTitle(2) = sMsgWizardName & " - " & GetResText(RID_FORM + 46) 116 WizardTitle(3) = sMsgWizardName & " - " & GetResText(RID_FORM + 47) 117 118 .hlnBinaries.Label = GetResText(RID_FORM + 50) 119 .optIgnoreBinaries.Label = GetResText(RID_FORM + 51) 120 .optBinariesasGraphics.Label = GetResText(RID_FORM + 52) 121 122 .hlnBackground.Label = GetResText(RID_FORM + 55) 123 .optTiled.Label = GetResText(RID_FORM + 56) 124 .optArea.Label = GetResText(RID_FORM + 57) 125 126 .optBorder0.Label = GetResText(RID_FORM + 29) 127 .optBorder1.Label = GetResText(RID_FORM + 30) 128 .optBorder2.Label = GetResText(RID_FORM + 31) 129 .optBorder1.State = 1 130 131 .optAlign0.Label = GetResText(RID_FORM + 33) 132 .optAlign2.Label = GetResText(RID_FORM + 34) 133 .optAlign0.State = 1 134 135 FNameAddOn = "" 136 If isHighContrast(DlgFormDB.getPeer) Then FNameAddOn = "_hc" 137 138 IDArray = Array(36, 37, 40, 38, 39) 139 For i = 1 To 5 140 ButtonHelpText = GetResText(RID_FORM + IDArray(i-1) 141 cmdButton = DlgFormDB.getControl("cmdArrange" & i) 142 cmdButton.Model.ImageURL = FormPath & "Arrange_" & i & FNameAddOn & ".gif" 143 cmdButton.Model.HelpText = ButtonHelpText 144 cmdButton.getPeer().setProperty("AccessibleName", ButtonHelpText) 145 Next i 146' .cmdArrange1.ImageURL = FormPath & "Arrange_1" & FNameAddOn & ".gif" 147' .cmdArrange1.HelpText = GetResText(RID_FORM + 36) 148' 149' .cmdArrange2.ImageURL = FormPath & "Arrange_2" & FNameAddOn & ".gif" 150' .cmdArrange2.HelpText = GetResText(RID_FORM + 37) 151' 152' .cmdArrange3.ImageURL = FormPath & "Arrange_3" & FNameAddOn & ".gif" 153' .cmdArrange3.HelpText = GetResText(RID_FORM + 40) 154' 155' .cmdArrange4.ImageURL = FormPath & "Arrange_4" & FNameAddOn & ".gif" 156' .cmdArrange4.HelpText = GetResText(RID_FORM + 38) 157' 158' .cmdArrange5.ImageURL = FormPath & "Arrange_5" & FNameAddOn & ".gif" 159' .cmdArrange5.HelpText = GetResText(RID_FORM + 39) 160 sWriterFilterName = GetResText(RID_FORM + 70) 161 End With 162 DlgFormDB.GetControl("cmdMoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 39) 163 DlgFormDB.GetControl("cmdRemoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 40) 164 DlgFormDB.GetControl("cmdMoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 41) 165 DlgFormDB.GetControl("cmdRemoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 42) 166 DlgFormDB.getControl("lstFields").getPeer().setProperty("AccessibleName", DeleteStr(slblFields, "~")) 167 DlgFormDB.getControl("lstSelFields").getPeer().setProperty("AccessibleName", DeleteStr(slblSelFields, "~")) 168 169 sSelectDatasource = GetResText(RID_COMMON + 37) 170 sSelectDBTable = GetResText(RID_COMMON + 38) 171End Sub 172 173 174 175Sub InitializeWidthList() 176 177 If Ubound(WidthList(),1) > 16 Then 178 ReDim WidthList(16,4) 179 End If 180 181 WidthList(0,0) = com.sun.star.sdbc.DataType.BIT ' = -7; 182 WidthList(0,1) = cCheckbox 183 WidthList(0,2) = False 184 WidthList(0,3) = "CheckBox" 185 186 WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT ' = -6; 187 WidthList(1,1) = cNumericBox 188 WidthList(1,2) = False 189 WidthList(1,3) = "FormattedField" 190 191 WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT ' = 5; 192 WidthList(2,1) = cNumericBox 193 WidthList(2,2) = False 194 WidthList(2,3) = "FormattedField" 195 196 WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER ' = 4; 197 WidthList(3,1) = cNumericBox 198 WidthList(3,2) = False 199 WidthList(3,3) = "FormattedField" 200 201 WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT ' = -5; 202 WidthList(4,1) = cNumericBox 203 WidthList(4,2) = False 204 WidthList(4,3) = "FormattedField" 205 206 WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT ' = 6; 207 WidthList(5,1) = cNumericBox 208 WidthList(5,2) = False 209 WidthList(5,3) = "FormattedField" 210 211 WidthList(6,0) = com.sun.star.sdbc.DataType.REAL ' = 7; 212 WidthList(6,1) = cNumericBox 213 WidthList(6,2) = False 214 WidthList(6,3) = "FormattedField" 215 216 WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE ' = 8; 217 WidthList(7,1) = cNumericBox 218 WidthList(7,2) = False 219 WidthList(7,3) = "FormattedField" 220 221 WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC ' = 2; 222 WidthList(8,1) = cNumericBox 223 WidthList(8,2) = False 224 WidthList(8,3) = "FormattedField" 225 226 WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL ' = 3; (including decimal places) 227 WidthList(9,1) = cNumericBox 228 WidthList(9,2) = False 229 WidthList(9,3) = "FormattedField" 230 231 WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR ' = 1; 232 WidthList(10,1) = cTextBox 233 WidthList(10,2) = False 234 WidthList(10,3) = "TextField" 235 236 WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR ' = 12; 237 WidthList(11,1) = cTextBox 238 WidthList(11,2) = True 239 WidthList(11,3) = "TextField" 240 241 WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR ' = -1; 242 WidthList(12,1) = cTextBox 243 WidthList(12,2) = True 244 WidthList(12,3) = "TextField" 245 246 WidthList(13,0) = com.sun.star.sdbc.DataType.DATE ' = 91; 247 WidthList(13,1) = cDateBox 248 WidthList(13,2) = False 249 WidthList(13,3) = "DateField" 250 251 WidthList(14,0) = com.sun.star.sdbc.DataType.TIME ' = 92; 252 WidthList(14,1) = cTimeBox 253 WidthList(14,2) = False 254 WidthList(14,3) = "TimeField" 255 256 WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP ' = 93; 257 WidthList(15,1) = cDateBox 258 WidthList(15,2) = False 259 WidthList(15,3) = "DateField" 260 261 WidthList(16,0) = com.sun.star.sdbc.DataType.BOOLEAN ' = 16; 262 WidthList(16,1) = cCheckbox 263 WidthList(16,2) = False 264 WidthList(16,3) = "CheckBox" 265 266 ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY ' = -2; 267 ImgWidthList(0,1) = cImageControl 268 ImgWidthList(0,2) = False 269 ImgWidthList(0,3) = "ImageControl" 270 271 ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY ' = -3; 272 ImgWidthList(1,1) = cImageControl 273 ImgWidthList(1,2) = False 274 ImgWidthList(1,3) = "ImageControl" 275 276 ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY ' = -4; 277 ImgWidthList(2,1) = cImageControl 278 ImgWidthList(2,2) = False 279 ImgWidthList(2,3) = "ImageControl" 280 281 ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB ' = 2004; 282 ImgWidthList(3,1) = cImageControl 283 ImgWidthList(3,2) = False 284 ImgWidthList(3,3) = "ImageControl" 285 286' Note: the following Fieldtypes are ignored 287'ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL 288'ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER 289'ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT 290'ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT 291'ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT 292'ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY 293'ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB 294'ExcludeList(7) = com.sun.star.sdbc.DataType.REF 295 296 oModelService(cLabel) = "com.sun.star.form.component.FixedText" 297 oModelService(cTextBox) = "com.sun.star.form.component.TextField" 298 oModelService(cCheckBox) = "com.sun.star.form.component.CheckBox" 299 oModelService(cDateBox) = "com.sun.star.form.component.DateField" 300 oModelService(cTimeBox) = "com.sun.star.form.component.TimeField" 301 oModelService(cNumericBox) = "com.sun.star.form.component.FormattedField" 302 oModelService(cGridControl) = "com.sun.star.form.component.GridControl" 303 oModelService(cImageControl) = "com.sun.star.form.component.DatabaseImageControl" 304End Sub 305</script:module> 306