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_Root" 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 =======================================================================================================================
14 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
15 ''' SF_Root
16 ''' =======
17 ''' FOR INTERNAL USE ONLY
18 ''' Singleton class holding all persistent variables shared
19 ''' by all the modules of the ScriptForge library
20 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
22 REM ============================================================= PRIVATE MEMBERS
25 Private [Me] As Object
26 Private [_Parent] As Object
27 Private ObjectType As String
' Must be
"ROOT
"
28 Private MainFunction As String
' Name of method or property called by user script
29 Private MainFunctionArgs As String
' Syntax of method called by user script
30 Private StackLevel As Integer
' Depth of calls between internal methods
32 ' Error management
33 Private ErrorHandler As Boolean
' True = error handling active, False = internal debugging
34 Private ConsoleLines() As Variant
' Array of messages displayable in console
35 Private ConsoleDialog As Object
' SFDialogs.Dialog object
36 Private ConsoleControl As Object
' SFDialogs.DialogControl object
37 Private DisplayEnabled As Boolean
' When True, display of console or error messages is allowed
38 Private StopWhenError As Boolean
' When True, process stops after error
> "WARNING
"
39 Private DebugMode As Boolean
' When True, log enter/exit each official Sub
41 ' Services management
42 Private ServicesList As Variant
' Dictionary of provided services
44 ' Usual UNO services
45 Private FunctionAccess As Object
' com.sun.star.sheet.FunctionAccess
46 Private PathSettings As Object
' com.sun.star.util.PathSettings
47 Private PathSubstitution As Object
' com.sun.star.util.PathSubstitution
48 Private ScriptProvider As Object
' com.sun.star.script.provider.MasterScriptProviderFactory
49 Private SystemShellExecute As Object
' com.sun.star.system.SystemShellExecute
50 Private CoreReflection As Object
' com.sun.star.reflection.CoreReflection
51 Private DispatchHelper As Object
' com.sun.star.frame.DispatchHelper
52 Private TextSearch As Object
' com.sun.star.util.TextSearch
53 Private SearchOptions As Object
' com.sun.star.util.SearchOptions
54 Private Locale As Object
' com.sun.star.lang.Locale
55 Private CharacterClass As Object
' com.sun.star.i18n.CharacterClassification
56 Private FileAccess As Object
' com.sun.star.ucb.SimpleFileAccess
57 Private FilterFactory As Object
' com.sun.star.document.FilterFactory
58 Private FolderPicker As Object
' com.sun.star.ui.dialogs.FolderPicker
59 Private FilePicker As Object
' com.sun.star.ui.dialogs.FilePicker
60 Private URLTransformer As Object
' com.sun.star.util.URLTransformer
61 Private Introspection As Object
' com.sun.star.beans.Introspection
62 Private BrowseNodeFactory As Object
' com.sun.star.script.browse.BrowseNodeFactory
63 Private DatabaseContext As Object
' com.sun.star.sdb.DatabaseContext
64 Private ConfigurationProvider _
65 As Object
' com.sun.star.configuration.ConfigurationProvider
66 Private MailService As Object
' com.sun.star.system.SimpleCommandMail or com.sun.star.system.SimpleSystemMail
68 ' Specific persistent services objects or properties
69 Private FileSystemNaming As String
' If
"SYS
", file and folder naming is based on operating system notation
70 Private PythonHelper As String
' File name of Python helper functions (stored in $(inst)/share/Scripts/python)
71 Private Interface As Object
' ScriptForge own L10N service
72 Private OSName As String
' WIN, LINUX, MACOS
73 Private SFDialogs As Variant
' Persistent storage for the SFDialogs library
75 REM ====================================================== CONSTRUCTOR/DESTRUCTOR
77 REM -----------------------------------------------------------------------------
78 Private Sub Class_Initialize()
80 Set [_Parent] = Nothing
81 ObjectType =
"ROOT
"
82 MainFunction =
""
83 MainFunctionArgs =
""
86 ConsoleLines = Array()
87 Set ConsoleDialog = Nothing
88 Set ConsoleControl = Nothing
93 Set FunctionAccess = Nothing
94 Set PathSettings = Nothing
95 Set PathSubstitution = Nothing
96 Set ScriptProvider = Nothing
97 Set SystemShellExecute = Nothing
98 Set CoreReflection = Nothing
99 Set DispatchHelper = Nothing
100 Set TextSearch = Nothing
101 Set SearchOptions = Nothing
103 Set CharacterClass = Nothing
104 Set FileAccess = Nothing
105 Set FilterFactory = Nothing
106 Set FolderPicker = Nothing
107 Set FilePicker = Nothing
108 Set URLTransformer = Nothing
109 Set Introspection = Nothing
110 FileSystemNaming =
"ANY
"
111 PythonHelper =
"ScriptForgeHelper.py
"
112 Set Interface = Nothing
113 Set BrowseNodeFactory = Nothing
114 Set DatabaseContext = Nothing
115 Set ConfigurationProvider = Nothing
116 Set MailService = Nothing
117 OSName =
""
119 End Sub
' ScriptForge.SF_Root Constructor
121 REM -----------------------------------------------------------------------------
122 Private Sub Class_Terminate()
123 Call Class_Initialize()
124 End Sub
' ScriptForge.SF_Root Destructor
126 REM -----------------------------------------------------------------------------
127 Public Function Dispose() As Variant
128 Call Class_Terminate()
129 Set Dispose = Nothing
130 End Function
' ScriptForge.SF_Root Explicit destructor
132 REM =========================================================== PRIVATE FUNCTIONS
134 REM -----------------------------------------------------------------------------
135 Public Sub _AddToConsole(ByVal psLine As String)
136 ''' Add a new line to the console
137 ''' TAB characters are expanded before the insertion of the line
138 ''' NB: Array redimensioning of a member of an object must be done in the class module
139 ''' Args:
140 ''' psLine: the line to add
142 Dim lConsole As Long
' UBound of ConsoleLines
143 Dim sLine As String
' Alias of psLine
145 ' Resize ConsoleLines
146 lConsole = UBound(ConsoleLines)
147 If lConsole
< 0 Then
148 ReDim ConsoleLines(
0)
150 ReDim Preserve ConsoleLines(
0 To lConsole +
1)
153 ' Add a timestamp to the line and insert it (without date)
154 sLine = Mid(SF_Utils._Repr(Now()),
12)
& " -
> " & psLine
155 ConsoleLines(lConsole +
1) = Mid(SF_Utils._Repr(Now()),
12)
& " -
> " & psLine
157 ' Add the new line to the actual (probably non-modal) console, if active
158 If Not IsNull(ConsoleDialog) Then
159 If ConsoleDialog._IsStillAlive(False) Then
' False to not raise an error
160 If IsNull(ConsoleControl) Then Set ConsoleControl = ConsoleDialog.Controls(SF_Exception.CONSOLENAME)
' Should not happen ...
161 ConsoleControl.WriteLine(sLine)
165 End Sub
' ScriptForge.SF_Root._AddToConsole
167 REM -----------------------------------------------------------------------------
168 Public Sub _LoadLocalizedInterface(Optional ByVal psMode As String)
169 ''' Build the user interface in a persistent L10N object
170 ''' Executed - only once - at first ScriptForge invocation by a user script
171 ''' Args:
172 ''' psMode: ADDTEXT =
> the (english) labels are loaded from code below
173 ''' POFILE =
> the localized labels are loaded from a PO file
174 ''' the name of the file is
"la.po
" where la = language part of locale
175 ''' (fallback to ADDTEXT mode if file does not exist)
177 Dim sInstallFolder As String
' ScriptForge installation directory
178 Dim sPOFolder As String
' Folder containing the PO files
179 Dim sPOFile As String
' PO File to load
180 Dim sLocale As String
' Locale
182 If ErrorHandler Then On Local Error GoTo Catch
185 'TODO: Modify default value
186 If IsMissing(psMode) Then psMode =
"POFILE
"
188 If psMode =
"POFILE
" Then
' Use this mode in production
189 ' Build the po file name
191 sInstallFolder = ._SFInstallFolder()
' ScriptForge installation folder
192 sLocale = SF_Utils._GetUNOService(
"Locale
").Language
193 sPOFolder = .BuildPath(sInstallFolder,
"po
")
194 sPOFile = .BuildPath(sPOFolder, sLocale
& ".po
")
195 If Not .FileExists(sPOFile) Then
' File not found =
> load texts from code below
196 psMode =
"ADDTEXT
"
198 Set Interface = CreateScriptService(
"L10N
", sPOFolder, sLocale)
203 If psMode =
"ADDTEXT
" Then
' Use this mode in development to prepare a new POT file
204 Set Interface = CreateScriptService(
"L10N
")
206 ' SF_Exception.Raise
207 .AddText( Context :=
"CLOSEBUTTON
" _
208 , MsgId :=
"Close
" _
209 , Comment :=
"Text in close buttons of progress and console dialog boxes
" _
211 .AddText( Context :=
"ERRORNUMBER
" _
212 , MsgId :=
"Error %
1" _
213 , Comment :=
"Title in error message box\n
" _
214 & "%
1: an error number
" _
216 .AddText( Context :=
"ERRORLOCATION
" _
217 , MsgId :=
"Location : %
1" _
218 , Comment :=
"Error message box\n
" _
219 & "%
1: a line number
" _
221 .AddText( Context :=
"LONGERRORDESC
" _
222 , MsgId :=
"Error %
1 - Location = %
2 - Description = %
3" _
223 , Comment :=
"Logfile record
" _
225 .AddText( Context :=
"STOPEXECUTION
" _
226 , MsgId :=
"THE EXECUTION IS CANCELLED.
" _
227 , Comment :=
"SF_Utils._Validate error message
" _
229 ' SF_Exception.RaiseAbort
230 .AddText( Context :=
"INTERNALERROR
" _
231 , MsgId :=
"The ScriptForge library has crashed. The reason is unknown.\n
" _
232 & "Maybe a bug that could be reported on\n
" _
233 & "\thttps://bugs.documentfoundation.org/\n\n
" _
234 & "More details : \n\n
" _
235 , Comment :=
"SF_Exception.RaiseAbort error message
" _
237 ' SF_Utils._Validate
238 .AddText( Context :=
"VALIDATESOURCE
" _
239 , MsgId :=
"Library : \t%
1\nService : \t%
2\nMethod : \t%
3" _
240 , Comment :=
"SF_Utils._Validate error message\n
" _
241 & "%
1: probably ScriptForge\n
" _
242 & "%
2: service or module name\n
" _
243 & "%
3: property or method name where the error occurred
" _
245 .AddText( Context :=
"VALIDATEARGS
" _
246 , MsgId :=
"Arguments: %
1" _
247 , Comment :=
"SF_Utils._Validate error message\n
" _
248 & "%
1: list of arguments of the method
" _
250 .AddText( Context :=
"VALIDATEERROR
" _
251 , MsgId :=
"A serious error has been detected in your code on argument : « %
1 ».
" _
252 , Comment :=
"SF_Utils._Validate error message\n
" _
253 & "%
1: Wrong argument name
" _
255 .AddText( Context :=
"VALIDATIONRULES
" _
256 , MsgId :=
"\tValidation rules :
", Comment :=
"SF_Utils.Validate error message
" _
258 .AddText( Context :=
"VALIDATETYPES
" _
259 , MsgId :=
"\t\t« %
1 » must have next type (or one of next types) : %
2" _
260 , Comment :=
"SF_Utils._Validate error message\n
" _
261 & "%
1: Wrong argument name\n
" _
262 & "%
2: Comma separated list of allowed types
" _
264 .AddText( Context :=
"VALIDATEVALUES
" _
265 , MsgId :=
"\t\t« %
1 » must contain one of next values : %
2" _
266 , Comment :=
"SF_Utils._Validate error message\n
" _
267 & "%
1: Wrong argument name\n
" _
268 & "%
2: Comma separated list of allowed values
" _
270 .AddText( Context :=
"VALIDATEREGEX
" _
271 , MsgId :=
"\t\t« %
1 » must match next regular expression : %
2" _
272 , Comment :=
"SF_Utils._Validate error message\n
" _
273 & "%
1: Wrong argument name\n
" _
274 & "%
2: A regular expression
" _
276 .AddText( Context :=
"VALIDATECLASS
" _
277 , MsgId :=
"\t\t« %
1 » must be a Basic object of class : %
2" _
278 , Comment :=
"SF_Utils._Validate error message\n
" _
279 & "%
1: Wrong argument name\n
" _
280 & "%
2: The name of a Basic class
" _
282 .AddText( Context :=
"VALIDATEACTUAL
" _
283 , MsgId :=
"The actual value of « %
1 » is :
'%
2'" _
284 , Comment :=
"SF_Utils._Validate error message\n
" _
285 & "%
1: Wrong argument name\n
" _
286 & "%
2: The value of the argument as a string
" _
288 .AddText( Context :=
"VALIDATEMISSING
" _
289 , MsgId :=
"The « %
1 » argument is mandatory, yet it is missing.
" _
290 , Comment :=
"SF_Utils._Validate error message\n
" _
291 & "%
1: Wrong argument name
" _
293 ' SF_Utils._ValidateArray
294 .AddText( Context :=
"VALIDATEARRAY
" _
295 , MsgId :=
"\t\t« %
1 » must be an array.
" _
296 , Comment :=
"SF_Utils._ValidateArray error message\n
" _
297 & "%
1: Wrong argument name
" _
299 .AddText( Context :=
"VALIDATEDIMS
" _
300 , MsgId :=
"\t\t« %
1 » must have exactly %
2 dimension(s).
" _
301 , Comment :=
"SF_Utils._ValidateArray error message\n
" _
302 & "%
1: Wrong argument name\n
" _
303 & "%
2: Number of dimensions of the array
" _
305 .AddText( Context :=
"VALIDATEALLTYPES
" _
306 , MsgId :=
"\t\t« %
1 » must have all elements of the same type : %
2" _
307 , Comment :=
"SF_Utils._ValidateArray error message\n
" _
308 & "%
1: Wrong argument name\n
" _
309 & "%
2: Either one single type or
'String, Date, Numeric
'" _
311 .AddText( Context :=
"VALIDATENOTNULL
" _
312 , MsgId :=
"\t\t« %
1 » must not contain any NULL or EMPTY elements.
" _
313 , Comment :=
"SF_Utils._ValidateArray error message\n
" _
314 & "%
1: Wrong argument name\n
" _
315 & "NULL and EMPTY should not be translated
" _
317 ' SF_Utils._ValidateFile
318 .AddText( Context :=
"VALIDATEFILE
" _
319 , MsgId :=
"\t\t« %
1 » must be of type String.
" _
320 , Comment :=
"SF_Utils._ValidateFile error message\n
" _
321 & "%
1: Wrong argument name\n
" _
322 & "'String
' should not be translated
" _
324 .AddText( Context :=
"VALIDATEFILESYS
" _
325 , MsgId :=
"\t\t« %
1 » must be a valid file or folder name expressed in the operating system native notation.
" _
326 , Comment :=
"SF_Utils._ValidateFile error message\n
" _
327 & "%
1: Wrong argument name
" _
329 .AddText( Context :=
"VALIDATEFILEURL
" _
330 , MsgId :=
"\t\t« %
1 » must be a valid file or folder name expressed in the portable URL notation.
" _
331 , Comment :=
"SF_Utils._ValidateFile error message\n
" _
332 & "%
1: Wrong argument name\n
" _
333 & "'URL
' should not be translated
" _
335 .AddText( Context :=
"VALIDATEFILEANY
" _
336 , MsgId :=
"\t\t« %
1 » must be a valid file or folder name.
" _
337 , Comment :=
"SF_Utils._ValidateFile error message\n
" _
338 & "%
1: Wrong argument name
" _
340 .AddText( Context :=
"VALIDATEWILDCARD
" _
341 , MsgId :=
"\t\t« %
1 » may contain one or more wildcard characters (?, *) in its last path component only.
" _
342 , Comment :=
"SF_Utils._ValidateFile error message\n
" _
343 & "%
1: Wrong argument name\n
" _
344 & "'(?, *)
' is to be left as is
" _
346 ' SF_Array.RangeInit
347 .AddText( Context :=
"ARRAYSEQUENCE
" _
348 , MsgId :=
"The respective values of
'From
',
'UpTo
' and
'ByStep
' are incoherent.\n\n
" _
349 & "\t« From » = %
1\n
" _
350 & "\t« UpTo » = %
2\n
" _
351 & "\t« ByStep » = %
3" _
352 , Comment :=
"SF_Array.RangeInit error message\n
" _
353 & "%
1, %
2, %
3: Numeric values\n
" _
354 & "'From
',
'UpTo
',
'ByStep
' should not be translated
" _
356 ' SF_Array.AppendColumn, AppendRow, PrependColumn, PrependRow
357 .AddText( Context :=
"ARRAYINSERT
" _
358 , MsgId :=
"The array and the vector to insert have incompatible sizes.\n\n
" _
359 & "\t« Array_2D » = %
2\n
" _
360 & "\t« %
1 » = %
3" _
361 , Comment :=
"SF_Array.AppendColumn (...) error message\n
" _
362 & "%
1:
'Column
' or
'Row
' of a matrix\n
" _
363 & "%
2, %
3: array contents\n
" _
364 & "'Array_2D
' should not be translated
" _
366 ' SF_Array.ExtractColumn, ExtractRow
367 .AddText( Context :=
"ARRAYINDEX1
" _
368 , MsgId :=
"The given index does not fit within the bounds of the array.\n\n
" _
369 & "\t« Array_2D » = %
2\n
" _
370 & "\t« %
1 » = %
3" _
371 , Comment :=
"SF_Array.ExtractColumn (...) error message\n
" _
372 & "%
1:
'Column
' or
'Row
' of a matrix\n
" _
373 & "%
2, %
3: array contents\n
" _
374 & "'Array_2D
' should not be translated
" _
376 ' SF_Array.ExtractColumn, ExtractRow
377 .AddText( Context :=
"ARRAYINDEX2
" _
378 , MsgId :=
"The given slice limits do not fit within the bounds of the array.\n\n
" _
379 & "\t« Array_2D » = %
1\n
" _
380 & "\t« From » = %
2\n
" _
381 & "\t« UpTo » = %
3" _
382 , Comment :=
"SF_Array.ExtractColumn (...) error message\n
" _
383 & "%
1:
'Column
' or
'Row
' of a matrix\n
" _
384 & "%
2, %
3: array contents\n
" _
385 & "'Array_2D
',
'From
' and
'UpTo
' should not be translated
" _
387 ' SF_Array.ImportFromCSVFile
388 .AddText( Context :=
"CSVPARSING
" _
389 , MsgId :=
"The given file could not be parsed as a valid CSV file.\n\n
" _
390 & "\t« File name » = %
1\n
" _
391 & "\tLine number = %
2\n
" _
392 & "\tContent = %
3" _
393 , Comment :=
"SF_Array.ImportFromCSVFile error message\n
" _
394 & "%
1: a file name\n
" _
395 & "%
2: numeric\n
" _
396 & "%
3: a long string
" _
398 ' SF_Dictionary.Add/ReplaceKey
399 .AddText( Context :=
"DUPLICATEKEY
" _
400 , MsgId :=
"The insertion of a new key
" _
401 & "into a dictionary failed because the key already exists.\n
" _
402 & "Note that the comparison between keys is NOT case-sensitive.\n\n
" _
403 & "« %
1 » = %
2" _
404 , Comment :=
"SF_Dictionary Add/ReplaceKey error message\n
" _
405 & "%
1: An identifier
" _
406 & "%
2: a (potentially long) string
" _
408 ' SF_Dictionary.Remove/ReplaceKey/ReplaceItem
409 .AddText( Context :=
"UNKNOWNKEY
" _
410 , MsgId :=
"The requested key does not exist in the dictionary.\n\n
" _
411 & "« %
1 » = %
2" _
412 , Comment :=
"SF_Dictionary Remove/ReplaceKey/ReplaceItem error message\n
" _
413 & "%
1: An identifier
" _
414 & "%
2: a (potentially long) string
" _
416 ' SF_Dictionary.Add/ReplaceKey
417 .AddText( Context :=
"INVALIDKEY
" _
418 , MsgId :=
"The insertion or the update of an entry
" _
419 & "into a dictionary failed because the given key contains only spaces.
" _
420 , Comment :=
"SF_Dictionary Add/ReplaceKey error message\n
" _
422 ' SF_FileSystem.CopyFile/MoveFile/DeleteFile/CreateScriptService(
"L10N
")
423 .AddText( Context :=
"UNKNOWNFILE
" _
424 , MsgId :=
"The given file could not be found on your system.\n\n
" _
425 & "« %
1 » = %
2" _
426 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
427 & "%
1: An identifier\n
" _
428 & "%
2: A file name
" _
430 ' SF_FileSystem.CopyFolder/MoveFolder/DeleteFolder/Files/SubFolders
431 .AddText( Context :=
"UNKNOWNFOLDER
" _
432 , MsgId :=
"The given folder could not be found on your system.\n\n
" _
433 & "« %
1 » = %
2" _
434 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
435 & "%
1: An identifier\n
" _
436 & "%
2: A folder name
" _
438 ' SF_FileSystem.CopyFile/MoveFolder/DeleteFile
439 .AddText( Context :=
"NOTAFILE
" _
440 , MsgId :=
"« %
1 » contains the name of an existing folder, not that of a file.\n\n
" _
441 & "« %
1 » = %
2" _
442 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
443 & "%
1: An identifier\n
" _
444 & "%
2: A file name
" _
446 ' SF_FileSystem.CopyFolder/MoveFolder/DeleteFolder/Files/SubFolders
447 .AddText( Context :=
"NOTAFOLDER
" _
448 , MsgId :=
"« %
1 » contains the name of an existing file, not that of a folder.\n\n
" _
449 & "« %
1 » = %
2" _
450 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
451 & "%
1: An identifier\n
" _
452 & "%
2: A folder name
" _
454 ' SF_FileSystem.Copy+Move/File+Folder/CreateTextFile/OpenTextFile
455 .AddText( Context :=
"OVERWRITE
" _
456 , MsgId :=
"You tried to create a new file which already exists. Overwriting it has been rejected.\n\n
" _
457 & "« %
1 » = %
2" _
458 , Comment :=
"SF_FileSystem copy/move/... error message\n
" _
459 & "%
1: An identifier\n
" _
460 & "%
2: A file name
" _
462 ' SF_FileSystem.Copy+Move+Delete/File+Folder
463 .AddText( Context :=
"READONLY
" _
464 , MsgId :=
"Copying or moving a file to a destination which has its read-only attribute set, or deleting such a file or folder is forbidden.\n\n
" _
465 & "« %
1 » = %
2" _
466 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
467 & "%
1: An identifier\n
" _
468 & "%
2: A file name
" _
470 ' SF_FileSystem.Copy+Move+Delete/File+Folder
471 .AddText( Context :=
"NOFILEMATCH
" _
472 , MsgId :=
"When « %
1 » contains wildcards. at least one file or folder must match the given filter. Otherwise the operation is rejected.\n\n
" _
473 & "« %
1 » = %
2" _
474 , Comment :=
"SF_FileSystem copy/move/delete error message\n
" _
475 & "%
1: An identifier\n
" _
476 & "%
2: A file or folder name with wildcards
" _
478 ' SF_FileSystem.CreateFolder
479 .AddText( Context :=
"FOLDERCREATION
" _
480 , MsgId :=
"« %
1 » contains the name of an existing file or an existing folder. The operation is rejected.\n\n
" _
481 & "« %
1 » = %
2" _
482 , Comment :=
"SF_FileSystem CreateFolder error message\n
" _
483 & "%
1: An identifier\n
" _
484 & "%
2: A file or folder name
" _
486 ' SF_Services.CreateScriptService
487 .AddText( Context :=
"UNKNOWNSERVICE
" _
488 , MsgId :=
"No service named
'%
4' has been registered for the library
'%
3'.\n\n
" _
489 & "« %
1 » = %
2" _
490 , Comment :=
"SF_Services.CreateScriptService error message\n
" _
491 & "%
1: An identifier\n
" _
492 & "%
2: A string\n
" _
493 & "%
3: A Basic library name\n
" _
494 & "%
4: A service (
1 word) name
" _
496 ' SF_Services.CreateScriptService
497 .AddText( Context :=
"SERVICESNOTLOADED
" _
498 , MsgId :=
"The library
'%
3' and its services could not been loaded.\n
" _
499 & "The reason is unknown.\n
" _
500 & "However, checking the
'%
3.SF_Services.RegisterScriptServices()
' function and its return value can be a good starting point.\n\n
" _
501 & "« %
1 » = %
2" _
502 , Comment :=
"SF_Services.CreateScriptService error message\n
" _
503 & "%
1: An identifier\n
" _
504 & "%
2: A string\n
" _
505 & "%
3: A Basic library name
" _
507 ' SF_Session.ExecuteCalcFunction
508 .AddText( Context :=
"CALCFUNC
" _
509 , MsgId :=
"The Calc
'%
1' function encountered an error. Either the given function does not exist or its arguments are invalid.
" _
510 , Comment :=
"SF_Session.ExecuteCalcFunction error message\n
" _
511 & "'Calc
' should not be translated
" _
513 ' SF_Session._GetScript
514 .AddText( Context :=
"NOSCRIPT
" _
515 , MsgId :=
"The requested %
1 script could not be located in the given libraries and modules.\n
" _
516 & "« %
2 » = %
3\n
" _
517 & "« %
4 » = %
5" _
518 , Comment :=
"SF_Session._GetScript error message\n
" _
519 & "%
1:
'Basic
' or
'Python
'\n
" _
520 & "%
2: An identifier\n
" _
521 & "%
3: A string\n
" _
522 & "%
2: An identifier\n
" _
523 & "%
3: A string
" _
525 ' SF_Session.ExecuteBasicScript
526 .AddText( Context :=
"SCRIPTEXEC
" _
527 , MsgId :=
"An exception occurred during the execution of the Basic script.\n
" _
528 & "Cause: %
3\n
" _
529 & "« %
1 » = %
2" _
530 , Comment :=
"SF_Session.ExecuteBasicScript error message\n
" _
531 & "%
1: An identifier\n
" _
532 & "%
2: A string\n
" _
533 & "%
3: A (long) string
" _
535 ' SF_Session.SendMail
536 .AddText( Context :=
"WRONGEMAIL
" _
537 , MsgId :=
"One of the email addresses has been found invalid.\n
" _
538 & "Invalid mail = « %
1 »
" _
539 , Comment :=
"SF_Session.SendMail error message\n
" _
540 & "%
1 = a mail address
" _
542 ' SF_Session.SendMail
543 .AddText( Context :=
"SENDMAIL
" _
544 , MsgId :=
"The message could not be sent due to a system error.\n
" _
545 & "A possible cause is that LibreOffice could not find any mail client.
" _
546 , Comment :=
"SF_Session.SendMail error message
" _
548 ' SF_TextStream._IsFileOpen
549 .AddText( Context :=
"FILENOTOPEN
" _
550 , MsgId :=
"The requested file operation could not be executed because the file was closed previously.\n\n
" _
551 & "File name =
'%
1'" _
552 , Comment :=
"SF_TextStream._IsFileOpen error message\n
" _
553 & "%
1: A file name
" _
555 ' SF_TextStream._IsFileOpen
556 .AddText( Context :=
"FILEOPENMODE
" _
557 , MsgId :=
"The requested file operation could not be executed because it is incompatible with the mode in which the file was opened.\n\n
" _
558 & "File name =
'%
1'\n
" _
559 & "Open mode = %
2" _
560 , Comment :=
"SF_TextStream._IsFileOpen error message\n
" _
561 & "%
1: A file name\n
" _
562 & "%
2: READ, WRITE or APPEND
" _
564 ' SF_UI.Document
565 .AddText( Context :=
"DOCUMENT
" _
566 , MsgId :=
"The requested document could not be found.\n\n
" _
567 & "%
1 =
'%
2'" _
568 , Comment :=
"SF_UI.GetDocument error message\n
" _
569 & "%
1: An identifier\n
" _
570 & "%
2: A string
" _
573 .AddText( Context :=
"DOCUMENTCREATION
" _
574 , MsgId :=
"The creation of a new document failed.\n
" _
575 & "Something must be wrong with some arguments.\n\n
" _
576 & "Either the document type is unknown, or no template file was given,\n
" _
577 & "or the given template file was not found on your system.\n\n
" _
578 & "%
1 =
'%
2'\n
" _
579 & "%
3 =
'%
4'" _
580 , Comment :=
"SF_UI.GetDocument error message\n
" _
581 & "%
1: An identifier\n
" _
582 & "%
2: A string\n
" _
583 & "%
3: An identifier\n
" _
584 & "%
4: A string
" _
586 ' SF_UI.OpenDocument
587 .AddText( Context :=
"DOCUMENTOPEN
" _
588 , MsgId :=
"The opening of the document failed.\n
" _
589 & "Something must be wrong with some arguments.\n\n
" _
590 & "Either the file does not exist, or the password is wrong, or the given filter is invalid.\n\n
" _
591 & "%
1 =
'%
2'\n
" _
592 & "%
3 =
'%
4'\n
" _
593 & "%
5 =
'%
6'" _
594 , Comment :=
"SF_UI.OpenDocument error message\n
" _
595 & "%
1: An identifier\n
" _
596 & "%
2: A string\n
" _
597 & "%
3: An identifier\n
" _
598 & "%
4: A string\n
" _
599 & "%
5: An identifier\n
" _
600 & "%
6: A string
" _
602 ' SF_UI.OpenBaseDocument
603 .AddText( Context :=
"BASEDOCUMENTOPEN
" _
604 , MsgId :=
"The opening of the Base document failed.\n
" _
605 & "Something must be wrong with some arguments.\n\n
" _
606 & "Either the file does not exist, or the file is not registered under the given name.\n\n
" _
607 & "%
1 =
'%
2'\n
" _
608 & "%
3 =
'%
4'" _
609 , Comment :=
"SF_UI.OpenDocument error message\n
" _
610 & "%
1: An identifier\n
" _
611 & "%
2: A string\n
" _
612 & "%
3: An identifier\n
" _
613 & "%
4: A string
" _
615 ' SF_Document._IsStillAlive
616 .AddText( Context :=
"DOCUMENTDEAD
" _
617 , MsgId :=
"The requested action could not be executed because the document was closed inadvertently.\n\n
" _
618 & "The concerned document is
'%
1'" _
619 , Comment :=
"SF_Document._IsStillAlive error message\n
" _
620 & "%
1: A file name
" _
622 ' SF_Document.Save
623 .AddText( Context :=
"DOCUMENTSAVE
" _
624 , MsgId :=
"The document could not be saved.\n
" _
625 & "Either the document has been opened read-only, or the destination file has a read-only attribute set,
" _
626 & "or the file where to save to is undefined.\n\n
" _
627 & "%
1 =
'%
2'" _
628 , Comment :=
"SF_Document.SaveAs error message\n
" _
629 & "%
1: An identifier\n
" _
630 & "%
2: A file name\n
" _
632 ' SF_Document.SaveAs
633 .AddText( Context :=
"DOCUMENTSAVEAS
" _
634 , MsgId :=
"The document could not be saved.\n
" _
635 & "Either the document must not be overwritten, or the destination file has a read-only attribute set,
" _
636 & "or the given filter is invalid.\n\n
" _
637 & "%
1 =
'%
2'\n
" _
638 & "%
3 = %
4\n
" _
639 & "%
5 =
'%
6'" _
640 , Comment :=
"SF_Document.SaveAs error message\n
" _
641 & "%
1: An identifier\n
" _
642 & "%
2: A file name\n
" _
643 & "%
3: An identifier\n
" _
644 & "%
4: True or False\n
" _
645 & "%
5: An identifier\n
" _
646 & "%
6: A string
" _
648 ' SF_Document.any update
649 .AddText( Context :=
"DOCUMENTREADONLY
" _
650 , MsgId :=
"You tried to edit a document which is not modifiable. The document has not been changed.\n\n
" _
651 & "« %
1 » = %
2" _
652 , Comment :=
"SF_Document any update\n
" _
653 & "%
1: An identifier\n
" _
654 & "%
2: A file name
" _
656 ' SF_Base.GetDatabase
657 .AddText( Context :=
"DBCONNECT
" _
658 , MsgId :=
"The database related to the actual Base document could not be retrieved.\n
" _
659 & "Check the connection/login parameters.\n\n
" _
660 & "« %
1 » =
'%
2'\n
" _
661 & "« %
3 » =
'%
4'\n
" _
662 & "« Document » = %
5" _
663 , Comment :=
"SF_Base GetDatabase\n
" _
664 & "%
1: An identifier\n
" _
665 & "%
2: A user name\n
" _
666 & "%
3: An identifier\n
" _
667 & "%
4: A password\n
" _
668 & "%
5: A file name
" _
670 ' SF_Calc._ParseAddress (sheet)
671 .AddText( Context :=
"CALCADDRESS1
" _
672 , MsgId :=
"The given address does not correspond with a valid sheet name.\n\n
" _
673 & "« %
1 » = %
2\n
" _
674 & "« %
3 » = %
4" _
675 , Comment :=
"SF_Calc _ParseAddress (sheet)\n
" _
676 & "%
1: An identifier\n
" _
677 & "%
2: A string\n
" _
678 & "%
3: An identifier\n
" _
679 & "%
4: A file name
" _
681 ' SF_Calc._ParseAddress (range)
682 .AddText( Context :=
"CALCADDRESS2
" _
683 , MsgId :=
"The given address does not correspond with a valid range of cells.\n\n
" _
684 & "« %
1 » = %
2\n
" _
685 & "« %
3 » = %
4" _
686 , Comment :=
"SF_Calc _ParseAddress (range)\n
" _
687 & "%
1: An identifier\n
" _
688 & "%
2: A string\n
" _
689 & "%
3: An identifier\n
" _
690 & "%
4: A file name
" _
692 ' SF_Calc.InsertSheet
693 .AddText( Context :=
"DUPLICATESHEET
" _
694 , MsgId :=
"There exists already in the document a sheet with the same name.\n\n
" _
695 & "« %
1 » = %
2\n
" _
696 & "« %
3 » = %
4" _
697 , Comment :=
"SF_Calc InsertSheet\n
" _
698 & "%
1: An identifier\n
" _
699 & "%
2: A string\n
" _
700 & "%
3: An identifier\n
" _
701 & "%
4: A file name
" _
703 ' SF_Calc.Offset
704 .AddText( Context :=
"OFFSETADDRESS
" _
705 , MsgId :=
"The computed range falls beyond the sheet boundaries or is meaningless.\n\n
" _
706 & "« %
1 » = %
2\n
" _
707 & "« %
3 » = %
4\n
" _
708 & "« %
5 » = %
6\n
" _
709 & "« %
7 » = %
8\n
" _
710 & "« %
9 » = %
10\n
" _
711 & "« %
11 » = %
12" _
712 , Comment :=
"SF_Calc Offset\n
" _
713 & "%
1: An identifier\n
" _
714 & "%
2: A Calc reference\n
" _
715 & "%
3: An identifier\n
" _
716 & "%
4: A number\n
" _
717 & "%
5: An identifier\n
" _
718 & "%
6: A number\n
" _
719 & "%
7: An identifier\n
" _
720 & "%
8: A number\n
" _
721 & "%
9: An identifier\n
" _
722 & "%
10: A number\n
" _
723 & "%
11: An identifier\n
" _
724 & "%
12: A file name
" _
726 ' SF_Dialog._NewDialog
727 .AddText( Context :=
"DIALOGNOTFOUND
" _
728 , MsgId :=
"The requested dialog could not be located in the given container or library.\n
" _
729 & "« %
1 » = %
2\n
" _
730 & "« %
3 » = %
4\n
" _
731 & "« %
5 » = %
6\n
" _
732 & "« %
7 » = %
8" _
733 , Comment :=
"SF_Dialog creation\n
" _
734 & "%
1: An identifier\n
" _
735 & "%
2: A string\n
" _
736 & "%
3: An identifier\n
" _
737 & "%
4: A file name\n
" _
738 & "%
5: An identifier\n
" _
739 & "%
6: A string\n
" _
740 & "%
7: An identifier\n
" _
741 & "%
8: A string
" _
743 ' SF_Dialog._IsStillAlive
744 .AddText( Context :=
"DIALOGDEAD
" _
745 , MsgId :=
"The requested action could not be executed because the dialog was closed inadvertently.\n\n
" _
746 & "The concerned dialog is
'%
1'.
" _
747 , Comment :=
"SF_Dialog._IsStillAlive error message\n
" _
748 & "%
1: An identifier
" _
750 ' SF_DialogControl._SetProperty
751 .AddText( Context :=
"CONTROLTYPE
" _
752 , MsgId :=
"The control
'%
1' in dialog
'%
2' is of type
'%
3'.\n
" _
753 & "The property
'%
4' is not applicable on that type of dialog controls.
" _
754 , Comment :=
"SF_DialogControl property setting\n
" _
755 & "%
1: An identifier\n
" _
756 & "%
2: An identifier\n
" _
757 & "%
3: A string\n
" _
758 & "%
4: An identifier
" _
760 ' SF_DialogControl.WriteLine
761 .AddText( Context :=
"TEXTFIELD
" _
762 , MsgId :=
"The control
'%
1' in dialog
'%
2' is not a multiline text field.\n
" _
763 & "The requested method could not be executed.
" _
764 , Comment :=
"SF_DialogControl add line in textbox\n
" _
765 & "%
1: An identifier\n
" _
766 & "%
2: An identifier
" _
768 ' SF_Database.RunSql
769 .AddText( Context :=
"DBREADONLY
" _
770 , MsgId :=
"The database has been opened in read-only mode.\n
" _
771 & "The
'%
1' method must not be executed in this context.
" _
772 , Comment :=
"SF_Database when running update SQL statement\n
" _
773 & "%
1: The concerned method
" _
775 ' SF_Database._ExecuteSql
776 .AddText( Context :=
"SQLSYNTAX
" _
777 , MsgId :=
"An SQL statement could not be interpreted or executed by the database system.\n
" _
778 & "Check its syntax, table and/or field names, ...\n\n
" _
779 & "SQL Statement : « %
1 »
" _
780 , Comment :=
"SF_Database can
't interpret SQL statement\n
" _
781 & "%
1: The statement
" _
790 End Sub
' ScriptForge.SF_Root._LoadLocalizedInterface
792 REM -----------------------------------------------------------------------------
793 Public Function _Repr() As String
794 ''' Convert the unique SF_Root instance to a readable string, typically for debugging purposes (DebugPrint ...)
795 ''' Args:
796 ''' Return:
797 ''' "[Root] (MainFunction: xxx, Console: yyy lines, ServicesList)
"
799 Dim sRoot As String
' Return value
800 Const cstRoot =
"[Root] (
"
802 sRoot = cstRoot
& "MainFunction:
" & MainFunction
& ", Console:
" & UBound(ConsoleLines) +
1 & " lines
" _
803 & ", Libraries:
" & SF_Utils._Repr(ServicesList.Keys) _
808 End Function
' ScriptForge.SF_Root._Repr
810 REM -----------------------------------------------------------------------------
811 Public Sub _StackReset()
812 ''' Reset private members after a fatal/abort error to leave
813 ''' a stable persistent storage after an unwanted interrupt
815 MainFunction =
""
816 MainFunctionArgs =
""
819 End Sub
' ScriptForge.SF_Root._StackReset
821 REM ================================================== END OF SCRIPTFORGE.SF_ROOT