update dev300-m57
[ooovba.git] / wizards / source / depot / CommonLang.xba
bloba1cb283dab1499df365cd4d118fa827ab356b4fa
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 &apos; Column A has the index 1
7 Public Const SBCOLUMNNAME1 = 3 &apos; Stock names, sheet 1
8 Public Const SBCOLUMNID1 = 4 &apos; Stock ID, sheet 1
9 Public Const SBCOLUMNQUANTITY1 = 5 &apos; Stock quantity sheet 1
10 Public Const SBCOLUMNRATE1 = 7 &apos; Price for stocks, sheet 1
11 Public Const SBCOLUMNNAME2 = 3 &apos; Stock names, sheet 2
12 Public Const SBCOLUMNDATE2 = 4 &apos; Transaction dates, sheet 2
13 Public Const SBCOLUMNQUANTITY2 = 5 &apos; Transaction quantity, sheet 2
14 Public Const SBCOLUMNRATE2 = 6 &apos; Price for stocks, sheet 2
15 Public Const SBCOLUMNPROVPERCENT2 = 7 &apos; Provision in %, sheet 2
16 Public Const SBCOLUMNPROVMIN2 = 8 &apos; Minimum provision, sheet 2
17 Public Const SBCOLUMNPROVFIX2 = 9 &apos; Fixed provision, sheet 2
18 Public Const SBCOLUMNPROCEEDS2 = 12 &apos; Profit, sheet 2
19 Public Const SBCOLUMNQTYSOLD2 = 14 &apos; Quantity sold, sheet 2
20 Public Const SBCOLUMNQTYREST2 = 15 &apos; Quantity not sold yet, sheet 2
21 Public Const SBCOLUMNPRCREST2 = 16 &apos; Proportional proce for quantity not sold yet, sheet 2
22 Public Const SBCOLUMNREALPROC2 = 17 &apos; Realized proceeds, sheet 2
23 Public Const SBCOLUMNDIVIDEND2 = 18 &apos; Dividend paid, sheet 2
24 Public Const SBCOLUMNREALPROFIT2 = 19 &apos; Realized profit, sheet 2
25 Public Const SBROWFIRSTTRANSACT2 = 8 &apos; First data row, sheet 2
26 Public Const SBROWHEADER1 = 6 &apos; 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 &apos; 0 = no ID, 1 = stocks have an ID
33 Public Const SBDIALOGSELL = 1 &apos; Step for main dialog
34 Public Const SBDIALOGBUY = 2 &apos; Step for main dialog
35 Public Const SBBINARY = 0
36 Public TransactMode as Integer
37 Public Const LIFO = -1
38 Public Const FIFO = 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 = &quot;d&quot;
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
84 Public Today as Date
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)
100 Public NullList()
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$
113 Public SellMethod$
114 Public cSplit$
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
124 Sub LoadLanguage()
125 LoadDepotDialogs()
126 Select Case sDocLanguage
127 Case &quot;de&quot;
128 LoadGermanLanguage()
129 Case &quot;en&quot;
130 LoadEnglishLanguage()
131 Case &quot;fr&quot;
132 LoadFrenchLanguage()
133 Case &quot;it&quot;
134 LoadItalianLanguage()
135 Case &quot;es&quot;
136 LoadSpanishLanguage()
137 Case &quot;sv&quot;
138 LoadSwedishLanguage()
139 Case &quot;ja&quot;
140 LoadJapaneseLanguage()
141 Case &quot;ko&quot;
142 LoadKoreanLanguage()
143 Case &quot;zh&quot;
144 If sDocCountry = &quot;CN&quot; Then
145 LoadChineseSimpleLanguage()
146 Else
147 LoadChineseTradLanguage()
148 End If
149 End Select
150 InitializeStartUpModel()
151 End Sub
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
163 GlobListIndex = -1
164 For n = 0 To 5
165 LocLanguage = sMarket(n,6)
166 LocCountry = sMarket(n,7)
167 If Instr(1,LocLanguage,&quot;;&quot;,SBBINARY) = 0 Then
168 bIsLocale = CheckDocLocale(LocLanguage, LocCountry)
169 Else
170 EuroIndex = 0
171 sLangList() = ArrayoutofString(LocLanguage, &quot;;&quot;, MaxIndex)
172 sCountryList() = ArrayoutofString(LocCountry, &quot;;&quot;, MaxIndex)
173 sExtensionList() = ArrayoutofString(sMarket(n,8), &quot;;&quot;, 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
190 End Sub
192 Sub LocalizedCurrencies()
193 If GlobListIndex = -1 Then
194 sCountryMarket(0,0) = &quot;Euro&quot;
195 sCountryMarket(0,1) = chr(8364)
196 sCountryMarket(0,2) = &quot;Paris&quot;
197 sCountryMarket(0,3) = &quot;http://fr.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.PA&amp;f=s4l1t1c1ghov&amp;e=.csv&quot;
198 sCountryMarket(0,5) = &quot;Code&quot;
199 sCountryMarket(0,6) = &quot;fr&quot;
200 sCountryMarket(0,7) = &quot;FR&quot;
201 sCountryMarket(0,8) = &quot;40C&quot;
202 sCountryMarket(0,9) = &quot;59/9&quot;
203 sCountryMarket(0,10) = &quot;1&quot;
205 sCountryMarket(1,0) = &quot;Euro&quot;
206 sCountryMarket(1,1) = chr(8364)
207 sCountryMarket(1,2) = &quot;Milano&quot;
208 sCountryMarket(1,3) = &quot;http://it.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.MI&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
209 sCountryMarket(1,5) = &quot;Codice&quot;
210 sCountryMarket(1,6) = &quot;it&quot;
211 sCountryMarket(1,7) = &quot;IT&quot;
212 sCountryMarket(1,8) = &quot;410&quot;
213 sCountryMarket(1,9) = &quot;44&quot;
214 sCountryMarket(1,10) = &quot;1&quot;
216 sCountryMarket(2,0) = &quot;Euro&quot;
217 sCountryMarket(2,1) = chr(8364)
218 sCountryMarket(2,2) = &quot;Madrid&quot;
219 sCountryMarket(2,3) = &quot;http://es.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;m=MC&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
220 sCountryMarket(2,5) = &quot;Simbolo&quot;
221 sCountryMarket(2,6) = &quot;es&quot;
222 sCountryMarket(2,7) = &quot;ES&quot;
223 sCountryMarket(2,8) = &quot;40A&quot;
224 sCountryMarket(2,9) = &quot;44&quot;
225 sCountryMarket(2,10) = &quot;1&quot;
227 sCountryMarket(3,0) = &quot;Dansk krone&quot;
228 sCountryMarket(3,1) = &quot;kr&quot;
229 sCountryMarket(3,2) = &quot;København&quot;
230 sCountryMarket(3,3) = &quot;http://dk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID.CO&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
231 sCountryMarket(3,5) = &quot;Aktiesymbol&quot;
232 sCountryMarket(3,6) = &quot;da&quot;
233 sCountryMarket(3,7) = &quot;DK&quot;
234 sCountryMarket(3,8) = &quot;406&quot;
235 sCountryMarket(3,9) = &quot;44&quot;
236 sCountryMarket(3,10) = &quot;1&quot;
238 sCountryMarket(4,0) = &quot;Svensk krona&quot;
239 sCountryMarket(4,1) = &quot;kr&quot;
240 sCountryMarket(4,2) = &quot;Stockholm&quot;
241 sCountryMarket(4,3) = &quot;http://se.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;f=sl1d1t1c1ohgv&amp;e=.c&quot;
242 sCountryMarket(4,5) = &quot;Kod&quot;
243 sCountryMarket(4,6) = &quot;sv&quot;
244 sCountryMarket(4,7) = &quot;SE&quot;
245 sCountryMarket(4,8) = &quot;41D&quot;
246 sCountryMarket(4,9) = &quot;44&quot;
247 sCountryMarket(4,10) = &quot;1&quot;
249 &apos; Taiwan Dollar
250 sCountryMarket(5,0) = &quot;新臺幣&quot;
251 sCountryMarket(5,1) = &quot;&quot;
252 sCountryMarket(5,2) = &quot;代號&quot;
253 sCountryMarket(5,3) = &quot;http://tw.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.TW&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
254 sCountryMarket(5,5) = &quot;代號&quot;
255 sCountryMarket(5,6) = &quot;zh&quot;
256 sCountryMarket(5,7) = &quot;TW&quot;
257 sCountryMarket(5,8) = &quot;404&quot;
258 sCountryMarket(5,9) = &quot;44&quot;
259 sCountryMarket(5,10) = &quot;1&quot;
261 &apos; Chinese Yuan
262 sCountryMarket(6,0) = &quot;人民币&quot;
263 sCountryMarket(6,1) = &quot;&quot;
264 sCountryMarket(6,2) = &quot;代号&quot;
265 sCountryMarket(6,3) = &quot;http://cn.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.SS&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
266 sCountryMarket(6,5) = &quot;代号&quot;
267 sCountryMarket(6,6) = &quot;zh&quot;
268 sCountryMarket(6,7) = &quot;CN&quot;
269 sCountryMarket(6,8) = &quot;804&quot;
270 sCountryMarket(6,9) = &quot;44&quot;
271 sCountryMarket(6,10) = &quot;1&quot;
273 &apos; korean Won
274 sCountryMarket(7,0) = &quot;한국 원화&quot;
275 sCountryMarket(7,1) = &quot;&quot;
276 sCountryMarket(7,2) = &quot;서울&quot;
277 sCountryMarket(7,3) = &quot;http://kr.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.KS&amp;f=snl1d1t1c1ohgv&amp;e=.csv&quot;
278 sCountryMarket(7,5) = &quot;종목 코드&quot;
279 sCountryMarket(7,6) = &quot;ko&quot;
280 sCountryMarket(7,7) = &quot;KR&quot;
281 sCountryMarket(7,8) = &quot;412&quot;
282 sCountryMarket(7,9) = &quot;44&quot;
283 sCountryMarket(7,10) = &quot;2&quot;
286 &apos; sCountryMarket(5,0) = &quot;Российский рубль&quot;
287 &apos; sCountryMarket(5,1) = &quot;р.&quot;
288 &apos; sCountryMarket(5,2) = &quot;&quot;
289 &apos; sCountryMarket(5,3) = &quot;&quot;
290 &apos; sCountryMarket(5,5) = &quot;&quot;
291 &apos; sCountryMarket(5,6) = &quot;ru&quot;
292 &apos; sCountryMarket(5,7) = &quot;RU&quot;
293 &apos; sCountryMarket(5,8) = &quot;-419&quot;
294 &apos; sCountryMarket(5,9) = &quot;&quot;
295 &apos;
296 &apos; sCountryMarket(6,0) = &quot;Złoty polski&quot;
297 &apos; sCountryMarket(6,1) = &quot;&quot;
298 &apos; sCountryMarket(6,2) = &quot;&quot;
299 &apos; sCountryMarket(6,3) = &quot;&quot;
300 &apos; sCountryMarket(6,5) = &quot;&quot; &apos;Still Todo!!
301 &apos; sCountryMarket(6,6) = &quot;pl&quot;
302 &apos; sCountryMarket(6,7) = &quot;PL&quot;
303 &apos; sCountryMarket(6,8) = &quot;-415&quot;
304 &apos; sCountryMarket(6,9) = &quot;&quot;
305 &apos;
306 &apos; sCountryMarket(7,0) = &quot;Türkische Lira&quot;
307 &apos; sCountryMarket(7,1) = &quot;TL&quot;
308 &apos; sCountryMarket(7,2) = &quot;&quot;
309 &apos; sCountryMarket(7,3) = &quot;&quot;
310 &apos; sCountryMarket(7,5) = &quot;&quot; &apos;Still Todo!!
311 &apos; sCountryMarket(7,6) = &quot;tr&quot;
312 &apos; sCountryMarket(7,7) = &quot;TR&quot;
313 &apos; sCountryMarket(7,8) = &quot;-41F&quot;
314 &apos; sCountryMarket(7,9) = &quot;&quot;
316 Dim n as Integer
317 Dim m as Integer
318 &apos; 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
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
330 End Sub
332 Sub LoadDepotDialogs()
333 DlgTransaction = LoadDialog(&quot;Depot&quot;, &quot;Dialog2&quot;)
334 DlgStockRates = LoadDialog(&quot;Depot&quot;, &quot;Dialog3&quot;)
335 DlgStartUp = LoadDialog(&quot;Depot&quot;, &quot;Dialog4&quot;)
336 TransactModel = DlgTransaction.Model
337 StockRatesModel = DlgStockRates.Model
338 StartUpModel = DlgStartUp.Model
339 End Sub
342 Sub InitializeStartUpModel()
343 With StartUpModel
344 .lblWelcome.Label = sStartupWelcome &amp; Chr(13) &amp; chr(13) &amp; sStartUpChooseMarket
345 sStartUpHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
346 .lblHint.Label = sStartupHint
347 &apos; .cmdGoOn.Enabled = Ubound(StartUpModel.lstMarkets.SelectedItems()) &lt;&gt; -1
348 .cmdGoOn.Label = sOK
349 .cmdCancel.Label = sCancel
350 End With
351 End Sub</script:module>