xref: /trunk/main/wizards/source/depot/CommonLang.xba (revision cdf0e10c)
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&apos; Column A has the index 1
7Public Const SBCOLUMNNAME1 = 3			&apos; Stock names, sheet 1
8Public Const SBCOLUMNID1 = 4			&apos; Stock ID, sheet 1
9Public Const SBCOLUMNQUANTITY1 = 5		&apos; Stock quantity sheet 1
10Public Const SBCOLUMNRATE1 = 7			&apos; Price for stocks, sheet 1
11Public Const SBCOLUMNNAME2 = 3			&apos; Stock names, sheet 2
12Public Const SBCOLUMNDATE2 = 4			&apos; Transaction dates, sheet 2
13Public Const SBCOLUMNQUANTITY2 = 5		&apos; Transaction quantity, sheet 2
14Public Const SBCOLUMNRATE2 = 6			&apos; Price for stocks, sheet 2
15Public Const SBCOLUMNPROVPERCENT2 = 7	&apos; Provision in %, sheet 2
16Public Const SBCOLUMNPROVMIN2 = 8		&apos; Minimum provision, sheet 2
17Public Const SBCOLUMNPROVFIX2 = 9		&apos; Fixed provision, sheet 2
18Public Const SBCOLUMNPROCEEDS2 = 12		&apos; Profit, sheet 2
19Public Const SBCOLUMNQTYSOLD2 = 14		&apos; Quantity sold, sheet 2
20Public Const SBCOLUMNQTYREST2 = 15		&apos; Quantity not sold yet, sheet 2
21Public Const SBCOLUMNPRCREST2 = 16		&apos; Proportional proce for quantity not sold yet, sheet 2
22Public Const SBCOLUMNREALPROC2 = 17		&apos; Realized proceeds, sheet 2
23Public Const SBCOLUMNDIVIDEND2 = 18		&apos; Dividend paid, sheet 2
24Public Const SBCOLUMNREALPROFIT2 = 19	&apos; Realized profit, sheet 2
25Public Const SBROWFIRSTTRANSACT2 = 8	&apos; First data row, sheet 2
26Public Const SBROWHEADER1 = 6			&apos; 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				&apos; 0 = no ID, 1 = stocks have an ID
33Public Const SBDIALOGSELL = 1			&apos; Step for main dialog
34Public Const SBDIALOGBUY = 2			&apos; 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 = &quot;d&quot;
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 &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()
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,&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
190End Sub
191
192Sub 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;
204
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;
215
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;
226
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;
237
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;
248
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;
260
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;
272
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;
284
285
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;zł&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;
315
316	Dim n as Integer
317	Dim m as Integer
318&apos;	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(&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
339End Sub
340
341
342Sub 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
351End Sub</script:module>