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