wizards/source/scriptforge/SF_Exception.xba       |  123 ++++++++++++++++++----
 wizards/source/scriptforge/SF_Root.xba            |    8 +
 wizards/source/scriptforge/SF_Utils.xba           |   11 +
 wizards/source/scriptforge/dialog.xlb             |    2 
 wizards/source/scriptforge/python/scriptforge.py  |    7 -
 wizards/source/scriptforge/python/scriptforge.pyi |   23 +++-
 wizards/source/scriptforge/script.xlb             |   16 +-
 7 files changed, 154 insertions(+), 36 deletions(-)

New commits:
commit c8d2751a90cbf1eceaf34257876d09b4eb1efd9d
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Sat Mar 29 16:09:57 2025 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Sun Mar 30 11:12:08 2025 +0200

    ScriptForge (SF_Exception) Return codes
    
    So far, an exception raised in a user script
    and detected by ScriptForge gave next behaviour:
    - an error message was displayed to the user (1)
    - the same error message was recorded in the
      console (2)
    - the execution of the script was stopped (3)
    
    The actual commit introduces 4 new properties
    in the SF_Exception service.
    Next two boolean properties may optionally
    change above behaviour:
      exception.ReportScriptErrors (default = True)
      exception.StopWhenError (default = True)
    They may change resp. behaviours (1) and (3).
    Note that behaviour (2) is preserved anyway.
    Their values are set until they are set
    again or until the LO session expires.
    
    When StopWhenError is set to False, next two
    properties allow to test the success of the
    last call to the ScriptForge API and to
    define an appropriate action, including the
    continuation of the process:
      exception.ReturnCode
      exception.ReturnCodeDescription
    
    Example:
        exc = CreateScriptService("Exception")
        fs = CreateScriptService("FileSystem")
        exc.ReportScriptErrors = False
        exc.StopWhenError = False
        fs.OpenTextFile("/aaa/bbb")
        if exc.ReturnCode = "UNKNOWNFILEERROR":
            ...
    
    The test on the return code must precede any
    next call to any ScriptForge API entry.
    
    The list of the available return codes is
    listed in the SF_Exception.xba source code.
    
    These changes are applicable both for Basic
    and Python user scripts.
    The user documentation should be reviewed.
    
    Change-Id: I6d274e54ee37702f244e729ea5c9d1751b69abec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183486
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/scriptforge/SF_Exception.xba 
b/wizards/source/scriptforge/SF_Exception.xba
index ad0566ddfe9f..d8104e8c8596 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -33,10 +33,17 @@ Option Explicit
 &apos;&apos;&apos;             or during control events processing
 &apos;&apos;&apos;                                                             
                                =&gt;   DebugPrint()
 &apos;&apos;&apos;
-&apos;&apos;&apos;             The usual behaviour of the application when an 
error occurs is:
-&apos;&apos;&apos;                     1.      Log the error in the console
-&apos;&apos;&apos;                     2,      Inform the user about the error 
with either a standard or a customized message
-&apos;&apos;&apos;                     3.      Optionally, stop the execution 
of the current macro
+&apos;&apos;&apos;             The behaviour of the application when an error 
occurs is:
+&apos;&apos;&apos;                     1.      Log the error in the console. 
This is always done
+&apos;&apos;&apos;                     2.      Inform the user about the error 
with either a standard or a localized message
+&apos;&apos;&apos;                             To force a silent mode, set :
+&apos;&apos;&apos;                                     
exception.ReportScriptErrors = False    &apos;  Default = True
+&apos;&apos;&apos;                     3.      To not stop the execution of 
the current macro when ScriptForge detects
+&apos;&apos;&apos;                             a user script error, set :
+&apos;&apos;&apos;                                     exception.StopWhenError 
= False                 &apos;  Default = True
+&apos;&apos;&apos;                             It then makes sense before 
further processing to explore the values of
+&apos;&apos;&apos;                                     exception.ReturnCode    
                                &apos;  Short error description
+&apos;&apos;&apos;                                     
exception.ReturnCodeDescription                 &apos;  Long error description
 &apos;&apos;&apos;
 &apos;&apos;&apos;             Detailed user documentation:
 &apos;&apos;&apos;                     
