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