home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 June
/
PCWorld_2002-06_cd.bin
/
Software
/
Komercni
/
openoffice
/
install
/
f_0271
/
Init.xba
< prev
next >
Wrap
Extensible Markup Language
|
2002-02-19
|
17KB
|
529 lines
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Init" script:language="StarBasic">Option Explicit
REM ***** BASIC *****
' Zu diskutieren:
' Autopilot von Werkzeugleiste f├╝r Textdokumente mit eigener Konverterseite?
' Konvertierung von Datenbankfeldern '- Problematik der Formatierung mit FS durchsprechen!?
' Option des einleitenden Welcome-Text, der erklärt, was eigentlich Sache ist (wie beim Dokumenten Konverter)
' Option der Checkbox-Gruppe in der die zu konvertierenden Dokumenttypen aufgef├╝hrt sind
' -> bei den letztgenannten Optionen müsste der Dialog in seiner Höhe vergrößert werden.
' Wir sollten informiert werden, ob und wie oder wann das Standard - Währungsformat für die Euroländer umgesetzt
' wird.
Public Const SBRANGEUBOUND = 20
Public StyleRangeAssignmentList(SBRANGEUBOUND)as String
Public SelRangeList(SBRANGEUBOUND) as String
Public RangeList(SBRANGEUBOUND) as String
Public UnprotectList() as String
Public FilterNames(2,1) as String
Public bDoUnProtect as Boolean
Public bCancelTask as Boolean
Public sREADY as String
Public sPROTECT as String
Public sCONTINUE as String
Public sSELTEMPL as String
Public sSELCELL as String
Public sCURRRANGES as String
Public sTEMPLATES as String
Public sSOURCEFILE as String
Public sSOURCEDIR as String
Public sTARGETDIR as String
Public sStsPROGRESS as String
Public sStsCELLPROGRSS as String
Public sStsRELRANGES as String
Public sStsRELSHEETRANGES as String
Public sStsREPROTECT as String
Public sMsgSELDIR as String
Public sMsgSELFILE as String
Public sMsgTARGETDIR as String
Public sMsgNOTTHERE as String
Public sMsgDLGTITLE as String
Public sMsgUNPROTECT as String
Public sMsgPWPROTECT as String
Public sMsgWRONGPW as String
Public sMsgSHEETPROTECTED as String
Public sMsgWARNING as String
Public sMsgSHEETSNOPROTECT as String
Public sMsgSHEETNOPROTECT as String
Public sMsgCHOOSECURRENCY as String
Public sMsgPASSWORD as String
Public sMsgOK as String
Public sMsgCANCEL as String
Public sMsgFileInvalid as String
Public sMsgNODIRECTORY as String
Public sMsgDOCISREADONLY as String
Public sMsgFileExists as String
Public sMsgCancelConversion as String
Public sMsgCancelTitle as String
Public sCurrPORTUGUESE as String
Public sCurrDUTCH as String
Public sCurrFRENCH as String
Public sCurrSPANISH as String
Public sCurrITALIAN as String
Public sCurrGERMAN as String
Public sCurrBELGIAN as String
Public sCurrIRISH as String
Public sCurrLUXEMBOURG as String
Public sCurrAUSTRIAN as String
Public sCurrFINNISH as String
Public sCurrGREEK as String
Public sCurrUNKNOWN as String
Public sCurrSYSUNKNOWN as String
Public sPrgsRETRIEVAL as String
Public sPrgsCONVERTING as String
Public sPrgsUNPROTECT as String
Public sInclusiveSubDir as String
Public Const SBCOUNTRYCOUNT = 12
Public CurMimeType as String
Public CurCellCount as Long
Public oSheets as Object
Public oStyles as Object
Public oStyle as Object
Public oFormats as Object
Public aSimpleStr as String
Public nSimpleKey as Long
Public aFormat() as Variant
Public oRanges as Object
Public oRange as Object
Public nLanguage as integer
Public nFormatLanguage as integer
Public aCellFormat as Variant
Public oDocument as Object
Public StartCol, StartRow, EndCol, EndRow as String
Public oSheet as Object
Public IntStartCol, IntStartRow, IntEndCol, IntEndRow as integer
Public oSelRanges as Object
Public nFormatType as Integer
Public sFormatCurrency as String
Public sFormatLanguage as String
Public CurSheetName as String
Public oStatusLine as Object
Public Const SBRELGET = 50
Public StatusValue as Single
Public TotCellCount as Long
Public StyleIndex as Integer
Public RangeIndex as Integer
Public CurrIndex as Integer
Public ActLangNumber(1) as Integer
Public CurExtension(2) as String
Public Currfactor as Double
Public CurrSymbolList(2) as String
Public CurrLanguage as String
Public CurrValue(11,5)
Public LangIDValue(11,2,2) as String
Public PreName as String
Public Separator as String
Public BitmapDir as String
Public TypeIndex as Integer, CSIndex as Integer, LangIndex as Integer, FSIndex as Integer
Public oLocale as New com.sun.star.lang.Locale
Public sEuroSign as String
Public oPointer as Object
Public sDocType as String
Public bPreSelected as Boolean
'Public DocDisposed as Boolean
'Public bMacroStopped as Boolean
Public bRecursive as Boolean
Public bCancelProtection as Boolean
Public CurrRoundMode as Boolean
Public bRangeListDefined as Boolean
' Note the variable bDocHasProtectedSheets does not contain information
' wether sheets have to be reprotected
Public bDocHasProtectedSheets as Boolean
Public sGOON as String
Public sHELP as String
Public sCANCEL as String
Dim sEnd as String
Sub InitializeResources()
With DialogModel
' Strings that are also needed by the Password Dialog
sGoOn = GetResText(1003)
sHelp = GetResText(1001)
sCANCEL = GetResText(1418)
sEnd = GetResText(1000)
.cmdCancel.Label = sCANCEL
.cmdHelp.Label = sHELP
.cmdBack.Label = GetResText(1002)
.cmdGoOn.Label = sGOON
.lblHint.Label = GetResText(1004)
.lblCurrencies.Label = GetResText(1006)
If .Step = 1 Then
.chkComplete.Label = GetResText(1100)
.hlnSelection.Label = GetResText(1101)
.optCellTemplates.Label = GetResText(1102)
.optSheetRanges.Label = GetResText(1103)
.optDocRanges.Label = GetResText(1104)
.optSelRange.Label = GetResText(1105)
sCURRRANGES = GetResText(1108)
.lblSelection.Label = sCURRRANGES
Else
.hlnExtent.Label = GetResText(1200)
.optSingleFile.Label = GetResText(1201) '"Einzelnes StarOffice -Dokument"'GetResText(1201)
.optWholeDir.Label = GetResText(1202)
.chkProtect.Label = GetResText(1207)
.chkTextDocuments.Label = GetResText(1210) ' "Auch Feldbefehle und Tabellen in Textdokumenten konvertieren"' Todo: Dieses Model später am Control unsichtbar machen
sSOURCEFILE = GetResText(1203)
sSOURCEDIR = GetResText(1204)
.lblSource.Label = sSOURCEDIR
sInclusiveSubDir = GetResText(1205)
.chkRecursive.Label = sInclusiveSubDir
sTARGETDIR = GetResText(1206)
.lblTarget.Label = STARGETDIR
.txtSource.Text = ConvertfromUrl(GetPathSettings("Work"))
SubstDir = .txtSource.Text
.txtTarget.Text = .txtSource.Text
.hlnProgress.Label = GetResText(1600)
.lblConfig.Label = GetResText(1603)
sPrgsRETRIEVAL = GetResText(1601)
sPrgsCONVERTING = GetResText(1602)
sPrgsUNPROTECT = GetResText(1604)
End If
.cmdBack.Enabled = False
sPROTECT = GetResText(1005)
sCONTINUE = GetResText(1007)
sSELTEMPL = GetResText(1106)
sSELCELL = GetResText(1107)
sCURRRANGES = GetResText(1108)
sTEMPLATES = GetResText(1109)
sStsPROGRESS = GetResText(1300)
sStsCELLPROGRSS = GetResText(1301)
sStsRELSHEETRANGES = GetResText(1302)
sStsRELRANGES = GetResText(1303)
sStsREPROTECT = GetResText(1304)
sREADY = GetResText(1400)
sMsgSELDIR = GetResText(1401)
sMsgSELFILE = GetResText(1402)
sMsgTARGETDIR = GetResText(1403)
sMsgNOTTHERE = GetResText(1404)
sMsgDLGTITLE = GetResText(1405)
sMsgUNPROTECT = GetResText(1406)
sMsgPWPROTECT = GetResText(1407)
sMsgWRONGPW = GetResText(1408)
sMsgSHEETPROTECTED = GetResText(1409)
sMsgWARNING = GetResText(1410)
sMsgSHEETSNOPROTECT = GetResText(1411)
sMsgSHEETNOPROTECT = GetResText(1412)
sMsgCHOOSECURRENCY = GetResText(1415)
sMsgPASSWORD = GetResText(1416)
sMsgOK = GetResText(1417)
sMsgCANCEL = GetResText(1418)
sMsgFILEINVALID = GetResText(1419)
sMsgFILEINVALID = ReplaceString(sMsgFILEINVALID,"%PRODUCTNAME", GetProductname())
SMsgNODIRECTORY = GetResText(1420)
sMsgDOCISREADONLY = GetResText(1421)
sMsgFileExists = GetResText(1422)
sMsgCancelConversion = GetResText(1423)
sMsgCancelTitle = GetResText(1424)
sCurrPORTUGUESE = GetResText(1500)
sCurrDUTCH = GetResText(1501)
sCurrFRENCH = GetResText(1502)
sCurrSPANISH = GetResText(1503)
sCurrITALIAN = GetResText(1504)
sCurrGERMAN = GetResText(1505)
sCurrBELGIAN = GetResText(1506)
sCurrIRISH = GetResText(1507)
sCurrLUXEMBOURG = GetResText(1508)
sCurrAUSTRIAN = GetResText(1509)
sCurrFINNISH = GetResText(1510)
sCurrGREEK = GetResText(1511)
sCurrUNKNOWN = GetResText(1511)
sCurrSYSUNKNOWN = GetResText(1512)
End With
End Sub
Sub InitializeLanguages()
sEuroSign = chr(8364)
' CURRENCIES_PORTUGUESE
LangIDValue(0,0,0) = "pt"
LangIDValue(0,0,1) = ""
LangIDValue(0,0,2) = "-816"
' CURRENCIES_DUTCH
LangIDValue(1,0,0) = "nl"
LangIDValue(1,0,1) = ""
LangIDValue(1,0,2) = "-413"
' CURRENCIES_FRENCH
LangIDValue(2,0,0) = "fr"
LangIDValue(2,0,1) = ""
LangIDValue(2,0,2) = "-40C"
' CURRENCIES_SPANISH
LangIDValue(3,0,0) = "es"
LangIDValue(3,0,1) = ""
LangIDValue(3,0,2) = "-40A"
'Spanish modern
LangIDValue(3,1,0) = "es"
LangIDValue(3,1,1) = ""
LangIDValue(3,1,2) = "-C0A"
'Spanish katalanic
LangIDValue(3,2,0) = "es"
LangIDValue(3,2,1) = ""
LangIDValue(3,2,2) = "-403"
' CURRENCIES_ITALIAN
LangIDValue(4,0,0) = "it"
LangIDValue(4,0,1) = ""
LangIDValue(4,0,2) = "-410"
' CURRENCIES_GERMAN
LangIDValue(5,0,0) = "de"
LangIDValue(5,0,1) = "DE"
LangIDValue(5,0,2) = "-407"
' CURRENCIES_BELGIAN
LangIDValue(6,0,0) = "fr"
LangIDValue(6,0,1) = "BE"
LangIDValue(6,0,2) = "-80C"
LangIDValue(6,1,0) = "nl"
LangIDValue(6,1,1) = "BE"
LangIDValue(6,1,2) = "-813"
' CURRENCIES_IRISH
LangIDValue(7,0,0) = "en"
LangIDValue(7,0,1) = "IE"
LangIDValue(7,0,2) = "-1809"
' CURRENCIES_LUXEMBOURG
LangIDValue(8,0,0) = "fr"
LangIDValue(8,0,1) = "LU"
LangIDValue(8,0,2) = "-140C"
LangIDValue(8,1,0) = "de"
LangIDValue(8,1,1) = "LU"
LangIDValue(8,1,2) = "-1007"
' CURRENCIES_AUSTRIAN
LangIDValue(9,0,0) = "de"
LangIDValue(9,0,1) = "AT"
LangIDValue(9,0,2) = "-C07"
' CURRENCIES_FINNISH
LangIDValue(10,0,0) = "fi"
LangIDValue(10,0,1) = "FI"
LangIDValue(10,0,2) = "-40B"
LangIDValue(10,1,0) = "sv"
LangIDValue(10,1,1) = "FI"
LangIDValue(10,1,2) = "-81D"
' CURRENCIES_GREEK
LangIDValue(11,0,0) = "el"
LangIDValue(11,0,1) = "GR"
LangIDValue(11,0,2) = "-408"
End Sub
Sub InitializeCurrencies()
Dim i as Integer
GoOn = True
CurrValue(0,0) = sCurrPORTUGUESE
' Wahrer Umrechnungskurs
CurrValue(0,1) = 200.482
' Gerundeter Umrechnungskurs
CurrValue(0,2) = 200
CurrValue(0,3) = "Esc."
CurrValue(0,4) = "Esc."
CurrValue(0,5) = "PTE"
CurrValue(1,0) = sCurrDUTCH
' Wahrer Umrechnungskurs
CurrValue(1,1) = 2.20371
' Gerundeter Umrechnungskurs
CurrValue(1,2) = 2
CurrValue(1,3) = "F"
CurrValue(1,4) = "fl"
CurrValue(1,5) = "NLG"
CurrValue(2,0) = sCurrFRENCH
' Wahrer Umrechnungskurs
CurrValue(2,1) = 6.55957
' Gerundeter Umrechnungskurs
CurrValue(2,2) = 7
CurrValue(2,3) = "F"
CurrValue(2,4) = "F"
CurrValue(2,5) = "FRF"
CurrValue(3,0) = sCurrSPANISH
' Wahrer Umrechnungskurs
CurrValue(3,1) = 166.386
' Gerundeter Umrechnungskurs
CurrValue(3,2) = 170
CurrValue(3,3) = "Pts"
CurrValue(3,4) = "Pts"
CurrValue(3,5) = "ESP"
CurrValue(4,0) = sCurrITALIAN
' Wahrer Umrechnungskurs
CurrValue(4,1) = 1936.27
' Gerundeter Umrechnungskurs
CurrValue(4,2) = 2000
CurrValue(4,3) = "L."
CurrValue(4,4) = "L."
CurrValue(4,5) = "ITL"
CurrValue(5,0) = sCurrGERMAN
' Wahrer Umrechnungskurs
CurrValue(5,1) = 1.95583
' Gerundeter Umrechnungskurs
CurrValue(5,2) = 2
CurrValue(5,3) = "DM"
CurrValue(5,4) = "DM"
CurrValue(5,5) = "DEM"
CurrValue(6,0) = sCurrBELGIAN
' Wahrer Umrechnungskurs
CurrValue(6,1) = 40.3399
' Gerundeter Umrechnungskurs
CurrValue(6,2) = 40
CurrValue(6,3) = "FB"
CurrValue(6,4) = "BF"
CurrValue(6,5) = "BEF"
CurrValue(7,0) = sCurrIRISH
' Wahrer Umrechnungskurs
CurrValue(7,1) = 0.787564
' Gerundeter Umrechnungskurs
CurrValue(7,2) = 0.8
CurrValue(7,3) = "IR£"
CurrValue(7,4) = "£" ' Todo: This is only for backwards compatibility. Follow Bug #92049
CurrValue(7,5) = "IEP"
CurrValue(8,0) = sCurrLUXEMBOURG
' Wahrer Umrechnungskurs
CurrValue(8,1) = 40.3399
' Gerundeter Umrechnungskurs
CurrValue(8,2) = 40
CurrValue(8,3) = "F"
CurrValue(8,4) = "F"
CurrValue(8,5) = "LUF"
CurrValue(9,0) = sCurrAUSTRIAN
' Wahrer Umrechnungskurs
CurrValue(9,1) = 13.7603
' Gerundeter Umrechnungskurs
CurrValue(9,2) = 15
CurrValue(9,3) = "├╢S"
CurrValue(9,4) = "S"
CurrValue(9,5) = "ATS"
CurrValue(10,0) = sCurrFINNISH
' Wahrer Umrechnungskurs
CurrValue(10,1) = 5.94573
' Gerundeter Umrechnungskurs
CurrValue(10,2) = 6
CurrValue(10,3) = "mk"
CurrValue(10,4) = "mk"
CurrValue(10,5) = "FIM"
' Todo: Werte verlorengegangen?
CurrValue(11,0) = sCurrGREEK
' Wahrer Umrechnungskurs
CurrValue(11,1) = 340.750
' Gerundeter Umrechnungskurs
CurrValue(11,2) = 400
CurrValue(11,3) = chr(916) & chr(961) & chr(967)
CurrValue(11,4) = chr(916) & chr(961) & chr(967)
CurrValue(11,5) = "GRD"
i = -1
CurrSymbolList(0) = ""
CurrSymbolList(1) = ""
InitializeCurrencyValues(CurrIndex)
End Sub
Sub InitializeControls()
If CurrIndex = -1 Then
If DialogModel.Step = 1 Then
EnableStep1DialogControls(True, False, False)
ElseIf DialogModel.Step = 2 Then
EnableStep2DialogControls(True)
End If
End If
End Sub
Sub InitializeConverter(oLocale, iDialogPage as Integer)
Dim Isthere as Boolean
ToggleWindow(False)
bCancelProtection = False
' bMacroStopped = False
bRangeListDefined = False
PWIndex = -1
sDocType = GetDocumentType(ThisComponent)
oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator()
If sDocType = "sCalc" Then
bDocHasProtectedSheets = CheckSheetProtection(oSheets)
End If
DialogConvert = LoadDialog("Euro", "DlgConvert")
DialogModel = DialogConvert.Model
DialogPassword = LoadDialog("Euro", "DlgPassword")
PasswordModel = DialogPassword.Model
DialogModel.Step = iDialogPage
InitializeResources()
InitializeLanguages()
InitializeLocales(oLocale)
InitializeCurrencies()
InitializeControls()
BitmapDir = GetOfficeSubPath("Template", "wizard/bitmap")
FillUpCurrencyListbox()
DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".bmp"
DialogConvert.Title = sMsgDLGTITLE
DialogModel.cmdGoOn.DefaultButton = True
ToggleWindow(True)
End Sub
Sub InitializeCurrencyValues(CurrIndex)
If CurrIndex <> -1 Then
CurrLanguage = CurrValue(CurrIndex,0)
CurrFactor = CurrValue(CurrIndex,1)
CurrSymbolList(0) = CurrValue(CurrIndex,3)
CurrSymbolList(1) = CurrValue(CurrIndex,4)
CurrSymbolList(2) = CurrValue(CurrIndex,5)
End If
End Sub
Function InitializeLocales(oLocale) as Boolean
Dim i as Integer, n as Integer, m as Integer
Dim sLanguage as String, sCountry as String
Dim bTakeThisLocale as Boolean
sLanguage = oLocale.Language
sCountry = oLocale.Country
For n = 0 To SBCOUNTRYCOUNT - 1
For m = 0 TO 1
If DialogModel.Step = 2 Then
bTakeThisLocale = LangIDValue(n,m,0) = sLanguage
Else
bTakeThisLocale = LangIDValue(n,m,0) = sLanguage' AND LangIDValue(n,m,1) = sCountry
End If
If bTakeThisLocale Then
CurrIndex = n
For i = 0 To 2
CurExtension(i) = LangIDValue(CurrIndex,i,2)
Next i
InitializeLocales = True
Exit Function
End If
Next m
Next n
CurrIndex = -1
InitializeLocales = False
End Function</script:module>