wizards/source/scriptforge/SF_Exception.xba    |   95 +++++++++++++++++++++++--
 wizards/source/scriptforge/SF_PythonHelper.xba |   14 ++-
 wizards/source/scriptforge/SF_Root.xba         |    7 +
 wizards/source/scriptforge/po/ScriptForge.pot  |    6 -
 wizards/source/scriptforge/po/en.po            |    6 -
 5 files changed, 111 insertions(+), 17 deletions(-)

New commits:
commit 8be08b6d1f53136d899a8aac3ccd401eb18990e9
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Sat Jun 19 17:24:54 2021 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Sat Jun 19 18:30:34 2021 +0200

    ScriptForge - (SF_Exception) Fix signature in error messages
    
    Basic use ProperCased arguments, Python lowercased ones.
    The error messages always displayed the ProperCase notation.
    
    Example:
    
    BEFORE: called both from Basic or Python:
    Library :   ScriptForge
    Service :   FileSystem
    Method :    OpenTextFile
    Arguments:  FileName, [IOMode=1], [Create=False], [Encoding="UTF-8"]
    A serious error has been detected in your code on argument : FileName
    The given file could not be found on your system.
        FileName = /...
    
    AFTER: called from Basic, as above, and from Python:
    Library :   ScriptForge
    Service :   FileSystem
    Method :    OpenTextFile
    Arguments:  filename, [iomode=1], [create=False], [encoding="UTF-8"]
    A serious error has been detected in your code on argument : filename
    The given file could not be found on your system.
        filename = /...
    
    Minor user visibility. No need to cherry-pick to 7.2 branch.
    
    Change-Id: I6938c3149fe883ded97051897c19aca23eadcc58
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117501
    Tested-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

diff --git a/wizards/source/scriptforge/SF_Exception.xba 
b/wizards/source/scriptforge/SF_Exception.xba
index 9b26466aa818..fd108e14f9ac 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -716,7 +716,7 @@ Try:
                vLocation = Split(_SF_.MainFunction, &quot;.&quot;)
                If UBound(vLocation) &lt; 2 Then vLocation = 
SF_Array.Prepend(vLocation, &quot;ScriptForge&quot;)
                sLocation = L10N.GetText(&quot;VALIDATESOURCE&quot;, 
vLocation(0), vLocation(1), vLocation(2)) _
-                                       &amp; &quot;\n&quot; &amp; 
L10N.GetText(&quot;VALIDATEARGS&quot;, _SF_.MainFunctionArgs)
+                                       &amp; &quot;\n&quot; &amp; 
L10N.GetText(&quot;VALIDATEARGS&quot;, _RightCaseArgs(_SF_.MainFunctionArgs))
        Else
                sLocation = &quot;&quot;
        End If
@@ -724,10 +724,12 @@ Try:
        With L10N
                Select Case UCase(ErrorCode)
                        Case MISSINGARGERROR    &apos;  SF_Utils._Validate(Name)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATEMISSING&quot;, pvArgs(0))
                        Case ARGUMENTERROR              &apos;  
SF_Utils._Validate(Value, Name, Types, Values, Regex, Class)
+                               pvArgs(1) = _RightCase(pvArgs(1))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(1)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATIONRULES&quot;)
@@ -737,6 +739,7 @@ Try:
                                If Len(pvArgs(5)) &gt; 0 Then sMessage = 
sMessage &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATECLASS&quot;, 
pvArgs(1), pvArgs(5))
                                sMessage = sMessage &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATEACTUAL&quot;, pvArgs(1), pvArgs(0))
                        Case ARRAYERROR &apos;  SF_Utils._ValidateArray(Value, 
Name, Dimensions, Types, NotNull)
+                               pvArgs(1) = _RightCase(pvArgs(1))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(1)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATIONRULES&quot;) _
@@ -746,6 +749,7 @@ Try:
                                If pvArgs(4) Then sMessage = sMessage &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATENOTNULL&quot;, pvArgs(1))
                                sMessage = sMessage &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATEACTUAL&quot;, pvArgs(1), pvArgs(0))
                        Case FILEERROR          &apos;  
