diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2022-06-21 18:29:03 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2022-06-21 19:34:04 +0200 |
commit | cb62be830fae6e42e94c42813923e635e895eae7 (patch) | |
tree | 861f322d2a6548327bddc40fde3889424e74828f /wizards | |
parent | 30a59b8bebd6baab98c32e3fcfafe447f0c4ce9d (diff) |
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'")
Cfr. commit on master: https://gerrit.libreoffice.org/c/core/+/136233
Change-Id: I7a47c9dfe1c7b507e99a37d5714046dd6d8e7567
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136258
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/sfdocuments/SF_Calc.xba | 8 |
1 files changed, 5 insertions, 3 deletions
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 |