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 sCurrCYPRIOT as String
72 Public sCurrMALTESE as String
73 Public sCurrSLOVAK as String
74 Public sCurrUNKNOWN as String
75 Public sCurrSYSUNKNOWN as String
77 Public sPrgsRETRIEVAL as String
78 Public sPrgsCONVERTING as String
79 Public sPrgsUNPROTECT as String
80 Public sInclusiveSubDir as String
82 Public Const SBCOUNTRYCOUNT =
15
83 Public CurMimeType as String
84 Public CurCellCount as Long
85 Public oSheets as Object
86 Public oStyles as Object
87 Public oStyle as Object
88 Public oFormats as Object
89 Public aSimpleStr as String
90 Public nSimpleKey as Long
91 Public aFormat() as Variant
92 Public oRanges as Object
93 Public oRange as Object
94 Public nLanguage as integer
95 Public nFormatLanguage as integer
96 Public aCellFormat as Variant
97 Public oDocument as Object
98 Public StartCol, StartRow, EndCol, EndRow as String
99 Public oSheet as Object
100 Public IntStartCol, IntStartRow, IntEndCol, IntEndRow as integer
101 Public oSelRanges as Object
102 Public nFormatType as Integer
103 Public sFormatCurrency as String
104 Public sFormatLanguage as String
105 Public CurSheetName as String
106 Public oStatusLine as Object
107 Public Const SBRELGET =
50
108 Public StatusValue as Single
109 Public TotCellCount as Long
110 Public StyleIndex as Integer
111 Public RangeIndex as Integer
112 Public CurrIndex as Integer
113 Public ActLangNumber(
1) as Integer
114 Public CurExtension(
2) as String
115 Public Currfactor as Double
116 Public CurrSymbolList(
2) as String
117 Public CurrLanguage as String
118 Public CurrValue(
15,
5)
119 Public LangIDValue(
15,
2,
2) as String
120 Public PreName as String
121 Public Separator as String
122 Public BitmapDir as String
123 Public TypeIndex as Integer, CSIndex as Integer, LangIndex as Integer, FSIndex as Integer
124 Public oLocale as New com.sun.star.lang.Locale
125 Public sEuroSign as String
126 Public oPointer as Object
127 Public sDocType as String
128 Public bPreSelected as Boolean
129 Public bRecursive as Boolean
130 Public bCancelProtection as Boolean
131 Public CurrRoundMode as Boolean
132 Public bRangeListDefined as Boolean
133 Public bDocHasProtectedSheets as Boolean
134 Public sGOON as String
135 Public sHELP as String
136 Public sCANCEL as String
139 Sub InitializeResources()
140 Dim LocWorkPath as String
142 ' Strings that are also needed by the Password Dialog
143 sGoOn = GetResText(
1003)
144 sHelp = GetResText(
1001)
145 sCANCEL = GetResText(
1418)
146 sEnd = GetResText(
1000)
147 sPROTECT = GetResText(
1005)
148 sCONTINUE = GetResText(
1007)
149 sSELTEMPL = GetResText(
1106)
150 sSELCELL = GetResText(
1107)
151 sCURRRANGES = GetResText(
1108)
152 sTEMPLATES = GetResText(
1109)
153 sStsPROGRESS = GetResText(
1300)
154 sStsCELLPROGRSS = GetResText(
1301)
155 sStsRELSHEETRANGES = GetResText(
1302)
156 sStsRELRANGES = GetResText(
1303)
157 sStsREPROTECT = GetResText(
1304)
158 sREADY = GetResText(
1400)
159 sMsgSELDIR = GetResText(
1401)
160 sMsgSELFILE = GetResText(
1402)
161 sMsgTARGETDIR = GetResText(
1403)
162 sMsgNOTTHERE = GetResText(
1404)
163 sMsgDLGTITLE = GetResText(
1405)
164 sMsgUNPROTECT = GetResText(
1406)
165 sMsgPWPROTECT = GetResText(
1407)
166 sMsgWRONGPW = GetResText(
1408)
167 sMsgSHEETPROTECTED = GetResText(
1409)
168 sMsgWARNING = GetResText(
1410)
169 sMsgSHEETSNOPROTECT = GetResText(
1411)
170 sMsgSHEETNOPROTECT = GetResText(
1412)
171 sMsgCHOOSECURRENCY = GetResText(
1415)
172 sMsgPASSWORD = GetResText(
1416)
173 sMsgOK = GetResText(
1417)
174 sMsgCANCEL = GetResText(
1418)
175 sMsgFILEINVALID = GetResText(
1419)
176 sMsgFILEINVALID = ReplaceString(sMsgFILEINVALID,
"%PRODUCTNAME
", GetProductname())
177 SMsgNODIRECTORY = GetResText(
1420)
178 sMsgDOCISREADONLY = GetResText(
1421)
179 sMsgFileExists = GetResText(
1422)
180 sMsgCancelConversion = GetResText(
1423)
181 sMsgCancelTitle = GetResText(
1424)
182 sCurrPORTUGUESE = GetResText(
1500)
183 sCurrDUTCH = GetResText(
1501)
184 sCurrFRENCH = GetResText(
1502)
185 sCurrSPANISH = GetResText(
1503)
186 sCurrITALIAN = GetResText(
1504)
187 sCurrGERMAN = GetResText(
1505)
188 sCurrBELGIAN = GetResText(
1506)
189 sCurrIRISH = GetResText(
1507)
190 sCurrLUXEMBOURG = GetResText(
1508)
191 sCurrAUSTRIAN = GetResText(
1509)
192 sCurrFINNISH = GetResText(
1510)
193 sCurrGREEK = GetResText(
1511)
194 sCurrSLOVENIAN = GetResText(
1512)
195 sCurrCYPRIOT = GetResText(
1513)
196 sCurrMALTESE = GetResText(
1514)
197 sCurrSLOVAK = GetResText(
1515)
198 sCurrUNKNOWN = GetResText(
1516)
199 sCurrSYSUNKNOWN = GetResText(
1517)
200 .cmdCancel.Label = sCANCEL
201 .cmdHelp.Label = sHELP
202 .cmdBack.Label = GetResText(
1002)
203 .cmdGoOn.Label = sGOON
204 .lblHint.Label = GetResText(
1004)
205 .lblCurrencies.Label = GetResText(
1006)
206 .cmdBack.Enabled = False
208 .chkComplete.Label = GetResText(
1100)
209 .hlnSelection.Label = GetResText(
1101)
210 .optCellTemplates.Label = GetResText(
1102)
211 .optSheetRanges.Label = GetResText(
1103)
212 .optDocRanges.Label = GetResText(
1104)
213 .optSelRange.Label = GetResText(
1105)
214 sCURRRANGES = GetResText(
1108)
215 .lblSelection.Label = sCURRRANGES
217 .lblProgress.Label = sStsPROGRESS
218 .hlnExtent.Label = GetResText(
1200)
219 .optSingleFile.Label = GetResText(
1201)
220 .optWholeDir.Label = GetResText(
1202)
221 .chkProtect.Label = GetResText(
1207)
222 .chkTextDocuments.Label = GetResText(
1210)
224 sSOURCEFILE = GetResText(
1203)
225 sSOURCEDIR = GetResText(
1204)
226 .lblSource.Label = sSOURCEDIR
227 sInclusiveSubDir = GetResText(
1205)
228 .chkRecursive.Label = sInclusiveSubDir
229 sTARGETDIR = GetResText(
1206)
230 .lblTarget.Label = STARGETDIR
232 LocWorkPath = GetPathSettings(
"Work
")
233 If Not oUcb.Exists(LocWorkPath) Then
234 ShowNoOfficePathError()
238 .txtSource.Text = ConvertfromUrl(LocWorkPath)
240 SubstDir = .txtSource.Text
241 .txtTarget.Text = .txtSource.Text
242 .hlnProgress.Label = GetResText(
1600)
243 .lblConfig.Label = GetResText(
1603)
244 sPrgsRETRIEVAL = GetResText(
1601)
245 sPrgsCONVERTING = GetResText(
1602)
246 sPrgsUNPROTECT = GetResText(
1604)
251 Sub InitializeLanguages()
252 sEuroSign = chr(
8364)
254 ' CURRENCIES_PORTUGUESE
255 LangIDValue(
0,
0,
0) =
"pt
"
256 LangIDValue(
0,
0,
1) =
""
257 LangIDValue(
0,
0,
2) =
"-
816"
259 ' CURRENCIES_DUTCH
260 LangIDValue(
1,
0,
0) =
"nl
"
261 LangIDValue(
1,
0,
1) =
""
262 LangIDValue(
1,
0,
2) =
"-
413"
264 ' CURRENCIES_FRENCH
265 LangIDValue(
2,
0,
0) =
"fr
"
266 LangIDValue(
2,
0,
1) =
""
267 LangIDValue(
2,
0,
2) =
"-
40C
"
269 ' CURRENCIES_SPANISH
270 LangIDValue(
3,
0,
0) =
"es
"
271 LangIDValue(
3,
0,
1) =
""
272 LangIDValue(
3,
0,
2) =
"-
40A
"
275 LangIDValue(
3,
1,
0) =
"es
"
276 LangIDValue(
3,
1,
1) =
""
277 LangIDValue(
3,
1,
2) =
"-C0A
"
279 'Spanish katalanic
280 LangIDValue(
3,
2,
0) =
"es
"
281 LangIDValue(
3,
2,
1) =
""
282 LangIDValue(
3,
2,
2) =
"-
403"
284 ' CURRENCIES_ITALIAN
285 LangIDValue(
4,
0,
0) =
"it
"
286 LangIDValue(
4,
0,
1) =
""
287 LangIDValue(
4,
0,
2) =
"-
410"
289 ' CURRENCIES_GERMAN
290 LangIDValue(
5,
0,
0) =
"de
"
291 LangIDValue(
5,
0,
1) =
"DE
"
292 LangIDValue(
5,
0,
2) =
"-
407"
294 ' CURRENCIES_BELGIAN
295 LangIDValue(
6,
0,
0) =
"fr
"
296 LangIDValue(
6,
0,
1) =
"BE
"
297 LangIDValue(
6,
0,
2) =
"-
80C
"
299 LangIDValue(
6,
1,
0) =
"nl
"
300 LangIDValue(
6,
1,
1) =
"BE
"
301 LangIDValue(
6,
1,
2) =
"-
813"
303 ' CURRENCIES_IRISH
304 LangIDValue(
7,
0,
0) =
"en
"
305 LangIDValue(
7,
0,
1) =
"IE
"
306 LangIDValue(
7,
0,
2) =
"-
1809"
308 LangIDValue(
7,
1,
0) =
"ga
"
309 LangIDValue(
7,
1,
1) =
"IE
"
310 LangIDValue(
7,
1,
2) =
"-
83C
"
312 ' CURRENCIES_LUXEMBOURG
313 LangIDValue(
8,
0,
0) =
"fr
"
314 LangIDValue(
8,
0,
1) =
"LU
"
315 LangIDValue(
8,
0,
2) =
"-
140C
"
317 LangIDValue(
8,
1,
0) =
"de
"
318 LangIDValue(
8,
1,
1) =
"LU
"
319 LangIDValue(
8,
1,
2) =
"-
1007"
321 ' CURRENCIES_AUSTRIAN
322 LangIDValue(
9,
0,
0) =
"de
"
323 LangIDValue(
9,
0,
1) =
"AT
"
324 LangIDValue(
9,
0,
2) =
"-C07
"
326 ' CURRENCIES_FINNISH
327 LangIDValue(
10,
0,
0) =
"fi
"
328 LangIDValue(
10,
0,
1) =
"FI
"
329 LangIDValue(
10,
0,
2) =
"-
40B
"
331 LangIDValue(
10,
1,
0) =
"sv
"
332 LangIDValue(
10,
1,
1) =
"FI
"
333 LangIDValue(
10,
1,
2) =
"-
81D
"
335 ' CURRENCIES_GREEK
336 LangIDValue(
11,
0,
0) =
"el
"
337 LangIDValue(
11,
0,
1) =
"GR
"
338 LangIDValue(
11,
0,
2) =
"-
408"
340 ' CURRENCIES_SLOVENIAN
341 LangIDValue(
12,
0,
0) =
"sl
"
342 LangIDValue(
12,
0,
1) =
"SI
"
343 LangIDValue(
12,
0,
2) =
"-
424"
345 ' CURRENCIES_CYPRIOT
346 LangIDValue(
13,
0,
0) =
"el
"
347 LangIDValue(
13,
0,
1) =
"CY
"
348 LangIDValue(
13,
0,
2) =
"-
408"
350 ' CURRENCIES_MALTESE
351 LangIDValue(
14,
0,
0) =
"mt
"
352 LangIDValue(
14,
0,
1) =
"MT
"
353 LangIDValue(
14,
0,
2) =
"-
43A
"
355 ' CURRENCIES_SLOVAK
356 LangIDValue(
15,
0,
0) =
"sk
"
357 LangIDValue(
15,
0,
1) =
"SK
"
358 LangIDValue(
15,
0,
2) =
"-
41B
"
364 Sub InitializeCurrencies()
368 CurrValue(
0,
0) = sCurrPORTUGUESE
369 ' real conversion rate
370 CurrValue(
0,
1) =
200.482
371 ' rounded conversion rate
373 CurrValue(
0,
3) =
"Esc.
"
374 CurrValue(
0,
4) =
"Esc.
"
375 CurrValue(
0,
5) =
"PTE
"
377 CurrValue(
1,
0) = sCurrDUTCH
378 ' real conversion rate
379 CurrValue(
1,
1) =
2.20371
380 ' rounded conversion rate
382 CurrValue(
1,
3) =
"F
"
383 CurrValue(
1,
4) =
"fl
"
384 CurrValue(
1,
5) =
"NLG
"
386 CurrValue(
2,
0) = sCurrFRENCH
387 ' real conversion rate
388 CurrValue(
2,
1) =
6.55957
389 ' rounded conversion rate
391 CurrValue(
2,
3) =
"F
"
392 CurrValue(
2,
4) =
"F
"
393 CurrValue(
2,
5) =
"FRF
"
395 CurrValue(
3,
0) = sCurrSPANISH
396 ' real conversion rate
397 CurrValue(
3,
1) =
166.386
398 ' rounded conversion rate
400 CurrValue(
3,
3) =
"Pts
"
401 CurrValue(
3,
4) =
"Pts
"
402 CurrValue(
3,
5) =
"ESP
"
404 CurrValue(
4,
0) = sCurrITALIAN
405 ' real conversion rate
406 CurrValue(
4,
1) =
1936.27
407 ' rounded conversion rate
408 CurrValue(
4,
2) =
2000
409 CurrValue(
4,
3) =
"L.
"
410 CurrValue(
4,
4) =
"L.
"
411 CurrValue(
4,
5) =
"ITL
"
413 CurrValue(
5,
0) = sCurrGERMAN
414 ' real conversion rate
415 CurrValue(
5,
1) =
1.95583
416 ' rounded conversion rate
418 CurrValue(
5,
3) =
"DM
"
419 CurrValue(
5,
4) =
"DM
"
420 CurrValue(
5,
5) =
"DEM
"
422 CurrValue(
6,
0) = sCurrBELGIAN
423 ' real conversion rate
424 CurrValue(
6,
1) =
40.3399
425 ' rounded conversion rate
427 CurrValue(
6,
3) =
"FB
"
428 CurrValue(
6,
4) =
"BF
"
429 CurrValue(
6,
5) =
"BEF
"
431 CurrValue(
7,
0) = sCurrIRISH
432 ' real conversion rate
433 CurrValue(
7,
1) =
0.787564
434 ' rounded conversion rate
436 CurrValue(
7,
3) =
"IR£
"
437 CurrValue(
7,
4) =
"£
"
438 CurrValue(
7,
5) =
"IEP
"
440 CurrValue(
8,
0) = sCurrLUXEMBOURG
441 ' real conversion rate
442 CurrValue(
8,
1) =
40.3399
443 ' rounded conversion rate
445 CurrValue(
8,
3) =
"F
"
446 CurrValue(
8,
4) =
"F
"
447 CurrValue(
8,
5) =
"LUF
"
449 CurrValue(
9,
0) = sCurrAUSTRIAN
450 ' real conversion rate
451 CurrValue(
9,
1) =
13.7603
452 ' rounded conversion rate
454 CurrValue(
9,
3) =
"öS
"
455 CurrValue(
9,
4) =
"S
"
456 CurrValue(
9,
5) =
"ATS
"
458 CurrValue(
10,
0) = sCurrFINNISH
459 ' real conversion rate
460 CurrValue(
10,
1) =
5.94573
461 ' rounded conversion rate
463 CurrValue(
10,
3) =
"mk
"
464 CurrValue(
10,
4) =
"mk
"
465 CurrValue(
10,
5) =
"FIM
"
467 CurrValue(
11,
0) = sCurrGREEK
468 ' real conversion rate
469 CurrValue(
11,
1) =
340.750
470 ' rounded conversion rate
471 CurrValue(
11,
2) =
400
472 CurrValue(
11,
3) = chr(
916)
& chr(
961)
& chr(
967)
473 CurrValue(
11,
4) = chr(
916)
& chr(
961)
& chr(
967)
474 CurrValue(
11,
5) =
"GRD
"
476 CurrValue(
12,
0) = sCurrSLOVENIAN
477 ' real conversion rate
478 CurrValue(
12,
1) =
239.64
479 ' rounded conversion rate
480 CurrValue(
12,
2) =
240
481 CurrValue(
12,
3) =
"SIT
"
482 CurrValue(
12,
4) =
"SIT
"
483 CurrValue(
12,
5) =
"SIT
"
485 CurrValue(
13,
0) = sCurrCYPRIOT
486 ' real conversion rate
487 CurrValue(
13,
1) =
0.585274
488 ' rounded conversion rate
489 CurrValue(
13,
2) =
0.6
490 CurrValue(
13,
3) =
"£C
"
491 CurrValue(
13,
4) =
"£
"
492 CurrValue(
13,
5) =
"CYP
"
494 CurrValue(
14,
0) = sCurrMALTESE
495 ' real conversion rate
496 CurrValue(
14,
1) =
0.429300
497 ' rounded conversion rate
498 CurrValue(
14,
2) =
0.4
499 CurrValue(
14,
3) = chr(
8356)
500 CurrValue(
14,
4) =
"Lm
"
501 CurrValue(
14,
5) =
"MTL
"
503 CurrValue(
15,
0) = sCurrSLOVAK
504 ' real conversion rate
505 CurrValue(
15,
1) =
30.1260
506 ' rounded conversion rate
508 CurrValue(
15,
3) =
"Sk
"
509 CurrValue(
15,
4) =
"Sk
"
510 CurrValue(
15,
5) =
"SKK
"
513 CurrSymbolList(
0) =
""
514 CurrSymbolList(
1) =
""
515 InitializeCurrencyValues(CurrIndex)
519 Sub InitializeControls()
520 If CurrIndex = -
1 Then
521 If DialogModel.Step =
1 Then
522 EnableStep1DialogControls(True, False, False)
523 ElseIf DialogModel.Step =
2 Then
524 EnableStep2DialogControls(True)
530 Sub InitializeConverter(oLocale, iDialogPage as Integer)
531 Dim Isthere as Boolean
532 bCancelProtection = False
533 bRangeListDefined = False
535 If iDialogPage =
1 Then
537 sDocType = Tools.GetDocumentType(ThisComponent)
538 If sDocType =
"sCalc
" Then
539 bDocHasProtectedSheets = CheckSheetProtection(oSheets)
541 oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator()
543 DialogConvert = LoadDialog(
"Euro
",
"DlgConvert
")
544 DialogModel = DialogConvert.Model
545 DialogPassword = LoadDialog(
"Euro
",
"DlgPassword
")
546 PasswordModel = DialogPassword.Model
547 DialogModel.Step = iDialogPage
548 InitializeResources()
549 InitializeLanguages()
550 InitializeLocales(oLocale)
551 InitializeCurrencies()
553 BitmapDir = GetOfficeSubPath(
"Template
",
"wizard/bitmap
")
554 If BitmapDir =
"" Then
557 FillUpCurrencyListbox()
558 DialogModel.imgPreview.ImageUrl = BitmapDir
& "euro_
" & DialogModel.Step
& ".bmp
"
559 DialogConvert.Title = sMsgDLGTITLE
560 DialogModel.cmdGoOn.DefaultButton = True
561 If iDialogPage =
1 Then
567 Sub InitializeCurrencyValues(CurrIndex)
568 If CurrIndex
<> -
1 Then
569 CurrLanguage = CurrValue(CurrIndex,
0)
570 CurrFactor = CurrValue(CurrIndex,
1)
571 CurrSymbolList(
0) = CurrValue(CurrIndex,
3)
572 CurrSymbolList(
1) = CurrValue(CurrIndex,
4)
573 CurrSymbolList(
2) = CurrValue(CurrIndex,
5)
578 Function InitializeLocales(oLocale) as Boolean
579 Dim i as Integer, n as Integer, m as Integer
580 Dim sLanguage as String, sCountry as String
581 Dim bTakeThisLocale as Boolean
582 sLanguage = oLocale.Language
583 sCountry = oLocale.Country
584 For n =
0 To SBCOUNTRYCOUNT -
1
586 If DialogModel.Step =
2 Then
587 bTakeThisLocale = LangIDValue(n,m,
0) = sLanguage
589 bTakeThisLocale = LangIDValue(n,m,
0) = sLanguage
591 If bTakeThisLocale Then
594 CurExtension(i) = LangIDValue(CurrIndex,i,
2)
596 InitializeLocales = True
602 InitializeLocales = False