SF_Utils._ValidateFile(Value, Name, WildCards)
+                               pvArgs(1) = _RightCase(pvArgs(1))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(1)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;VALIDATIONRULES&quot;) _
@@ -782,57 +786,70 @@ Try:
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;INVALIDKEY&quot;)
                        Case UNKNOWNFILEERROR           &apos;  
SF_FileSystem.CopyFile/MoveFile/DeleteFile/CreateScriptService(&quot;L10N&quot;)(ArgName,
 Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;UNKNOWNFILE&quot;, pvArgs(0), pvArgs(1))
                        Case UNKNOWNFOLDERERROR         &apos;  
SF_FileSystem.CopyFolder/MoveFolder/DeleteFolder/Files/SubFolders(ArgName, 
Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;UNKNOWNFOLDER&quot;, pvArgs(0), pvArgs(1))
                        Case NOTAFILEERROR                      &apos;  
SF_FileSystem.CopyFile/MoveFile/DeleteFile(ArgName, Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;NOTAFILE&quot;, pvArgs(0), pvArgs(1))
                        Case NOTAFOLDERERROR            &apos;  
SF_FileSystem.CopyFolder/MoveFolder/DeleteFolder/Files/SubFolders(ArgName, 
Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;NOTAFOLDER&quot;, pvArgs(0), pvArgs(1))
                        Case OVERWRITEERROR             &apos;  
SF_FileSystem.Copy+Move/File+Folder/CreateTextFile/OpenTextFile(ArgName, 
Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;OVERWRITE&quot;, pvArgs(0), pvArgs(1))
                        Case READONLYERROR              &apos;  
SF_FileSystem.Copy+Move+Delete/File+Folder(ArgName, Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;READONLY&quot;, pvArgs(0), pvArgs(1))
                        Case NOFILEMATCHERROR   &apos;  
SF_FileSystem.Copy+Move+Delete/File+Folder(ArgName, Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;NOFILEMATCH&quot;, pvArgs(0), pvArgs(1))
                        Case FOLDERCREATIONERROR        &apos;  
SF_FileSystem.CreateFolder(ArgName, Filename)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;FOLDERCREATION&quot;, pvArgs(0), pvArgs(1))
                        Case UNKNOWNSERVICEERROR        &apos;  
SF_Services.CreateScriptService(ArgName, Value, Library, Service)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;UNKNOWNSERVICE&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3))
                        Case SERVICESNOTLOADEDERROR     &apos;  
SF_Services.CreateScriptService(ArgName, Value, Library)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;SERVICESNOTLOADED&quot;, pvArgs(0), 
pvArgs(1), pvArgs(2))
                        Case CALCFUNCERROR                      &apos;  
SF_Session.ExecuteCalcFunction(CalcFunction)
                                sMessage = sLocation _
-                                       &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
&quot;CalcFunction&quot;) _
+                                       &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
_RightCase(&quot;CalcFunction&quot;)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;CALCFUNC&quot;, pvArgs(0))
                        Case NOSCRIPTERROR                      &apos;  
SF_Session._GetScript(Language, &quot;Scope&quot;, Scope, &quot;Script&quot;, 
Script)
+                               pvArgs(1) = _RightCase(pvArgs(1))       :       
pvArgs(3) = _RightCase(pvArgs(3))
                                sMessage = sLocation _
-                                       &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
&quot;Script&quot;) _
+                                       &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
_RightCase(&quot;Script&quot;)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;NOSCRIPT&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4))
                        Case SCRIPTEXECERROR                    &apos;  
SF_Session.ExecuteBasicScript(&quot;Script&quot;, Script, Cause)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;SCRIPTEXEC&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2))
                        Case WRONGEMAILERROR            &apos;  
SF_Session.SendMail(Arg, Email)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;WRONGEMAIL&quot;, pvArgs(1))
@@ -849,42 +866,54 @@ Try:
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;ENDOFFILE&quot;, pvArgs(0))
                        Case DOCUMENTERROR                      &apos;  
SF_UI.GetDocument(ArgName, WindowName)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENT&quot;, pvArgs(0), pvArgs(1))
                        Case DOCUMENTCREATIONERROR      &apos;  
