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 4REM ***** BASIC ***** 5 6 7 8Public Const SBRANGEUBOUND = 20 9Public StyleRangeAssignmentList(SBRANGEUBOUND)as String 10Public SelRangeList(SBRANGEUBOUND) as String 11Public RangeList(SBRANGEUBOUND) as String 12Public UnprotectList() as String 13Public FilterNames(2,1) as String 14Public bDoUnProtect as Boolean 15Public bCancelTask as Boolean 16 17Public sREADY as String 18Public sPROTECT as String 19Public sCONTINUE as String 20 21Public sSELTEMPL as String 22Public sSELCELL as String 23Public sCURRRANGES as String 24Public sTEMPLATES as String 25 26Public sSOURCEFILE as String 27Public sSOURCEDIR as String 28Public sTARGETDIR as String 29 30Public sStsPROGRESS as String 31Public sStsCELLPROGRSS as String 32Public sStsRELRANGES as String 33Public sStsRELSHEETRANGES as String 34Public sStsREPROTECT as String 35 36Public sMsgSELDIR as String 37Public sMsgSELFILE as String 38Public sMsgTARGETDIR as String 39Public sMsgNOTTHERE as String 40Public sMsgDLGTITLE as String 41Public sMsgUNPROTECT as String 42Public sMsgPWPROTECT as String 43Public sMsgWRONGPW as String 44Public sMsgSHEETPROTECTED as String 45Public sMsgWARNING as String 46Public sMsgSHEETSNOPROTECT as String 47Public sMsgSHEETNOPROTECT as String 48Public sMsgCHOOSECURRENCY as String 49Public sMsgPASSWORD as String 50Public sMsgOK as String 51Public sMsgCANCEL as String 52Public sMsgFileInvalid as String 53Public sMsgNODIRECTORY as String 54Public sMsgDOCISREADONLY as String 55Public sMsgFileExists as String 56Public sMsgCancelConversion as String 57Public sMsgCancelTitle as String 58Public sCurrPORTUGUESE as String 59Public sCurrDUTCH as String 60Public sCurrFRENCH as String 61Public sCurrSPANISH as String 62Public sCurrITALIAN as String 63Public sCurrGERMAN as String 64Public sCurrBELGIAN as String 65Public sCurrIRISH as String 66Public sCurrLUXEMBOURG as String 67Public sCurrAUSTRIAN as String 68Public sCurrFINNISH as String 69Public sCurrGREEK as String 70Public sCurrSLOVENIAN as String 71Public sCurrCYPRIOT as String 72Public sCurrMALTESE as String 73Public sCurrSLOVAK as String 74Public sCurrUNKNOWN as String 75Public sCurrSYSUNKNOWN as String 76 77Public sPrgsRETRIEVAL as String 78Public sPrgsCONVERTING as String 79Public sPrgsUNPROTECT as String 80Public sInclusiveSubDir as String 81 82Public Const SBCOUNTRYCOUNT = 15 83Public CurMimeType as String 84Public CurCellCount as Long 85Public oSheets as Object 86Public oStyles as Object 87Public oStyle as Object 88Public oFormats as Object 89Public aSimpleStr as String 90Public nSimpleKey as Long 91Public aFormat() as Variant 92Public oRanges as Object 93Public oRange as Object 94Public nLanguage as integer 95Public nFormatLanguage as integer 96Public aCellFormat as Variant 97Public oDocument as Object 98Public StartCol, StartRow, EndCol, EndRow as String 99Public oSheet as Object 100Public IntStartCol, IntStartRow, IntEndCol, IntEndRow as integer 101Public oSelRanges as Object 102Public nFormatType as Integer 103Public sFormatCurrency as String 104Public sFormatLanguage as String 105Public CurSheetName as String 106Public oStatusLine as Object 107Public Const SBRELGET = 50 108Public StatusValue as Single 109Public TotCellCount as Long 110Public StyleIndex as Integer 111Public RangeIndex as Integer 112Public CurrIndex as Integer 113Public ActLangNumber(1) as Integer 114Public CurExtension(2) as String 115Public Currfactor as Double 116Public CurrSymbolList(2) as String 117Public CurrLanguage as String 118Public CurrValue(15,5) 119Public LangIDValue(15,2,2) as String 120Public PreName as String 121Public Separator as String 122Public BitmapDir as String 123Public TypeIndex as Integer, CSIndex as Integer, LangIndex as Integer, FSIndex as Integer 124Public oLocale as New com.sun.star.lang.Locale 125Public sEuroSign as String 126Public oPointer as Object 127Public sDocType as String 128Public bPreSelected as Boolean 129Public bRecursive as Boolean 130Public bCancelProtection as Boolean 131Public CurrRoundMode as Boolean 132Public bRangeListDefined as Boolean 133Public bDocHasProtectedSheets as Boolean 134Public sGOON as String 135Public sHELP as String 136Public sCANCEL as String 137Dim sEnd as String 138 139Sub InitializeResources() 140Dim LocWorkPath as String 141 With DialogModel 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 207 If .Step = 1 Then 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 216 Else 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) 223 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 231 232 LocWorkPath = GetPathSettings("Work") 233 If Not oUcb.Exists(LocWorkPath) Then 234 ShowNoOfficePathError() 235 Stop 236 End If 237 238 .txtSource.Text = ConvertfromUrl(LocWorkPath) 239 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) 247 End If 248 End With 249End Sub 250 251Sub InitializeLanguages() 252 sEuroSign = chr(8364) 253 254' CURRENCIES_PORTUGUESE 255 LangIDValue(0,0,0) = "pt" 256 LangIDValue(0,0,1) = "" 257 LangIDValue(0,0,2) = "-816" 258 259' CURRENCIES_DUTCH 260 LangIDValue(1,0,0) = "nl" 261 LangIDValue(1,0,1) = "" 262 LangIDValue(1,0,2) = "-413" 263 264' CURRENCIES_FRENCH 265 LangIDValue(2,0,0) = "fr" 266 LangIDValue(2,0,1) = "" 267 LangIDValue(2,0,2) = "-40C" 268 269' CURRENCIES_SPANISH 270 LangIDValue(3,0,0) = "es" 271 LangIDValue(3,0,1) = "" 272 LangIDValue(3,0,2) = "-40A" 273 274 'Spanish modern 275 LangIDValue(3,1,0) = "es" 276 LangIDValue(3,1,1) = "" 277 LangIDValue(3,1,2) = "-C0A" 278 279 'Spanish katalanic 280 LangIDValue(3,2,0) = "es" 281 LangIDValue(3,2,1) = "" 282 LangIDValue(3,2,2) = "-403" 283 284' CURRENCIES_ITALIAN 285 LangIDValue(4,0,0) = "it" 286 LangIDValue(4,0,1) = "" 287 LangIDValue(4,0,2) = "-410" 288 289' CURRENCIES_GERMAN 290 LangIDValue(5,0,0) = "de" 291 LangIDValue(5,0,1) = "DE" 292 LangIDValue(5,0,2) = "-407" 293 294' CURRENCIES_BELGIAN 295 LangIDValue(6,0,0) = "fr" 296 LangIDValue(6,0,1) = "BE" 297 LangIDValue(6,0,2) = "-80C" 298 299 LangIDValue(6,1,0) = "nl" 300 LangIDValue(6,1,1) = "BE" 301 LangIDValue(6,1,2) = "-813" 302 303' CURRENCIES_IRISH 304 LangIDValue(7,0,0) = "en" 305 LangIDValue(7,0,1) = "IE" 306 LangIDValue(7,0,2) = "-1809" 307 308 LangIDValue(7,1,0) = "ga" 309 LangIDValue(7,1,1) = "IE" 310 LangIDValue(7,1,2) = "-83C" 311 312' CURRENCIES_LUXEMBOURG 313 LangIDValue(8,0,0) = "fr" 314 LangIDValue(8,0,1) = "LU" 315 LangIDValue(8,0,2) = "-140C" 316 317 LangIDValue(8,1,0) = "de" 318 LangIDValue(8,1,1) = "LU" 319 LangIDValue(8,1,2) = "-1007" 320 321' CURRENCIES_AUSTRIAN 322 LangIDValue(9,0,0) = "de" 323 LangIDValue(9,0,1) = "AT" 324 LangIDValue(9,0,2) = "-C07" 325 326' CURRENCIES_FINNISH 327 LangIDValue(10,0,0) = "fi" 328 LangIDValue(10,0,1) = "FI" 329 LangIDValue(10,0,2) = "-40B" 330 331 LangIDValue(10,1,0) = "sv" 332 LangIDValue(10,1,1) = "FI" 333 LangIDValue(10,1,2) = "-81D" 334 335' CURRENCIES_GREEK 336 LangIDValue(11,0,0) = "el" 337 LangIDValue(11,0,1) = "GR" 338 LangIDValue(11,0,2) = "-408" 339 340' CURRENCIES_SLOVENIAN 341 LangIDValue(12,0,0) = "sl" 342 LangIDValue(12,0,1) = "SI" 343 LangIDValue(12,0,2) = "-424" 344 345' CURRENCIES_CYPRIOT 346 LangIDValue(13,0,0) = "el" 347 LangIDValue(13,0,1) = "CY" 348 LangIDValue(13,0,2) = "-408" 349 350' CURRENCIES_MALTESE 351 LangIDValue(14,0,0) = "mt" 352 LangIDValue(14,0,1) = "MT" 353 LangIDValue(14,0,2) = "-43A" 354 355' CURRENCIES_SLOVAK 356 LangIDValue(15,0,0) = "sk" 357 LangIDValue(15,0,1) = "SK" 358 LangIDValue(15,0,2) = "-41B" 359 360End Sub 361 362 363 364Sub InitializeCurrencies() 365Dim i as Integer 366 GoOn = True 367 368 CurrValue(0,0) = sCurrPORTUGUESE 369 ' real conversion rate 370 CurrValue(0,1) = 200.482 371 ' rounded conversion rate 372 CurrValue(0,2) = 200 373 CurrValue(0,3) = "Esc." 374 CurrValue(0,4) = "Esc." 375 CurrValue(0,5) = "PTE" 376 377 CurrValue(1,0) = sCurrDUTCH 378 ' real conversion rate 379 CurrValue(1,1) = 2.20371 380 ' rounded conversion rate 381 CurrValue(1,2) = 2 382 CurrValue(1,3) = "F" 383 CurrValue(1,4) = "fl" 384 CurrValue(1,5) = "NLG" 385 386 CurrValue(2,0) = sCurrFRENCH 387 ' real conversion rate 388 CurrValue(2,1) = 6.55957 389 ' rounded conversion rate 390 CurrValue(2,2) = 7 391 CurrValue(2,3) = "F" 392 CurrValue(2,4) = "F" 393 CurrValue(2,5) = "FRF" 394 395 CurrValue(3,0) = sCurrSPANISH 396 ' real conversion rate 397 CurrValue(3,1) = 166.386 398 ' rounded conversion rate 399 CurrValue(3,2) = 170 400 CurrValue(3,3) = "Pts" 401 CurrValue(3,4) = "Pts" 402 CurrValue(3,5) = "ESP" 403 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" 412 413 CurrValue(5,0) = sCurrGERMAN 414 ' real conversion rate 415 CurrValue(5,1) = 1.95583 416 ' rounded conversion rate 417 CurrValue(5,2) = 2 418 CurrValue(5,3) = "DM" 419 CurrValue(5,4) = "DM" 420 CurrValue(5,5) = "DEM" 421 422 CurrValue(6,0) = sCurrBELGIAN 423 ' real conversion rate 424 CurrValue(6,1) = 40.3399 425 ' rounded conversion rate 426 CurrValue(6,2) = 40 427 CurrValue(6,3) = "FB" 428 CurrValue(6,4) = "BF" 429 CurrValue(6,5) = "BEF" 430 431 CurrValue(7,0) = sCurrIRISH 432 ' real conversion rate 433 CurrValue(7,1) = 0.787564 434 ' rounded conversion rate 435 CurrValue(7,2) = 0.8 436 CurrValue(7,3) = "IR£" 437 CurrValue(7,4) = "£" 438 CurrValue(7,5) = "IEP" 439 440 CurrValue(8,0) = sCurrLUXEMBOURG 441 ' real conversion rate 442 CurrValue(8,1) = 40.3399 443 ' rounded conversion rate 444 CurrValue(8,2) = 40 445 CurrValue(8,3) = "F" 446 CurrValue(8,4) = "F" 447 CurrValue(8,5) = "LUF" 448 449 CurrValue(9,0) = sCurrAUSTRIAN 450 ' real conversion rate 451 CurrValue(9,1) = 13.7603 452 ' rounded conversion rate 453 CurrValue(9,2) = 15 454 CurrValue(9,3) = "öS" 455 CurrValue(9,4) = "S" 456 CurrValue(9,5) = "ATS" 457 458 CurrValue(10,0) = sCurrFINNISH 459 ' real conversion rate 460 CurrValue(10,1) = 5.94573 461 ' rounded conversion rate 462 CurrValue(10,2) = 6 463 CurrValue(10,3) = "mk" 464 CurrValue(10,4) = "mk" 465 CurrValue(10,5) = "FIM" 466 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" 475 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" 484 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" 493 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" 502 503 CurrValue(15,0) = sCurrSLOVAK 504 ' real conversion rate 505 CurrValue(15,1) = 30.1260 506 ' rounded conversion rate 507 CurrValue(15,2) = 30 508 CurrValue(15,3) = "Sk" 509 CurrValue(15,4) = "Sk" 510 CurrValue(15,5) = "SKK" 511 512 i = -1 513 CurrSymbolList(0) = "" 514 CurrSymbolList(1) = "" 515 InitializeCurrencyValues(CurrIndex) 516End Sub 517 518 519Sub 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) 525 End If 526 End If 527End Sub 528 529 530Sub InitializeConverter(oLocale, iDialogPage as Integer) 531Dim Isthere as Boolean 532 bCancelProtection = False 533 bRangeListDefined = False 534 PWIndex = -1 535 If iDialogPage = 1 Then 536 ToggleWindow(False) 537 sDocType = Tools.GetDocumentType(ThisComponent) 538 If sDocType = "sCalc" Then 539 bDocHasProtectedSheets = CheckSheetProtection(oSheets) 540 End If 541 oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator() 542 End If 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() 552 InitializeControls() 553 BitmapDir = GetOfficeSubPath("Template", "../wizard/bitmap") 554 If BitmapDir = "" Then 555 Stop 556 End If 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 562 ToggleWindow(True) 563 End If 564End Sub 565 566 567Sub 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) 574 End If 575End Sub 576 577 578Function InitializeLocales(oLocale) as Boolean 579Dim i as Integer, n as Integer, m as Integer 580Dim sLanguage as String, sCountry as String 581Dim bTakeThisLocale as Boolean 582 sLanguage = oLocale.Language 583 sCountry = oLocale.Country 584 For n = 0 To SBCOUNTRYCOUNT - 1 585 For m = 0 TO 1 586 If DialogModel.Step = 2 Then 587 bTakeThisLocale = LangIDValue(n,m,0) = sLanguage 588 Else 589 bTakeThisLocale = LangIDValue(n,m,0) = sLanguage 590 End If 591 If bTakeThisLocale Then 592 CurrIndex = n 593 For i = 0 To 2 594 CurExtension(i) = LangIDValue(CurrIndex,i,2) 595 Next i 596 InitializeLocales = True 597 Exit Function 598 End If 599 Next m 600 Next n 601 CurrIndex = -1 602 InitializeLocales = False 603End Function 604</script:module> 605