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