wizards/source/scriptforge/SF_Exception.xba   |    4 ++++
 wizards/source/scriptforge/SF_Root.xba        |   10 ++++++++++
 wizards/source/scriptforge/po/ScriptForge.pot |   15 ++++++++++++++-
 wizards/source/scriptforge/po/en.po           |   15 ++++++++++++++-
 wizards/source/sfdocuments/SF_FormControl.xba |   15 ++++++++-------
 5 files changed, 50 insertions(+), 9 deletions(-)

New commits:
commit 304571f88154ec1cf3e605b37ef54492b77451ef
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Wed Feb 3 17:05:24 2021 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Feb 4 10:53:44 2021 +0100

    ScriptForge - (SF_FormControl) Review error checking
    
    - separate error message vs corresponding message for dialogs
    - more precision on form naming: form document.form name
    - add new error message in SF_Exception and SF_Root messages lists
    - add new message in po files
    
    Change-Id: I1f7f2dc7b5627d12a8c5ecf238e6cbd3aa1505fb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110380
    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 8739e0edfa8e..18d562b21e7b 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -110,6 +110,7 @@ Const CALCFORMNOTFOUNDERROR         =       
&quot;CALCFORMNOTFOUNDERROR&quot;
 Const WRITERFORMNOTFOUNDERROR  =       &quot;WRITERFORMNOTFOUNDERROR&quot;
 Const BASEFORMNOTFOUNDERROR            =       
&quot;BASEFORMNOTFOUNDERROR&quot;
 Const SUBFORMNOTFOUNDERROR             =       &quot;SUBFORMNOTFOUNDERROR&quot;
+Const FORMCONTROLTYPEERROR             =       &quot;FORMCONTROLTYPEERROR&quot;
 
 &apos; SF_Dialog
 Const DIALOGNOTFOUNDERROR              =       &quot;DIALOGNOTFOUNDERROR&quot;
@@ -847,6 +848,9 @@ Try:
                        Case SUBFORMNOTFOUNDERROR       &apos;  
SF_Form.Subforms(Subform, Mainform)
                                sMessage = sLocation _
                                        &amp; &quot;\n&quot; &amp; 
&quot;\n&quot; &amp; .GetText(&quot;SUBFORMNOTFOUND&quot;, pvArgs(0), pvArgs(1))
+                       Case FORMCONTROLTYPEERROR       &apos;  
SF_FormControl._SetProperty(ControlName, FormName, ControlType, Property)
+                               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)
                                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) _
diff --git a/wizards/source/scriptforge/SF_Root.xba 
b/wizards/source/scriptforge/SF_Root.xba
index 3d643acdd121..334e4798018c 100644
--- a/wizards/source/scriptforge/SF_Root.xba
+++ b/wizards/source/scriptforge/SF_Root.xba
@@ -774,6 +774,16 @@ Try:
                                                                        &amp;   
&quot;%1: A form name\n&quot; _
                                                                        &amp;   
&quot;%2: A form name&quot; _
                                        )
