summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2022-06-21 16:30:03 +0200
committerJean-Pierre Ledure <jp@ledure.be>2022-06-21 18:23:10 +0200
commit7f2464c41adf3e45fe020e87198fb0cb939e6e34 (patch)
tree99e6563ec9d1ef0e7207ca51bc3819a8a8a9a322
parentafc828b9833b7a612369e95606ba56d41ef2c369 (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'") 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 <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba8
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 _
&apos;&apos;&apos; DUPLICATESHEETERROR A sheet with the given name exists already
Dim vSheets As Variant &apos; List of sheets
+Dim sSheet As String &apos; Sheet name without single quotes
Dim lSheet As Long &apos; Index in list of sheets
Dim vTypes As Variant &apos; Array of accepted variable types
Dim bValid As Boolean &apos; Return value
@@ -4474,12 +4475,13 @@ Try:
pvSheetName = _Component.CurrentController.ActiveSheet.Name
Else
vSheets = _Component.getSheets.getElementNames()
+ sSheet = Replace(pvSheetName, &quot;&apos;&quot;, &quot;&quot;)
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