1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * 22 ***********************************************************--> 23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CommonLang" script:language="StarBasic">REM ***** BASIC ***** 24 25 26' Column A has the index 1 27Public Const SBCOLUMNNAME1 = 3 ' Stock names, sheet 1 28Public Const SBCOLUMNID1 = 4 ' Stock ID, sheet 1 29Public Const SBCOLUMNQUANTITY1 = 5 ' Stock quantity sheet 1 30Public Const SBCOLUMNRATE1 = 7 ' Price for stocks, sheet 1 31Public Const SBCOLUMNNAME2 = 3 ' Stock names, sheet 2 32Public Const SBCOLUMNDATE2 = 4 ' Transaction dates, sheet 2 33Public Const SBCOLUMNQUANTITY2 = 5 ' Transaction quantity, sheet 2 34Public Const SBCOLUMNRATE2 = 6 ' Price for stocks, sheet 2 35Public Const SBCOLUMNPROVPERCENT2 = 7 ' Provision in %, sheet 2 36Public Const SBCOLUMNPROVMIN2 = 8 ' Minimum provision, sheet 2 37Public Const SBCOLUMNPROVFIX2 = 9 ' Fixed provision, sheet 2 38Public Const SBCOLUMNPROCEEDS2 = 12 ' Profit, sheet 2 39Public Const SBCOLUMNQTYSOLD2 = 14 ' Quantity sold, sheet 2 40Public Const SBCOLUMNQTYREST2 = 15 ' Quantity not sold yet, sheet 2 41Public Const SBCOLUMNPRCREST2 = 16 ' Proportional proce for quantity not sold yet, sheet 2 42Public Const SBCOLUMNREALPROC2 = 17 ' Realized proceeds, sheet 2 43Public Const SBCOLUMNDIVIDEND2 = 18 ' Dividend paid, sheet 2 44Public Const SBCOLUMNREALPROFIT2 = 19 ' Realized profit, sheet 2 45Public Const SBROWFIRSTTRANSACT2 = 8 ' First data row, sheet 2 46Public Const SBROWHEADER1 = 6 ' Headline, sheet 1 47Public Const SBMSGOK = 0 48Public Const SBMSGYESNO = 4 49Public Const SBMSGSTOP = 16 50Public Const SBMSGQUESTION = 32 51Public Const SBMSGDEFAULTBTN2 = 256 52Public Const SBHASID = 1 ' 0 = no ID, 1 = stocks have an ID 53Public Const SBDIALOGSELL = 1 ' Step for main dialog 54Public Const SBDIALOGBUY = 2 ' Step for main dialog 55Public Const SBBINARY = 0 56Public TransactMode as Integer 57Public Const LIFO = -1 58Public Const FIFO = 1 59 60Public Const HANDLEDIVIDEND = 1 61Public Const HANDLESPLIT = 2 62 63Global oDocument as Object 64Global oDocFormats() as Object 65Global oController as Object 66Global oFirstSheet as Object 67Global oBankSheet as Object 68Global oMovementSheet as Object 69Global sDocLanguage as String 70Global sDocCountry as String 71Global oSheets as Object 72Global oDocLocale as New com.sun.star.lang.Locale 73Global bEnableMarket as Boolean 74Global bEnableInternet as Boolean 75Global oMarketModel as Object 76Global oInternetModel as Object 77 78Global sCurCurrency$, sCurExtension$, sCurChartSource$, sCurStockIDLabel$, sCurSeparator$ 79 80Public oNumberFormatter as Object 81Public bDebugmode as Boolean 82Global GlobListindex as Integer 83Public blabla() as String 84Public SplitDate as Date 85Public oChartSheet as Object 86Public oBackgroundSheet as Object 87Public Const SBDATECOLUMN = 3 88Public Const SBVALUECOLUMN = 4 89Public Const SBSTARTROW = 25 90Public Const SBCHARTPERIOD = 14 91Public Const SBINTERVAL = "d" 92Public sColumnHeader as String 93Public StartDate as Date 94Public EndDate as Date 95Public iCurRow as Integer 96Public iMaxRow as Integer 97Public iStartDay as Integer 98Public iStartMonth as Integer 99Public iStartYear as Integer 100Public iEndDay as Integer 101Public iEndMonth as Integer 102Public iEndYear as Integer 103Public oStatusLine as Object 104Public Today as Date 105Public sInterval as String 106Public ShortMonths(11,1) 107Public iStep as Integer 108Public sDepotCurrency as String 109Public iValueCol as Integer 110 111Public DlgReference as Object 112Public DlgTransaction as Object 113Public DlgStockRates as Object 114Public DlgStartUp as Object 115Public TransactModel as Object 116Public StockRatesModel as Object 117Public StartUpModel as Object 118Public StockRatesTitle(1 To 3) 119Public TransactTitle(1 To 2) 120Public NullList() 121Public sStartupWelcome$, sStartupChooseMarket$, sStartupHint$ 122 123Public sMarket(7,10) as String 124Public sCountryMarket(7,10) as String 125 126Public cDlgCaption1$, cDlgCaption2$ 127Public sMsgError$, sMsgNoName$, sMsgNoQuantity$, sMsgNoDividend$, sMsgNoExchangeRate$ 128Public sMsgNoValidExchangeDate$, sMsgWrongExchangeDate$, sMsgSellTooMuch$, sMsgConfirm$ 129Public sMsgFreeStock$, sMsgTotalLoss$, sMsgEndDatebeforeNow$, sMsgStartDatebeforeEndDate$ 130 131Public sOk$, sCancel$ 132Public sMsgAuthorization$, sMsgDeleteAll$ 133Public SellMethod$ 134Public cSplit$ 135Global HistoryChartSource as String 136Public DateCellStyle as String 137Public CurrCellStyle as String 138Public sStartDate$, sEndDate$, sHistory$ 139Public sInsertStockname$ 140Public sProductname$, sTitle$ 141Public sInsertStocks$, sStockname$, sNoInternetUpdate$, sMarketplace$, sNoInternetDataAvailable$ 142Public sCheckInternetSettings as String 143 144Sub LoadLanguage() 145 LoadDepotDialogs() 146 Select Case sDocLanguage 147 Case "de" 148 LoadGermanLanguage() 149 Case "en" 150 LoadEnglishLanguage() 151 Case "fr" 152 LoadFrenchLanguage() 153 Case "it" 154 LoadItalianLanguage() 155 Case "es" 156 LoadSpanishLanguage() 157 Case "sv" 158 LoadSwedishLanguage() 159 Case "ja" 160 LoadJapaneseLanguage() 161 Case "ko" 162 LoadKoreanLanguage() 163 Case "zh" 164 If sDocCountry = "CN" Then 165 LoadChineseSimpleLanguage() 166 Else 167 LoadChineseTradLanguage() 168 End If 169 End Select 170 InitializeStartUpModel() 171End Sub 172 173Sub CompleteMarketList() 174Dim EuroIndex as Integer 175Dim LocCountry as String 176Dim LocLanguage as String 177Dim sLangList() as String 178Dim sCountryList() as String 179Dim sExtensionList() as String 180Dim MaxIndex as Integer 181Dim bIsLocale as Boolean 182 183 GlobListIndex = -1 184 For n = 0 To 5 185 LocLanguage = sMarket(n,6) 186 LocCountry = sMarket(n,7) 187 If Instr(1,LocLanguage,";",SBBINARY) = 0 Then 188 bIsLocale = CheckDocLocale(LocLanguage, LocCountry) 189 Else 190 EuroIndex = 0 191 sLangList() = ArrayoutofString(LocLanguage, ";", MaxIndex) 192 sCountryList() = ArrayoutofString(LocCountry, ";", MaxIndex) 193 sExtensionList() = ArrayoutofString(sMarket(n,8), ";", MaxIndex) 194 For m = 0 To MaxIndex 195 bIsLocale = CheckDocLocale(sLangList(m), sCountryList(m)) 196 If bIsLocale Then 197 EuroIndex = m 198 Exit For 199 End If 200 Next m 201 sMarket(n,6) = sLangList(EuroIndex) 202 sMarket(n,7) = sCountryList(EuroIndex) 203 sMarket(n,8) = sExtensionList(EuroIndex) 204 End If 205 If bIsLocale Then 206 GlobListIndex = n 207 Exit For 208 End If 209 Next n 210End Sub 211 212Sub LocalizedCurrencies() 213 If GlobListIndex = -1 Then 214 sCountryMarket(0,0) = "Euro" 215 sCountryMarket(0,1) = chr(8364) 216 sCountryMarket(0,2) = "Paris" 217 sCountryMarket(0,3) = "http://fr.finance.yahoo.com/d/quotes.csv?s=<StockID>.PA&f=s4l1t1c1ghov&e=.csv" 218 sCountryMarket(0,5) = "Code" 219 sCountryMarket(0,6) = "fr" 220 sCountryMarket(0,7) = "FR" 221 sCountryMarket(0,8) = "40C" 222 sCountryMarket(0,9) = "59/9" 223 sCountryMarket(0,10) = "1" 224 225 sCountryMarket(1,0) = "Euro" 226 sCountryMarket(1,1) = chr(8364) 227 sCountryMarket(1,2) = "Milano" 228 sCountryMarket(1,3) = "http://it.finance.yahoo.com/d/quotes.csv?s=<StockID>.MI&f=sl1d1t1c1ohgv&e=.csv" 229 sCountryMarket(1,5) = "Codice" 230 sCountryMarket(1,6) = "it" 231 sCountryMarket(1,7) = "IT" 232 sCountryMarket(1,8) = "410" 233 sCountryMarket(1,9) = "44" 234 sCountryMarket(1,10) = "1" 235 236 sCountryMarket(2,0) = "Euro" 237 sCountryMarket(2,1) = chr(8364) 238 sCountryMarket(2,2) = "Madrid" 239 sCountryMarket(2,3) = "http://es.finance.yahoo.com/d/quotes.csv?s=<StockID>&m=MC&f=sl1d1t1c1ohgv&e=.csv" 240 sCountryMarket(2,5) = "Simbolo" 241 sCountryMarket(2,6) = "es" 242 sCountryMarket(2,7) = "ES" 243 sCountryMarket(2,8) = "40A" 244 sCountryMarket(2,9) = "44" 245 sCountryMarket(2,10) = "1" 246 247 sCountryMarket(3,0) = "Dansk krone" 248 sCountryMarket(3,1) = "kr" 249 sCountryMarket(3,2) = "København" 250 sCountryMarket(3,3) = "http://dk.finance.yahoo.com/d/quotes.csv?s=<StockID.CO&f=sl1d1t1c1ohgv&e=.csv" 251 sCountryMarket(3,5) = "Aktiesymbol" 252 sCountryMarket(3,6) = "da" 253 sCountryMarket(3,7) = "DK" 254 sCountryMarket(3,8) = "406" 255 sCountryMarket(3,9) = "44" 256 sCountryMarket(3,10) = "1" 257 258 sCountryMarket(4,0) = "Svensk krona" 259 sCountryMarket(4,1) = "kr" 260 sCountryMarket(4,2) = "Stockholm" 261 sCountryMarket(4,3) = "http://se.finance.yahoo.com/d/quotes.csv?s=<StockID>.L&f=sl1d1t1c1ohgv&e=.c" 262 sCountryMarket(4,5) = "Kod" 263 sCountryMarket(4,6) = "sv" 264 sCountryMarket(4,7) = "SE" 265 sCountryMarket(4,8) = "41D" 266 sCountryMarket(4,9) = "44" 267 sCountryMarket(4,10) = "1" 268 269 ' Taiwan Dollar 270 sCountryMarket(5,0) = "新臺幣" 271 sCountryMarket(5,1) = "¥" 272 sCountryMarket(5,2) = "代號" 273 sCountryMarket(5,3) = "http://tw.finance.yahoo.com/d/quotes.csv?s=<StockID>.TW&f=sl1d1t1c1ohgv&e=.csv" 274 sCountryMarket(5,5) = "代號" 275 sCountryMarket(5,6) = "zh" 276 sCountryMarket(5,7) = "TW" 277 sCountryMarket(5,8) = "404" 278 sCountryMarket(5,9) = "44" 279 sCountryMarket(5,10) = "1" 280 281 ' Chinese Yuan 282 sCountryMarket(6,0) = "人民币" 283 sCountryMarket(6,1) = "¥" 284 sCountryMarket(6,2) = "代号" 285 sCountryMarket(6,3) = "http://cn.finance.yahoo.com/d/quotes.csv?s=<StockID>.SS&f=sl1d1t1c1ohgv&e=.csv" 286 sCountryMarket(6,5) = "代号" 287 sCountryMarket(6,6) = "zh" 288 sCountryMarket(6,7) = "CN" 289 sCountryMarket(6,8) = "804" 290 sCountryMarket(6,9) = "44" 291 sCountryMarket(6,10) = "1" 292 293 ' korean Won 294 sCountryMarket(7,0) = "한국 원화" 295 sCountryMarket(7,1) = "₩" 296 sCountryMarket(7,2) = "서울" 297 sCountryMarket(7,3) = "http://kr.finance.yahoo.com/d/quotes.csv?s=<StockID>.KS&f=snl1d1t1c1ohgv&e=.csv" 298 sCountryMarket(7,5) = "종목 코드" 299 sCountryMarket(7,6) = "ko" 300 sCountryMarket(7,7) = "KR" 301 sCountryMarket(7,8) = "412" 302 sCountryMarket(7,9) = "44" 303 sCountryMarket(7,10) = "2" 304 305 306' sCountryMarket(5,0) = "Российский рубль" 307' sCountryMarket(5,1) = "р." 308' sCountryMarket(5,2) = "" 309' sCountryMarket(5,3) = "" 310' sCountryMarket(5,5) = "" 311' sCountryMarket(5,6) = "ru" 312' sCountryMarket(5,7) = "RU" 313' sCountryMarket(5,8) = "-419" 314' sCountryMarket(5,9) = "" 315' 316' sCountryMarket(6,0) = "Złoty polski" 317' sCountryMarket(6,1) = "zł" 318' sCountryMarket(6,2) = "" 319' sCountryMarket(6,3) = "" 320' sCountryMarket(6,5) = "" 'Still Todo!! 321' sCountryMarket(6,6) = "pl" 322' sCountryMarket(6,7) = "PL" 323' sCountryMarket(6,8) = "-415" 324' sCountryMarket(6,9) = "" 325' 326' sCountryMarket(7,0) = "Türkische Lira" 327' sCountryMarket(7,1) = "TL" 328' sCountryMarket(7,2) = "" 329' sCountryMarket(7,3) = "" 330' sCountryMarket(7,5) = "" 'Still Todo!! 331' sCountryMarket(7,6) = "tr" 332' sCountryMarket(7,7) = "TR" 333' sCountryMarket(7,8) = "-41F" 334' sCountryMarket(7,9) = "" 335 336 Dim n as Integer 337 Dim m as Integer 338' Dim sCountryMarket(6,9) as String 339 340 For n = 0 To Ubound(sCountryMarket(),1) 341 If sDocLanguage = sCountryMarket(n,6) and sDocCountry = sCountryMarket(n,7) Then 342 GlobListIndex = 6 343 For m = 0 To 10 344 sMarket(6,m) = sCountryMarket(n,m) 345 Next m 346 Exit For 347 End If 348 Next n 349 End If 350End Sub 351 352Sub LoadDepotDialogs() 353 DlgTransaction = LoadDialog("Depot", "Dialog2") 354 DlgStockRates = LoadDialog("Depot", "Dialog3") 355 DlgStartUp = LoadDialog("Depot", "Dialog4") 356 TransactModel = DlgTransaction.Model 357 StockRatesModel = DlgStockRates.Model 358 StartUpModel = DlgStartUp.Model 359End Sub 360 361 362Sub InitializeStartUpModel() 363 With StartUpModel 364 .lblWelcome.Label = sStartupWelcome & Chr(13) & chr(13) & sStartUpChooseMarket 365 sStartUpHint = ReplaceString(sStartUpHint, sHistory, "<History>") 366 .lblHint.Label = sStartupHint 367' .cmdGoOn.Enabled = Ubound(StartUpModel.lstMarkets.SelectedItems()) <> -1 368 .cmdGoOn.Label = sOK 369 .cmdCancel.Label = sCancel 370 End With 371End Sub</script:module> 372