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_Services" 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 =======================================================================================================================
11 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
12 ''' SF_Services
13 ''' ===========
14 ''' Singleton class implementing the
"ScriptForge.Services
" service
15 ''' Implemented as a usual Basic module
16 ''' The ScriptForge framework includes
17 ''' the current ScriptForge library
18 ''' a number of
"associated
" libraries
19 ''' any user/contributor extension wanting to fit into the framework
20 ''' The methods in this module constitute the kernel of the ScriptForge framework
21 ''' - RegisterScriptServices
22 ''' Register for a library the list of services it implements
23 ''' Each library in the framework must implement its own RegisterScriptServices method
24 ''' This method consists in a series of invocations of next
2 methods
25 ''' - RegisterService
26 ''' Register a single service
27 ''' - RegisterEventManager
28 ''' Register a single event manager
29 ''' - CreateScriptService
30 ''' Called by user scripts to get an object giving access to a service or to the event manager
32 ''' Detailed user documentation:
33 ''' https://help.libreoffice.org/latest/en-US/text/sbasic/shared/
03/sf_services.html?DbPAR=BASIC
34 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
36 REM ================================================================== EXCEPTIONS
38 Const UNKNOWNSERVICEERROR =
"UNKNOWNSERVICEERROR
" ' Service not found within the registered services of the given library
39 Const SERVICESNOTLOADEDERROR =
"SERVICESNOTLOADEDERROR
" ' Failure during the registering of the services of the given library
40 Const UNKNOWNFILEERROR =
"UNKNOWNFILEERROR
" ' Source file does not exist
42 REM ============================================================== PUBLIC MEMBERS
44 ' Defines an entry in in the services dictionary
47 ServiceType As Integer
50 ' 2 Method reference as a string
51 ServiceReference As Object
52 ServiceMethod As String
53 EventManager As Boolean
' True if registered item is an event manager
56 Private vServicesArray As Variant
' List of services registered by a library
58 REM ============================================================== PUBLIC METHODS
60 REM -----------------------------------------------------------------------------
61 Public Function CreateScriptService(Optional ByRef Service As Variant _
62 , ParamArray pvArgs As Variant _
64 ''' Create access to the services of a library for the benefit of a user script
65 ''' A service is to understand either:
66 ''' as a set of methods gathered in a Basic standard module
67 ''' or a set of methods and properties gathered in a Basic class module
68 ''' Args:
69 ''' Service: the name of the service in
2 parts
"library.service
"
70 ''' The library is a Basic library that must exist in the GlobalScope
71 ''' (default =
"ScriptForge
")
72 ''' The service is one of the services registered by the library
73 ''' thru the RegisterScriptServices() routine
74 ''' pvArgs: a set of arguments passed to the constructor of the service
75 ''' This is only possible if the service refers to a Basic class module
76 ''' Returns
77 ''' The object containing either the reference of the Basic module
78 ''' or of the Basic class instance
79 ''' Both are Basic objects
80 ''' Returns Nothing if an error occurred.
81 ''' ==
>> NOTE: The error can be within the user script creating the new class instance
82 ''' Exceptions:
83 ''' SERVICESNOTLOADEDERROR RegisterScriptService probable failure
84 ''' UNKNOWNSERVICEERROR Service not found
85 ''' Examples
86 ''' CreateScriptService(
"Array
")
87 ''' =
> Refers to ScriptForge.Array or SF_Array
88 ''' CreateScriptService(
"ScriptForge.Dictionary
")
89 ''' =
> Returns a new empty dictionary;
"ScriptForge.
" is optional
90 ''' CreateScriptService(
"SFDocuments.Calc
")
91 ''' =
> Refers to the Calc service, implemented in the SFDocuments library
92 ''' CreateScriptService(
"Dialog
", dlgName)
93 ''' =
> Returns a Dialog instance referring to the dlgName dialog
94 ''' CreateScriptService(
"SFDocuments.Event
", oEvent)
95 ''' =
> Refers to the Document service instance, implemented in the SFDocuments library, having triggered the event
97 Dim vScriptService As Variant
' Return value
98 Dim vServiceItem As Variant
' A single service (see _Service type definition)
99 Dim vServicesList As Variant
' Output of RegisterScriptServices
100 Dim vSplit As Variant
' Array to split argument in
101 Dim sLibrary As String
' Library part of the argument
102 Dim sService As String
' Service part of the argument
103 Dim vLibrary As Variant
' Dictionary of libraries
104 Dim vService As Variant
' An individual service object
105 Const cstThisSub =
"SF_Services.CreateScriptService
"
106 Const cstSubArgs =
"Service, arg0[, arg1] ...
"
108 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
109 Set vScriptService = Nothing
112 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
113 If Not SF_Utils._Validate(Service,
"Service
", V_STRING) Then GoTo Catch
114 If Len(Service) =
0 Then GoTo CatchNotFound
118 ' Initialize the list of services when CreateScriptService called for the very
1st time
119 If IsEmpty(_SF_.ServicesList) Then _SF_.ServicesList = SF_Services._NewDictionary()
121 ' Simple parsing of argument
122 vSplit = Split(Service,
".
")
123 If UBound(vSplit)
> 1 Then GoTo CatchNotFound
124 If UBound(vSplit) =
0 Then
125 sLibrary =
"ScriptForge
" ' Yes, the default value !
127 ' Accept other default values for associated libraries
128 Select Case LCase(sService)
129 Case
"document
",
"calc
",
"writer
",
"base
",
"formdocument
",
"documentevent
",
"formevent
"
130 sLibrary =
"SFDocuments
"
131 Case
"dialog
",
"dialogevent
",
"newdialog
"
132 sLibrary =
"SFDialogs
"
133 Case
"database
",
"datasheet
" : sLibrary =
"SFDatabases
"
134 Case
"unittest
" : sLibrary =
"SFUnitTests
"
135 Case
"menu
",
"popupmenu
",
"toolbar
",
"toolbarbutton
"
136 sLibrary =
"SFWidgets
"
144 With _SF_.ServicesList
146 ' Load the set of services from the library, if not yet done
147 If Not .Exists(sLibrary) Then
148 If Not SF_Services._LoadLibraryServices(sLibrary) Then GoTo CatchNotLoaded
151 ' Find and return the requested service
152 vServicesList = .Item(sLibrary)
153 If Not vServicesList.Exists(sService) Then GoTo CatchNotFound
154 vServiceItem = vServicesList.Item(sService)
155 Select Case vServiceItem.ServiceType
156 Case
1 ' Basic module
157 vScriptService = vServiceItem.ServiceReference
158 Case
2 ' Method to call
159 If sLibrary =
"ScriptForge
" Then
' Direct call
160 Select Case UCase(sService)
161 Case
"DICTIONARY
" : vScriptService = SF_Services._NewDictionary()
162 Case
"L10N
" : vScriptService = SF_Services._NewL10N(pvArgs)
163 Case
"TIMER
" : vScriptService = SF_Services._NewTimer(pvArgs)
166 Else
' Call via script provider
167 Set vService = SF_Session._GetScript(
"Basic
", SF_Session.SCRIPTISAPPLICATION, vServiceItem.ServiceMethod)
168 vScriptService = vService.Invoke(Array(pvArgs()), Array(), Array())
176 CreateScriptService = vScriptService
177 SF_Utils._ExitFunction(cstThisSub)
182 SF_Exception.RaiseFatal(UNKNOWNSERVICEERROR,
"Service
", Service, sLibrary, sService)
185 SF_Exception.RaiseFatal(SERVICESNOTLOADEDERROR,
"Service
", Service, sLibrary)
187 End Function
' ScriptForge.SF_Services.CreateScriptService
189 REM -----------------------------------------------------------------------------
190 Public Function RegisterEventManager(Optional ByVal ServiceName As Variant _
191 , Optional ByRef ServiceReference As Variant _
193 ''' Register into ScriptForge a new event entry for the library
194 ''' from which this method is called
195 ''' MUST BE CALLED ONLY from a specific RegisterScriptServices() method
196 ''' Usually the method should be called only once by library
197 ''' Args:
198 ''' ServiceName: the name of the service as a string. It the service exists
199 ''' already for the library the method overwrites the existing entry
200 ''' ServiceReference: the function which will identify the source of the triggered event
201 ''' something like:
"libraryname.modulename.function
"
202 ''' Returns:
203 ''' True if successful
204 ''' Example:
205 ''' ' Code snippet stored in a module contained in the SFDocuments library
206 ''' Sub RegisterScriptServices()
207 ''' ' Register the events manager of the library
208 ''' RegisterEventManager(
"DocumentEvent
",
"SFDocuments.SF_Register._EventManager
")
209 ''' End Sub
210 ''' ' Code snippet stored in a user script
211 ''' Sub Trigger(poEvent As Object)
' Triggered by a DOCUMENTEVENT event
212 ''' Dim myDoc As Object
213 ''' ' To get the document concerned by the event:
214 ''' Set myDoc = CreateScriptService(
"SFDocuments.DocumentEvent
", poEvent)
215 ''' End Sub
217 Dim bRegister As Boolean
' Return value
218 Const cstThisSub =
"SF_Services.RegisterEventManager
"
219 Const cstSubArgs =
"ServiceName, ServiceReference
"
221 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
225 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
226 If Not SF_Utils._Validate(ServiceName,
"ServiceName
", V_STRING) Then GoTo Finally
227 If Not SF_Utils._Validate(ServiceReference,
"ServiceReference
",V_STRING) Then GoTo Finally
231 bRegister = _AddToServicesArray(ServiceName, ServiceReference, True)
234 RegisterEventManager = bRegister
235 SF_Utils._ExitFunction(cstThisSub)
239 End Function
' ScriptForge.SF_Services.RegisterEventManager
241 REM -----------------------------------------------------------------------------
242 Public Function RegisterService(Optional ByVal ServiceName As Variant _
243 , Optional ByRef ServiceReference As Variant _
245 ''' Register into ScriptForge a new service entry for the library
246 ''' from which this method is called
247 ''' MUST BE CALLED ONLY from a specific RegisterScriptServices() method
248 ''' Args:
249 ''' ServiceName: the name of the service as a string. It the service exists
250 ''' already for the library the method overwrites the existing entry
251 ''' ServiceReference: either
252 ''' - the Basic module that implements the methods of the service
253 ''' something like: GlobalScope.Library.Module
254 ''' - an instance of the class implementing the methods and properties of the service
255 ''' something like:
"libraryname.modulename.function
"
256 ''' Returns:
257 ''' True if successful
259 Dim bRegister As Boolean
' Return value
260 Const cstThisSub =
"SF_Services.RegisterService
"
261 Const cstSubArgs =
"ServiceName, ServiceReference
"
263 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
267 If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
268 If Not SF_Utils._Validate(ServiceName,
"ServiceName
", V_STRING) Then GoTo Finally
269 If Not SF_Utils._Validate(ServiceReference,
"ServiceReference
", Array(V_STRING, V_OBJECT)) Then GoTo Finally
273 bRegister = _AddToServicesArray(ServiceName, ServiceReference, False)
276 RegisterService = bRegister
277 SF_Utils._ExitFunction(cstThisSub)
281 End Function
' ScriptForge.SF_Services.RegisterService
283 REM -----------------------------------------------------------------------------
284 Public Sub RegisterScriptServices() As Variant
285 ''' Register into ScriptForge the list of the services implemented by the current library
286 ''' Each library pertaining to the framework must implement its own version of this method
287 ''' This method may be stored in any standard (i.e. not class-) module
289 ''' Each individual service is registered by calling the RegisterService() method
291 ''' The current version is given as an example
293 With GlobalScope.ScriptForge.SF_Services
294 .RegisterService(
"Array
", GlobalScope.ScriptForge.SF_Array)
' Reference to the Basic module
295 .RegisterService(
"Dictionary
",
"ScriptForge.SF_Services._NewDictionary
")
' Reference to the function initializing the service
296 .RegisterService(
"Exception
", GlobalScope.ScriptForge.SF_Exception)
297 .RegisterService(
"FileSystem
", GlobalScope.ScriptForge.SF_FileSystem)
298 .RegisterService(
"L10N
",
"ScriptForge.SF_Services._NewL10N
")
299 .RegisterService(
"Platform
", GlobalScope.ScriptForge.SF_Platform)
300 .RegisterService(
"Region
", GlobalScope.ScriptForge.SF_Region)
301 .RegisterService(
"Session
", GlobalScope.ScriptForge.SF_Session)
302 .RegisterService(
"String
", GlobalScope.ScriptForge.SF_String)
303 .RegisterService(
"Timer
",
"ScriptForge.SF_Services._NewTimer
")
304 .RegisterService(
"UI
", GlobalScope.ScriptForge.SF_UI)
308 End Sub
' ScriptForge.SF_Services.RegisterScriptServices
310 REM =========================================================== PRIVATE FUNCTIONS
312 REM -----------------------------------------------------------------------------
313 Private Function _AddToServicesArray(ByVal psServiceName As String _
314 , ByRef pvServiceReference As Variant _
315 , ByVal pbEvent As Boolean _
317 ''' Add the arguments as an additional row in vServicesArray (Public variable)
318 ''' Called from RegisterService and RegisterEvent methods
320 Dim bRegister As Boolean
' Return value
321 Dim lMax As Long
' Number of rows in vServicesArray
326 ' Ignore when method is not called from RegisterScriptServices()
327 If IsEmpty(vServicesArray) Or IsNull(vServicesArray) Or Not IsArray(vServicesArray) Then GoTo Finally
330 lMax = UBound(vServicesArray,
1) +
1
332 ReDim vServicesArray(
0 To
0,
0 To
2)
334 ReDim Preserve vServicesArray(
0 To lMax,
0 To
2)
336 vServicesArray(lMax,
0) = psServiceName
337 vServicesArray(lMax,
1) = pvServiceReference
338 vServicesArray(lMax,
2) = pbEvent
342 _AddToServicesArray = bRegister
344 End Function
' ScriptForge.SF_Services._AddToServicesArray
346 REM -----------------------------------------------------------------------------
347 Private Function _FindModuleFromMethod(ByVal psLibrary As String _
348 , ByVal psMethod As String _
350 ''' Find in the given library the name of the module containing
351 ''' the method given as
2nd argument (usually RegisterScriptServices)
352 ''' Args:
353 ''' psLibrary: the name of the Basic library
354 ''' psMethod: the method to locate
355 ''' Returns:
356 ''' The name of the module or a zero-length string if not found
358 Dim vCategories As Variant
' "user
" or
"share
" library categories
359 Dim sCategory As String
360 Dim vLanguages As Variant
' "Basic
",
"Python
", ... programming languages
361 Dim sLanguage As String
362 Dim vLibraries As Variant
' Library names
363 Dim sLibrary As String
364 Dim vModules As Variant
' Module names
365 Dim sModule As String
' Return value
366 Dim vMethods As Variant
' Method/properties/subs/functions
367 Dim sMethod As String
368 Dim oRoot As Object
' com.sun.star.script.browse.BrowseNodeFactory
369 Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer
371 _FindModuleFromMethod =
""
372 Set oRoot = SF_Utils._GetUNOService(
"BrowseNodeFactory
").createView(com.sun.star.script.browse.BrowseNodeFactoryViewTypes.MACROORGANIZER)
374 ' Exploration is done via tree nodes
375 If Not IsNull(oRoot) Then
376 If oRoot.hasChildNodes() Then
377 vCategories = oRoot.getChildNodes()
378 For i =
0 To UBound(vCategories)
379 sCategory = vCategories(i).getName()
380 ' Consider
"My macros
& Dialogs
" and
"LibreOffice Macros
& Dialogs
" only
381 If sCategory =
"user
" Or sCategory =
"share
" Then
382 If vCategories(i).hasChildNodes() Then
383 vLanguages = vCategories(i).getChildNodes()
384 For j =
0 To UBound(vLanguages)
385 sLanguage = vLanguages(j).getName()
386 ' Consider Basic libraries only
387 If sLanguage =
"Basic
" Then
388 If vLanguages(j).hasChildNodes() Then
389 vLibraries = vLanguages(j).getChildNodes()
390 For k =
0 To UBound(vLibraries)
391 sLibrary = vLibraries(k).getName()
392 ' Consider the given library only
393 If sLibrary = psLibrary Then
394 If vLibraries(k).hasChildNodes() Then
395 vModules = vLibraries(k).getChildNodes()
396 For l =
0 To UBound(vModules)
397 sModule = vModules(l).getName()
398 ' Check if the module contains the targeted method
399 If vModules(l).hasChildNodes() Then
400 vMethods = vModules(l).getChildNodes()
401 For m =
0 To UBound(vMethods)
402 sMethod = vMethods(m).getName()
403 If sMethod = psMethod Then
404 _FindModuleFromMethod = sModule
422 End Function
' ScriptForge.SF_Services._FindModuleFromMethod
424 REM -----------------------------------------------------------------------------
425 Private Function _LoadLibraryServices(ByVal psLibrary As String) As Boolean
426 ''' Execute psLibrary.RegisterScriptServices() and load its services into the persistent storage
427 ''' Args:
428 ''' psLibrary: the name of the Basic library
429 ''' Library will be loaded if not yet done
430 ''' Returns:
431 ''' True if success
432 ''' The list of services is loaded directly into the persistent storage
435 Dim vServicesList As Variant
' Dictionary of services
436 Dim vService As Variant
' Single service entry in dictionary
437 Dim vServiceItem As Variant
' Single service in vServicesArray
438 Dim sModule As String
' Name of module containing the RegisterScriptServices method
440 Const cstRegister =
"RegisterScriptServices
"
443 _LoadLibraryServices = False
445 vServicesArray = Array()
447 If psLibrary =
"ScriptForge
" Then
449 ScriptForge.SF_Services.RegisterScriptServices()
451 ' Register services via script provider
452 If GlobalScope.BasicLibraries.hasByName(psLibrary) Then
453 If Not GlobalScope.BasicLibraries.isLibraryLoaded(psLibrary) Then
454 GlobalScope.BasicLibraries.LoadLibrary(psLibrary)
459 sModule = SF_Services._FindModuleFromMethod(psLibrary, cstRegister)
460 If Len(sModule) =
0 Then GoTo Finally
461 SF_Session.ExecuteBasicScript(, psLibrary
& ".
" & sModule
& ".
" & cstRegister)
464 ' Store in persistent storage
465 ' - Create list of services for the current library
466 Set vServicesList = SF_Services._NewDictionary()
467 For i =
0 To UBound(vServicesArray,
1)
468 Set vService = New _Service
470 .ServiceName = vServicesArray(i,
0)
471 vServiceItem = vServicesArray(i,
1)
472 If VarType(vServiceItem) = V_STRING Then
474 .ServiceMethod = vServiceItem
475 Set .ServiceReference = Nothing
478 .ServiceMethod =
""
479 Set .ServiceReference = vServiceItem
481 .EventManager = vServicesArray(i,
2)
483 vServicesList.Add(vServicesArray(i,
0), vService)
485 ' - Add the new dictionary to the persistent dictionary
486 _SF_.ServicesList.Add(psLibrary, vServicesList)
487 _LoadLibraryServices = True
488 vServicesArray = Empty
492 End Function
' ScriptForge.SF_Services._LoadLibraryServices
494 REM -----------------------------------------------------------------------------
495 Public Function _NewDictionary() As Variant
496 ''' Create a new instance of the SF_Dictionary class
497 ''' Returns: the instance or Nothing
501 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
506 Set oDict = New SF_Dictionary
507 Set oDict.[Me] = oDict
510 Set _NewDictionary = oDict
515 End Function
' ScriptForge.SF_Services._NewDictionary
517 REM -----------------------------------------------------------------------------
518 Public Function _NewL10N(Optional ByVal pvArgs As Variant) As Variant
519 ''' Create a new instance of the SF_L10N class
521 ''' FolderName: the folder containing the PO files in SF_FileSystem.FileNaming notation
522 ''' Locale: locale of user session (default) or any other valid la{nguage]-CO[UNTRY] combination
523 ''' The country part is optional. Valid are f.i.
"fr
",
"fr-CH
",
"en-US
"
524 ''' Encoding: The character set that should be used
525 ''' Use one of the Names listed in https://www.iana.org/assignments/character-sets/character-sets.xhtml
526 ''' Note that LibreOffice probably does not implement all existing sets
527 ''' Default = UTF-
8
528 ''' Locale2: fallback Locale to select if Locale po file does not exist (typically
"en-US
")
529 ''' Encoding2: Encoding of the
2nd Locale file
530 ''' Returns: the instance or Nothing
531 ''' Exceptions:
532 ''' UNKNOWNFILEERROR The PO file does not exist
534 Dim oL10N As Variant
' Return value
535 Dim sFolderName As String
' Folder containing the PO files
536 Dim sLocale As String
' Passed argument or that of the user session
537 Dim sLocale2 As String
' Alias for Locale2
538 Dim oLocale As Variant
' com.sun.star.lang.Locale
539 Dim sPOFile As String
' PO file must exist
540 Dim sEncoding As String
' Alias for Encoding
541 Dim sEncoding2 As String
' Alias for Encoding2
543 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
546 If IsMissing(pvArgs) Then pvArgs = Array()
547 sPOFile =
""
548 sEncoding =
""
549 If UBound(pvArgs)
>=
0 Then
550 If Not SF_Utils._ValidateFile(pvArgs(
0),
"Folder (Arg0)
", , True) Then GoTo Catch
551 sFolderName = pvArgs(
0)
552 sLocale =
""
553 If UBound(pvArgs)
>=
1 Then
554 If Not SF_Utils._Validate(pvArgs(
1),
"Locale (Arg1)
", V_STRING) Then GoTo Catch
557 If Len(sLocale) =
0 Then
' Called from Python, the Locale argument may be the zero-length string
558 Set oLocale = SF_Utils._GetUNOService(
"OfficeLocale
")
559 sLocale = oLocale.Language
& "-
" & oLocale.Country
561 If UBound(pvArgs)
>=
2 Then
562 If IsMissing(pvArgs(
2)) Or IsEmpty(pvArgs(
2)) Then pvArgs(
2) =
"UTF-
8"
563 If Not SF_Utils._Validate(pvArgs(
2),
"Encoding (Arg2)
", V_STRING) Then GoTo Catch
564 sEncoding = pvArgs(
2)
566 sEncoding =
"UTF-
8"
568 sLocale2 =
""
569 If UBound(pvArgs)
>=
3 Then
570 If Not SF_Utils._Validate(pvArgs(
3),
"Locale2 (Arg3)
", V_STRING) Then GoTo Catch
573 If UBound(pvArgs)
>=
4 Then
574 If Not SF_Utils._Validate(pvArgs(
4),
"Encoding2 (Arg4)
", V_STRING) Then GoTo Catch
575 sEncoding2 = pvArgs(
4)
577 sEncoding2 =
"UTF-
8"
579 If Len(sFolderName)
> 0 Then
580 sPOFile = SF_FileSystem.BuildPath(sFolderName, sLocale
& ".po
")
581 If Not SF_FileSystem.FileExists(sPOFile) Then
582 If Len(sLocale2) =
0 Then GoTo CatchNotExists
' No fallback =
> error
583 ' Try the fallback
584 sPOFile = SF_FileSystem.BuildPath(sFolderName, sLocale2
& ".po
")
585 If Not SF_FileSystem.FileExists(sPOFile) Then GoTo CatchNotExists
586 sEncoding = sEncoding2
592 Set oL10N = New SF_L10N
593 Set oL10N.[Me] = oL10N
594 oL10N._Initialize(sPOFile, sEncoding)
603 SF_Exception.RaiseFatal(UNKNOWNFILEERROR,
"FileName
", sPOFile)
605 End Function
' ScriptForge.SF_Services._NewL10N
607 REM -----------------------------------------------------------------------------
608 Public Function _NewTimer(Optional ByVal pvArgs As Variant) As Variant
609 ''' Create a new instance of the SF_Timer class
610 ''' Args:
611 ''' [
0] : If True, start the timer immediately
612 ''' Returns: the instance or Nothing
614 Dim oTimer As Variant
' Return value
615 Dim bStart As Boolean
' Automatic start ?
617 If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
620 If IsMissing(pvArgs) Then pvArgs = Array()
621 If UBound(pvArgs)
< 0 Then
624 If Not SF_Utils._Validate(pvArgs(
0),
"Start (Arg0)
", V_BOOLEAN) Then GoTo Catch
628 Set oTimer = New SF_Timer
629 Set oTimer.[Me] = oTimer
630 If bStart Then oTimer.Start()
633 Set _NewTimer = oTimer
638 End Function
' ScriptForge.SF_Services._NewTimer
640 REM ============================================== END OF SCRIPTFORGE.SF_SERVICES