https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_exception.html?DbPAR=BASIC
@@ -205,6 +212,41 @@ Property Let Number(ByVal pvNumber As Variant)
        _PropertySet &quot;Number&quot;, pvNumber
 End Property   &apos;  ScriptForge.SF_Exception.Number (let)
 
+REM 
-----------------------------------------------------------------------------
+Property Get ReportScriptErrors() As Variant
+&apos;&apos;&apos;     Indicates whether script errors are displayed in a 
message box when they occur
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.ReportScriptErrors
+       ReportScriptErrors = _PropertyGet(&quot;ReportScriptErrors&quot;)
+End Property   &apos;  ScriptForge.SF_Exception.ReportScriptErrors (get)
+
+REM 
-----------------------------------------------------------------------------
+Property Let ReportScriptErrors(ByVal pvReportScriptErrors As Variant)
+&apos;&apos;&apos;     When set to False, an error occur silently. Useful f.i. 
in Calc user-defined functions.
+&apos;&apos;&apos;     The set value is preserved until it is explicitly set 
again.
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.ReportScriptErrors = False
+       _PropertySet &quot;ReportScriptErrors&quot;, pvReportScriptErrors
+End Property   &apos;  ScriptForge.SF_Exception.ReportScriptErrors (let)
+
+REM 
-----------------------------------------------------------------------------
+Property Get ReturnCode() As String
+&apos;&apos;&apos;     Returns the code returned by  the last call to the 
ScriptForge API from a user script.
+&apos;&apos;&apos;     It is the zero-length string if everything ran without 
error
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.ReturnCode
+       ReturnCode = _PropertyGet(&quot;ReturnCode&quot;)
+End Property   &apos;  ScriptForge.SF_Exception.ReturnCode (get)
+
+REM 
-----------------------------------------------------------------------------
+Property Get ReturnCodeDescription() As String
+&apos;&apos;&apos;     Returns the localized description of the code returned 
by  the last call to the ScriptForge API from a user script.
+&apos;&apos;&apos;     It is the zero-length string if everything ran without 
error
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.ReturnCodeDescription
+       ReturnCodeDescription = _PropertyGet(&quot;ReturnCodeDescription&quot;)
+End Property   &apos;  ScriptForge.SF_Exception.ReturnCodeDescription (get)
+
 REM 
-----------------------------------------------------------------------------
 Property Get Source() As Variant
 &apos;&apos;&apos;     Returns the location of the last error that has occurred
@@ -221,6 +263,23 @@ Property Let Source(ByVal pvSource As Variant)
        _PropertySet &quot;Source&quot;, pvSource
 End Property   &apos;  ScriptForge.SF_Exception.Source (let)
 
+REM 
-----------------------------------------------------------------------------
+Property Get StopWhenError() As Variant
+&apos;&apos;&apos;     Indicates whether the Basic process is stopped when 
ScriptForge detects a user script error
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.StopWhenError
+       StopWhenError = _PropertyGet(&quot;StopWhenError&quot;)
+End Property   &apos;  ScriptForge.SF_Exception.StopWhenError (get)
+
+REM 
-----------------------------------------------------------------------------
+Property Let StopWhenError(ByVal pvStopWhenError As Variant)
+&apos;&apos;&apos;     When set to False, the Basic process continues when 
ScriptForge detects a user script error. Default = True.
+&apos;&apos;&apos;     The set value is preserved until it is explicitly set 
again.
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             myException.StopWhenError = False
+       _PropertySet &quot;StopWhenError&quot;, pvStopWhenError
+End Property   &apos;  ScriptForge.SF_Exception.StopWhenError (let)
+
 REM 
-----------------------------------------------------------------------------
 Property Get ObjectType As String
 &apos;&apos;&apos;     Only to enable object representation
@@ -237,7 +296,7 @@ REM 
===================================================================== METHOD
 
 REM 
-----------------------------------------------------------------------------
 Public Sub Clear()