SF_UI.Create(Arg1Name, DocumentType, Arg2Name, TemplateFile)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTCREATION&quot;, pvArgs(0), 
pvArgs(1), pvArgs(2), pvArgs(3))
                        Case DOCUMENTOPENERROR          &apos;  
SF_UI.OpenDocument(Arg1Name, FileName, Arg2Name, Password, Arg3Name, FilterName)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))       :       pvArgs(4) = 
_RightCase(pvArgs(4))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTOPEN&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4), pvArgs(5))
                        Case BASEDOCUMENTOPENERROR      &apos;  
SF_UI.OpenBaseDocument(Arg1Name, FileName, Arg2Name, RegistrationName)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;BASEDOCUMENTOPEN&quot;, pvArgs(0), 
pvArgs(1), pvArgs(2), pvArgs(3))
                        Case DOCUMENTDEADERROR  &apos;  
SF_Document._IsStillAlive(FileName)
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTDEAD&quot;, pvArgs(0))
                        Case DOCUMENTSAVEERROR          &apos;  
SF_Document.Save(Arg1Name, FileName)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTSAVE&quot;, pvArgs(0), pvArgs(1))
                        Case DOCUMENTSAVEASERROR        &apos;  
SF_Document.SaveAs(Arg1Name, FileName, Arg2, Overwrite, Arg3, FilterName)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))       :       pvArgs(4) = 
_RightCase(pvArgs(4))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTSAVEAS&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4), pvArgs(5))
                        Case DOCUMENTREADONLYERROR      &apos;  
SF_Document.update property(&quot;Document&quot;, FileName)
+                               pvArgs(0) = _RightCase(pvArgs(0))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DOCUMENTREADONLY&quot;, pvArgs(0), 
pvArgs(1))
                        Case DBCONNECTERROR     &apos;  
SF_Base.GetDatabase(&quot;User&quot;, User, &quot;Password&quot;, Password, 
FileName)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DBCONNECT&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4))
                        Case CALCADDRESSERROR           &apos;  
SF_Calc._ParseAddress(Address, &quot;Range&quot;/&quot;Sheet&quot;, Scope, 
Document)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;CALCADDRESS&quot; &amp; Iif(pvArgs(0) = 
&quot;Sheet&quot;, &quot;1&quot;, &quot;2&quot;), pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3))
                        Case DUPLICATESHEETERROR        &apos;  
SF_Calc.InsertSheet(arg, SheetName, Document)
+                               pvArgs(0) = _RightCase(pvArgs(2))       :       
pvArgs(0) = _RightCase(pvArgs(2))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 
pvArgs(0)) _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DUPLICATESHEET&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3))
-                       Case OFFSETADDRESSERROR         &apos;  
SF_Calc.RangeOffset(&quot;range&quot;, Range, &quot;Rows&quot;, Rows, 
&quot;Columns&quot;, Columns, &quot;Height&quot;, Height, &quot;Width&quot;, 
Width, &quot;Document, Document)
+                       Case OFFSETADDRESSERROR         &apos;  
SF_Calc.RangeOffset(&quot;Range&quot;, Range, &quot;Rows&quot;, Rows, 
&quot;Columns&quot;, Columns, &quot;Height&quot;, Height, &quot;Width&quot;, 
Width, &quot;Document, Document)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))       :       pvArgs(4) = 
_RightCase(pvArgs(4))
+                               pvArgs(6) = _RightCase(pvArgs(6))       :       
pvArgs(8) = _RightCase(pvArgs(8))       :       pvArgs(10) = 
_RightCase(pvArgs(10))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;OFFSETADDRESS&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4) _
                                                                        , 
pvArgs(5), pvArgs(6), pvArgs(7), pvArgs(8), pvArgs(9), pvArgs(10), pvArgs(11))
@@ -907,6 +936,8 @@ Try:
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;FORMCONTROLTYPE&quot;, pvArgs(0), 
pvArgs(1), pvArgs(2), pvArgs(3))
                        Case DIALOGNOTFOUNDERROR        &apos;  
