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 *****
6 ' Column A has the index
1
7 Public Const SBCOLUMNNAME1 =
3 ' Stock names, sheet
1
8 Public Const SBCOLUMNID1 =
4 ' Stock ID, sheet
1
9 Public Const SBCOLUMNQUANTITY1 =
5 ' Stock quantity sheet
1
10 Public Const SBCOLUMNRATE1 =
7 ' Price for stocks, sheet
1
11 Public Const SBCOLUMNNAME2 =
3 ' Stock names, sheet
2
12 Public Const SBCOLUMNDATE2 =
4 ' Transaction dates, sheet
2
13 Public Const SBCOLUMNQUANTITY2 =
5 ' Transaction quantity, sheet
2
14 Public Const SBCOLUMNRATE2 =
6 ' Price for stocks, sheet
2
15 Public Const SBCOLUMNPROVPERCENT2 =
7 ' Provision in %, sheet
2
16 Public Const SBCOLUMNPROVMIN2 =
8 ' Minimum provision, sheet
2
17 Public Const SBCOLUMNPROVFIX2 =
9 ' Fixed provision, sheet
2
18 Public Const SBCOLUMNPROCEEDS2 =
12 ' Profit, sheet
2
19 Public Const SBCOLUMNQTYSOLD2 =
14 ' Quantity sold, sheet
2
20 Public Const SBCOLUMNQTYREST2 =
15 ' Quantity not sold yet, sheet
2
21 Public Const SBCOLUMNPRCREST2 =
16 ' Proportional proce for quantity not sold yet, sheet
2
22 Public Const SBCOLUMNREALPROC2 =
17 ' Realized proceeds, sheet
2
23 Public Const SBCOLUMNDIVIDEND2 =
18 ' Dividend paid, sheet
2
24 Public Const SBCOLUMNREALPROFIT2 =
19 ' Realized profit, sheet
2
25 Public Const SBROWFIRSTTRANSACT2 =
8 ' First data row, sheet
2
26 Public Const SBROWHEADER1 =
6 ' Headline, sheet
1
27 Public Const SBMSGOK =
0
28 Public Const SBMSGYESNO =
4
29 Public Const SBMSGSTOP =
16
30 Public Const SBMSGQUESTION =
32
31 Public Const SBMSGDEFAULTBTN2 =
256
32 Public Const SBHASID =
1 ' 0 = no ID,
1 = stocks have an ID
33 Public Const SBDIALOGSELL =
1 ' Step for main dialog
34 Public Const SBDIALOGBUY =
2 ' Step for main dialog
35 Public Const SBBINARY =
0
36 Public TransactMode as Integer
37 Public Const LIFO = -
1
40 Public Const HANDLEDIVIDEND =
1
41 Public Const HANDLESPLIT =
2
43 Global oDocument as Object
44 Global oDocFormats() as Object
45 Global oController as Object
46 Global oFirstSheet as Object
47 Global oBankSheet as Object
48 Global oMovementSheet as Object
49 Global sDocLanguage as String
50 Global sDocCountry as String
51 Global oSheets as Object
52 Global oDocLocale as New com.sun.star.lang.Locale
53 Global bEnableMarket as Boolean
54 Global bEnableInternet as Boolean
55 Global oMarketModel as Object
56 Global oInternetModel as Object
58 Global sCurCurrency$, sCurExtension$, sCurChartSource$, sCurStockIDLabel$, sCurSeparator$
60 Public oNumberFormatter as Object
61 Public bDebugmode as Boolean
62 Global GlobListindex as Integer
63 Public blabla() as String
64 Public SplitDate as Date
65 Public oChartSheet as Object
66 Public oBackgroundSheet as Object
67 Public Const SBDATECOLUMN =
3
68 Public Const SBVALUECOLUMN =
4
69 Public Const SBSTARTROW =
25
70 Public Const SBCHARTPERIOD =
14
71 Public Const SBINTERVAL =
"d
"
72 Public sColumnHeader as String
73 Public StartDate as Date
74 Public EndDate as Date
75 Public iCurRow as Integer
76 Public iMaxRow as Integer
77 Public iStartDay as Integer
78 Public iStartMonth as Integer
79 Public iStartYear as Integer
80 Public iEndDay as Integer
81 Public iEndMonth as Integer
82 Public iEndYear as Integer
83 Public oStatusLine as Object
85 Public sInterval as String
86 Public ShortMonths(
11,
1)
87 Public iStep as Integer
88 Public sDepotCurrency as String
89 Public iValueCol as Integer
91 Public DlgReference as Object
92 Public DlgTransaction as Object
93 Public DlgStockRates as Object
94 Public DlgStartUp as Object
95 Public TransactModel as Object
96 Public StockRatesModel as Object
97 Public StartUpModel as Object
98 Public StockRatesTitle(
1 To
3)
99 Public TransactTitle(
1 To
2)
101 Public sStartupWelcome$, sStartupChooseMarket$, sStartupHint$
103 Public sMarket(
7,
10) as String
104 Public sCountryMarket(
7,
10) as String
106 Public cDlgCaption1$, cDlgCaption2$
107 Public sMsgError$, sMsgNoName$, sMsgNoQuantity$, sMsgNoDividend$, sMsgNoExchangeRate$
108 Public sMsgNoValidExchangeDate$, sMsgWrongExchangeDate$, sMsgSellTooMuch$, sMsgConfirm$
109 Public sMsgFreeStock$, sMsgTotalLoss$, sMsgEndDatebeforeNow$, sMsgStartDatebeforeEndDate$
111 Public sOk$, sCancel$
112 Public sMsgAuthorization$, sMsgDeleteAll$
115 Global HistoryChartSource as String
116 Public DateCellStyle as String
117 Public CurrCellStyle as String
118 Public sStartDate$, sEndDate$, sHistory$
119 Public sInsertStockname$
120 Public sProductname$, sTitle$
121 Public sInsertStocks$, sStockname$, sNoInternetUpdate$, sMarketplace$, sNoInternetDataAvailable$
122 Public sCheckInternetSettings as String
126 Select Case sDocLanguage
130 LoadEnglishLanguage()
134 LoadItalianLanguage()
136 LoadSpanishLanguage()
138 LoadSwedishLanguage()
140 LoadJapaneseLanguage()
144 If sDocCountry =
"CN
" Then
145 LoadChineseSimpleLanguage()
147 LoadChineseTradLanguage()
150 InitializeStartUpModel()
153 Sub CompleteMarketList()
154 Dim EuroIndex as Integer
155 Dim LocCountry as String
156 Dim LocLanguage as String
157 Dim sLangList() as String
158 Dim sCountryList() as String
159 Dim sExtensionList() as String
160 Dim MaxIndex as Integer
161 Dim bIsLocale as Boolean
165 LocLanguage = sMarket(n,
6)
166 LocCountry = sMarket(n,
7)
167 If Instr(
1,LocLanguage,
";
",SBBINARY) =
0 Then
168 bIsLocale = CheckDocLocale(LocLanguage, LocCountry)
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))
181 sMarket(n,
6) = sLangList(EuroIndex)
182 sMarket(n,
7) = sCountryList(EuroIndex)
183 sMarket(n,
8) = sExtensionList(EuroIndex)
192 Sub 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"
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"
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"
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"
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"
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"
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"
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"
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) =
""
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) =
""
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) =
""
318 ' Dim sCountryMarket(
6,
9) as String
320 For n =
0 To Ubound(sCountryMarket(),
1)
321 If sDocLanguage = sCountryMarket(n,
6) and sDocCountry = sCountryMarket(n,
7) Then
324 sMarket(
6,m) = sCountryMarket(n,m)
332 Sub 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
342 Sub InitializeStartUpModel()
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
349 .cmdCancel.Label = sCancel
351 End Sub
</script:module>