+       &apos;  SF_FormControl._SetProperty
+                       .AddText(       Context := &quot;FORMCONTROLTYPE&quot; _
+                                               , MsgId := &quot;The control 
&apos;%1&apos; in form &apos;%2&apos; is of type &apos;%3&apos;.\n&quot; _
+                                                                       &amp; 
&quot;The property or method &apos;%4&apos; is not applicable on that type of 
form controls.&quot; _
+                                               , Comment :=    
&quot;SF_FormControl property setting\n&quot; _
+                                                                       &amp;   
&quot;%1: An identifier\n&quot; _
+                                                                       &amp;   
&quot;%2: An identifier\n&quot; _
+                                                                       &amp;   
&quot;%3: A string\n&quot; _
+                                                                       &amp;   
&quot;%4: An identifier&quot; _
+                                       )
        &apos;  SF_Dialog._NewDialog
                        .AddText(       Context := &quot;DIALOGNOTFOUND&quot; _
                                                , MsgId := &quot;The requested 
dialog could not be located in the given container or library.\n&quot; _
diff --git a/wizards/source/scriptforge/po/ScriptForge.pot 
b/wizards/source/scriptforge/po/ScriptForge.pot
index d75dbab0a991..a4c6ff514bc4 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: 2020-12-29 18:05:28\n"
+"POT-Creation-Date: 2021-02-03 15:55:36\n"
 "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -794,6 +794,19 @@ msgid  ""
 "The subform = '%1'."
 msgstr ""
 
+#. SF_FormControl property setting
+#. %1: An identifier
+#. %2: An identifier
+#. %3: A string
+#. %4: An identifier
+#, kde-format
+msgctxt "FORMCONTROLTYPE"
+msgid  ""
+"The control '%1' in form '%2' is of type '%3'.\n"
+"The property or method '%4' is not applicable on that type of form "
+"controls."
+msgstr ""
+
 #. SF_Dialog creation
 #. %1: An identifier
 #. %2: A string
diff --git a/wizards/source/scriptforge/po/en.po 
b/wizards/source/scriptforge/po/en.po
index d75dbab0a991..a4c6ff514bc4 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: 2020-12-29 18:05:28\n"
+"POT-Creation-Date: 2021-02-03 15:55:36\n"
 "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -794,6 +794,19 @@ msgid  ""
 "The subform = '%1'."
 msgstr ""
 
+#. SF_FormControl property setting
+#. %1: An identifier
+#. %2: An identifier
+#. %3: A string
+#. %4: An identifier
+#, kde-format
+msgctxt "FORMCONTROLTYPE"
+msgid  ""
+"The control '%1' in form '%2' is of type '%3'.\n"
+"The property or method '%4' is not applicable on that type of form "
+"controls."
+msgstr ""
+
 #. SF_Dialog creation
 #. %1: An identifier
 #. %2: A string
diff --git a/wizards/source/sfdocuments/SF_FormControl.xba 
b/wizards/source/sfdocuments/SF_FormControl.xba
index 242f2c0e6405..3e4ad352c782 100644
--- a/wizards/source/sfdocuments/SF_FormControl.xba
+++ b/wizards/source/sfdocuments/SF_FormControl.xba
@@ -41,8 +41,7 @@ Option Explicit
 
 REM ================================================================== 
EXCEPTIONS
 
-Private Const CONTROLTYPEERROR         =       &quot;CONTROLTYPEERROR&quot;
-Private Const TEXTFIELDERROR           =       &quot;TEXTFIELDERROR&quot;
+Private Const FORMCONTROLTYPEERROR             =       
&quot;FORMCONTROLTYPEERROR&quot;
 
 REM ============================================================= PRIVATE 
MEMBERS
 
@@ -1494,6 +1493,7 @@ Private Function _PropertySet(Optional ByVal psProperty 
As String _
 
 Dim bSet As Boolean                                                    &apos;  
Return value
 Static oSession As Object                                      &apos;  Alias 
of SF_Session
+Dim sFormName As String                                                &apos;  
Full form identification for error messages
 Dim vSet As Variant                                                    &apos;  
Value to set in UNO model or view property
 Dim vActions As Variant                                                &apos;  
Action property: list of available actions
 Dim sAction As String                                          &apos;  A 
single action
@@ -1513,7 +1513,7 @@ Const cstSubArgs = &quot;Value&quot;
 
        cstThisSub = &quot;SFDocuments.FormControl.set&quot; &amp; psProperty
        ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
-       If Not [_Parent]._IsStillAlive() Then GoTo Finally
+       If Not _ParentForm._IsStillAlive() Then GoTo Finally
 
        If IsNull(oSession) Then Set oSession = 
ScriptForge.SF_Services.CreateScriptService(&quot;Session&quot;)
        bSet = True
@@ -1578,7 +1578,7 @@ Const cstSubArgs = &quot;Value&quot;
                        Select Case _ControlType
                                Case CTLCOMBOBOX
                                        If 
oSession.HasUNOProperty(_ControlModel, &quot;Text&quot;) And 
oSession.HasUNOProperty(_ControlModel, &quot;StringItemList&quot;) Then
-                                               _ControlModel.Text = 
_ControlModel.StringItemList(CInt(pvValue))
+                                               If pvValue &gt;= 0 And pvValue 
&lt;= UBound(_ControlModel.StringItemList) Then _ControlModel.Text = 
_ControlModel.StringItemList(CInt(pvValue))
                                        End If
                                Case CTLLISTBOX
                                        If 
oSession.HasUNOProperty(_ControlModel, &quot;SelectedItems&quot;) Then 
_ControlModel.SelectedItems = Array(CInt(pvValue))
@@ -1595,7 +1595,7 @@ Const cstSubArgs = &quot;Value&quot;
                                                                                
,       .TABLE _
                                                                                
,       .TABLEFIELDS
                                                                        Set 
oDatabase = _ParentForm.GetDatabase()
-                                                                       If 
_ControlModel.ListSourceType = .QUERY        Then vList = oDatabase.Queries 
Else vList = oDatabase.Tables
+                                                                       If 
_ControlModel.ListSourceType = .QUERY Then vList = oDatabase.Queries Else vList 
= oDatabase.Tables
                                                                        If Not 
ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING, vList) Then Goto 
Finally
                                                                        If 
_ControlType = CTLCOMBOBOX Then _ControlModel.ListSource = pvValue Else 
_ControlModel.ListSource = Array(pvValue)
                                                                        
_ControlModel.refresh()
@@ -1713,7 +1713,7 @@ Const cstSubArgs = &quot;Value&quot;
                                Case CTLCOMBOBOX
                                        If 
oSession.HasUnoProperty(_ControlModel, &quot;Text&quot;) And 
oSession.HasUnoProperty(_ControlModel, &quot;StringItemList&quot;) Then
                                                If pvValue &lt;&gt; 
&quot;&quot; Then
-                                                       If Not 
ScriptForge.SF_Utils._Validate(pvValue, &quot;Vamue&quot;, V_STRING, 
_ControlModel.StringItemList) Then Goto Finally
+                                                       If Not 
ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING, 
_ControlModel.StringItemList) Then Goto Finally
                                                End If
                                                _ControlModel.Text = pvValue
                                        End If
@@ -1805,7 +1805,8 @@ Finally:
 Catch:
        GoTo Finally
 CatchType:
-       ScriptForge.SF_Exception.RaiseFatal(CONTROLTYPEERROR, _Name, _FormName, 
_ControlType, psProperty)
+       If Len(_ParentForm._FormDocumentName) &gt; 0 Then sFormName = 
_ParentForm._FormDocumentName &amp; &quot;.&quot; Else sFormName = &quot;&quot;
+       ScriptForge.SF_Exception.RaiseFatal(FORMCONTROLTYPEERROR, _Name, 
sFormName &amp; _FormName, _ControlType, psProperty)
        GoTo Finally
 End Function   &apos;  SFDocuments.SF_FormControl._PropertySet
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to