298 lines
12 KiB
Java
298 lines
12 KiB
Java
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
-->
|
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
|
|
|
|
|
|
Public Const SBCANCEL = 2
|
|
Public Const SBREPEAT = 4
|
|
Public LabelDiffHeight as Long
|
|
Public BasicLabelDiffHeight as Long
|
|
|
|
Public WizardTitle(1 To 3) as String
|
|
Public DlgFormDB as Object
|
|
Public DialogModel as Object
|
|
|
|
Dim sMsgWizardName as String
|
|
Dim sMsgErrMsg as String
|
|
Dim sMsgErrNoDatabase as String
|
|
Dim sMsgErrNoTableInDatabase as String
|
|
Dim sMsgErrTitleSuggestedExist as String
|
|
Dim sMsgErrTitleSyntaxError as String
|
|
Dim sMsgErrTitleAsTableExist as String
|
|
Dim sMsgProgressText as String
|
|
Dim sMsgCreatedForm as String
|
|
Dim sMsgErrCouldNotOpenObject as String
|
|
Dim sMsgErrNameToLong as String
|
|
Dim sTimeAppendix as String
|
|
Dim sDateAppendix as String
|
|
Public sGoOn as String
|
|
Public sReady as String
|
|
Public sMsgNoConnection as String
|
|
Public XPixelFactor as Long
|
|
Public YPixelFactor as Long
|
|
Public sSelectDatasource as String
|
|
Public sSelectDBTable as String
|
|
|
|
|
|
|
|
Sub LoadLanguage ()
|
|
sMsgWizardName = GetResText("RID_FORM_0")
|
|
sMsgErrMsg = GetResText("RID_DB_COMMON_6")
|
|
sMsgErrNoDatabase = GetResText("RID_DB_COMMON_8")
|
|
sMsgErrNoTableInDatabase = GetResText("RID_DB_COMMON_9")
|
|
sMsgErrTitleSuggestedExist = GetResText("RID_DB_COMMON_10")
|
|
sMsgErrTitleAsTableExist = GetResText("RID_DB_COMMON_10")
|
|
sMsgErrTitleSyntaxError = GetResText("RID_DB_COMMON_11")
|
|
sMsgNoConnection = GetResText("RID_DB_COMMON_14")
|
|
sMsgProgressText = GetResText("RID_FORM_2")
|
|
sMsgCreatedForm = GetResText("RID_FORM_26")
|
|
sMsgErrNameToLong = GetResText("RID_FORM_27")
|
|
sMsgErrCouldNotOpenObject = GetResText("RID_DB_COMMON_13")
|
|
|
|
' Internal Logic
|
|
sDateAppendix = GetResText("RID_FORM_4")
|
|
sTimeAppendix = GetResText("RID_FORM_5")
|
|
|
|
sReady = GetResText("RID_DB_COMMON_0")
|
|
End Sub
|
|
|
|
|
|
Sub SetDialogLanguage ()
|
|
Dim i as Integer
|
|
Dim ButtonHelpText as String
|
|
Dim CmdButton as Object
|
|
Dim IDArray as Variant
|
|
Dim FNameAddOn as String
|
|
Dim slblSelFields as String
|
|
Dim slblFields as String
|
|
|
|
DlgFormDB = LoadDialog("FormWizard", "DlgFormDB")
|
|
DialogModel = DlgFormDB.Model
|
|
|
|
With DialogModel
|
|
.cmdCancel.Label = GetResText("RID_DB_COMMON_1")
|
|
.cmdBack.Label = GetResText("RID_DB_COMMON_2")
|
|
.cmdHelp.Label = GetResText("RID_DB_COMMON_20")
|
|
sGoOn = GetResText("RID_DB_COMMON_3")
|
|
.cmdGoOn.Label = sGoOn
|
|
.lblTables.Label = GetResText("RID_FORM_6")
|
|
|
|
slblFields = GetResText("RID_FORM_12")
|
|
slblSelFields = GetResText("RID_FORM_13")
|
|
.lblFields.Label = slblFields
|
|
.lblSelFields.Label = slblSelFields
|
|
|
|
.lblStyles.Label = GetResText("RID_FORM_21")
|
|
.hlnBorderLayout.Label = GetResText("RID_FORM_28")
|
|
.hlnAlign.Label = GetResText("RID_FORM_32")
|
|
.hlnArrangements.Label = GetResText("RID_FORM_35")
|
|
|
|
WizardTitle(1) = sMsgWizardName & " - " & GetResText("RID_FORM_45")
|
|
WizardTitle(2) = sMsgWizardName & " - " & GetResText("RID_FORM_46")
|
|
WizardTitle(3) = sMsgWizardName & " - " & GetResText("RID_FORM_47")
|
|
|
|
.hlnBinaries.Label = GetResText("RID_FORM_50")
|
|
.optIgnoreBinaries.Label = GetResText("RID_FORM_51")
|
|
.optBinariesasGraphics.Label = GetResText("RID_FORM_52")
|
|
|
|
.hlnBackground.Label = GetResText("RID_FORM_55")
|
|
.optTiled.Label = GetResText("RID_FORM_56")
|
|
.optArea.Label = GetResText("RID_FORM_57")
|
|
|
|
.optBorder0.Label = GetResText("RID_FORM_29")
|
|
.optBorder1.Label = GetResText("RID_FORM_30")
|
|
.optBorder2.Label = GetResText("RID_FORM_31")
|
|
.optBorder1.State = 1
|
|
|
|
.optAlign0.Label = GetResText("RID_FORM_33")
|
|
.optAlign2.Label = GetResText("RID_FORM_34")
|
|
.optAlign0.State = 1
|
|
|
|
REM//FIXME: Remove this unused FNameAddOn through the file
|
|
FNameAddOn = ""
|
|
|
|
IDArray = Array("RID_FORM_36", "RID_FORM_37", "RID_FORM_40", "RID_FORM_38", "RID_FORM_39")
|
|
For i = 1 To 5
|
|
ButtonHelpText = GetResText(IDArray(i-1))
|
|
cmdButton = DlgFormDB.getControl("cmdArrange" & i)
|
|
cmdButton.Model.ImageURL = FormPath & "Arrange_" & i & FNameAddOn & ".gif"
|
|
cmdButton.Model.HelpText = ButtonHelpText
|
|
cmdButton.getPeer().setProperty("AccessibleName", ButtonHelpText)
|
|
Next i
|
|
' .cmdArrange1.ImageURL = FormPath & "Arrange_1" & FNameAddOn & ".gif"
|
|
' .cmdArrange1.HelpText = GetResText("RID_FORM_36")
|
|
'
|
|
' .cmdArrange2.ImageURL = FormPath & "Arrange_2" & FNameAddOn & ".gif"
|
|
' .cmdArrange2.HelpText = GetResText("RID_FORM_37")
|
|
'
|
|
' .cmdArrange3.ImageURL = FormPath & "Arrange_3" & FNameAddOn & ".gif"
|
|
' .cmdArrange3.HelpText = GetResText("RID_FORM_40")
|
|
'
|
|
' .cmdArrange4.ImageURL = FormPath & "Arrange_4" & FNameAddOn & ".gif"
|
|
' .cmdArrange4.HelpText = GetResText("RID_FORM_38")
|
|
'
|
|
' .cmdArrange5.ImageURL = FormPath & "Arrange_5" & FNameAddOn & ".gif"
|
|
' .cmdArrange5.HelpText = GetResText("RID_FORM_39")
|
|
End With
|
|
DlgFormDB.GetControl("cmdMoveSelected").getPeer().setProperty("AccessibleName", GetResText("RID_DB_COMMON_39"))
|
|
DlgFormDB.GetControl("cmdRemoveSelected").getPeer().setProperty("AccessibleName", GetResText("RID_DB_COMMON_40"))
|
|
DlgFormDB.GetControl("cmdMoveAll").getPeer().setProperty("AccessibleName", GetResText("RID_DB_COMMON_41"))
|
|
DlgFormDB.GetControl("cmdRemoveAll").getPeer().setProperty("AccessibleName", GetResText("RID_DB_COMMON_42"))
|
|
DlgFormDB.getControl("lstFields").getPeer().setProperty("AccessibleName", DeleteStr(slblFields, "~"))
|
|
DlgFormDB.getControl("lstSelFields").getPeer().setProperty("AccessibleName", DeleteStr(slblSelFields, "~"))
|
|
|
|
sSelectDatasource = GetResText("RID_DB_COMMON_37")
|
|
sSelectDBTable = GetResText("RID_DB_COMMON_38")
|
|
End Sub
|
|
|
|
|
|
|
|
Sub InitializeWidthList()
|
|
|
|
If Ubound(WidthList(),1) > 16 Then
|
|
ReDim WidthList(16,4)
|
|
End If
|
|
|
|
WidthList(0,0) = com.sun.star.sdbc.DataType.BIT ' = -7;
|
|
WidthList(0,1) = cCheckbox
|
|
WidthList(0,2) = False
|
|
WidthList(0,3) = "CheckBox"
|
|
|
|
WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT ' = -6;
|
|
WidthList(1,1) = cNumericBox
|
|
WidthList(1,2) = False
|
|
WidthList(1,3) = "FormattedField"
|
|
|
|
WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT ' = 5;
|
|
WidthList(2,1) = cNumericBox
|
|
WidthList(2,2) = False
|
|
WidthList(2,3) = "FormattedField"
|
|
|
|
WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER ' = 4;
|
|
WidthList(3,1) = cNumericBox
|
|
WidthList(3,2) = False
|
|
WidthList(3,3) = "FormattedField"
|
|
|
|
WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT ' = -5;
|
|
WidthList(4,1) = cNumericBox
|
|
WidthList(4,2) = False
|
|
WidthList(4,3) = "FormattedField"
|
|
|
|
WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT ' = 6;
|
|
WidthList(5,1) = cNumericBox
|
|
WidthList(5,2) = False
|
|
WidthList(5,3) = "FormattedField"
|
|
|
|
WidthList(6,0) = com.sun.star.sdbc.DataType.REAL ' = 7;
|
|
WidthList(6,1) = cNumericBox
|
|
WidthList(6,2) = False
|
|
WidthList(6,3) = "FormattedField"
|
|
|
|
WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE ' = 8;
|
|
WidthList(7,1) = cNumericBox
|
|
WidthList(7,2) = False
|
|
WidthList(7,3) = "FormattedField"
|
|
|
|
WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC ' = 2;
|
|
WidthList(8,1) = cNumericBox
|
|
WidthList(8,2) = False
|
|
WidthList(8,3) = "FormattedField"
|
|
|
|
WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL ' = 3; (including decimal places)
|
|
WidthList(9,1) = cNumericBox
|
|
WidthList(9,2) = False
|
|
WidthList(9,3) = "FormattedField"
|
|
|
|
WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR ' = 1;
|
|
WidthList(10,1) = cTextBox
|
|
WidthList(10,2) = False
|
|
WidthList(10,3) = "TextField"
|
|
|
|
WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR ' = 12;
|
|
WidthList(11,1) = cTextBox
|
|
WidthList(11,2) = True
|
|
WidthList(11,3) = "TextField"
|
|
|
|
WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR ' = -1;
|
|
WidthList(12,1) = cTextBox
|
|
WidthList(12,2) = True
|
|
WidthList(12,3) = "TextField"
|
|
|
|
WidthList(13,0) = com.sun.star.sdbc.DataType.DATE ' = 91;
|
|
WidthList(13,1) = cDateBox
|
|
WidthList(13,2) = False
|
|
WidthList(13,3) = "DateField"
|
|
|
|
WidthList(14,0) = com.sun.star.sdbc.DataType.TIME ' = 92;
|
|
WidthList(14,1) = cTimeBox
|
|
WidthList(14,2) = False
|
|
WidthList(14,3) = "TimeField"
|
|
|
|
WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP ' = 93;
|
|
WidthList(15,1) = cDateBox
|
|
WidthList(15,2) = False
|
|
WidthList(15,3) = "DateField"
|
|
|
|
WidthList(16,0) = com.sun.star.sdbc.DataType.BOOLEAN ' = 16;
|
|
WidthList(16,1) = cCheckbox
|
|
WidthList(16,2) = False
|
|
WidthList(16,3) = "CheckBox"
|
|
|
|
ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY ' = -2;
|
|
ImgWidthList(0,1) = cImageControl
|
|
ImgWidthList(0,2) = False
|
|
ImgWidthList(0,3) = "ImageControl"
|
|
|
|
ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY ' = -3;
|
|
ImgWidthList(1,1) = cImageControl
|
|
ImgWidthList(1,2) = False
|
|
ImgWidthList(1,3) = "ImageControl"
|
|
|
|
ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY ' = -4;
|
|
ImgWidthList(2,1) = cImageControl
|
|
ImgWidthList(2,2) = False
|
|
ImgWidthList(2,3) = "ImageControl"
|
|
|
|
ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB ' = 2004;
|
|
ImgWidthList(3,1) = cImageControl
|
|
ImgWidthList(3,2) = False
|
|
ImgWidthList(3,3) = "ImageControl"
|
|
|
|
' Note: the following Fieldtypes are ignored
|
|
'ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL
|
|
'ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER
|
|
'ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT
|
|
'ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT
|
|
'ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT
|
|
'ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY
|
|
'ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB
|
|
'ExcludeList(7) = com.sun.star.sdbc.DataType.REF
|
|
|
|
oModelService(cLabel) = "com.sun.star.form.component.FixedText"
|
|
oModelService(cTextBox) = "com.sun.star.form.component.TextField"
|
|
oModelService(cCheckBox) = "com.sun.star.form.component.CheckBox"
|
|
oModelService(cDateBox) = "com.sun.star.form.component.DateField"
|
|
oModelService(cTimeBox) = "com.sun.star.form.component.TimeField"
|
|
oModelService(cNumericBox) = "com.sun.star.form.component.FormattedField"
|
|
oModelService(cGridControl) = "com.sun.star.form.component.GridControl"
|
|
oModelService(cImageControl) = "com.sun.star.form.component.DatabaseImageControl"
|
|
End Sub
|
|
</script:module>
|