tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / wizards / source / scriptforge / SF_Platform.xba
blobade9681b54c40be9d86628bd3023d51782a938c3
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_Platform" 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_Platform
13 &apos;&apos;&apos; ===========
14 &apos;&apos;&apos; Singleton class implementing the &quot;ScriptForge.Platform&quot; service
15 &apos;&apos;&apos; Implemented as a usual Basic module
16 &apos;&apos;&apos;
17 &apos;&apos;&apos; A collection of properties about the execution environment:
18 &apos;&apos;&apos; - HW platform
19 &apos;&apos;&apos; - Operating System
20 &apos;&apos;&apos; - current user
21 &apos;&apos;&apos; - LibreOffice version
22 &apos;&apos;&apos;
23 &apos;&apos;&apos; Service invocation example:
24 &apos;&apos;&apos; Dim platform As Variant
25 &apos;&apos;&apos; platform = CreateScriptService(&quot;Platform&quot;)
26 &apos;&apos;&apos;
27 &apos;&apos;&apos; Detailed user documentation:
28 &apos;&apos;&apos; https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_platform.html?DbPAR=BASIC
29 &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;
31 REM ================================================================== EXCEPTIONS
33 REM ============================================================ MODULE CONSTANTS
35 REM ===================================================== CONSTRUCTOR/DESTRUCTOR
37 REM -----------------------------------------------------------------------------
38 Public Function Dispose() As Variant
39 Set Dispose = Nothing
40 End Function &apos; ScriptForge.SF_Array Explicit destructor
42 REM ================================================================== PROPERTIES
44 REM -----------------------------------------------------------------------------
45 Property Get Architecture() As String
46 &apos;&apos;&apos; Returns the actual bit architecture
47 &apos;&apos;&apos; Example:
48 &apos;&apos;&apos; MsgBox platform.Architecture &apos; 64bit
49 Architecture = _PropertyGet(&quot;Architecture&quot;)
50 End Property &apos; ScriptForge.SF_Platform.Architecture (get)
52 REM -----------------------------------------------------------------------------
53 Property Get ComputerName() As String
54 &apos;&apos;&apos; Returns the computer&apos;s network name
55 &apos;&apos;&apos; Example:
56 &apos;&apos;&apos; MsgBox platform.ComputerName
57 ComputerName = _PropertyGet(&quot;ComputerName&quot;)
58 End Property &apos; ScriptForge.SF_Platform.ComputerName (get)
60 REM -----------------------------------------------------------------------------
61 Property Get CPUCount() As Integer
62 &apos;&apos;&apos; Returns the number of Central Processor Units
63 &apos;&apos;&apos; Example:
64 &apos;&apos;&apos; MsgBox platform.CPUCount &apos; 4
65 CPUCount = _PropertyGet(&quot;CPUCount&quot;)
66 End Property &apos; ScriptForge.SF_Platform.CPUCount (get)
68 REM -----------------------------------------------------------------------------
69 Property Get CurrentUser() As String
70 &apos;&apos;&apos; Returns the name of logged in user
71 &apos;&apos;&apos; Example:
72 &apos;&apos;&apos; MsgBox platform.CurrentUser
73 CurrentUser = _PropertyGet(&quot;CurrentUser&quot;)
74 End Property &apos; ScriptForge.SF_Platform.CurrentUser (get)
76 REM -----------------------------------------------------------------------------
77 Property Get Extensions() As Variant
78 &apos;&apos;&apos; Returns the list of availableeExtensions as an unsorted array of unique strings
79 &apos;&apos;&apos; To get the list sorted, use SF_Array.Sort()
80 &apos;&apos;&apos; Example:
81 &apos;&apos;&apos; myExtensionsList = platform.Extensions
82 Extensions = _PropertyGet(&quot;Extensions&quot;)
83 End Property &apos; ScriptForge.SF_Platform.Extensions (get)
85 REM -----------------------------------------------------------------------------
86 Property Get FilterNames() As Variant
87 &apos;&apos;&apos; Returns the list of available document import and export filter names as an unsorted array of unique strings
88 &apos;&apos;&apos; To get the list sorted, use SF_Array.Sort()
89 &apos;&apos;&apos; Example:
90 &apos;&apos;&apos; myFilterNamesList = platform.FilterNames
91 FilterNames = _PropertyGet(&quot;FilterNames&quot;)
92 End Property &apos; ScriptForge.SF_Platform.FilterNames (get)
94 REM -----------------------------------------------------------------------------
95 Property Get Fonts() As Variant
96 &apos;&apos;&apos; Returns the list of available fonts as an unsorted array of unique strings
97 &apos;&apos;&apos; To get the list sorted, use SF_Array.Sort()
98 &apos;&apos;&apos; Example:
99 &apos;&apos;&apos; myFontsList = platform.Fonts
100 Fonts = _PropertyGet(&quot;Fonts&quot;)
101 End Property &apos; ScriptForge.SF_Platform.Fonts (get)
103 REM -----------------------------------------------------------------------------
104 Property Get FormatLocale() As String
105 &apos;&apos;&apos; Returns the locale used for number and date formats, combining language-COUNTRY (la-CO)
106 &apos;&apos;&apos; Example:
107 &apos;&apos;&apos; MsgBox platform.FormatLocale
108 FormatLocale = _PropertyGet(&quot;FormatLocale&quot;)
109 End Property &apos; ScriptForge.SF_Platform.FormatLocale (get)
111 REM -----------------------------------------------------------------------------
112 Property Get Locale() As String
113 &apos;&apos;&apos; Returns the locale of the operating system, combining language-COUNTRY (la-CO)
114 &apos;&apos;&apos; Example:
115 &apos;&apos;&apos; MsgBox platform.Locale
116 Locale = _PropertyGet(&quot;Locale&quot;)
117 End Property &apos; ScriptForge.SF_Platform.Locale (get)
119 REM -----------------------------------------------------------------------------
120 Property Get Machine() As String
121 &apos;&apos;&apos; Returns the machine type like &apos;i386&apos; or &apos;x86_64&apos;
122 &apos;&apos;&apos; Example:
123 &apos;&apos;&apos; MsgBox platform.Machine
124 Machine = _PropertyGet(&quot;Machine&quot;)
125 End Property &apos; ScriptForge.SF_Platform.Machine (get)
127 REM -----------------------------------------------------------------------------
128 Property Get ObjectType As String
129 &apos;&apos;&apos; Only to enable object representation
130 ObjectType = &quot;SF_Platform&quot;
131 End Property &apos; ScriptForge.SF_Platform.ObjectType
133 REM -----------------------------------------------------------------------------
134 Property Get OfficeLocale() As String
135 &apos;&apos;&apos; Returns the locale of the user interface, combining language-COUNTRY (la-CO)
136 &apos;&apos;&apos; Example:
137 &apos;&apos;&apos; MsgBox platform.OfficeLocale
138 OfficeLocale = _PropertyGet(&quot;OfficeLocale&quot;)
139 End Property &apos; ScriptForge.SF_Platform.OfficeLocale (get)
141 REM -----------------------------------------------------------------------------
142 Property Get OfficeVersion() As String
143 &apos;&apos;&apos; Returns the office software version in the form &apos;LibreOffice w.x.y.z (The Document Foundation)&apos;
144 &apos;&apos;&apos; Example:
145 &apos;&apos;&apos; MsgBox platform.OfficeVersion
146 OfficeVersion = _PropertyGet(&quot;OfficeVersion&quot;)
147 End Property &apos; ScriptForge.SF_Platform.OfficeVersion (get)
149 REM -----------------------------------------------------------------------------
150 Property Get OSName() As String
151 &apos;&apos;&apos; Returns the name of the operating system like &apos;Linux&apos; or &apos;Windows&apos;
152 &apos;&apos;&apos; Example:
153 &apos;&apos;&apos; MsgBox platform.OSName
154 OSName = _PropertyGet(&quot;OSName&quot;)
155 End Property &apos; ScriptForge.SF_Platform.OSName (get)
157 REM -----------------------------------------------------------------------------
158 Property Get OSPlatform() As String
159 &apos;&apos;&apos; Returns a single string identifying the underlying platform with as much useful and human-readable information as possible
160 &apos;&apos;&apos; Example:
161 &apos;&apos;&apos; MsgBox platform.OSPlatform &apos; Linux-4.15.0-117-generic-x86_64-with-Ubuntu-18.04-bionic
162 OSPlatform = _PropertyGet(&quot;OSPlatform&quot;)
163 End Property &apos; ScriptForge.SF_Platform.OSPlatform (get)
165 REM -----------------------------------------------------------------------------
166 Property Get OSRelease() As String
167 &apos;&apos;&apos; Returns the operating system&apos;s release
168 &apos;&apos;&apos; Example:
169 &apos;&apos;&apos; MsgBox platform.OSRelease &apos; 4.15.0-117-generic
170 OSRelease = _PropertyGet(&quot;OSRelease&quot;)
171 End Property &apos; ScriptForge.SF_Platform.OSRelease (get)
173 REM -----------------------------------------------------------------------------
174 Property Get OSVersion() As String
175 &apos;&apos;&apos; Returns the name of the operating system build or version
176 &apos;&apos;&apos; Example:
177 &apos;&apos;&apos; MsgBox platform.OSVersion &apos; #118-Ubuntu SMP Fri Sep 4 20:02:41 UTC 2020
178 OSVersion = _PropertyGet(&quot;OSVersion&quot;)
179 End Property &apos; ScriptForge.SF_Platform.OSVersion (get)
181 REM -----------------------------------------------------------------------------
182 Property Get Printers() As Variant
183 &apos;&apos;&apos; Returns the list of available printers type as a zero-based array
184 &apos;&apos;&apos; The default printer is put in the 1st position in the list (index = 0)
185 &apos;&apos;&apos; Example:
186 &apos;&apos;&apos; MsgBox join(platform.Printers, &quot;,&quot;)
187 Printers = _PropertyGet(&quot;Printers&quot;)
188 End Property &apos; ScriptForge.SF_Platform.Printers (get)
190 REM -----------------------------------------------------------------------------
191 Property Get Processor() As String
192 &apos;&apos;&apos; Returns the (real) processor name, e.g. &apos;amdk6&apos;. Might return the same value as Machine
193 &apos;&apos;&apos; Example:
194 &apos;&apos;&apos; MsgBox platform.Processor
195 Processor = _PropertyGet(&quot;Processor&quot;)
196 End Property &apos; ScriptForge.SF_Platform.Processor (get)
198 REM -----------------------------------------------------------------------------
199 Property Get PythonVersion() As String
200 &apos;&apos;&apos; Returns the Python version as string &apos;Python major.minor.patchlevel&apos;
201 &apos;&apos;&apos; Example:
202 &apos;&apos;&apos; MsgBox platform.PythonVersion &apos; Python 3.7.7
203 PythonVersion = _PropertyGet(&quot;PythonVersion&quot;)
204 End Property &apos; ScriptForge.SF_Platform.PythonVersion (get)
206 REM -----------------------------------------------------------------------------
207 Property Get ServiceName As String
208 &apos;&apos;&apos; Internal use
209 ServiceName = &quot;ScriptForge.Platform&quot;
210 End Property &apos; ScriptForge.SF_Platform.ServiceName
212 REM -----------------------------------------------------------------------------
213 Property Get SystemLocale() As String
214 &apos;&apos;&apos; Returns the locale of the operating system, combining language-COUNTRY (la-CO)
215 &apos;&apos;&apos; Example:
216 &apos;&apos;&apos; MsgBox platform.SystemLocale
217 SystemLocale = _PropertyGet(&quot;SystemLocale&quot;)
218 End Property &apos; ScriptForge.SF_Platform.SystemLocale (get)
220 REM -----------------------------------------------------------------------------
221 Property Get UserData() As Variant
222 &apos;&apos;&apos; Returns a dictionary of all Options + User Data values
223 &apos;&apos;&apos; Example:
224 &apos;&apos;&apos; dict = platform.UserData
225 UserData = _PropertyGet(&quot;UserData&quot;)
226 End Property &apos; ScriptForge.SF_Platform.UserData (get)
228 REM ===================================================================== METHODS
230 REM -----------------------------------------------------------------------------
231 Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
232 &apos;&apos;&apos; Return the actual value of the given property
233 &apos;&apos;&apos; Args:
234 &apos;&apos;&apos; PropertyName: the name of the property as a string
235 &apos;&apos;&apos; Returns:
236 &apos;&apos;&apos; The actual value of the property
237 &apos;&apos;&apos; If the property does not exist, returns Null
238 &apos;&apos;&apos; Exceptions:
239 &apos;&apos;&apos; ARGUMENTERROR The property does not exist
241 Const cstThisSub = &quot;Platform.GetProperty&quot;
242 Const cstSubArgs = &quot;&quot;
244 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
245 GetProperty = Null
247 Check:
248 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
249 If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
250 End If
252 Try:
253 GetProperty = _PropertyGet(PropertyName)
255 Finally:
256 SF_Utils._ExitFunction(cstThisSub)
257 Exit Function
258 Catch:
259 GoTo Finally
260 End Function &apos; ScriptForge.SF_Platform.GetProperty
262 REM -----------------------------------------------------------------------------
263 Public Function Methods() As Variant
264 &apos;&apos;&apos; Return the list of public methods of the Model service as an array
266 Methods = Array( _
269 End Function &apos; ScriptForge.SF_Platform.Methods
271 REM -----------------------------------------------------------------------------
272 Public Function Properties() As Variant
273 &apos;&apos;&apos; Return the list or properties of the Platform class as an array
275 Properties = Array( _
276 &quot;Architecture&quot; _
277 , &quot;ComputerName&quot; _
278 , &quot;CPUCount&quot; _
279 , &quot;CurrentUser&quot; _
280 , &quot;Extensions&quot; _
281 , &quot;FilterNames&quot; _
282 , &quot;Fonts&quot; _
283 , &quot;FormatLocale&quot; _
284 , &quot;Locale&quot; _
285 , &quot;Machine&quot; _
286 , &quot;OfficeLocale&quot; _
287 , &quot;OfficeVersion&quot; _
288 , &quot;OSName&quot; _
289 , &quot;OSPlatform&quot; _
290 , &quot;OSRelease&quot; _
291 , &quot;OSVersion&quot; _
292 , &quot;Printers&quot; _
293 , &quot;Processor&quot; _
294 , &quot;PythonVersion&quot; _
295 , &quot;SystemLocale&quot; _
296 , &quot;UserData&quot; _
299 End Function &apos; ScriptForge.SF_Platform.Properties
301 REM =========================================================== PRIVATE FUNCTIONS
303 REM -----------------------------------------------------------------------------
304 Public Function _GetPrinters() as Variant
305 &apos;&apos;&apos; Returns the list of available printers.
306 &apos;&apos;&apos; The default printer is put in the 1st position (index = 0)
308 Dim oPrinterServer As Object &apos; com.sun.star.awt.PrinterServer
309 Dim vPrinters As Variant &apos; Array of printer names
310 Dim sDefaultPrinter As String &apos; The default printer
311 Dim lDefault As Long &apos; Initial position of the default printer in the list
313 On Local Error GoTo Catch &apos; Prevent any error
314 vPrinters = Array()
316 Try:
317 &apos; Find printers
318 Set oPrinterServer = SF_Utils._GetUNOService(&quot;PrinterServer&quot;)
319 With oPrinterServer
320 vPrinters = .getPrinterNames()
321 sDefaultPrinter = .getDefaultPrinterName()
322 End With
324 &apos; Put the default printer on top of the list
325 If Len(sDefaultPrinter) &gt; 0 Then
326 lDefault = SF_Array.IndexOf(vPrinters, sDefaultPrinter, CaseSensitive := True)
327 If lDefault &gt; 0 Then &apos; Invert 2 printers
328 vPrinters(lDefault) = vPrinters(0)
329 vPrinters(0) = sDefaultPrinter
330 End If
331 End If
333 Finally:
334 _GetPrinters() = vPrinters()
335 Exit Function
336 Catch:
337 GoTo Finally
338 End Function &apos; ScriptForge.SF_Platform._GetPrinters
340 REM -----------------------------------------------------------------------------
341 Public Function _GetProductName() as String
342 &apos;&apos;&apos; Returns Office product and version numbers found in configuration registry
343 &apos;&apos;&apos; Derived from the Tools library
345 Dim oProdNameAccess as Object &apos; configmgr.RootAccess
346 Dim sProdName as String
347 Dim sVersion as String
348 Dim sVendor As String
350 On Local Error GoTo Catch &apos; Prevent any error
351 _GetProductName = &quot;&quot;
353 Try:
354 Set oProdNameAccess = SF_Utils._GetRegistryKeyContent(&quot;org.openoffice.Setup/Product&quot;)
356 sProdName = oProdNameAccess.ooName
357 sVersion = oProdNameAccess.ooSetupVersionAboutBox
358 sVendor = oProdNameAccess.ooVendor
360 _GetProductName = sProdName &amp; &quot; &quot; &amp; sVersion &amp; &quot; (&quot; &amp; sVendor &amp; &quot;)&quot;
362 Finally:
363 Exit Function
364 Catch:
365 GoTo Finally
366 End Function &apos; ScriptForge.SF_Platform._GetProductName
368 REM -----------------------------------------------------------------------------
369 Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
370 &apos;&apos;&apos; Return the value of the named property
371 &apos;&apos;&apos; Args:
372 &apos;&apos;&apos; psProperty: the name of the property
374 Dim sOSName As String &apos; Operating system
375 Dim oLocale As Object &apos; com.sun.star.lang.Locale
376 Dim oPrinterServer As Object &apos; com.sun.star.awt.PrinterServer
377 Dim oToolkit As Object &apos; com.sun.star.awt.Toolkit
378 Dim oDevice As Object &apos; com.sun.star.awt.XDevice
379 Dim oFilterFactory As Object &apos; com.sun.star.document.FilterFactory
380 Dim oFontDescriptors As Variant &apos; Array of com.sun.star.awt.FontDescriptor
381 Dim sFonts As String &apos; Comma-separated list of fonts
382 Dim sFont As String &apos; A single font name
383 Dim vExtensionsList As Variant &apos; Array of extension descriptors
384 Dim sExtensions As String &apos; Comma separated list of extensions
385 Dim sExtension As String &apos; A single extension name
386 Dim vUserDataInternal As Variant&apos; The internal names of the supported user data items
387 Dim vUserDataExternal As Variant&apos; The external names of the supported user data items
388 Dim vUserData As Variant &apos; A SF_Dictionary instance linking user data external names and values
389 Dim vUserDataOptions As Variant &apos; configmgr.RootAccess
390 Dim i As Long
392 Const cstPyHelper = &quot;$&quot; &amp; &quot;_SF_Platform&quot;
393 Dim cstThisSub As String
394 Const cstSubArgs = &quot;&quot;
396 cstThisSub = &quot;Platform.get&quot; &amp; psProperty
397 SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
399 Select Case psProperty
400 Case &quot;Architecture&quot;, &quot;ComputerName&quot;, &quot;CPUCount&quot;, &quot;CurrentUser&quot;, &quot;Machine&quot; _
401 , &quot;OSPlatform&quot;, &quot;OSRelease&quot;, &quot;OSVersion&quot;, &quot;Processor&quot;, &quot;PythonVersion&quot;
402 With ScriptForge.SF_Session
403 _PropertyGet = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper &amp; cstPyHelper, psProperty)
404 End With
405 Case &quot;Extensions&quot;
406 Set vExtensionsList = SF_Utils._GetUnoService(&quot;PackageInformationProvider&quot;).ExtensionList
407 sExtensions = &quot;&quot;
408 For i = 0 To UBound(vExtensionsList)
409 sExtensions = sExtensions &amp; &quot;,&quot; &amp; vExtensionsList(i)(0)
410 Next i
411 If Len(sExtensions) &gt; 0 Then _PropertyGet = Split(Mid(sExtensions, 2), &quot;,&quot;) Else _PropertyGet = Array()
412 Case &quot;FilterNames&quot;
413 Set oFilterFactory = SF_Utils._GetUNOService(&quot;FilterFactory&quot;)
414 _PropertyGet = oFilterFactory.getElementNames()
415 Case &quot;Fonts&quot;
416 Set oToolkit = SF_Utils._GetUnoService(&quot;Toolkit&quot;)
417 Set oDevice = oToolkit.createScreenCompatibleDevice(0, 0)
418 oFontDescriptors = oDevice.FontDescriptors()
419 sFonts = &quot;,&quot;
420 &apos; Select only not yet registered fonts
421 For i = 0 To UBound(oFontDescriptors)
422 sFont = oFontDescriptors(i).Name
423 If InStr(1, sFonts, &quot;,&quot; &amp; sFont &amp; &quot;,&quot;, 0) = 0 Then sFonts = sFonts &amp; sFont &amp; &quot;,&quot; &apos; Case-sensitive comparison
424 Next i
425 &apos; Remove leading and trailing commas
426 If Len(sFonts) &gt; 1 Then _PropertyGet = Split(Mid(sFonts, 2, Len(sFonts) - 2), &quot;,&quot;) Else _PropertyGet = Array()
427 Case &quot;FormatLocale&quot;
428 Set oLocale = SF_Utils._GetUNOService(&quot;FormatLocale&quot;)
429 _PropertyGet = oLocale.Language &amp; &quot;-&quot; &amp; oLocale.Country
430 Case &quot;OfficeLocale&quot;
431 Set oLocale = SF_Utils._GetUNOService(&quot;OfficeLocale&quot;)
432 _PropertyGet = oLocale.Language &amp; &quot;-&quot; &amp; oLocale.Country
433 Case &quot;OfficeVersion&quot;
434 _PropertyGet = _GetProductName()
435 Case &quot;OSName&quot;
436 &apos; Calc INFO function preferred to Python script to avoid ScriptForge initialization risks when Python is not installed
437 sOSName = _SF_.OSName
438 If sOSName = &quot;&quot; Then
439 sOSName = SF_Session.ExecuteCalcFunction(&quot;INFO&quot;, &quot;system&quot;)
440 Select Case sOSName
441 Case &quot;WNT&quot; : sOSName = &quot;Windows&quot;
442 Case &quot;MACOSX&quot; : sOSName = &quot;macOS&quot;
443 Case &quot;LINUX&quot; : sOSName = &quot;Linux&quot;
444 Case &quot;SOLARIS&quot; : sOSName = &quot;Solaris&quot;
445 Case Else : sOSName = SF_String.Capitalize(sOSName)
446 End Select
447 EndIf
448 _PropertyGet = sOSName
449 Case &quot;Printers&quot;
450 _PropertyGet = _GetPrinters()
451 Case &quot;SystemLocale&quot;, &quot;Locale&quot;
452 Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
453 _PropertyGet = oLocale.Language &amp; &quot;-&quot; &amp; oLocale.Country
454 Case &quot;UserData&quot;
455 vUserDataExternal = Array( _
456 &quot;city&quot;, &quot;company&quot;, &quot;country&quot;, &quot;email&quot;, &quot;encryptionkey&quot;, &quot;encrypttoself&quot;, &quot;fax&quot; _
457 , &quot;firstname&quot;, &quot;homephone&quot;, &quot;initials&quot;, &quot;lastname&quot;, &quot;officephone&quot;, &quot;position&quot; _
458 , &quot;postalcode&quot;, &quot;signingkey&quot;, &quot;state&quot;, &quot;street&quot;, &quot;title&quot; _
460 vUserDataInternal = Array( _
461 &quot;l&quot;, &quot;o&quot;, &quot;c&quot;, &quot;mail&quot;, &quot;encryptionkey&quot;, &quot;encrypttoself&quot;, &quot;facsimiletelephonenumber&quot; _
462 , &quot;givenname&quot;, &quot;homephone&quot;, &quot;initials&quot;, &quot;sn&quot;, &quot;telephonenumber&quot;, &quot;position&quot; _
463 , &quot;postalcode&quot;, &quot;signingkey&quot;, &quot;st&quot;, &quot;street&quot;, &quot;title&quot; _
465 &apos; Get the UserData page from the Options database
466 vUserDataOptions = SF_Utils._GetRegistryKeyContent(&quot;org.openoffice.UserProfile/Data&quot;)
467 &apos; Create and feed an output dictionary with case-sensitive comparison of keys
468 vUserData = CreateScriptService(&quot;ScriptForge.Dictionary&quot;, True)
469 For i = 0 To UBound(vUserDataExternal)
470 vUserData.Add(vUserDataExternal(i), vUserDataOptions.getByName(vUserDataInternal(i)))
471 Next i
472 _PropertyGet = vUserData
473 Case Else
474 _PropertyGet = Null
475 End Select
477 Finally:
478 SF_Utils._ExitFunction(cstThisSub)
479 Exit Function
480 End Function &apos; ScriptForge.SF_Platform._PropertyGet
482 REM ============================================ END OF SCRIPTFORGE.SF_PLATFORM
483 </script:module>