-&apos;&apos;&apos; Reset the current error status and clear the SF_Exception 
object
+&apos;&apos;&apos; Reset the current error status, clear the SF_Exception 
object and reinitialize the return code.
 &apos;&apos;&apos;     Args:
 &apos;&apos;&apos;     Examples:
 &apos;&apos;&apos;             On Local Error GoTo Catch
@@ -260,6 +319,11 @@ Try:
                ._SysDescription = &quot;&quot;
        End With
 
+       With _SF_
+               .ReturnCode = &quot;&quot;
+               .ReturnCodeDescription = &quot;&quot;
+       End With
+
 Finally:
        On Error GoTo 0
        Exit Sub
@@ -320,7 +384,7 @@ Try:
                        &apos;  Terminate the modal dialog
                        If Modal Then
                                Set .ConsoleControl = .ConsoleControl.Dispose()
-                               Set .ConsoleDialog = .ConsoleDialog.Dispose()
+                               .ConsoleDialog.Terminate()
                        End If
                End If
        End With
@@ -527,7 +591,7 @@ Const cstSubArgs = &quot;&quot;
        GetProperty = Null
 
 Check:
-       If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+       If SF_Utils._EnterFunction(cstThisSub, cstSubArgs, pbReinitRC := False) 
Then            &apos;  Keep return codes untouched
                If Not SF_Utils._Validate(PropertyName, 
&quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
        End If
 
@@ -566,7 +630,11 @@ Public Function Properties() As Variant
        Properties = Array( _
                                        &quot;Description&quot; _
                                        , &quot;Number&quot; _
+                                       , &quot;ReportScriptErrors&quot; _
+                                       , &quot;ReturnCode&quot; _
+                                       , &quot;ReturnCodeDescription&quot; _
                                        , &quot;Source&quot; _
+                                       , &quot;StopWhenError&quot; _
                                        )
 
 End Function   &apos;  ScriptForge.SF_Exception.Properties
@@ -620,6 +688,7 @@ REM 
----------------------------------------------------------------------------
 Public Sub Raise(Optional ByVal Number As Variant _
                                                                , Optional 
ByVal Source As Variant _
                                                                , Optional 
ByVal Description As Variant _
+                                                               , Optional 
ByVal _Warning As Variant _
                                                                )
 &apos;&apos;&apos; Generate a run-time error. An error message is displayed to 
the user and logged
 &apos;&apos;&apos;     in the console. The execution is STOPPED
@@ -628,6 +697,7 @@ Public Sub Raise(Optional ByVal Number As Variant _
 &apos;&apos;&apos;                     If numeric and &lt;= 2000, it is 
considered a LibreOffice Basic run-time error (default = Err)
 &apos;&apos;&apos;             Source: the line where the error occurred 
(default = Erl) or any string describing the location of the error
 &apos;&apos;&apos;             Description: the error message to log in the 
console and to display to the user
+&apos;&apos;&apos;             _Warning: When True, do not stop the process. 
FOR INTERNAL USE ONLY
 &apos;&apos;&apos;     Examples:
 &apos;&apos;&apos;             On Local Error GoTo Catch
 &apos;&apos;&apos;             &apos;  ...
@@ -650,6 +720,7 @@ Check:
        If IsMissing(Number) Or IsEmpty(Number) Then Number = -1
        If IsMissing(Source) Or IsEmpty(Source) Then Source = -1
        If IsMissing(Description) Or IsEmpty(Description) Then Description = 
&quot;&quot;
+       If IsMissing(_Warning) Or IsEmpty(_Warning) Then _Warning = False
        If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
                If Not SF_Utils._Validate(Number, &quot;Number&quot;, 
Array(V_STRING, V_NUMERIC)) Then GoTo Finally
                If Not SF_Utils._Validate(Source, &quot;Source&quot;, 
Array(V_STRING, V_NUMERIC)) Then GoTo Finally
@@ -670,7 +741,7 @@ Try:
                Set L10N = _SF_._GetLocalizedInterface()
                sMessage = L10N.GetText(&quot;LONGERRORDESC&quot;, .Number, 
.Source, .Description)
                .DebugPrint(sMessage)
-               If _SF_.DisplayEnabled Then MsgBox 
L10N.GetText(&quot;ERRORNUMBER&quot;, .Number) _
+               If _SF_.ReportScriptErrors Then MsgBox 
L10N.GetText(&quot;ERRORNUMBER&quot;, .Number) _
                                                                                
                &amp; SF_String.sfNewLine &amp; 
L10N.GetText(&quot;ERRORLOCATION&quot;, .Source) _
                                                                                
                &amp; SF_String.sfNewLine &amp; .Description _
                                                                                
        , MB_OK + MB_ICONSTOP _
@@ -679,7 +750,7 @@ Try:
 
 Finally:
        SF_Utils._ExitFunction(cstThisSub)
-       If _SF_.StopWhenError Then
+       If Not _Warning Then
                SF_Exception.Clear()
                _SF_._StackReset()
                Stop
@@ -729,7 +800,7 @@ Try:
                &apos;  Log and display
                sMessage = L10N.GetText(&quot;LONGERRORDESC&quot;, .Number, 
.Source, .Description)
                .DebugPrint(sMessage)
-               If _SF_.DisplayEnabled Then
+               If _SF_.ReportScriptErrors Then
                        sMessage = sLocation _
                                                        &amp; 
L10N.GetText(&quot;INTERNALERROR&quot;) _
                                                        &amp; 
L10N.GetText(&quot;ERRORLOCATION&quot;, Source &amp; &quot;/&quot; &amp; 
.Source) &amp; SF_String.sfNewLine &amp; .Description _
@@ -744,7 +815,7 @@ Try:
 
 Finally:
        _SF_._StackReset()
-       If _SF_.StopWhenError Then Stop
+       Stop            &apos;  Unconditional stop whatever the value of the 
StopWhenError flag
        Exit Sub
 Catch:
        GoTo Finally
@@ -1096,7 +1167,7 @@ Try:
        _SF_._AddToConsole(sMessage)
 
        &apos;  Display fatal event, if relevant (default)
-       If _SF_.DisplayEnabled Then
+       If _SF_.ReportScriptErrors Then
                If _SF_.StopWhenError Then sMessage = sMessage &amp; &quot;
&quot; &amp; &quot;
&quot; &amp; &quot;
&quot; &amp; L10N.GetText(&quot;STOPEXECUTION&quot;)
                &apos;  Do you need more help ?
                If Len(sMethod) &gt; 0 Then
@@ -1115,8 +1186,12 @@ Try:
        
 Finally:
        SF_Utils._ExitFunction(cstThisSub)
-       _SF_._StackReset()
-       If _SF_.StopWhenError Then Stop
+       With _SF_
+               ._StackReset()
+               If .StopWhenError Then Stop
+               .ReturnCode = ErrorCode
+               .ReturnCodeDescription = sMessage                       
+       End With
        Exit Sub
 Catch:
        GoTo Finally
@@ -1145,7 +1220,6 @@ Public Sub RaiseWarning(Optional ByVal Number As Variant _
 &apos;&apos;&apos;                     
SF_Exception.RaiseWarning(&quot;MYAPPERROR&quot;, &quot;myFunction&quot;, 
&quot;Application error&quot;)
 &apos;&apos;&apos;                     SF_Exception.RaiseWarning(,, &quot;To 
divide by zero is not a good idea !&quot;)
 
-Dim bStop As Boolean                   &apos;  Alias for stop switch
 Const cstThisSub = &quot;Exception.RaiseWarning&quot;
 Const cstSubArgs = &quot;[Number=Err], [Source=Erl], [Description]&quot;
 
@@ -1164,13 +1238,10 @@ Check:
        End If
 
 Try:
-       bStop = _SF_.StopWhenError              &apos;  Store current value to 
reset it before leaving the Sub
-       _SF_.StopWhenError = False
-       SF_Exception.Raise(Number, Source, Description)
+       SF_Exception.Raise(Number, Source, Description, _Warning := True)
 
 Finally:
        SF_Utils._ExitFunction(cstThisSub)
-       _SF_.StopWhenError = bStop
        Exit Sub
 Catch:
        GoTo Finally
@@ -1248,7 +1319,7 @@ End Sub           &apos;  
ScriptForge.SF_Exception._CloseConsole
 REM 
-----------------------------------------------------------------------------
 Private Sub _ConsoleRefresh()
 &apos;&apos;&apos;     Reload the content of the console in the dialog
-&apos;&apos;&apos;     Needed when console first loaded or when totally or 
partially cleared
+&apos;&apos;&apos;     Needed when console loaded for the first time or when 
totally or partially cleared
 
        With _SF_
                &apos;  Do nothing if console inactive
@@ -1302,8 +1373,16 @@ Const cstSubArgs = &quot;&quot;
                        If _Description = &quot;&quot; Then _PropertyGet = 
_SysDescription Else _PropertyGet = _Description
                Case &quot;Number&quot;
                        If IsEmpty(_Number) Then _PropertyGet = _SysNumber Else 
_PropertyGet = _Number
+               Case &quot;ReportScriptErrors&quot;
+                       _PropertyGet = _SF_.ReportScriptErrors
+               Case &quot;ReturnCode&quot;
+                       _PropertyGet = _SF_.ReturnCode
+               Case &quot;ReturnCodeDescription&quot;
+                       _PropertyGet = _SF_.ReturnCodeDescription
                Case &quot;Source&quot;
                        If IsEmpty(_Source) Then _PropertyGet = _SysSource Else 
_PropertyGet = _Source
+               Case &quot;StopWhenError&quot;
+                       _PropertyGet = _SF_.StopWhenError
                Case Else
                        _PropertyGet = Null
        End Select
@@ -1346,6 +1425,8 @@ Const cstSubArgs = &quot;&quot;
                                        _Number = Empty
                                Case Else
                        End Select
+               Case &quot;ReportScriptErrors&quot;
+                       If VarType(pvValue) = V_BOOLEAN Then 
_SF_.ReportScriptErrors = pvValue
                Case &quot;Source&quot;
                        Select Case SF_Utils._VarTypeExt(pvValue)
                                Case V_STRING
@@ -1354,6 +1435,8 @@ Const cstSubArgs = &quot;&quot;
                                        _Source = CLng(pvValue)
                                Case Else
                        End Select
+               Case &quot;StopWhenError&quot;
+                       If VarType(pvValue) = V_BOOLEAN Then _SF_.StopWhenError 
= pvValue
                Case Else
        End Select
        
diff --git a/wizards/source/scriptforge/SF_Root.xba 
b/wizards/source/scriptforge/SF_Root.xba
index 63aaf6bdb05a..fd1e566d04d0 100644
--- a/wizards/source/scriptforge/SF_Root.xba
+++ b/wizards/source/scriptforge/SF_Root.xba
@@ -34,8 +34,10 @@ Private ErrorHandler         As Boolean      &apos; True = 
error handling active, False = in
 Private ConsoleLines()         As Variant      &apos; Array of messages 
displayable in console
 Private ConsoleDialog          As Object       &apos; SFDialogs.Dialog object
 Private ConsoleControl         As Object       &apos; SFDialogs.DialogControl 
object
-Private DisplayEnabled         As Boolean      &apos; When True, display of 
console or error messages is allowed
+Private ReportScriptErrors     As Boolean      &apos; When True, error 
messages are displayed to the user
 Private StopWhenError          As Boolean      &apos; When True, process stops 
after error &gt; &quot;WARNING&quot;
+Private ReturnCode                     As String       &apos; The short error 
code
+Private ReturnCodeDescription As String        &apos;  The long and localized 
error message
 Private TriggeredByPython      As Boolean      &apos; When True, the actual 
user script is a Python script
 Private DebugMode                      As Boolean      &apos; When True, log 
enter/exit each official Sub
 
@@ -109,8 +111,10 @@ Private Sub Class_Initialize()
        ConsoleLines = Array()
        Set ConsoleDialog = Nothing
        Set ConsoleControl = Nothing
-       DisplayEnabled = True
+       ReportScriptErrors = True
        StopWhenError = True
+       ReturnCode = &quot;&quot;
+       ReturnCodeDescription = &quot;&quot;
        TriggeredByPython = False
        DebugMode = False
        Set ProgressBarDialog = Nothing
diff --git a/wizards/source/scriptforge/SF_Utils.xba 
b/wizards/source/scriptforge/SF_Utils.xba
index c84821898333..ef6b11c08129 100644
--- a/wizards/source/scriptforge/SF_Utils.xba
+++ b/wizards/source/scriptforge/SF_Utils.xba
@@ -153,7 +153,10 @@ Finally:
 End Function   &apos;  ScriptForge.SF_Utils._CStrToDate
 
 REM 
-----------------------------------------------------------------------------
-Public Function _EnterFunction(ByVal psSub As String, Optional ByVal psArgs As 
String) As Boolean
+Public Function _EnterFunction(ByVal psSub As String _
+                                                               , Optional 
ByVal psArgs As String _
+                                                               , Optional 
ByVal pbReinitRC As Variant _
+                                                               ) As Boolean
 &apos;&apos;&apos;     Called on top of each public function
 &apos;&apos;&apos;     Used to trace routine in/outs (debug mode)
 &apos;&apos;&apos;             and to allow the explicit mention of the user 
call which caused an error
@@ -164,11 +167,17 @@ Public Function _EnterFunction(ByVal psSub As String, 
Optional ByVal psArgs As S
 
                If IsEmpty(_SF_) Or IsNull(_SF_) Then 
SF_Utils._InitializeRoot()        &apos;  First use of ScriptForge during 
current LibO session
                If IsMissing(psArgs) Then psArgs = &quot;&quot;
+               If IsMissing(pbReinitRC) Then pbReinitRC = True
                With _SF_
                        If .StackLevel = 0 Then
                                .MainFunction = psSub
                                .MainFunctionArgs = psArgs
                                _EnterFunction = True
+                               If pbReinitRC Then
+                                       &apos;  Reinitialize return code status
+                                       .ReturnCode = &quot;&quot;
+                                       .ReturnCodeDescription = &quot;&quot;
+                               End If
                        Else
                                _EnterFunction = False
                        End If
diff --git a/wizards/source/scriptforge/dialog.xlb 
b/wizards/source/scriptforge/dialog.xlb
index 5bd67a06a121..7b54d071c4f9 100644
--- a/wizards/source/scriptforge/dialog.xlb
+++ b/wizards/source/scriptforge/dialog.xlb
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 
1.0//EN" "library.dtd">
 <library:library xmlns:library="http://openoffice.org/2000/library"; 
library:name="ScriptForge" library:readonly="false" 
library:passwordprotected="false">
- <library:element library:name="dlgProgress"/>
  <library:element library:name="dlgConsole"/>
+ <library:element library:name="dlgProgress"/>
 </library:library>
\ No newline at end of file
diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index c364a9789ddb..534e11016919 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1074,7 +1074,10 @@ class SFScriptForge:
         serviceimplementation = 'basic'
         servicename = 'ScriptForge.Exception'
         servicesynonyms = ('exception', 'scriptforge.exception')
-        serviceproperties = dict()
+        serviceproperties = dict(ReportScriptErrors = 3, ReturnCode = 1, 
ReturnCodeDescription = 1, StopWhenError = 3)
+
+        def Clear(self):
+            return self.ExecMethod(self.vbMethod, 'Clear')
 
         def Console(self, modal = True):
             # From Python, the current XComponentContext must be added as last 
argument
@@ -1170,7 +1173,7 @@ class SFScriptForge:
         serviceimplementation = 'basic'
         servicename = 'ScriptForge.FileSystem'
         servicesynonyms = ('filesystem', 'scriptforge.filesystem')
-        serviceproperties = dict(FileNaming = 3, ConfigFolder = 1, 
ExtensionsFolder = 1, HomeFolder = 1,
+        serviceproperties = dict(ConfigFolder = 1, ExtensionsFolder = 1, 
FileNaming = 3, HomeFolder = 1,
                                  InstallFolder = 1, TemplatesFolder = 1, 
TemporaryFolder = 1,
                                  UserTemplatesFolder = 1) # 1 because 
FileNaming determines every time the folder format
         # Open TextStream constants
diff --git a/wizards/source/scriptforge/python/scriptforge.pyi 
b/wizards/source/scriptforge/python/scriptforge.pyi
index 369ba40fcc3d..68d4e5d2c22c 100644
--- a/wizards/source/scriptforge/python/scriptforge.pyi
+++ b/wizards/source/scriptforge/python/scriptforge.pyi
@@ -780,7 +780,26 @@ class SFScriptForge:
             Console entries can be dumped to a text file or visualized in a 
dialogue.
             """
 
-        def Console(self, modal: bool = ...):
+        ReportScriptErrors: bool
+        """ When set to ``False``, an error occur silently. Useful f.i. in 
Calc user-defined functions.
+        The set value is preserved until it is explicitly set again. """
+        ReturnCode: str
+        """ Returns the code returned by  the last call to the ScriptForge API 
from a user script.
+        It is the zero-length string if everything ran without error.   """
+        ReturnCodeDescription: str
+        """ Returns the localized description of the code returned by  the 
last call to the ScriptForge API 
+        from a user script. It is the zero-length string if everything ran 
without error.   """
+        StopWhenError: bool
+        """ When set to ``False``, the process continues when ScriptForge 
detects a user script error.
+        Default = ``True``. The set value is preserved until it is explicitly 
set again. """
+
+        def Clear(self):
+            """
+                Reset the current error status and return code.
+                """
+            ...
+
+        def Console(self, modal: bool = ...) -> None:
             """
                 Displays the console messages in a modal or non-modal dialog. 
In both modes, all the past messages
                 issued by a ``DebugPrint()`` method or resulting from an 
exception are displayed. In non-modal mode,
@@ -796,7 +815,7 @@ class SFScriptForge:
                 """
             ...
 
-        def ConsoleClear(self, keep: int = ...):
+        def ConsoleClear(self, keep: int = ...) -> None:
             """
                 Clears the console keeping an optional number of recent 
messages. If the console is activated in non-modal mode,
                 it is refreshed.
diff --git a/wizards/source/scriptforge/script.xlb 
b/wizards/source/scriptforge/script.xlb
index b91788543b81..8a853e5342e3 100644
--- a/wizards/source/scriptforge/script.xlb
+++ b/wizards/source/scriptforge/script.xlb
@@ -1,23 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 
1.0//EN" "library.dtd">
 <library:library xmlns:library="http://openoffice.org/2000/library"; 
library:name="ScriptForge" library:readonly="false" 
library:passwordprotected="false">
- <library:element library:name="_ModuleModel"/>
- <library:element library:name="SF_Session"/>
- <library:element library:name="SF_Dictionary"/>
  <library:element library:name="SF_Exception"/>
+ <library:element library:name="SF_Dictionary"/>
  <library:element library:name="SF_Services"/>
  <library:element library:name="SF_UI"/>
- <library:element library:name="SF_Timer"/>
- <library:element library:name="SF_FileSystem"/>
  <library:element library:name="SF_TextStream"/>
  <library:element library:name="SF_Array"/>
+ <library:element library:name="SF_Region"/>
+ <library:element library:name="SF_L10N"/>
  <library:element library:name="SF_PythonHelper"/>
  <library:element library:name="SF_Platform"/>
  <library:element library:name="SF_String"/>
+ <library:element library:name="SF_Session"/>
+ <library:element library:name="_ModuleModel"/>
  <library:element library:name="_CodingConventions"/>
  <library:element library:name="SF_Utils"/>
- <library:element library:name="SF_Root"/>
  <library:element library:name="__License"/>
- <library:element library:name="SF_Region"/>
- <library:element library:name="SF_L10N"/>
+ <library:element library:name="SF_Root"/>
+ <library:element library:name="SF_Timer"/>
+ <library:element library:name="SF_FileSystem"/>
 </library:library>
\ No newline at end of file

Reply via email to