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