SF_Dialog._NewDialog(Service, DialogName, WindowName)
+                               pvArgs(0) = _RightCase(pvArgs(0))       :       
pvArgs(2) = _RightCase(pvArgs(2))       :       pvArgs(4) = 
_RightCase(pvArgs(4))
+                               pvArgs(6) = _RightCase(pvArgs(6))
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;DIALOGNOTFOUND&quot;, pvArgs(0), pvArgs(1), 
pvArgs(2), pvArgs(3), pvArgs(4) _
                                                                        , 
pvArgs(5), pvArgs(6), pvArgs(7))
@@ -1188,5 +1219,61 @@ Private Function _Repr() As String
 
 End Function   &apos;  ScriptForge.SF_Exception._Repr
 
+REM 
-----------------------------------------------------------------------------
+Private Function _RightCase(psString As String) As String
+&apos;&apos;&apos;     Return the input argument in lower case only when the 
procedure in execution
+&apos;&apos;&apos;     has been triggered from a Python script
+&apos;&apos;&apos;     Indeed, Python requires lower case arguments
+&apos;&apos;&apos;     Args:
+&apos;&apos;&apos;             psString: probably an identifier in ProperCase
+&apos;&apos;&apos;     Return:
+&apos;&apos;&apos;             The input argument in lower case or left 
unchanged depending on the execution context
+
+Try:
+       If _SF_.TriggeredByPython Then _RightCase = LCase(psString) Else 
_RightCase = psString
+
+Finally:
+       Exit Function
+End Function   &apos;  ScriptForge.SF_Exception._RightCase
+
+REM 
-----------------------------------------------------------------------------
+Private Function _RightCaseArgs(psString As String) As String
+&apos;&apos;&apos;     Return the input argument unchanged when the execution 
context is Basic
+&apos;&apos;&apos;     When it is Python, the argument names are lowercased.
+&apos;&apos;&apos;     Args:
+&apos;&apos;&apos;             psString: one of the cstSubArgs strings located 
in each official method
+&apos;&apos;&apos;     Return:
+&apos;&apos;&apos;             The input string in which the argument names 
are put in lower case when called from Python scripts
+
+Dim sSubArgs As String                         &apos;  Return value
+Dim vArgs As Variant                           &apos;  Input string split on 
the comma character
+Dim sSingleArg As String                       &apos;  Single vArgs item
+Dim vSingleArgs As Variant                     &apos;  vSingleArg split on 
equal sign
+Dim i As Integer
+
+Const cstComma = &quot;,&quot;
+Const cstEqual = &quot;=&quot;
+
+Try:
+       If Len(psString) = 0 Then
+               sSubArgs = &quot;&quot;
+       ElseIf _SF_.TriggeredByPython Then
+               vArgs = SF_String.SplitNotQuoted(psString, cstComma, QuoteChar 
:= &quot;&quot;&quot;&quot;)
+               For i = 0 To UBound(vArgs)
+                       sSingleArg = vArgs(i)
+                       vSingleArgs = Split(sSingleArg, cstEqual)
+                       vSingleArgs(0) = LCase(vSingleArgs(0))
+                       vArgs(i) = join(vSingleArgs, cstEqual)
+               Next i
+               sSubArgs = Join(vArgs, cstComma)
+       Else
+               sSubArgs = psString
+       End If
+
+Finally:
+       _RightCaseArgs = sSubArgs
+       Exit Function
+End Function   &apos;  ScriptForge.SF_Exception._RightCaseArgs
+
 REM ============================================ END OF 
SCRIPTFORGE.SF_EXCEPTION
 </script:module>
\ No newline at end of file
diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba 
b/wizards/source/scriptforge/SF_PythonHelper.xba
index 931a37adb3c4..2addd1eca678 100644
--- a/wizards/source/scriptforge/SF_PythonHelper.xba
+++ b/wizards/source/scriptforge/SF_PythonHelper.xba
@@ -675,11 +675,14 @@ Try:
        &apos;          may be considered as properties when no argument
 &apos;                 Requires Python and Basic update in the concerned 
library but is transparent for this dispatcher
 
