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=
"Init" script:
language=
"StarBasic">Option Explicit
8 Public Const SBRANGEUBOUND =
20
9 Public StyleRangeAssignmentList(SBRANGEUBOUND)as String
10 Public SelRangeList(SBRANGEUBOUND) as String
11 Public RangeList(SBRANGEUBOUND) as String
12 Public UnprotectList() as String
13 Public FilterNames(
2,
1) as String
14 Public bDoUnProtect as Boolean
15 Public bCancelTask as Boolean
17 Public sREADY as String
18 Public sPROTECT as String
19 Public sCONTINUE as String
21 Public sSELTEMPL as String
22 Public sSELCELL as String
23 Public sCURRRANGES as String
24 Public sTEMPLATES as String
26 Public sSOURCEFILE as String
27 Public sSOURCEDIR as String
28 Public sTARGETDIR as String
30 Public sStsPROGRESS as String
31 Public sStsCELLPROGRSS as String
32 Public sStsRELRANGES as String
33 Public sStsRELSHEETRANGES as String
34 Public sStsREPROTECT as String
36 Public sMsgSELDIR as String
37 Public sMsgSELFILE as String
38 Public sMsgTARGETDIR as String
39 Public sMsgNOTTHERE as String
40 Public sMsgDLGTITLE as String
41 Public sMsgUNPROTECT as String
42 Public sMsgPWPROTECT as String
43 Public sMsgWRONGPW as String
44 Public sMsgSHEETPROTECTED as String
45 Public sMsgWARNING as String
46 Public sMsgSHEETSNOPROTECT as String
47 Public sMsgSHEETNOPROTECT as String
48 Public sMsgCHOOSECURRENCY as String
49 Public sMsgPASSWORD as String
50 Public sMsgOK as String
51 Public sMsgCANCEL as String
52 Public sMsgFileInvalid as String
53 Public sMsgNODIRECTORY as String
54 Public sMsgDOCISREADONLY as String
55 Public sMsgFileExists as String
56 Public sMsgCancelConversion as String
57 Public sMsgCancelTitle as String
58 Public sCurrPORTUGUESE as String
59 Public sCurrDUTCH as String
60 Public sCurrFRENCH as String
61 Public sCurrSPANISH as String
62 Public sCurrITALIAN as String
63 Public sCurrGERMAN as String
64 Public sCurrBELGIAN as String
65 Public sCurrIRISH as String
66 Public sCurrLUXEMBOURG as String
67 Public sCurrAUSTRIAN as String
68 Public sCurrFINNISH as String
69 Public sCurrGREEK as String
70 Public sCurrSLOVENIAN as String
71 Public sCurrUNKNOWN as String
72 Public sCurrSYSUNKNOWN as String
74 Public sPrgsRETRIEVAL as String
75 Public sPrgsCONVERTING as String
76 Public sPrgsUNPROTECT as String
77 Public sInclusiveSubDir as String
79 Public Const SBCOUNTRYCOUNT =
12
80 Public CurMimeType as String
81 Public CurCellCount as Long
82 Public oSheets as Object
83 Public oStyles as Object
84 Public oStyle as Object
85 Public oFormats as Object
86 Public aSimpleStr as String
87 Public nSimpleKey as Long
88 Public aFormat() as Variant
89 Public oRanges as Object
90 Public oRange as Object
91 Public nLanguage as integer
92 Public nFormatLanguage as integer
93 Public aCellFormat as Variant
94 Public oDocument as Object
95 Public StartCol, StartRow, EndCol, EndRow as String
96 Public oSheet as Object
97 Public IntStartCol, IntStartRow, IntEndCol, IntEndRow as integer
98 Public oSelRanges as Object
99 Public nFormatType as Integer
100 Public sFormatCurrency as String
101 Public sFormatLanguage as String
102 Public CurSheetName as String
103 Public oStatusLine as Object
104 Public Const SBRELGET =
50
105 Public StatusValue as Single
106 Public TotCellCount as Long
107 Public StyleIndex as Integer
108 Public RangeIndex as Integer
109 Public CurrIndex as Integer
110 Public ActLangNumber(
1) as Integer
111 Public CurExtension(
2) as String
112 Public Currfactor as Double
113 Public CurrSymbolList(
2) as String
114 Public CurrLanguage as String
115 Public CurrValue(
12,
5)
116 Public LangIDValue(
12,
2,
2) as String
117 Public PreName as String
118 Public Separator as String
119 Public BitmapDir as String
120 Public TypeIndex as Integer, CSIndex as Integer, LangIndex as Integer, FSIndex as Integer
121 Public oLocale as New com.sun.star.lang.Locale
122 Public sEuroSign as String
123 Public oPointer as Object
124 Public sDocType as String
125 Public bPreSelected as Boolean
126 Public bRecursive as Boolean
127 Public bCancelProtection as Boolean
128 Public CurrRoundMode as Boolean
129 Public bRangeListDefined as Boolean
130 Public bDocHasProtectedSheets as Boolean
131 Public sGOON as String
132 Public sHELP as String
133 Public sCANCEL as String
136 Sub InitializeResources()
137 Dim LocWorkPath as String
139 ' Strings that are also needed by the Password Dialog
140 sGoOn = GetResText(
1003)
141 sHelp = GetResText(
1001)
142 sCANCEL = GetResText(
1418)
143 sEnd = GetResText(
1000)
144 sPROTECT = GetResText(
1005)
145 sCONTINUE = GetResText(
1007)
146 sSELTEMPL = GetResText(
1106)
147 sSELCELL = GetResText(
1107)
148 sCURRRANGES = GetResText(
1108)
149 sTEMPLATES = GetResText(
1109)
150 sStsPROGRESS = GetResText(
1300)
151 sStsCELLPROGRSS = GetResText(
1301)
152 sStsRELSHEETRANGES = GetResText(
1302)
153 sStsRELRANGES = GetResText(
1303)
154 sStsREPROTECT = GetResText(
1304)
155 sREADY = GetResText(
1400)
156 sMsgSELDIR = GetResText(
1401)
157 sMsgSELFILE = GetResText(
1402)
158 sMsgTARGETDIR = GetResText(
1403)
159 sMsgNOTTHERE = GetResText(
1404)
160 sMsgDLGTITLE = GetResText(
1405)
161 sMsgUNPROTECT = GetResText(
1406)
162 sMsgPWPROTECT = GetResText(
1407)
163 sMsgWRONGPW = GetResText(
1408)
164 sMsgSHEETPROTECTED = GetResText(
1409)
165 sMsgWARNING = GetResText(
1410)
166 sMsgSHEETSNOPROTECT = GetResText(
1411)
167 sMsgSHEETNOPROTECT = GetResText(
1412)
168 sMsgCHOOSECURRENCY = GetResText(
1415)
169 sMsgPASSWORD = GetResText(
1416)
170 sMsgOK = GetResText(
1417)
171 sMsgCANCEL = GetResText(
1418)
172 sMsgFILEINVALID = GetResText(
1419)
173 sMsgFILEINVALID = ReplaceString(sMsgFILEINVALID,
"%PRODUCTNAME
", GetProductname())
174 SMsgNODIRECTORY = GetResText(
1420)
175 sMsgDOCISREADONLY = GetResText(
1421)
176 sMsgFileExists = GetResText(
1422)
177 sMsgCancelConversion = GetResText(
1423)
178 sMsgCancelTitle = GetResText(
1424)
179 sCurrPORTUGUESE = GetResText(
1500)
180 sCurrDUTCH = GetResText(
1501)
181 sCurrFRENCH = GetResText(
1502)
182 sCurrSPANISH = GetResText(
1503)
183 sCurrITALIAN = GetResText(
1504)
184 sCurrGERMAN = GetResText(
1505)
185 sCurrBELGIAN = GetResText(
1506)
186 sCurrIRISH = GetResText(
1507)
187 sCurrLUXEMBOURG = GetResText(
1508)
188 sCurrAUSTRIAN = GetResText(
1509)
189 sCurrFINNISH = GetResText(
1510)
190 sCurrGREEK = GetResText(
1511)
191 sCurrSLOVENIAN = GetResText(
1512)
192 sCurrUNKNOWN = GetResText(
1513)
193 sCurrSYSUNKNOWN = GetResText(
1514)
194 .cmdCancel.Label = sCANCEL
195 .cmdHelp.Label = sHELP
196 .cmdBack.Label = GetResText(
1002)
197 .cmdGoOn.Label = sGOON
198 .lblHint.Label = GetResText(
1004)
199 .lblCurrencies.Label = GetResText(
1006)
200 .cmdBack.Enabled = False
202 .chkComplete.Label = GetResText(
1100)
203 .hlnSelection.Label = GetResText(
1101)
204 .optCellTemplates.Label = GetResText(
1102)
205 .optSheetRanges.Label = GetResText(
1103)
206 .optDocRanges.Label = GetResText(
1104)
207 .optSelRange.Label = GetResText(
1105)
208 sCURRRANGES = GetResText(
1108)
209 .lblSelection.Label = sCURRRANGES
211 .lblProgress.Label = sStsPROGRESS
212 .hlnExtent.Label = GetResText(
1200)
213 .optSingleFile.Label = GetResText(
1201)
214 .optWholeDir.Label = GetResText(
1202)
215 .chkProtect.Label = GetResText(
1207)
216 .chkTextDocuments.Label = GetResText(
1210)
218 sSOURCEFILE = GetResText(
1203)
219 sSOURCEDIR = GetResText(
1204)
220 .lblSource.Label = sSOURCEDIR
221 sInclusiveSubDir = GetResText(
1205)
222 .chkRecursive.Label = sInclusiveSubDir
223 sTARGETDIR = GetResText(
1206)
224 .lblTarget.Label = STARGETDIR
226 LocWorkPath = GetPathSettings(
"Work
")
227 If Not oUcb.Exists(LocWorkPath) Then
228 ShowNoOfficePathError()
232 .txtSource.Text = ConvertfromUrl(LocWorkPath)
234 SubstDir = .txtSource.Text
235 .txtTarget.Text = .txtSource.Text
236 .hlnProgress.Label = GetResText(
1600)
237 .lblConfig.Label = GetResText(
1603)
238 sPrgsRETRIEVAL = GetResText(
1601)
239 sPrgsCONVERTING = GetResText(
1602)
240 sPrgsUNPROTECT = GetResText(
1604)
245 Sub InitializeLanguages()
246 sEuroSign = chr(
8364)
248 ' CURRENCIES_PORTUGUESE
249 LangIDValue(
0,
0,
0) =
"pt
"
250 LangIDValue(
0,
0,
1) =
""
251 LangIDValue(
0,
0,
2) =
"-
816"
253 ' CURRENCIES_DUTCH
254 LangIDValue(
1,
0,
0) =
"nl
"
255 LangIDValue(
1,
0,
1) =
""
256 LangIDValue(
1,
0,
2) =
"-
413"
258 ' CURRENCIES_FRENCH
259 LangIDValue(
2,
0,
0) =
"fr
"
260 LangIDValue(
2,
0,
1) =
""
261 LangIDValue(
2,
0,
2) =
"-
40C
"
263 ' CURRENCIES_SPANISH
264 LangIDValue(
3,
0,
0) =
"es
"
265 LangIDValue(
3,
0,
1) =
""
266 LangIDValue(
3,
0,
2) =
"-
40A
"
269 LangIDValue(
3,
1,
0) =
"es
"
270 LangIDValue(
3,
1,
1) =
""
271 LangIDValue(
3,
1,
2) =
"-C0A
"
273 'Spanish katalanic
274 LangIDValue(
3,
2,
0) =
"es
"
275 LangIDValue(
3,
2,
1) =
""
276 LangIDValue(
3,
2,
2) =
"-
403"
278 ' CURRENCIES_ITALIAN
279 LangIDValue(
4,
0,
0) =
"it
"
280 LangIDValue(
4,
0,
1) =
""
281 LangIDValue(
4,
0,
2) =
"-
410"
283 ' CURRENCIES_GERMAN
284 LangIDValue(
5,
0,
0) =
"de
"
285 LangIDValue(
5,
0,
1) =
"DE
"
286 LangIDValue(
5,
0,
2) =
"-
407"
288 ' CURRENCIES_BELGIAN
289 LangIDValue(
6,
0,
0) =
"fr
"
290 LangIDValue(
6,
0,
1) =
"BE
"
291 LangIDValue(
6,
0,
2) =
"-
80C
"
293 LangIDValue(
6,
1,
0) =
"nl
"
294 LangIDValue(
6,
1,
1) =
"BE
"
295 LangIDValue(
6,
1,
2) =
"-
813"
297 ' CURRENCIES_IRISH
298 LangIDValue(
7,
0,
0) =
"en
"
299 LangIDValue(
7,
0,
1) =
"IE
"
300 LangIDValue(
7,
0,
2) =
"-
1809"
302 ' CURRENCIES_LUXEMBOURG
303 LangIDValue(
8,
0,
0) =
"fr
"
304 LangIDValue(
8,
0,
1) =
"LU
"
305 LangIDValue(
8,
0,
2) =
"-
140C
"
307 LangIDValue(
8,
1,
0) =
"de
"
308 LangIDValue(
8,
1,
1) =
"LU
"
309 LangIDValue(
8,
1,
2) =
"-
1007"
311 ' CURRENCIES_AUSTRIAN
312 LangIDValue(
9,
0,
0) =
"de
"
313 LangIDValue(
9,
0,
1) =
"AT
"
314 LangIDValue(
9,
0,
2) =
"-C07
"
316 ' CURRENCIES_FINNISH
317 LangIDValue(
10,
0,
0) =
"fi
"
318 LangIDValue(
10,
0,
1) =
"FI
"
319 LangIDValue(
10,
0,
2) =
"-
40B
"
321 LangIDValue(
10,
1,
0) =
"sv
"
322 LangIDValue(
10,
1,
1) =
"FI
"
323 LangIDValue(
10,
1,
2) =
"-
81D
"
325 ' CURRENCIES_GREEK
326 LangIDValue(
11,
0,
0) =
"el
"
327 LangIDValue(
11,
0,
1) =
"GR
"
328 LangIDValue(
11,
0,
2) =
"-
408"
330 ' CURRENCIES_SLOVENIAN
331 LangIDValue(
12,
0,
0) =
"sl
"
332 LangIDValue(
12,
0,
1) =
"SI
"
333 LangIDValue(
12,
0,
2) =
"-
408"
338 Sub InitializeCurrencies()
342 CurrValue(
0,
0) = sCurrPORTUGUESE
343 ' real conversion rate
344 CurrValue(
0,
1) =
200.482
345 ' rounded conversion rate
347 CurrValue(
0,
3) =
"Esc.
"
348 CurrValue(
0,
4) =
"Esc.
"
349 CurrValue(
0,
5) =
"PTE
"
351 CurrValue(
1,
0) = sCurrDUTCH
352 ' real conversion rate
353 CurrValue(
1,
1) =
2.20371
354 ' rounded conversion rate
356 CurrValue(
1,
3) =
"F
"
357 CurrValue(
1,
4) =
"fl
"
358 CurrValue(
1,
5) =
"NLG
"
360 CurrValue(
2,
0) = sCurrFRENCH
361 ' real conversion rate
362 CurrValue(
2,
1) =
6.55957
363 ' rounded conversion rate
365 CurrValue(
2,
3) =
"F
"
366 CurrValue(
2,
4) =
"F
"
367 CurrValue(
2,
5) =
"FRF
"
369 CurrValue(
3,
0) = sCurrSPANISH
370 ' real conversion rate
371 CurrValue(
3,
1) =
166.386
372 ' rounded conversion rate
374 CurrValue(
3,
3) =
"Pts
"
375 CurrValue(
3,
4) =
"Pts
"
376 CurrValue(
3,
5) =
"ESP
"
378 CurrValue(
4,
0) = sCurrITALIAN
379 ' real conversion rate
380 CurrValue(
4,
1) =
1936.27
381 ' rounded conversion rate
382 CurrValue(
4,
2) =
2000
383 CurrValue(
4,
3) =
"L.
"
384 CurrValue(
4,
4) =
"L.
"
385 CurrValue(
4,
5) =
"ITL
"
387 CurrValue(
5,
0) = sCurrGERMAN
388 ' real conversion rate
389 CurrValue(
5,
1) =
1.95583
390 ' rounded conversion rate
392 CurrValue(
5,
3) =
"DM
"
393 CurrValue(
5,
4) =
"DM
"
394 CurrValue(
5,
5) =
"DEM
"
396 CurrValue(
6,
0) = sCurrBELGIAN
397 ' real conversion rate
398 CurrValue(
6,
1) =
40.3399
399 ' rounded conversion rate
401 CurrValue(
6,
3) =
"FB
"
402 CurrValue(
6,
4) =
"BF
"
403 CurrValue(
6,
5) =
"BEF
"
405 CurrValue(
7,
0) = sCurrIRISH
406 ' real conversion rate
407 CurrValue(
7,
1) =
0.787564
408 ' rounded conversion rate
410 CurrValue(
7,
3) =
"IR£
"
411 CurrValue(
7,
4) =
"£
"
412 CurrValue(
7,
5) =
"IEP
"
414 CurrValue(
8,
0) = sCurrLUXEMBOURG
415 ' real conversion rate
416 CurrValue(
8,
1) =
40.3399
417 ' rounded conversion rate
419 CurrValue(
8,
3) =
"F
"
420 CurrValue(
8,
4) =
"F
"
421 CurrValue(
8,
5) =
"LUF
"
423 CurrValue(
9,
0) = sCurrAUSTRIAN
424 ' real conversion rate
425 CurrValue(
9,
1) =
13.7603
426 ' rounded conversion rate
428 CurrValue(
9,
3) =
"öS
"
429 CurrValue(
9,
4) =
"S
"
430 CurrValue(
9,
5) =
"ATS
"
432 CurrValue(
10,
0) = sCurrFINNISH
433 ' real conversion rate
434 CurrValue(
10,
1) =
5.94573
435 ' rounded conversion rate
437 CurrValue(
10,
3) =
"mk
"
438 CurrValue(
10,
4) =
"mk
"
439 CurrValue(
10,
5) =
"FIM
"
441 CurrValue(
11,
0) = sCurrGREEK
442 ' real conversion rate
443 CurrValue(
11,
1) =
340.750
444 ' rounded conversion rate
445 CurrValue(
11,
2) =
400
446 CurrValue(
11,
3) = chr(
916)
& chr(
961)
& chr(
967)
447 CurrValue(
11,
4) = chr(
916)
& chr(
961)
& chr(
967)
448 CurrValue(
11,
5) =
"GRD
"
450 CurrValue(
12,
0) = sCurrSLOVENIAN
451 ' real conversion rate
452 CurrValue(
12,
1) =
239.64
453 ' rounded conversion rate
454 CurrValue(
12,
2) =
240
455 CurrValue(
12,
3) =
"SIT
"
456 CurrValue(
12,
4) =
"SIT
"
457 CurrValue(
12,
5) =
"SIT
"
460 CurrSymbolList(
0) =
""
461 CurrSymbolList(
1) =
""
462 InitializeCurrencyValues(CurrIndex)
466 Sub InitializeControls()
467 If CurrIndex = -
1 Then
468 If DialogModel.Step =
1 Then
469 EnableStep1DialogControls(True, False, False)
470 ElseIf DialogModel.Step =
2 Then
471 EnableStep2DialogControls(True)
477 Sub InitializeConverter(oLocale, iDialogPage as Integer)
478 Dim Isthere as Boolean
479 bCancelProtection = False
480 bRangeListDefined = False
482 If iDialogPage =
1 Then
484 sDocType = Tools.GetDocumentType(ThisComponent)
485 If sDocType =
"sCalc
" Then
486 bDocHasProtectedSheets = CheckSheetProtection(oSheets)
488 oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator()
490 DialogConvert = LoadDialog(
"Euro
",
"DlgConvert
")
491 DialogModel = DialogConvert.Model
492 DialogPassword = LoadDialog(
"Euro
",
"DlgPassword
")
493 PasswordModel = DialogPassword.Model
494 DialogModel.Step = iDialogPage
495 InitializeResources()
496 InitializeLanguages()
497 InitializeLocales(oLocale)
498 InitializeCurrencies()
500 BitmapDir = GetOfficeSubPath(
"Template
",
"wizard/bitmap
")
501 If BitmapDir =
"" Then
504 FillUpCurrencyListbox()
505 DialogModel.imgPreview.ImageUrl = BitmapDir
& "euro_
" & DialogModel.Step
& ".bmp
"
506 DialogConvert.Title = sMsgDLGTITLE
507 DialogModel.cmdGoOn.DefaultButton = True
508 If iDialogPage =
1 Then
514 Sub InitializeCurrencyValues(CurrIndex)
515 If CurrIndex
<> -
1 Then
516 CurrLanguage = CurrValue(CurrIndex,
0)
517 CurrFactor = CurrValue(CurrIndex,
1)
518 CurrSymbolList(
0) = CurrValue(CurrIndex,
3)
519 CurrSymbolList(
1) = CurrValue(CurrIndex,
4)
520 CurrSymbolList(
2) = CurrValue(CurrIndex,
5)
525 Function InitializeLocales(oLocale) as Boolean
526 Dim i as Integer, n as Integer, m as Integer
527 Dim sLanguage as String, sCountry as String
528 Dim bTakeThisLocale as Boolean
529 sLanguage = oLocale.Language
530 sCountry = oLocale.Country
531 For n =
0 To SBCOUNTRYCOUNT -
1
533 If DialogModel.Step =
2 Then
534 bTakeThisLocale = LangIDValue(n,m,
0) = sLanguage
536 bTakeThisLocale = LangIDValue(n,m,
0) = sLanguage
538 If bTakeThisLocale Then
541 CurExtension(i) = LangIDValue(CurrIndex,i,
2)
543 InitializeLocales = True
549 InitializeLocales = False