wizards/source/sfdocuments/SF_Calc.xba | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit 7f2464c41adf3e45fe020e87198fb0cb939e6e34 Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Tue Jun 21 16:30:03 2022 +0200 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Tue Jun 21 18:23:10 2022 +0200 ScriptForge - (SF_Calc)FIX wrong sheet name validation When the name of a sheet contains a "." or a space, when passed as an argument, the name must be surrounded with sinle quotes (like in usual Calc formulas). The validation of the sheet name goes thru the comparison with the list of existing sheet names in the document. The comparison compared erroneously the name with quotes and sheet name without quotes. Gave an unjustified user error. Example: calc.Sheet("'Commits 7.4'") Actual commit should be pushed to LibreOffice 7.4 too. Change-Id: I1ffd1dc42a0fd4a28fcea87de297c4cb02da6a5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136233 Tested-by: Jean-Pierre Ledure <j...@ledure.be> Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 4b42163753bb..0b7b88ae8f76 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -4444,6 +4444,7 @@ Private Function _ValidateSheet(Optional ByRef pvSheetName As Variant _ ''' DUPLICATESHEETERROR A sheet with the given name exists already Dim vSheets As Variant ' List of sheets +Dim sSheet As String ' Sheet name without single quotes Dim lSheet As Long ' Index in list of sheets Dim vTypes As Variant ' Array of accepted variable types Dim bValid As Boolean ' Return value @@ -4474,12 +4475,13 @@ Try: pvSheetName = _Component.CurrentController.ActiveSheet.Name Else vSheets = _Component.getSheets.getElementNames() + sSheet = Replace(pvSheetName, "'", "") If pvNew Then - If ScriptForge.SF_Array.Contains(vSheets, pvSheetName) Then GoTo CatchDuplicate + If ScriptForge.SF_Array.Contains(vSheets, sSheet) Then GoTo CatchDuplicate Else - If Not ScriptForge.SF_Utils._Validate(pvSheetName, psArgName, V_STRING, vSheets) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(sSheet, psArgName, V_STRING, vSheets) Then GoTo Finally If pvResetSheet Then - lSheet = ScriptForge.SF_Array.IndexOf(vSheets, pvSheetName, CaseSensitive := False) + lSheet = ScriptForge.SF_Array.IndexOf(vSheets, sSheet, CaseSensitive := False) pvSheetName = vSheets(lSheet) End If End If