-       &apos;  Initialize Python persistent storage at 1st call
-       
-       If IsEmpty(_SF_.PythonStorage) Then _SF_._InitPythonStorage()
-       &apos;  Reset any error
-       _SF_._Stackreset()
+       With _SF_
+               &apos;  Initialize Python persistent storage at 1st call
+               If IsEmpty(.PythonStorage) Then ._InitPythonStorage()
+               &apos;  Reset any error
+               ._Stackreset()
+               &apos;  Set Python trigger to manage signatures in error 
messages
+               .TriggeredByPython = True
+       End With
 
        Select case VarType(BasicObject)
                Case V_STRING
@@ -865,6 +868,7 @@ Try:
        _PythonDispatcher = vReturnArray
                
 Finally:
+       _SF_.TriggeredByPython = False          &apos;  Reset normal state
        Exit Function
 Catch:
        GoTo Finally
diff --git a/wizards/source/scriptforge/SF_Root.xba 
b/wizards/source/scriptforge/SF_Root.xba
index 0a5aaa6055ab..f553ab5f5889 100644
--- a/wizards/source/scriptforge/SF_Root.xba
+++ b/wizards/source/scriptforge/SF_Root.xba
@@ -36,6 +36,7 @@ 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 StopWhenError          As Boolean      &apos; When True, process stops 
after error &gt; &quot;WARNING&quot;
+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
 
 &apos; Progress and status bars
@@ -98,6 +99,7 @@ Private Sub Class_Initialize()
        Set ConsoleControl = Nothing
        DisplayEnabled = True
        StopWhenError = True
+       TriggeredByPython = False
        DebugMode = False
        Set ProgressBarDialog = Nothing
        Set ProgressBarText = Nothing
@@ -605,8 +607,8 @@ Try:
                                                                        &amp;   
&quot;%1: &apos;Basic&apos; or &apos;Python&apos;\n&quot; _
                                                                        &amp;   
&quot;%2: An identifier\n&quot; _
                                                                        &amp;   
&quot;%3: A string\n&quot; _
-                                                                       &amp;   
&quot;%2: An identifier\n&quot; _
-                                                                       &amp;   
&quot;%3: A string&quot; _
+                                                                       &amp;   
&quot;%4: An identifier\n&quot; _
+                                                                       &amp;   
&quot;%5: A string&quot; _
                                        )
        &apos;  SF_Session.ExecuteBasicScript
                        .AddText(       Context := &quot;SCRIPTEXEC&quot; _
@@ -971,6 +973,7 @@ Public Sub _StackReset()
        MainFunction = &quot;&quot;
        MainFunctionArgs = &quot;&quot;
        StackLevel = 0
+       TriggeredByPython = False
 
 End Sub                &apos;          ScriptForge.SF_Root._StackReset
 
diff --git a/wizards/source/scriptforge/po/ScriptForge.pot 
b/wizards/source/scriptforge/po/ScriptForge.pot
index dac8660fa867..5bb44f2d1d6e 100644
--- a/wizards/source/scriptforge/po/ScriptForge.pot
+++ b/wizards/source/scriptforge/po/ScriptForge.pot
@@ -14,7 +14,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: 
https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n";
-"POT-Creation-Date: 2021-06-15 16:52:08\n"
+"POT-Creation-Date: 2021-06-19 16:57:15\n"
 "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -451,8 +451,8 @@ msgstr ""
 #. %1: 'Basic' or 'Python'
 #. %2: An identifier
 #. %3: A string
-#. %2: An identifier
-#. %3: A string
+#. %4: An identifier
+#. %5: A string
 #, kde-format
 msgctxt "NOSCRIPT"
 msgid  ""
diff --git a/wizards/source/scriptforge/po/en.po 
b/wizards/source/scriptforge/po/en.po
index dac8660fa867..5bb44f2d1d6e 100644
--- a/wizards/source/scriptforge/po/en.po
+++ b/wizards/source/scriptforge/po/en.po
@@ -14,7 +14,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: 
https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n";
-"POT-Creation-Date: 2021-06-15 16:52:08\n"
+"POT-Creation-Date: 2021-06-19 16:57:15\n"
 "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -451,8 +451,8 @@ msgstr ""
 #. %1: 'Basic' or 'Python'
 #. %2: An identifier
 #. %3: A string
-#. %2: An identifier
-#. %3: A string
+#. %4: An identifier
+#. %5: A string
 #, kde-format
 msgctxt "NOSCRIPT"
 msgid  ""
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to