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