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