[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 4 09:54:34 UTC 2021


 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 <jp at ledure.be>
AuthorDate: Wed Feb 3 17:05:24 2021 +0100
Commit:     Jean-Pierre Ledure <jp at 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 <jp at ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <jp at 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		=	"CALCFORMNOTFOUNDERROR"
 Const WRITERFORMNOTFOUNDERROR	=	"WRITERFORMNOTFOUNDERROR"
 Const BASEFORMNOTFOUNDERROR		=	"BASEFORMNOTFOUNDERROR"
 Const SUBFORMNOTFOUNDERROR		=	"SUBFORMNOTFOUNDERROR"
+Const FORMCONTROLTYPEERROR		=	"FORMCONTROLTYPEERROR"
 
 '	SF_Dialog
 Const DIALOGNOTFOUNDERROR		=	"DIALOGNOTFOUNDERROR"
@@ -847,6 +848,9 @@ Try:
 			Case SUBFORMNOTFOUNDERROR	'	SF_Form.Subforms(Subform, Mainform)
 				sMessage = sLocation _
 					& "\n" & "\n" & .GetText("SUBFORMNOTFOUND", pvArgs(0), pvArgs(1))
+			Case FORMCONTROLTYPEERROR	'	SF_FormControl._SetProperty(ControlName, FormName, ControlType, Property)
+				sMessage = sLocation _
+					& "\n" & "\n" & .GetText("FORMCONTROLTYPE", pvArgs(0), pvArgs(1), pvArgs(2), pvArgs(3))
 			Case DIALOGNOTFOUNDERROR	'	SF_Dialog._NewDialog(Service, DialogName, WindowName)
 				sMessage = sLocation _
 					& "\n" & "\n" & .GetText("DIALOGNOTFOUND", 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:
 									&	"%1: A form name\n" _
 									&	"%2: A form name" _
 					)
+	'	SF_FormControl._SetProperty
+			.AddText(	Context := "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." _
+						, Comment :=	"SF_FormControl property setting\n" _
+									&	"%1: An identifier\n" _
+									&	"%2: An identifier\n" _
+									&	"%3: A string\n" _
+									&	"%4: An identifier" _
+					)
 	'	SF_Dialog._NewDialog
 			.AddText(	Context := "DIALOGNOTFOUND" _
 						, MsgId := "The requested dialog could not be located in the given container or library.\n" _
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 at ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL at 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 at ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL at 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		=	"CONTROLTYPEERROR"
-Private Const TEXTFIELDERROR		=	"TEXTFIELDERROR"
+Private Const FORMCONTROLTYPEERROR		=	"FORMCONTROLTYPEERROR"
 
 REM ============================================================= PRIVATE MEMBERS
 
@@ -1494,6 +1493,7 @@ Private Function _PropertySet(Optional ByVal psProperty As String _
 
 Dim bSet As Boolean							'	Return value
 Static oSession As Object					'	Alias of SF_Session
+Dim sFormName As String						'	Full form identification for error messages
 Dim vSet As Variant							'	Value to set in UNO model or view property
 Dim vActions As Variant						'	Action property: list of available actions
 Dim sAction As String						'	A single action
@@ -1513,7 +1513,7 @@ Const cstSubArgs = "Value"
 
 	cstThisSub = "SFDocuments.FormControl.set" & 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("Session")
 	bSet = True
@@ -1578,7 +1578,7 @@ Const cstSubArgs = "Value"
 			Select Case _ControlType
 				Case CTLCOMBOBOX
 					If oSession.HasUNOProperty(_ControlModel, "Text") And oSession.HasUNOProperty(_ControlModel, "StringItemList") Then
-						_ControlModel.Text = _ControlModel.StringItemList(CInt(pvValue))
+						If pvValue >= 0 And pvValue <= UBound(_ControlModel.StringItemList) Then _ControlModel.Text = _ControlModel.StringItemList(CInt(pvValue))
 					End If
 				Case CTLLISTBOX
 					If oSession.HasUNOProperty(_ControlModel, "SelectedItems") Then _ControlModel.SelectedItems = Array(CInt(pvValue))
@@ -1595,7 +1595,7 @@ Const cstSubArgs = "Value"
 										,	.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 = "Value"
 				Case CTLCOMBOBOX
 					If oSession.HasUnoProperty(_ControlModel, "Text") And oSession.HasUnoProperty(_ControlModel, "StringItemList") Then
 						If pvValue <> "" Then
-							If Not ScriptForge.SF_Utils._Validate(pvValue, "Vamue", V_STRING, _ControlModel.StringItemList) Then Goto Finally
+							If Not ScriptForge.SF_Utils._Validate(pvValue, "Value", 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) > 0 Then sFormName = _ParentForm._FormDocumentName & "." Else sFormName = ""
+	ScriptForge.SF_Exception.RaiseFatal(FORMCONTROLTYPEERROR, _Name, sFormName & _FormName, _ControlType, psProperty)
 	GoTo Finally
 End Function	'	SFDocuments.SF_FormControl._PropertySet
 


More information about the Libreoffice-commits mailing list