calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / wizards / source / scriptforge / SF_Region.xba
blobd3eacfae09829d0bb472b0f0800b65b34cb1054e
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="SF_Region" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
4 REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
5 REM === Full documentation is available on https://help.libreoffice.org/ ===
6 REM =======================================================================================================================
8 Option Compatible
9 Option Explicit
11 &apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
12 &apos;&apos;&apos; SF_Region
13 &apos;&apos;&apos; =========
14 &apos;&apos;&apos; Singleton class implementing the &quot;ScriptForge.Region&quot; service
15 &apos;&apos;&apos; Implemented as a usual Basic module
16 &apos;&apos;&apos;
17 &apos;&apos;&apos; A collection of functions about languages, countries and timezones
18 &apos;&apos;&apos; - Locales
19 &apos;&apos;&apos; - Currencies
20 &apos;&apos;&apos; - Numbers and dates formatting
21 &apos;&apos;&apos; - Calendars
22 &apos;&apos;&apos; - Timezones conversions
23 &apos;&apos;&apos; - Numbers transformed to text
24 &apos;&apos;&apos;
25 &apos;&apos;&apos; Definitions:
26 &apos;&apos;&apos; Locale or Region
27 &apos;&apos;&apos; A combination of a language (2 or 3 lower case characters) and a country (2 upper case characters)
28 &apos;&apos;&apos; Most properties and methods require a locale as argument.
29 &apos;&apos;&apos; Some of them accept either the complete locale or only the language or country parts.
30 &apos;&apos;&apos; When absent, the considered locale is the locale used in the LibreOffice user interface.
31 &apos;&apos;&apos; (see the SF_Platform.OfficeLocale property)
32 &apos;&apos;&apos; Timezone
33 &apos;&apos;&apos; Specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;.
34 &apos;&apos;&apos; The time offset between the timezone and the Greenwich Meridian Time (GMT) is expressed in minutes.
35 &apos;&apos;&apos; The Daylight Saving Time (DST) is an additional offset.
36 &apos;&apos;&apos; Both offsets can be positive or negative.
37 &apos;&apos;&apos; More info on
38 &apos;&apos;&apos; https://timezonedb.com/time-zones
39 &apos;&apos;&apos; https://en.wikipedia.org/wiki/Time_zone
40 &apos;&apos;&apos;
41 &apos;&apos;&apos; Service invocation example:
42 &apos;&apos;&apos; Dim regio As Object
43 &apos;&apos;&apos; Set regio = CreateScriptService(&quot;Region&quot;)
44 &apos;&apos;&apos;
45 &apos;&apos;&apos; Detailed user documentation:
46 &apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_region.html?DbPAR=BASIC
47 &apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
49 REM ================================================================== EXCEPTIONS
51 REM ============================================================= PRIVATE MEMBERS
53 Private UserLocale As String &apos; platform.OfficeLocale
55 &apos; Reference tables
56 Private LocaleData As Variant &apos; com.sun.star.i18n.LocaleData
57 Private LocaleNames As Variant &apos; Array of all available &quot;la-CO&quot; strings
59 Private UserIndex As Integer &apos; Index of UserLocale in reference tables
61 REM ============================================================ MODULE CONSTANTS
63 REM ===================================================== CONSTRUCTOR/DESTRUCTOR
65 REM -----------------------------------------------------------------------------
66 Public Function Dispose() As Variant
67 Set Dispose = Nothing
68 End Function &apos; ScriptForge.SF_Region Explicit destructor
70 REM ================================================================== PROPERTIES
72 REM -----------------------------------------------------------------------------
73 Property Get Country(Optional ByVal Region As Variant) As String
74 &apos;&apos;&apos; Returns the english country name applicable in the given region.
75 &apos;&apos;&apos; The region expressed either as a
76 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
77 &apos;&apos;&apos; - country only (CO)
78 &apos;&apos;&apos; Example:
79 &apos;&apos;&apos; MsgBox Regio.Country(&quot;IT&quot;) &apos; Italy
80 Country = _PropertyGet(&quot;Country&quot;, Region)
81 End Property &apos; ScriptForge.SF_Region.Country (get)
83 REM -----------------------------------------------------------------------------
84 Property Get Currency(Optional ByVal Region As Variant) As String
85 &apos;&apos;&apos; Returns the currency applicable in the given region.
86 &apos;&apos;&apos; The region is expressed either as a
87 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
88 &apos;&apos;&apos; - country only (CO)
89 &apos;&apos;&apos; Example:
90 &apos;&apos;&apos; MsgBox Regio.Currency(&quot;IT&quot;) &apos; EUR
91 Currency = _PropertyGet(&quot;Currency&quot;, Region)
92 End Property &apos; ScriptForge.SF_Region.Currency (get)
94 REM -----------------------------------------------------------------------------
95 Public Function DatePatterns(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
96 &apos;&apos;&apos; Returns list of date acceptance patterns for the given region.
97 &apos;&apos;&apos; Patterns with input combinations that are accepted as incomplete date input, such as M/D or D.M
98 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
99 &apos;&apos;&apos; The list is zero-based.
100 &apos;&apos;&apos; Example:
101 &apos;&apos;&apos; MsgBox Join(Regio.DatePatterns(&quot;it-IT&quot;), &quot;,&quot;) &apos; D/M/Y,D/M
102 DatePatterns = _PropertyGet(&quot;DatePatterns&quot;, Region)
103 End Function &apos; ScriptForge.SF_Region.DatePatterns (get)
105 REM -----------------------------------------------------------------------------
106 Property Get DateSeparator(Optional ByVal Region As Variant) As String
107 &apos;&apos;&apos; Returns the separator used in dates applicable in the given region.
108 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
109 &apos;&apos;&apos; Example:
110 &apos;&apos;&apos; MsgBox Regio.DateSeparator(&quot;it-IT&quot;) &apos; /
111 DateSeparator = _PropertyGet(&quot;DateSeparator&quot;, Region)
112 End Property &apos; ScriptForge.SF_Region.DateSeparator (get)
114 REM -----------------------------------------------------------------------------
115 Public Function DayAbbrevNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
116 &apos;&apos;&apos; Returns list of abbreviated names of weekdays applicable in the given region.
117 &apos;&apos;&apos; The region expressed as a
118 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
119 &apos;&apos;&apos; - language only (la)
120 &apos;&apos;&apos; The list is zero-based. The 1st in the list [0] is the Monday.
121 &apos;&apos;&apos; Example:
122 &apos;&apos;&apos; MsgBox Join(Regio.DayAbbrevNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; lun,mar,mer,gio,ven,sab,dom
123 DayAbbrevNames = _PropertyGet(&quot;DayAbbrevNames&quot;, Region)
124 End Function &apos; ScriptForge.SF_Region.DayAbbrevNames (get)
126 REM -----------------------------------------------------------------------------
127 Public Function DayNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
128 &apos;&apos;&apos; Returns list of names of weekdays applicable in the given region.
129 &apos;&apos;&apos; The region expressed as a
130 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
131 &apos;&apos;&apos; - language only (la)
132 &apos;&apos;&apos; The list is zero-based. The 1st in the list [0] is the Monday.
133 &apos;&apos;&apos; Example:
134 &apos;&apos;&apos; MsgBox Join(Regio.DayNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; lunedì,martedì,mercoledì,giovedì,venerdì,sabato,domenica
135 DayNames = _PropertyGet(&quot;DayNames&quot;, Region)
136 End Function &apos; ScriptForge.SF_Region.DayNames (get)
138 REM -----------------------------------------------------------------------------
139 Public Function DayNarrowNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
140 &apos;&apos;&apos; Returns list of initials of weekdays applicable in the given region.
141 &apos;&apos;&apos; The region expressed as a
142 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
143 &apos;&apos;&apos; - language only (la)
144 &apos;&apos;&apos; The list is zero-based. The 1st in the list [0] is the Monday.
145 &apos;&apos;&apos; Example:
146 &apos;&apos;&apos; MsgBox Join(Regio.DayNarrowNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; l,m,m,g,v,s,d
147 DayNarrowNames = _PropertyGet(&quot;DayNarrowNames&quot;, Region)
148 End Function &apos; ScriptForge.SF_Region.DayNarrowNames (get)
150 REM -----------------------------------------------------------------------------
151 Property Get DecimalPoint(Optional ByVal Region As Variant) As String
152 &apos;&apos;&apos; Returns the decimal separator used in numbers applicable in the given region.
153 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
154 &apos;&apos;&apos; Example:
155 &apos;&apos;&apos; MsgBox Regio.DecimalPoint(&quot;it-IT&quot;) &apos; .
156 DecimalPoint = _PropertyGet(&quot;DecimalPoint&quot;, Region)
157 End Property &apos; ScriptForge.SF_Region.DecimalPoint (get)
159 REM -----------------------------------------------------------------------------
160 Property Get Language(Optional ByVal Region As Variant) As String
161 &apos;&apos;&apos; Returns the english Language name applicable in the given region.
162 &apos;&apos;&apos; The region expressed as a
163 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
164 &apos;&apos;&apos; - language only (la)
165 &apos;&apos;&apos; Example:
166 &apos;&apos;&apos; MsgBox Regio.Language(&quot;it-IT&quot;) &apos; Italian
167 Language = _PropertyGet(&quot;Language&quot;, Region)
168 End Property &apos; ScriptForge.SF_Region.Language (get)
170 REM -----------------------------------------------------------------------------
171 Property Get ListSeparator(Optional ByVal Region As Variant) As String
172 &apos;&apos;&apos; Returns the separator used in lists applicable in the given region.
173 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
174 &apos;&apos;&apos; Example:
175 &apos;&apos;&apos; MsgBox Regio.ListSeparator(&quot;it-IT&quot;) &apos; ;
176 ListSeparator = _PropertyGet(&quot;ListSeparator&quot;, Region)
177 End Property &apos; ScriptForge.SF_Region.ListSeparator (get)
179 REM -----------------------------------------------------------------------------
180 Public Function MonthAbbrevNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
181 &apos;&apos;&apos; Returns list of abbreviated names of months applicable in the given region.
182 &apos;&apos;&apos; The region expressed as a
183 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
184 &apos;&apos;&apos; - language only (la)
185 &apos;&apos;&apos; The list is zero-based.
186 &apos;&apos;&apos; Example:
187 &apos;&apos;&apos; MsgBox Join(Regio.MonthAbbrevNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; gen,feb,mar,apr,mag,giu,lug,ago,set,ott,nov,dic
188 MonthAbbrevNames = _PropertyGet(&quot;MonthAbbrevNames&quot;, Region)
189 End Function &apos; ScriptForge.SF_Region.MonthAbbrevNames (get)
191 REM -----------------------------------------------------------------------------
192 Public Function MonthNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
193 &apos;&apos;&apos; Returns list of names of months applicable in the given region.
194 &apos;&apos;&apos; The region expressed as a
195 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
196 &apos;&apos;&apos; - language only (la)
197 &apos;&apos;&apos; The list is zero-based.
198 &apos;&apos;&apos; Example:
199 &apos;&apos;&apos; MsgBox Join(Regio.MonthNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; gennaio,febbraio,marzo,aprile,maggio,giugno,luglio,agosto,settembre,ottobre,novembre,dicembre
200 MonthNames = _PropertyGet(&quot;MonthNames&quot;, Region)
201 End Function &apos; ScriptForge.SF_Region.MonthNames (get)
203 REM -----------------------------------------------------------------------------
204 Public Function MonthNarrowNames(Optional ByVal Region As Variant) As Variant &apos; Function better than Property when return value is an array
205 &apos;&apos;&apos; Returns list of initials of months applicable in the given region.
206 &apos;&apos;&apos; The region expressed as a
207 &apos;&apos;&apos; - locale combining language-COUNTRY (la-CO)
208 &apos;&apos;&apos; - language only (la)
209 &apos;&apos;&apos; The list is zero-based.
210 &apos;&apos;&apos; Example:
211 &apos;&apos;&apos; MsgBox Join(Regio.MonthNarrowNames(&quot;it-IT&quot;), &quot;,&quot;) &apos; g,f,m,a,m,g,l,a,s,o,n,d
212 MonthNarrowNames = _PropertyGet(&quot;MonthNarrowNames&quot;, Region)
213 End Function &apos; ScriptForge.SF_Region.MonthNarrowNames (get)
215 REM -----------------------------------------------------------------------------
216 Property Get ObjectType As String
217 &apos;&apos;&apos; Only to enable object representation
218 ObjectType = &quot;SF_Region&quot;
219 End Property &apos; ScriptForge.SF_Region.ObjectType
221 REM -----------------------------------------------------------------------------
222 Property Get ServiceName As String
223 &apos;&apos;&apos; Internal use
224 ServiceName = &quot;ScriptForge.Region&quot;
225 End Property &apos; ScriptForge.SF_Region.ServiceName
227 REM -----------------------------------------------------------------------------
228 Property Get ThousandSeparator(Optional ByVal Region As Variant) As String
229 &apos;&apos;&apos; Returns the thousands separator used in numbers applicable in the given region.
230 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
231 &apos;&apos;&apos; Example:
232 &apos;&apos;&apos; MsgBox Regio.ThousandSeparator(&quot;it-IT&quot;) &apos; .
233 ThousandSeparator = _PropertyGet(&quot;ThousandSeparator&quot;, Region)
234 End Property &apos; ScriptForge.SF_Region.ThousandSeparator (get)
236 REM -----------------------------------------------------------------------------
237 Property Get TimeSeparator(Optional ByVal Region As Variant) As String
238 &apos;&apos;&apos; Returns the separator used to format times applicable in the given region.
239 &apos;&apos;&apos; The region is expressed as a locale combining language-COUNTRY (la-CO)
240 &apos;&apos;&apos; Example:
241 &apos;&apos;&apos; MsgBox Regio.TimeSeparator(&quot;it-IT&quot;) &apos; :
242 TimeSeparator = _PropertyGet(&quot;TimeSeparator&quot;, Region)
243 End Property &apos; ScriptForge.SF_Region.TimeSeparator (get)
245 REM ===================================================================== METHODS
247 REM -----------------------------------------------------------------------------
248 Public Function DSTOffset(Optional ByVal LocalDateTime As Variant _
249 , Optional ByVal TimeZone As Variant _
250 , Optional ByVal Locale As Variant _
251 ) As Integer
252 &apos;&apos;&apos; Computes the additional offset due to daylight saving (&quot;summer time&quot;)
253 &apos;&apos;&apos; Args
254 &apos;&apos;&apos; LocalDateTime: local date and time as a Date. DST offset varies during the year.
255 &apos;&apos;&apos; TimeZone: specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;
256 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or COUNTRY alone (CO)
257 &apos;&apos;&apos; Return:
258 &apos;&apos;&apos; The offset in minutes
259 &apos;&apos;&apos; Examples:
260 &apos;&apos;&apos; regio.DSTOffset(DateSerial(2022, 8, 20) + TimeSerial(16, 58, 17), &quot;Europe/Brussels&quot;, &quot;fr-BE&quot;) &apos; 60
262 Dim iDSTOffset As Integer &apos; Return value
263 Dim oLocale As Object &apos; com.sun.star.lang.Locale
264 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
265 Const cstThisSub = &quot;Region.DSTOffset&quot;
266 Const cstSubArgs = &quot;LocalDateTime, TimeZone, [Locale=&quot;&quot;&quot;&quot;]&quot;
268 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
269 iDSTOffset = 0
271 Check:
272 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
273 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
274 If Not SF_Utils._Validate(LocalDateTime, &quot;LocalDateTime&quot;, V_DATE) Then GoTo Finally
275 If Not SF_Utils._Validate(TimeZone, &quot;TimeZone&quot;, V_STRING) Then GoTo Finally
276 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
277 End If
279 Set oLocale = SF_Region._GetLocale(Locale, pbCountry := True)
280 If IsNull(oLocale) Then GoTo Finally
282 Try:
283 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
284 With oCalendarImpl
285 .loadDefaultCalendarTZ(oLocale, TimeZone)
286 .setLocalDateTime(LocaldateTime)
287 iDSTOffset = .getValue(com.sun.star.i18n.CalendarFieldIndex.DST_OFFSET)
288 End With
290 Finally:
291 DSTOffset = iDSTOffset
292 SF_Utils._ExitFunction(cstThisSub)
293 Exit Function
294 Catch:
295 GoTo Finally
296 End Function &apos; ScriptForge.SF_Region.DSTOffset
298 REM -----------------------------------------------------------------------------
299 Public Function GetProperty(Optional ByVal PropertyName As Variant _
300 , Optional Region As Variant _
301 ) As Variant
302 &apos;&apos;&apos; Return the actual value of the given property
303 &apos;&apos;&apos; Args:
304 &apos;&apos;&apos; PropertyName: the name of the property as a string
305 &apos;&apos;&apos; Region: the language-COUNTRY combination (la-CO) or the country (CO- or the language (la)
306 &apos;&apos;&apos; Returns:
307 &apos;&apos;&apos; The actual value of the property
308 &apos;&apos;&apos; Exceptions:
309 &apos;&apos;&apos; ARGUMENTERROR The property does not exist
311 Const cstThisSub = &quot;Region.GetProperty&quot;
312 Const cstSubArgs = &quot;&quot;
314 If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
315 GetProperty = Null
317 Check:
318 If IsMissing(Region) Or IsEmpty(Region) Then Region = &quot;&quot;
319 If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
320 If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
321 If Not ScriptForge.SF_Utils._Validate(Region, &quot;Region&quot;, V_STRING) Then GoTo Catch
322 End If
324 Try:
325 If Len(Region) = 0 Then
326 GetProperty = _PropertyGet(PropertyName)
327 Else
328 GetProperty = _PropertyGet(PropertyName, Region)
329 End If
331 Finally:
332 SF_Utils._ExitFunction(cstThisSub)
333 Exit Function
334 Catch:
335 GoTo Finally
336 End Function &apos; ScriptForge.SF_Region.GetProperty
338 REM -----------------------------------------------------------------------------
339 Public Function LocalDateTime(Optional ByVal UTCDateTime As Variant _
340 , Optional ByVal TimeZone As Variant _
341 , Optional ByVal Locale As Variant _
342 ) As Date
343 &apos;&apos;&apos; Computes the local date and time from a UTC date and time
344 &apos;&apos;&apos; Args
345 &apos;&apos;&apos; UTCDateTime: the universal date and time to be converted to local time
346 &apos;&apos;&apos; TimeZone: specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;
347 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or COUNTRY alone (CO)
348 &apos;&apos;&apos; Return:
349 &apos;&apos;&apos; The local time converted from the corresponding UTC date and time as a Date
350 &apos;&apos;&apos; If the returned value is before 1900, it is likely that the Locale is not recognized
351 &apos;&apos;&apos; If the returned value matches the local time, it is likely that the timezone is not recognized
352 &apos;&apos;&apos; Examples:
353 &apos;&apos;&apos; regio.LocalDateTime(DateSerial(2022, 3, 20) + TimeSerial(16, 58, 17), &quot;Europe/Brussels&quot;, &quot;fr-BE&quot;)
354 &apos;&apos;&apos; &apos; 2022-03-20 17:58:17
356 Dim dLocalDateTime As Double &apos; Return value
357 Dim oLocale As Object &apos; com.sun.star.lang.Locale
358 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
359 Const cstThisSub = &quot;Region.LocalDateTime&quot;
360 Const cstSubArgs = &quot;UTCDateTime, TimeZone, [Locale=&quot;&quot;&quot;&quot;]&quot;
362 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
363 dLocalDateTime = -1
365 Check:
366 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
367 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
368 If Not SF_Utils._Validate(LocalDateTime, &quot;LocalDateTime&quot;, V_DATE) Then GoTo Finally
369 If Not SF_Utils._Validate(TimeZone, &quot;TimeZone&quot;, V_STRING) Then GoTo Finally
370 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
371 End If
373 Set oLocale = SF_Region._GetLocale(Locale, pbCountry := True)
374 If IsNull(oLocale) Then GoTo Finally
376 Try:
377 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
378 With oCalendarImpl
379 .loadDefaultCalendarTZ(oLocale, TimeZone)
380 .setDateTime(UTCDateTime)
381 dLocalDateTime = .getLocalDateTime()
382 End With
384 Finally:
385 LocalDateTime = CDate(dLocalDateTime)
386 SF_Utils._ExitFunction(cstThisSub)
387 Exit Function
388 Catch:
389 GoTo Finally
390 End Function &apos; ScriptForge.SF_Region.LocalDateTime
392 REM -----------------------------------------------------------------------------
393 Public Function Methods() As Variant
394 &apos;&apos;&apos; Return the list of public methods of the Region class as an array
396 Methods = Array( _
397 &quot;DSTOffset&quot; _
398 , &quot;LocalDateTime&quot; _
399 , &quot;Number2Text&quot; _
400 , &quot;TimeZoneOffset&quot; _
401 , &quot;UTCDateTime&quot; _
402 , &quot;UTCNow&quot; _
405 End Function &apos; ScriptForge.SF_Region.Methods
407 REM -----------------------------------------------------------------------------
408 Public Function Number2Text(Optional ByVal Number As Variant _
409 , Optional ByVal Locale As Variant _
410 ) As String
411 &apos;&apos;&apos; Convert numbers and money amounts in many languages into words
412 &apos;&apos;&apos; Args
413 &apos;&apos;&apos; Number: the number to spell out
414 &apos;&apos;&apos; Accepted types: strings or numeric values (integer or real numbers)
415 &apos;&apos;&apos; When a string, a variety of prefixes is supported
416 &apos;&apos;&apos; The string &quot;help&quot; provides helpful tips about allowed prefixes by language
417 &apos;&apos;&apos; Example for french
418 &apos;&apos;&apos; un, deux, trois
419 &apos;&apos;&apos; feminine: une, deux, trois
420 &apos;&apos;&apos; masculine: un, deux, trois
421 &apos;&apos;&apos; ordinal: premier, deuxième, troisième
422 &apos;&apos;&apos; ordinal-feminine: première, deuxième, troisième
423 &apos;&apos;&apos; ordinal-masculine: premier, deuxième, troisième
424 &apos;&apos;&apos; informal: onze-cents, douze-cents, treize-cents
425 &apos;&apos;&apos; Numbers may be prefixed by ISO currency codes (EUR, USD, ...)
426 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or language alone (la)
427 &apos;&apos;&apos; The list of supported languages can be found on
428 &apos;&apos;&apos; https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1linguistic2_1_1XNumberText.html
429 &apos;&apos;&apos; Return:
430 &apos;&apos;&apos; The number or amount transformed in words
431 &apos;&apos;&apos; Examples:
432 &apos;&apos;&apos; regio.Number2Text(&quot;help&quot;, &quot;fr&quot;) &apos; See above
433 &apos;&apos;&apos; regio.Number2Text(&quot;79,93&quot;, &quot;fr-BE&quot;) &apos; septante-neuf virgule nonante-trois
434 &apos;&apos;&apos; regio.Number2Text(Pi(), &quot;pt-BR&quot;) &apos; três vírgula um quatro um cinco nove dois seis cinco três cinco oito nove sete nove
435 &apos;&apos;&apos; regio.Number2Text(&quot;EUR 1234.56&quot;, &quot;it&quot;) &apos; milleduecentotrentaquattro euro cinquantasei centesimi
437 Dim sNumber2Text As String &apos; Return value
438 Dim oLocale As Object &apos; com.sun.star.lang.Locale
439 Dim oNumber2Text As Object &apos; com.sun.star.linguistic2.NumberText
440 Const cstThisSub = &quot;Region.Number2Text&quot;
441 Const cstSubArgs = &quot;Number, [Locale=&quot;&quot;&quot;&quot;]&quot;
443 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
444 sNumber2Text = &quot;&quot;
446 Check:
447 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
448 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
449 If Not SF_Utils._Validate(Number, &quot;Number&quot;, Array(V_STRING, V_NUMERIC)) Then GoTo Finally
450 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
451 End If
453 Set oLocale = SF_Region._GetLocale(Locale, pbLanguage := True)
454 If IsNull(oLocale) Then GoTo Finally
456 Try:
457 Set oNumber2Text = SF_Utils._GetUNOService(&quot;Number2Text&quot;)
458 sNumber2Text = oNumber2Text.getNumberText(Number, oLocale)
460 Finally:
461 Number2Text = sNumber2Text
462 SF_Utils._ExitFunction(cstThisSub)
463 Exit Function
464 Catch:
465 GoTo Finally
466 End Function &apos; ScriptForge.SF_Region.Number2Text
468 REM -----------------------------------------------------------------------------
469 Public Function Properties() As Variant
470 &apos;&apos;&apos; Return the list or properties of the Region class as an array
472 Properties = Array( _
473 &quot;Country&quot; _
474 , &quot;Currency&quot; _
475 , &quot;DatePatterns&quot; _
476 , &quot;DateSeparator&quot; _
477 , &quot;DayAbbrevNames&quot; _
478 , &quot;DayNames&quot; _
479 , &quot;DayNarrowNames&quot; _
480 , &quot;DecimalPoint&quot; _
481 , &quot;Language&quot; _
482 , &quot;ListSeparator&quot; _
483 , &quot;MonthAbbrevNames&quot; _
484 , &quot;MonthNames&quot; _
485 , &quot;MonthNarrowNames&quot; _
486 , &quot;ThousandSeparator&quot; _
487 , &quot;TimeSeparator&quot; _
490 End Function &apos; ScriptForge.SF_Region.Properties
492 REM -----------------------------------------------------------------------------
493 Public Function TimeZoneOffset(Optional ByVal TimeZone As Variant _
494 , Optional ByVal Locale As Variant _
495 ) As Integer
496 &apos;&apos;&apos; Computes the offset between GMT and the given timezone and locale
497 &apos;&apos;&apos; Args
498 &apos;&apos;&apos; TimeZone: specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;
499 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or COUNTRY alone (CO)
500 &apos;&apos;&apos; Return:
501 &apos;&apos;&apos; The offset in minutes
502 &apos;&apos;&apos; Examples:
503 &apos;&apos;&apos; regio.TimeZoneOffset(&quot;Europe/Brussels&quot;, &quot;fr-BE&quot;) &apos; 60
505 Dim iTimeZoneOffset As Integer &apos; Return value
506 Dim oLocale As Object &apos; com.sun.star.lang.Locale
507 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
508 Const cstThisSub = &quot;Region.TimeZoneOffset&quot;
509 Const cstSubArgs = &quot;TimeZone, [Locale=&quot;&quot;&quot;&quot;]&quot;
511 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
512 iTimeZoneOffset = 0
514 Check:
515 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
516 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
517 If Not SF_Utils._Validate(TimeZone, &quot;TimeZone&quot;, V_STRING) Then GoTo Finally
518 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
519 End If
521 Set oLocale = SF_Region._GetLocale(Locale, pbCountry := True)
522 If IsNull(oLocale) Then GoTo Finally
524 Try:
525 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
526 With oCalendarImpl
527 .loadDefaultCalendarTZ(oLocale, TimeZone)
528 iTimeZoneOffset = .getValue(com.sun.star.i18n.CalendarFieldIndex.ZONE_OFFSET)
529 End With
531 Finally:
532 TimeZoneOffset = iTimeZoneOffset
533 SF_Utils._ExitFunction(cstThisSub)
534 Exit Function
535 Catch:
536 GoTo Finally
537 End Function &apos; ScriptForge.SF_Region.TimeZoneOffset
539 REM -----------------------------------------------------------------------------
540 Public Function UTCDateTime(Optional ByVal LocalDateTime As Variant _
541 , Optional ByVal TimeZone As Variant _
542 , Optional ByVal Locale As Variant _
543 ) As Date
544 &apos;&apos;&apos; Computes the UTC date and time of a given local date and time
545 &apos;&apos;&apos; Args
546 &apos;&apos;&apos; LocalDateTime: the date and time measured in a given timezone
547 &apos;&apos;&apos; TimeZone: specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;
548 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or COUNTRY alone (CO)
549 &apos;&apos;&apos; Return:
550 &apos;&apos;&apos; The local time converted to the corresponding UTC date and time as a Date
551 &apos;&apos;&apos; If the returned value is before 1900, it is likely that the Locale is not recognized
552 &apos;&apos;&apos; If the returned value matches the local time, it is likely that the the timezone is not recognized
553 &apos;&apos;&apos; Examples:
554 &apos;&apos;&apos; regio.UTCDateTime(DateSerial(2022, 3, 20) + TimeSerial(17, 58, 17), &quot;Europe/Brussels&quot;, &quot;fr-BE&quot;)
555 &apos;&apos;&apos; &apos; 2022-03-20 16:58:17
557 Dim dUTCDateTime As Double &apos; Return value
558 Dim oLocale As Object &apos; com.sun.star.lang.Locale
559 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
560 Const cstThisSub = &quot;Region.UTCDateTime&quot;
561 Const cstSubArgs = &quot;LocalDateTime, TimeZone, [Locale=&quot;&quot;&quot;&quot;]&quot;
563 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
564 dUTCDateTime = -1
566 Check:
567 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
568 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
569 If Not SF_Utils._Validate(LocalDateTime, &quot;LocalDateTime&quot;, V_DATE) Then GoTo Finally
570 If Not SF_Utils._Validate(TimeZone, &quot;TimeZone&quot;, V_STRING) Then GoTo Finally
571 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
572 End If
574 Set oLocale = SF_Region._GetLocale(Locale, pbCountry := True)
575 If IsNull(oLocale) Then GoTo Finally
577 Try:
578 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
579 With oCalendarImpl
580 .loadDefaultCalendarTZ(oLocale, TimeZone)
581 .setLocalDateTime(LocalDateTime)
582 dUTCDateTime = .getDateTime()
583 End With
585 Finally:
586 UTCDateTime = CDate(dUTCDateTime)
587 SF_Utils._ExitFunction(cstThisSub)
588 Exit Function
589 Catch:
590 GoTo Finally
591 End Function &apos; ScriptForge.SF_Region.UTCDateTime
593 REM -----------------------------------------------------------------------------
594 Public Function UTCNow(Optional ByVal TimeZone As Variant _
595 , Optional ByVal Locale As Variant _
596 ) As Date
597 &apos;&apos;&apos; Computes the actual UTC date and time
598 &apos;&apos;&apos; Args
599 &apos;&apos;&apos; TimeZone: specified as &quot;Region/City&quot; name like &quot;Europe/Berlin&quot;, or a custom time zone ID such as &quot;UTC&quot; or &quot;GMT-8:00&quot;
600 &apos;&apos;&apos; Locale: expressed as a locale combining language-COUNTRY (la-CO), or COUNTRY alone (CO)
601 &apos;&apos;&apos; Return:
602 &apos;&apos;&apos; The actual UTC date and time as a Date
603 &apos;&apos;&apos; If the returned value is before 1900, it is likely that the Locale is not recognized
604 &apos;&apos;&apos; If the returned value matches the local time, it is likely that the the timezone is not recognized
605 &apos;&apos;&apos; Examples:
606 &apos;&apos;&apos; regio.UTCNow(&quot;Europe/Brussels&quot;, &quot;fr-BE&quot;) &apos; 2022-03-20 16:58:17
608 Dim dUTCNow As Double &apos; Return value
609 Dim oLocale As Object &apos; com.sun.star.lang.Locale
610 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
611 Const cstThisSub = &quot;Region.UTCNow&quot;
612 Const cstSubArgs = &quot;TimeZone, [Locale=&quot;&quot;&quot;&quot;]&quot;
614 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
615 dUTCNow = -1
617 Check:
618 If IsMissing(Locale) Or IsEmpty(Locale) Then Locale = &quot;&quot;
619 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
620 If Not SF_Utils._Validate(TimeZone, &quot;TimeZone&quot;, V_STRING) Then GoTo Finally
621 If Not SF_Utils._Validate(Locale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
622 End If
624 Set oLocale = SF_Region._GetLocale(Locale, pbCountry := True)
625 If IsNull(oLocale) Then GoTo Finally
627 Try:
628 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
629 With oCalendarImpl
630 .loadDefaultCalendarTZ(oLocale, TimeZone)
631 .setLocalDateTime(Now())
632 dUTCNow = .getDateTime()
633 End With
635 Finally:
636 UTCNow = CDate(dUTCNow)
637 SF_Utils._ExitFunction(cstThisSub)
638 Exit Function
639 Catch:
640 GoTo Finally
641 End Function &apos; ScriptForge.SF_Region.UTCNow
643 REM =========================================================== PRIVATE FUNCTIONS
645 REM -----------------------------------------------------------------------------
646 Private Function _GetLocale(ByVal psLocale As String _
647 , Optional ByVal pbCountry As Variant _
648 , Optional ByVal pbLanguage As Variant _
649 ) As Object
650 &apos;&apos;&apos; Convert a locale given as a string to a com.sun.star.lang.Locale object
651 &apos;&apos;&apos; Args:
652 &apos;&apos;&apos; psLocale: the input string, as &quot;la-CO&quot;, &quot;la&quot; or &quot;CO&quot;
653 &apos;&apos;&apos; pbCountry: True when &quot;CO&quot; only is admitted
654 &apos;&apos;&apos; pbLanguage: True when &quot;la&quot; only is admitted
655 &apos;&apos;&apos; At most one out of pbLanguage or pbCountry may be True
656 &apos;&apos;&apos; Returns:
657 &apos;&apos;&apos; com.sun.star.lang.Locale
659 Dim sLocale As String &apos; &quot;la-CO&quot;
660 Dim iLocale As Integer &apos; Index in reference tables
661 Dim oLocale As Object &apos; Return value com.sun.star.lang.Locale
662 Dim i As Integer
664 If IsMissing(pbCountry) Or IsEmpty(pbCountry) Then pbCountry = False
665 If IsMissing(pbLanguage) Or IsEmpty(pbLanguage) Then pbLanguage = False
667 _LoadAllLocales() &apos; Initialize locale reference tables
669 Check:
670 &apos; The argument may be a language &quot;la&quot;, a country &quot;CO&quot; or a Locale &quot;la-CO&quot;
671 &apos; Scan the reference tables to find a valid locale as a com.sun.star.lang.Locale
672 Set oLocale = Nothing : sLocale = &quot;&quot; : iLocale = -1
673 If Len(psLocale) = 0 Then &apos; Default value is the office com.sun.star.i18n.Locale
674 sLocale = UserLocale
675 iLocale = UserIndex
676 ElseIf InStr(psLocale, &quot;-&quot;) = 0 Then &apos; Language only or country only
677 Select Case True
678 Case pbLanguage
679 &apos; Find any locale having the argument as language
680 For i = 0 To UBound(LocaleNames)
681 &apos; A language is presumed 2 or 3 characters long
682 If Split(LocaleNames(i), &quot;-&quot;)(0) = LCase(psLocale) Then
683 sLocale = LocaleNames(i)
684 iLocale = i
685 Exit For
686 End If
687 Next i
688 Case pbCountry
689 &apos; Find any locale having the argument as country
690 For i = 0 To UBound(LocaleNames)
691 &apos; A country is presumed exactly 2 characters long
692 If Right(LocaleNames(i), 2) = UCase(psLocale) Then
693 sLocale = LocaleNames(i)
694 iLocale = i
695 Exit For
696 End If
697 Next i
698 Case Else
699 End Select
700 Else &apos; A full locale is given
701 iLocale = SF_Array.IndexOf(LocaleNames, psLocale, CaseSensitive := False)
702 If iLocale &gt;= 0 Then sLocale = LocaleNames(iLocale)
703 End If
705 Try:
706 &apos; Build error message when relevant
707 If iLocale &lt; 0 Then
708 If Not SF_Utils._Validate(psLocale, &quot;Locale&quot;, V_STRING, LocaleNames) Then GoTo Finally
709 Else
710 Set oLocale = CreateUnoStruct(&quot;com.sun.star.lang.Locale&quot;)
711 oLocale.Language = Split(sLocale, &quot;-&quot;)(0) &apos; A language is 2 or 3 characters long
712 oLocale.Country = Right(sLocale, 2)
713 End If
715 Finally:
716 Set _GetLocale = oLocale
717 Exit Function
718 End Function &apos; ScriptForge.SF_Region._GetLocale
720 REM -----------------------------------------------------------------------------
721 Private Sub _LoadAllLocales()
722 &apos;&apos;&apos; Initialize the LocaleNames array = the list of all available locales in the LibreOffice installation
724 Dim oOffice As Object &apos; com.sun.star.lang.Locale
725 Dim vLocales As Variant &apos; Array of com.sun.star.lang.Locale
726 Dim iTop As Integer &apos; Upper bound of LocaleNames
727 Dim i As Integer
729 Try:
730 &apos; Office locale
731 If Len(UserLocale) = 0 Then
732 Set oOffice = SF_Utils._GetUNOService(&quot;OfficeLocale&quot;)
733 UserLocale = oOffice.Language &amp; &quot;-&quot; &amp; oOffice.Country
734 End If
736 &apos; LocaleData, localeNames and UserIndex
737 If IsEmpty(LocaleData) Or IsNull(LocaleData) Or Not IsArray(LocaleNames) Then
738 LocaleData = SF_Utils._GetUNOService(&quot;LocaleData&quot;)
739 vLocales = LocaleData.getAllInstalledLocaleNames()
740 LocaleNames = Array()
741 iTop = UBound(vLocales)
742 ReDim LocaleNames(0 To iTop)
743 For i = 0 To iTop
744 LocaleNames(i) = vLocales(i).Language &amp; &quot;-&quot; &amp; vLocales(i).Country
745 If LocaleNames(i) = UserLocale Then UserIndex = i
746 Next i
747 End If
749 End Sub &apos; ScriptForge.SF_Region._LoadAllLocales
751 REM -----------------------------------------------------------------------------
752 Private Function _PropertyGet(Optional ByVal psProperty As String _
753 , Optional ByVal pvLocale As Variant) As Variant
754 &apos;&apos;&apos; Return the value of the named property
755 &apos;&apos;&apos; Args:
756 &apos;&apos;&apos; psProperty: the name of the property
757 &apos;&apos;&apos; pvLocale: a locale in the form language-COUNTRY (la-CO) or language only, or country only
758 &apos;&apos;&apos; When language or country only, any locale matching either the language or the country is selected
760 Dim oLocale As Object &apos; com.sun.star.lang.Locale
761 Dim vCurrencies As Variant &apos; Array of com.sun.star.i18n.Currency
762 Dim oCurrency As Object &apos; com.sun.star.i18n.Currency
763 Dim oLanguageCountryInfo As Object &apos; com.sun.star.i18n.LanguageCountryInfo
764 Dim oLocaleDataItem2 As Object &apos; com.sun.star.i18n.LocaleDataItem2
765 Dim oCalendarImpl As Object &apos; com.sun.star.i18n.CalendarImpl
766 Dim oCalItem As Object &apos; com.sun.star.i18n.CalendarItem2
767 Dim vCalItems() As Variant &apos; Array of days/months
768 Dim i As Integer, j As Integer
770 Dim cstThisSub As String
771 Const cstSubArgs = &quot;&quot;
773 cstThisSub = &quot;Region.Get&quot; &amp; psProperty
774 SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
776 Check:
777 If IsMissing(pvLocale) Or IsEmpty(pvLocale) Then pvLocale = &quot;&quot;
778 If Not SF_Utils._Validate(pvLocale, &quot;Locale&quot;, V_STRING) Then GoTo Finally
780 Select Case psProperty
781 Case &quot;Currency&quot;, &quot;Country&quot;
782 Set oLocale = SF_Region._GetLocale(pvLocale, pbCountry := True) &apos; Country only is admitted
783 Case &quot;Language&quot;, &quot;DayNames&quot;, &quot;DayAbbrevNames&quot;, &quot;DayNarrowNames&quot; _
784 , &quot;MonthNames&quot;, &quot;MonthAbbrevNames&quot;, &quot;MonthNarrowNames&quot;
785 Set oLocale = SF_Region._GetLocale(pvLocale, pbLanguage := True) &apos; Language only is admitted
786 Case Else
787 Set oLocale = SF_Region._GetLocale(pvLocale)
788 End Select
789 If IsNull(oLocale) Then GoTo Finally
791 Try:
792 Select Case psProperty
793 Case &quot;Country&quot;, &quot;Language&quot;
794 Set oLanguageCountryInfo = LocaleData.getLanguageCountryInfo(oLocale)
795 With oLanguageCountryInfo
796 If psProperty = &quot;Country&quot; Then _PropertyGet = .CountryDefaultName Else _PropertyGet = .LanguageDefaultName
797 End With
798 Case &quot;Currency&quot;
799 vCurrencies = LocaleData.getAllCurrencies(oLocale)
800 _PropertyGet = &quot;&quot;
801 For Each oCurrency In vCurrencies
802 If oCurrency.Default Then
803 _PropertyGet = oCurrency.BankSymbol
804 Exit For
805 End If
806 Next oCurrency
807 Case &quot;DatePatterns&quot;
808 _PropertyGet = LocaleData.getDateAcceptancePatterns(oLocale)
809 Case &quot;DateSeparator&quot;, &quot;DecimalPoint&quot;, &quot;ListSeparator&quot;, &quot;ThousandSeparator&quot;, &quot;TimeSeparator&quot;
810 Set oLocaleDataItem2 = LocaleData.getLocaleItem2(oLocale)
811 With oLocaleDataItem2
812 Select Case psProperty
813 Case &quot;DateSeparator&quot; : _PropertyGet = .dateSeparator
814 Case &quot;DecimalPoint&quot; : _PropertyGet = .decimalSeparator
815 Case &quot;ListSeparator&quot; : _PropertyGet = .listSeparator
816 Case &quot;ThousandSeparator&quot; : _PropertyGet = .thousandSeparator
817 Case &quot;TimeSeparator&quot; : _PropertyGet = .timeSeparator
818 End Select
819 End With
820 Case &quot;DayAbbrevNames&quot;, &quot;DayNames&quot;, &quot;DayNarrowNames&quot;
821 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
822 With oCalendarImpl
823 .loadDefaultCalendar(oLocale)
824 vCalItems = Array() : ReDim vCalItems(0 To 6)
825 For i = 0 To UBound(.Days2)
826 Set oCalItem = .Days2(i)
827 j = Iif(i = 0, 6, i - 1)
828 Select Case psProperty
829 Case &quot;DayNames&quot; : vCalItems(j) = oCalItem.FullName
830 Case &quot;DayAbbrevNames&quot; : vCalItems(j) = oCalItem.AbbrevName
831 Case &quot;DayNarrowNames&quot; : vCalItems(j) = oCalItem.NarrowName
832 End Select
833 Next i
834 _PropertyGet = vCalItems
835 End With
836 Case &quot;MonthAbbrevNames&quot;, &quot;MonthNames&quot;, &quot;MonthNarrowNames&quot;
837 Set oCalendarImpl = SF_Utils._GetUNOService(&quot;CalendarImpl&quot;)
838 With oCalendarImpl
839 .loadDefaultCalendar(oLocale)
840 vCalItems = Array() : ReDim vCalItems(0 To 11)
841 For i = 0 To UBound(.Months2)
842 Set oCalItem = .Months2(i)
843 Select Case psProperty
844 Case &quot;MonthNames&quot; : vCalItems(i) = oCalItem.FullName
845 Case &quot;MonthAbbrevNames&quot; : vCalItems(i) = oCalItem.AbbrevName
846 Case &quot;MonthNarrowNames&quot; : vCalItems(i) = oCalItem.NarrowName
847 End Select
848 Next i
849 _PropertyGet = vCalItems
850 End With
851 Case Else
852 _PropertyGet = &quot;&quot;
853 End Select
855 Finally:
856 SF_Utils._ExitFunction(cstThisSub)
857 Exit Function
858 End Function &apos; ScriptForge.SF_Region._PropertyGet
860 REM ================================================ END OF SCRIPTFORGE.SF_REGION
861 </script:module>