update dev300-m58
[ooovba.git] / wizards / source / euro / Init.xba
blobbaedb650a0f98ae0bf623e562fd588f9a68e5673
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
4 REM ***** BASIC *****
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
134 Dim sEnd as String
136 Sub InitializeResources()
137 Dim LocWorkPath as String
138 With DialogModel
139 &apos; 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,&quot;%PRODUCTNAME&quot;, 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
201 If .Step = 1 Then
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
210 Else
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(&quot;Work&quot;)
227 If Not oUcb.Exists(LocWorkPath) Then
228 ShowNoOfficePathError()
229 Stop
230 End If
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)
241 End If
242 End With
243 End Sub
245 Sub InitializeLanguages()
246 sEuroSign = chr(8364)
248 &apos; CURRENCIES_PORTUGUESE
249 LangIDValue(0,0,0) = &quot;pt&quot;
250 LangIDValue(0,0,1) = &quot;&quot;
251 LangIDValue(0,0,2) = &quot;-816&quot;
253 &apos; CURRENCIES_DUTCH
254 LangIDValue(1,0,0) = &quot;nl&quot;
255 LangIDValue(1,0,1) = &quot;&quot;
256 LangIDValue(1,0,2) = &quot;-413&quot;
258 &apos; CURRENCIES_FRENCH
259 LangIDValue(2,0,0) = &quot;fr&quot;
260 LangIDValue(2,0,1) = &quot;&quot;
261 LangIDValue(2,0,2) = &quot;-40C&quot;
263 &apos; CURRENCIES_SPANISH
264 LangIDValue(3,0,0) = &quot;es&quot;
265 LangIDValue(3,0,1) = &quot;&quot;
266 LangIDValue(3,0,2) = &quot;-40A&quot;
268 &apos;Spanish modern
269 LangIDValue(3,1,0) = &quot;es&quot;
270 LangIDValue(3,1,1) = &quot;&quot;
271 LangIDValue(3,1,2) = &quot;-C0A&quot;
273 &apos;Spanish katalanic
274 LangIDValue(3,2,0) = &quot;es&quot;
275 LangIDValue(3,2,1) = &quot;&quot;
276 LangIDValue(3,2,2) = &quot;-403&quot;
278 &apos; CURRENCIES_ITALIAN
279 LangIDValue(4,0,0) = &quot;it&quot;
280 LangIDValue(4,0,1) = &quot;&quot;
281 LangIDValue(4,0,2) = &quot;-410&quot;
283 &apos; CURRENCIES_GERMAN
284 LangIDValue(5,0,0) = &quot;de&quot;
285 LangIDValue(5,0,1) = &quot;DE&quot;
286 LangIDValue(5,0,2) = &quot;-407&quot;
288 &apos; CURRENCIES_BELGIAN
289 LangIDValue(6,0,0) = &quot;fr&quot;
290 LangIDValue(6,0,1) = &quot;BE&quot;
291 LangIDValue(6,0,2) = &quot;-80C&quot;
293 LangIDValue(6,1,0) = &quot;nl&quot;
294 LangIDValue(6,1,1) = &quot;BE&quot;
295 LangIDValue(6,1,2) = &quot;-813&quot;
297 &apos; CURRENCIES_IRISH
298 LangIDValue(7,0,0) = &quot;en&quot;
299 LangIDValue(7,0,1) = &quot;IE&quot;
300 LangIDValue(7,0,2) = &quot;-1809&quot;
302 &apos; CURRENCIES_LUXEMBOURG
303 LangIDValue(8,0,0) = &quot;fr&quot;
304 LangIDValue(8,0,1) = &quot;LU&quot;
305 LangIDValue(8,0,2) = &quot;-140C&quot;
307 LangIDValue(8,1,0) = &quot;de&quot;
308 LangIDValue(8,1,1) = &quot;LU&quot;
309 LangIDValue(8,1,2) = &quot;-1007&quot;
311 &apos; CURRENCIES_AUSTRIAN
312 LangIDValue(9,0,0) = &quot;de&quot;
313 LangIDValue(9,0,1) = &quot;AT&quot;
314 LangIDValue(9,0,2) = &quot;-C07&quot;
316 &apos; CURRENCIES_FINNISH
317 LangIDValue(10,0,0) = &quot;fi&quot;
318 LangIDValue(10,0,1) = &quot;FI&quot;
319 LangIDValue(10,0,2) = &quot;-40B&quot;
321 LangIDValue(10,1,0) = &quot;sv&quot;
322 LangIDValue(10,1,1) = &quot;FI&quot;
323 LangIDValue(10,1,2) = &quot;-81D&quot;
325 &apos; CURRENCIES_GREEK
326 LangIDValue(11,0,0) = &quot;el&quot;
327 LangIDValue(11,0,1) = &quot;GR&quot;
328 LangIDValue(11,0,2) = &quot;-408&quot;
330 &apos; CURRENCIES_SLOVENIAN
331 LangIDValue(12,0,0) = &quot;sl&quot;
332 LangIDValue(12,0,1) = &quot;SI&quot;
333 LangIDValue(12,0,2) = &quot;-408&quot;
334 End Sub
338 Sub InitializeCurrencies()
339 Dim i as Integer
340 GoOn = True
342 CurrValue(0,0) = sCurrPORTUGUESE
343 &apos; real conversion rate
344 CurrValue(0,1) = 200.482
345 &apos; rounded conversion rate
346 CurrValue(0,2) = 200
347 CurrValue(0,3) = &quot;Esc.&quot;
348 CurrValue(0,4) = &quot;Esc.&quot;
349 CurrValue(0,5) = &quot;PTE&quot;
351 CurrValue(1,0) = sCurrDUTCH
352 &apos; real conversion rate
353 CurrValue(1,1) = 2.20371
354 &apos; rounded conversion rate
355 CurrValue(1,2) = 2
356 CurrValue(1,3) = &quot;F&quot;
357 CurrValue(1,4) = &quot;fl&quot;
358 CurrValue(1,5) = &quot;NLG&quot;
360 CurrValue(2,0) = sCurrFRENCH
361 &apos; real conversion rate
362 CurrValue(2,1) = 6.55957
363 &apos; rounded conversion rate
364 CurrValue(2,2) = 7
365 CurrValue(2,3) = &quot;F&quot;
366 CurrValue(2,4) = &quot;F&quot;
367 CurrValue(2,5) = &quot;FRF&quot;
369 CurrValue(3,0) = sCurrSPANISH
370 &apos; real conversion rate
371 CurrValue(3,1) = 166.386
372 &apos; rounded conversion rate
373 CurrValue(3,2) = 170
374 CurrValue(3,3) = &quot;Pts&quot;
375 CurrValue(3,4) = &quot;Pts&quot;
376 CurrValue(3,5) = &quot;ESP&quot;
378 CurrValue(4,0) = sCurrITALIAN
379 &apos; real conversion rate
380 CurrValue(4,1) = 1936.27
381 &apos; rounded conversion rate
382 CurrValue(4,2) = 2000
383 CurrValue(4,3) = &quot;L.&quot;
384 CurrValue(4,4) = &quot;L.&quot;
385 CurrValue(4,5) = &quot;ITL&quot;
387 CurrValue(5,0) = sCurrGERMAN
388 &apos; real conversion rate
389 CurrValue(5,1) = 1.95583
390 &apos; rounded conversion rate
391 CurrValue(5,2) = 2
392 CurrValue(5,3) = &quot;DM&quot;
393 CurrValue(5,4) = &quot;DM&quot;
394 CurrValue(5,5) = &quot;DEM&quot;
396 CurrValue(6,0) = sCurrBELGIAN
397 &apos; real conversion rate
398 CurrValue(6,1) = 40.3399
399 &apos; rounded conversion rate
400 CurrValue(6,2) = 40
401 CurrValue(6,3) = &quot;FB&quot;
402 CurrValue(6,4) = &quot;BF&quot;
403 CurrValue(6,5) = &quot;BEF&quot;
405 CurrValue(7,0) = sCurrIRISH
406 &apos; real conversion rate
407 CurrValue(7,1) = 0.787564
408 &apos; rounded conversion rate
409 CurrValue(7,2) = 0.8
410 CurrValue(7,3) = &quot;IR£&quot;
411 CurrValue(7,4) = &quot;£&quot;
412 CurrValue(7,5) = &quot;IEP&quot;
414 CurrValue(8,0) = sCurrLUXEMBOURG
415 &apos; real conversion rate
416 CurrValue(8,1) = 40.3399
417 &apos; rounded conversion rate
418 CurrValue(8,2) = 40
419 CurrValue(8,3) = &quot;F&quot;
420 CurrValue(8,4) = &quot;F&quot;
421 CurrValue(8,5) = &quot;LUF&quot;
423 CurrValue(9,0) = sCurrAUSTRIAN
424 &apos; real conversion rate
425 CurrValue(9,1) = 13.7603
426 &apos; rounded conversion rate
427 CurrValue(9,2) = 15
428 CurrValue(9,3) = &quot;öS&quot;
429 CurrValue(9,4) = &quot;S&quot;
430 CurrValue(9,5) = &quot;ATS&quot;
432 CurrValue(10,0) = sCurrFINNISH
433 &apos; real conversion rate
434 CurrValue(10,1) = 5.94573
435 &apos; rounded conversion rate
436 CurrValue(10,2) = 6
437 CurrValue(10,3) = &quot;mk&quot;
438 CurrValue(10,4) = &quot;mk&quot;
439 CurrValue(10,5) = &quot;FIM&quot;
441 CurrValue(11,0) = sCurrGREEK
442 &apos; real conversion rate
443 CurrValue(11,1) = 340.750
444 &apos; rounded conversion rate
445 CurrValue(11,2) = 400
446 CurrValue(11,3) = chr(916) &amp; chr(961) &amp; chr(967)
447 CurrValue(11,4) = chr(916) &amp; chr(961) &amp; chr(967)
448 CurrValue(11,5) = &quot;GRD&quot;
450 CurrValue(12,0) = sCurrSLOVENIAN
451 &apos; real conversion rate
452 CurrValue(12,1) = 239.64
453 &apos; rounded conversion rate
454 CurrValue(12,2) = 240
455 CurrValue(12,3) = &quot;SIT&quot;
456 CurrValue(12,4) = &quot;SIT&quot;
457 CurrValue(12,5) = &quot;SIT&quot;
459 i = -1
460 CurrSymbolList(0) = &quot;&quot;
461 CurrSymbolList(1) = &quot;&quot;
462 InitializeCurrencyValues(CurrIndex)
463 End Sub
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)
472 End If
473 End If
474 End Sub
477 Sub InitializeConverter(oLocale, iDialogPage as Integer)
478 Dim Isthere as Boolean
479 bCancelProtection = False
480 bRangeListDefined = False
481 PWIndex = -1
482 If iDialogPage = 1 Then
483 ToggleWindow(False)
484 sDocType = Tools.GetDocumentType(ThisComponent)
485 If sDocType = &quot;sCalc&quot; Then
486 bDocHasProtectedSheets = CheckSheetProtection(oSheets)
487 End If
488 oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator()
489 End If
490 DialogConvert = LoadDialog(&quot;Euro&quot;, &quot;DlgConvert&quot;)
491 DialogModel = DialogConvert.Model
492 DialogPassword = LoadDialog(&quot;Euro&quot;, &quot;DlgPassword&quot;)
493 PasswordModel = DialogPassword.Model
494 DialogModel.Step = iDialogPage
495 InitializeResources()
496 InitializeLanguages()
497 InitializeLocales(oLocale)
498 InitializeCurrencies()
499 InitializeControls()
500 BitmapDir = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
501 If BitmapDir = &quot;&quot; Then
502 Stop
503 End If
504 FillUpCurrencyListbox()
505 DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
506 DialogConvert.Title = sMsgDLGTITLE
507 DialogModel.cmdGoOn.DefaultButton = True
508 If iDialogPage = 1 Then
509 ToggleWindow(True)
510 End If
511 End Sub
514 Sub InitializeCurrencyValues(CurrIndex)
515 If CurrIndex &lt;&gt; -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)
521 End If
522 End Sub
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
532 For m = 0 TO 1
533 If DialogModel.Step = 2 Then
534 bTakeThisLocale = LangIDValue(n,m,0) = sLanguage
535 Else
536 bTakeThisLocale = LangIDValue(n,m,0) = sLanguage
537 End If
538 If bTakeThisLocale Then
539 CurrIndex = n
540 For i = 0 To 2
541 CurExtension(i) = LangIDValue(CurrIndex,i,2)
542 Next i
543 InitializeLocales = True
544 Exit Function
545 End If
546 Next m
547 Next n
548 CurrIndex = -1
549 InitializeLocales = False
550 End Function
551 </script:module>