file-online-preview/office-plugin/windows-office/share/basic/FormWizard/Language.xba

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(&quot;RID_FORM_0&quot;)
sMsgErrMsg = GetResText(&quot;RID_DB_COMMON_6&quot;)
sMsgErrNoDatabase = GetResText(&quot;RID_DB_COMMON_8&quot;)
sMsgErrNoTableInDatabase = GetResText(&quot;RID_DB_COMMON_9&quot;)
sMsgErrTitleSuggestedExist = GetResText(&quot;RID_DB_COMMON_10&quot;)
sMsgErrTitleAsTableExist = GetResText(&quot;RID_DB_COMMON_10&quot;)
sMsgErrTitleSyntaxError = GetResText(&quot;RID_DB_COMMON_11&quot;)
sMsgNoConnection = GetResText(&quot;RID_DB_COMMON_14&quot;)
sMsgProgressText = GetResText(&quot;RID_FORM_2&quot;)
sMsgCreatedForm = GetResText(&quot;RID_FORM_26&quot;)
sMsgErrNameToLong = GetResText(&quot;RID_FORM_27&quot;)
sMsgErrCouldNotOpenObject = GetResText(&quot;RID_DB_COMMON_13&quot;)
&apos; Internal Logic
sDateAppendix = GetResText(&quot;RID_FORM_4&quot;)
sTimeAppendix = GetResText(&quot;RID_FORM_5&quot;)
sReady = GetResText(&quot;RID_DB_COMMON_0&quot;)
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(&quot;FormWizard&quot;, &quot;DlgFormDB&quot;)
DialogModel = DlgFormDB.Model
With DialogModel
.cmdCancel.Label = GetResText(&quot;RID_DB_COMMON_1&quot;)
.cmdBack.Label = GetResText(&quot;RID_DB_COMMON_2&quot;)
.cmdHelp.Label = GetResText(&quot;RID_DB_COMMON_20&quot;)
sGoOn = GetResText(&quot;RID_DB_COMMON_3&quot;)
.cmdGoOn.Label = sGoOn
.lblTables.Label = GetResText(&quot;RID_FORM_6&quot;)
slblFields = GetResText(&quot;RID_FORM_12&quot;)
slblSelFields = GetResText(&quot;RID_FORM_13&quot;)
.lblFields.Label = slblFields
.lblSelFields.Label = slblSelFields
.lblStyles.Label = GetResText(&quot;RID_FORM_21&quot;)
.hlnBorderLayout.Label = GetResText(&quot;RID_FORM_28&quot;)
.hlnAlign.Label = GetResText(&quot;RID_FORM_32&quot;)
.hlnArrangements.Label = GetResText(&quot;RID_FORM_35&quot;)
WizardTitle(1) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_45&quot;)
WizardTitle(2) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_46&quot;)
WizardTitle(3) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(&quot;RID_FORM_47&quot;)
.hlnBinaries.Label = GetResText(&quot;RID_FORM_50&quot;)
.optIgnoreBinaries.Label = GetResText(&quot;RID_FORM_51&quot;)
.optBinariesasGraphics.Label = GetResText(&quot;RID_FORM_52&quot;)
.hlnBackground.Label = GetResText(&quot;RID_FORM_55&quot;)
.optTiled.Label = GetResText(&quot;RID_FORM_56&quot;)
.optArea.Label = GetResText(&quot;RID_FORM_57&quot;)
.optBorder0.Label = GetResText(&quot;RID_FORM_29&quot;)
.optBorder1.Label = GetResText(&quot;RID_FORM_30&quot;)
.optBorder2.Label = GetResText(&quot;RID_FORM_31&quot;)
.optBorder1.State = 1
.optAlign0.Label = GetResText(&quot;RID_FORM_33&quot;)
.optAlign2.Label = GetResText(&quot;RID_FORM_34&quot;)
.optAlign0.State = 1
REM//FIXME: Remove this unused FNameAddOn through the file
FNameAddOn = &quot;&quot;
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;)
For i = 1 To 5
ButtonHelpText = GetResText(IDArray(i-1))
cmdButton = DlgFormDB.getControl(&quot;cmdArrange&quot; &amp; i)
cmdButton.Model.ImageURL = FormPath &amp; &quot;Arrange_&quot; &amp; i &amp; FNameAddOn &amp; &quot;.gif&quot;
cmdButton.Model.HelpText = ButtonHelpText
cmdButton.getPeer().setProperty(&quot;AccessibleName&quot;, ButtonHelpText)
Next i
&apos; .cmdArrange1.ImageURL = FormPath &amp; &quot;Arrange_1&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
&apos; .cmdArrange1.HelpText = GetResText(&quot;RID_FORM_36&quot;)
&apos;
&apos; .cmdArrange2.ImageURL = FormPath &amp; &quot;Arrange_2&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
&apos; .cmdArrange2.HelpText = GetResText(&quot;RID_FORM_37&quot;)
&apos;
&apos; .cmdArrange3.ImageURL = FormPath &amp; &quot;Arrange_3&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
&apos; .cmdArrange3.HelpText = GetResText(&quot;RID_FORM_40&quot;)
&apos;
&apos; .cmdArrange4.ImageURL = FormPath &amp; &quot;Arrange_4&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
&apos; .cmdArrange4.HelpText = GetResText(&quot;RID_FORM_38&quot;)
&apos;
&apos; .cmdArrange5.ImageURL = FormPath &amp; &quot;Arrange_5&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
&apos; .cmdArrange5.HelpText = GetResText(&quot;RID_FORM_39&quot;)
End With
DlgFormDB.GetControl(&quot;cmdMoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_39&quot;))
DlgFormDB.GetControl(&quot;cmdRemoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_40&quot;))
DlgFormDB.GetControl(&quot;cmdMoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_41&quot;))
DlgFormDB.GetControl(&quot;cmdRemoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(&quot;RID_DB_COMMON_42&quot;))
DlgFormDB.getControl(&quot;lstFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblFields, &quot;~&quot;))
DlgFormDB.getControl(&quot;lstSelFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblSelFields, &quot;~&quot;))
sSelectDatasource = GetResText(&quot;RID_DB_COMMON_37&quot;)
sSelectDBTable = GetResText(&quot;RID_DB_COMMON_38&quot;)
End Sub
Sub InitializeWidthList()
If Ubound(WidthList(),1) &gt; 16 Then
ReDim WidthList(16,4)
End If
WidthList(0,0) = com.sun.star.sdbc.DataType.BIT &apos; = -7;
WidthList(0,1) = cCheckbox
WidthList(0,2) = False
WidthList(0,3) = &quot;CheckBox&quot;
WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT &apos; = -6;
WidthList(1,1) = cNumericBox
WidthList(1,2) = False
WidthList(1,3) = &quot;FormattedField&quot;
WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT &apos; = 5;
WidthList(2,1) = cNumericBox
WidthList(2,2) = False
WidthList(2,3) = &quot;FormattedField&quot;
WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER &apos; = 4;
WidthList(3,1) = cNumericBox
WidthList(3,2) = False
WidthList(3,3) = &quot;FormattedField&quot;
WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT &apos; = -5;
WidthList(4,1) = cNumericBox
WidthList(4,2) = False
WidthList(4,3) = &quot;FormattedField&quot;
WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT &apos; = 6;
WidthList(5,1) = cNumericBox
WidthList(5,2) = False
WidthList(5,3) = &quot;FormattedField&quot;
WidthList(6,0) = com.sun.star.sdbc.DataType.REAL &apos; = 7;
WidthList(6,1) = cNumericBox
WidthList(6,2) = False
WidthList(6,3) = &quot;FormattedField&quot;
WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE &apos; = 8;
WidthList(7,1) = cNumericBox
WidthList(7,2) = False
WidthList(7,3) = &quot;FormattedField&quot;
WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC &apos; = 2;
WidthList(8,1) = cNumericBox
WidthList(8,2) = False
WidthList(8,3) = &quot;FormattedField&quot;
WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL &apos; = 3; (including decimal places)
WidthList(9,1) = cNumericBox
WidthList(9,2) = False
WidthList(9,3) = &quot;FormattedField&quot;
WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR &apos; = 1;
WidthList(10,1) = cTextBox
WidthList(10,2) = False
WidthList(10,3) = &quot;TextField&quot;
WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR &apos; = 12;
WidthList(11,1) = cTextBox
WidthList(11,2) = True
WidthList(11,3) = &quot;TextField&quot;
WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR &apos; = -1;
WidthList(12,1) = cTextBox
WidthList(12,2) = True
WidthList(12,3) = &quot;TextField&quot;
WidthList(13,0) = com.sun.star.sdbc.DataType.DATE &apos; = 91;
WidthList(13,1) = cDateBox
WidthList(13,2) = False
WidthList(13,3) = &quot;DateField&quot;
WidthList(14,0) = com.sun.star.sdbc.DataType.TIME &apos; = 92;
WidthList(14,1) = cTimeBox
WidthList(14,2) = False
WidthList(14,3) = &quot;TimeField&quot;
WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP &apos; = 93;
WidthList(15,1) = cDateBox
WidthList(15,2) = False
WidthList(15,3) = &quot;DateField&quot;
WidthList(16,0) = com.sun.star.sdbc.DataType.BOOLEAN &apos; = 16;
WidthList(16,1) = cCheckbox
WidthList(16,2) = False
WidthList(16,3) = &quot;CheckBox&quot;
ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY &apos; = -2;
ImgWidthList(0,1) = cImageControl
ImgWidthList(0,2) = False
ImgWidthList(0,3) = &quot;ImageControl&quot;
ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY &apos; = -3;
ImgWidthList(1,1) = cImageControl
ImgWidthList(1,2) = False
ImgWidthList(1,3) = &quot;ImageControl&quot;
ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY &apos; = -4;
ImgWidthList(2,1) = cImageControl
ImgWidthList(2,2) = False
ImgWidthList(2,3) = &quot;ImageControl&quot;
ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB &apos; = 2004;
ImgWidthList(3,1) = cImageControl
ImgWidthList(3,2) = False
ImgWidthList(3,3) = &quot;ImageControl&quot;
&apos; Note: the following Fieldtypes are ignored
&apos;ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL
&apos;ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER
&apos;ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT
&apos;ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT
&apos;ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT
&apos;ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY
&apos;ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB
&apos;ExcludeList(7) = com.sun.star.sdbc.DataType.REF
oModelService(cLabel) = &quot;com.sun.star.form.component.FixedText&quot;
oModelService(cTextBox) = &quot;com.sun.star.form.component.TextField&quot;
oModelService(cCheckBox) = &quot;com.sun.star.form.component.CheckBox&quot;
oModelService(cDateBox) = &quot;com.sun.star.form.component.DateField&quot;
oModelService(cTimeBox) = &quot;com.sun.star.form.component.TimeField&quot;
oModelService(cNumericBox) = &quot;com.sun.star.form.component.FormattedField&quot;
oModelService(cGridControl) = &quot;com.sun.star.form.component.GridControl&quot;
oModelService(cImageControl) = &quot;com.sun.star.form.component.DatabaseImageControl&quot;
End Sub
</script:module>