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