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