diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2024-09-08 15:47:27 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2024-09-08 17:14:50 +0200 |
commit | 70f3fea2f3956ec7344be45d035aafe12905896f (patch) | |
tree | 6c9a1946409b9b6e4bcbbef53b5598e02bbe2dde /wizards | |
parent | 7639d707034cbd6e578be7e074e73d4ab4b3563c (diff) |
ScriptForge (Dictionary) support case-sensitive keys
To enhance the compatibility between
- sf dictionaries
- python dicts
- arrays of PropertyValues
it was necessary to propose the support
of case-sensitive keys, i.e. keys are
different if a case-sensitive comparison
finds them different.
So far only not case-sensitive keys
were supported.
This required a re-visit of the implementation
of the ScriptForge.SF_Dictionary service. So far
it was built upon a Basic Collection class which
differentiates keys not case-sensitively. The
new implementation uses sorted arrays.
The invocation of the service is now:
dict = CreateScriptService("Dictionary", True/False)
True means case-sensitive keys.
Default = False, which preserves the compatibility
with the past.
ScriptForge uses dictionaries internally in
several places. For each of them it has been
assessed if the new attribute was justified
or not. For most of the contexts, it was.
The functionality makes sense only for Basic
user scripts.
The documentation of the Dictionary page
should be revised according to the new invocation
syntax.
Change-Id: If1f695bcbf1673a2b71c1e41487b1781caab71c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173044
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/scriptforge/SF_Array.xba | 6 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_Dictionary.xba | 118 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_L10N.xba | 4 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_Platform.xba | 6 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_PythonHelper.xba | 5 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_Services.xba | 18 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_Session.xba | 4 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_UI.xba | 2 | ||||
-rw-r--r-- | wizards/source/sfdatabases/SF_Dataset.xba | 10 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Document.xba | 5 | ||||
-rw-r--r-- | wizards/source/sfunittests/SF_UnitTest.xba | 2 | ||||
-rw-r--r-- | wizards/source/sfwidgets/SF_ContextMenu.xba | 2 | ||||
-rw-r--r-- | wizards/source/sfwidgets/SF_PopupMenu.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfwidgets/SF_Toolbar.xba | 2 |
14 files changed, 100 insertions, 90 deletions
diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 50257829755f..557d40226754 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -336,7 +336,7 @@ End Function ' ScriptForge.SF_Array.Contains REM ----------------------------------------------------------------------------- Public Function ConvertToDictionary(Optional ByRef Array_2D As Variant) As Variant -''' Store the content of a 2-columns array into a dictionary +''' Store the content of a 2-columns array into a dictionary with case-sensitive comparison of keys ''' Key found in 1st column, Item found in 2nd ''' Args: ''' Array_2D: 1st column must contain exclusively non zero-length strings @@ -348,7 +348,7 @@ Public Function ConvertToDictionary(Optional ByRef Array_2D As Variant) As Varia Dim oDict As Variant ' Return value Dim i As Long -Const cstThisSub = "Dictionary.ConvertToArray" +Const cstThisSub = "Array.ConvertToDictionary" Const cstSubArgs = "Array_2D" If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch @@ -359,7 +359,7 @@ Check: End If Try: - Set oDict = SF_Services.CreateScriptService("Dictionary") + Set oDict = SF_Services.CreateScriptService("Dictionary", True) For i = LBound(Array_2D, 1) To UBound(Array_2D, 1) oDict.Add(Array_2D(i, 0), Array_2D(i, 1)) Next i diff --git a/wizards/source/scriptforge/SF_Dictionary.xba b/wizards/source/scriptforge/SF_Dictionary.xba index 22ada5148e2a..a5ea8fc6ac6e 100644 --- a/wizards/source/scriptforge/SF_Dictionary.xba +++ b/wizards/source/scriptforge/SF_Dictionary.xba @@ -15,21 +15,23 @@ Option Explicit ''' ============= ''' Class for management of dictionaries ''' A dictionary is a collection of key-item pairs -''' The key is a not case-sensitive string +''' The key is either a case-sensitive or a not case-sensitive string ''' Items may be of any type ''' Keys, items can be retrieved, counted, etc. ''' -''' The implementation is based on -''' - one collection mapping keys and entries in the array -''' - one 1-column array: key + data +''' The implementation is based on 3 one-column arrays: +''' 1) The keys - sorted +''' 2) The positions in 3) - same sequence as 1) +''' 3) The item contents - stacked up when defined - erased items are set to Empty ''' ''' Why a Dictionary class beside the builtin Collection class ? ''' A standard Basic collection does not support the retrieval of the keys -''' Additionally it may contain only simple data (strings, numbers, ...) +''' A standard Basic collection does not support the update/removal of entries +''' No easy conversion to/from json or PropertyValues ''' ''' Service instantiation example: ''' Dim myDict As Variant -''' myDict = CreateScriptService("Dictionary") ' Once per dictionary +''' myDict = CreateScriptService("Dictionary", True) ' Case-sensitive, default = False ''' ''' Detailed user documentation: ''' https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_dictionary.html?DbPAR=BASIC @@ -43,17 +45,13 @@ Const INVALIDKEYERROR = "INVALIDKEYERROR" ' Key contains only REM ============================================================= PRIVATE MEMBERS -' Defines an entry in the MapItems array -Type ItemMap - Key As String - Value As Variant -End Type - Private [Me] As Object Private [_Parent] As Object Private ObjectType As String ' Must be "DICTIONARY" Private ServiceName As String -Private MapKeys As Variant ' To retain the original keys +Private CaseSensitive As Boolean ' Determined at dictionary creation, default = False +Private MapKeys As Variant ' Array of keys +Private MapPositions As Variant ' Array of indexes in MapItems, sorted as MapKeys Private MapItems As Variant ' Array of ItemMaps Private _MapSize As Long ' Total number of entries in the dictionary Private _MapRemoved As Long ' Number of inactive entries in the dictionary @@ -66,8 +64,10 @@ Private Sub Class_Initialize() Set [_Parent] = Nothing ObjectType = "DICTIONARY" ServiceName = "ScriptForge.Dictionary" - Set MapKeys = New Collection - Set MapItems = Array() + CaseSensitive = False + MapKeys = Array() + MapPositions = Array() + MapItems = Array() _MapSize = 0 _MapRemoved = 0 End Sub ' ScriptForge.SF_Dictionary Constructor @@ -157,7 +157,8 @@ Public Function Add(Optional ByVal Key As Variant _ ''' Examples: ''' myDict.Add("NewKey", NewValue) -Dim oItemMap As ItemMap ' New entry in the MapItems array +Dim vItemMap As Variant ' Output of SF_Array._FindItem +Dim lIndex As Long ' Index in MapKeys and MapPositions Const cstThisSub = "Dictionary.Add" Const cstSubArgs = "Key, Item" @@ -174,15 +175,16 @@ Check: End If End If If Key = Space(Len(Key)) Then GoTo CatchInvalid - If Exists(Key) Then GoTo CatchDuplicate Try: _MapSize = _MapSize + 1 - MapKeys.Add(_MapSize, Key) - oItemMap.Key = Key - oItemMap.Value = Item + vItemMap = SF_Array._FindItem(MapKeys, Key, CaseSensitive, "ASC") + If vItemMap(0) Then GoTo CatchDuplicate ' Key exists already + lIndex = vItemMap(1) + MapKeys = SF_Array.Insert(MapKeys, lIndex, Key) + MapPositions = SF_Array.Insert(MapPositions, lIndex, _MapSize) ReDim Preserve MapItems(1 To _MapSize) - MapItems(_MapSize) = oItemMap + MapItems(_MapSize) = Item Add = True Finally: @@ -404,12 +406,7 @@ Check: End If Try: - ' Dirty but preferred to go through whole collection - On Local Error GoTo NotFound - vItem = MapKeys(Key) - NotFound: - Exists = ( Not ( Err = 5 ) And vItem > 0 ) - On Local Error GoTo 0 + Exists = SF_Array.Contains(MapKeys, Key, CaseSensitive, SortOrder := "ASC") Finally: SF_Utils._ExitFunction(cstThisSub) @@ -660,7 +657,8 @@ Public Function Remove(Optional ByVal Key As Variant) As Boolean ''' Examples: ''' myDict.Remove("OldKey") -Dim lIndex As Long ' To remove entry in the MapItems array +Dim vItemMap As Variant ' Output of SF_Array._FindItem +Dim lIndex As Long ' Index in MapKeys and MapPositions Const cstThisSub = "Dictionary.Remove" Const cstSubArgs = "Key" @@ -671,12 +669,15 @@ Check: If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not SF_Utils._Validate(Key, "Key", V_STRING) Then GoTo Catch End If - If Not Exists(Key) Then GoTo CatchUnknown - Try: - lIndex = MapKeys.Item(Key) - MapKeys.Remove(Key) - Erase MapItems(lIndex) ' Is now Empty + vItemMap = SF_Array._FindItem(MapKeys, Key, CaseSensitive, "ASC") + If Not vItemMap(0) Then GoTo CatchUnknown + lIndex = vItemMap(1) + MapKeys(lIndex) = "" + MapKeys = SF_Array.TrimArray(MapKeys) + Erase MapItems(MapPositions(lIndex)) + MapPositions(lIndex) = Null + MapPositions = SF_Array.TrimArray(MapPositions) _MapRemoved = _MapRemoved + 1 Remove = True @@ -712,7 +713,7 @@ Check: Try: vKeys = Keys For Each sColl In vKeys - MapKeys.Remove(sColl) + Remove(sColl) Next sColl Erase MapKeys Erase MapItems @@ -740,7 +741,7 @@ Public Function ReplaceItem(Optional ByVal Key As Variant _ ''' Examples: ''' myDict.ReplaceItem("Key", NewValue) -Dim oItemMap As ItemMap ' Content to update in the MapItems array +Dim vItemMap As Variant ' Output of SF_Array._FindItem Dim lIndex As Long ' Entry in the MapItems array Const cstThisSub = "Dictionary.ReplaceItem" Const cstSubArgs = "Key, Value" @@ -757,13 +758,13 @@ Check: If Not SF_Utils._Validate(Value, "Value") Then GoTo Catch End If End If - If Not Exists(Key) Then GoTo CatchUnknown Try: ' Find entry in MapItems and update it with the new value - lIndex = MapKeys.Item(Key) - oItemMap = MapItems(lIndex) - oItemMap.Value = Value + vItemMap = SF_Array._FindItem(MapKeys, Key, CaseSensitive, "ASC") + If Not vItemMap(0) Then GoTo CatchUnknown + lIndex = vItemMap(1) + MapItems(MapPositions(lIndex)) = Value ReplaceItem = True Finally: @@ -791,8 +792,6 @@ Public Function ReplaceKey(Optional ByVal Key As Variant _ ''' Examples: ''' myDict.ReplaceKey("OldKey", "NewKey") -Dim oItemMap As ItemMap ' Content to update in the MapItems array -Dim lIndex As Long ' Entry in the MapItems array Const cstThisSub = "Dictionary.ReplaceKey" Const cstSubArgs = "Key, Value" @@ -809,14 +808,9 @@ Check: If Exists(Value) Then GoTo CatchDuplicate Try: - ' Remove the Key entry and create a new one in MapKeys - With MapKeys - lIndex = .Item(Key) - .Remove(Key) - .Add(lIndex, Value) - End With - oItemMap = MapItems(lIndex) - oItemMap.Key = Value + ' Remove the Key entry and create a new one + Add(Value, Item(Key)) + Remove(Key) ReplaceKey = True Finally: @@ -880,8 +874,9 @@ Private Function _PropertyGet(Optional ByVal psProperty As String _ ''' psProperty: the name of the property ''' pvKey: the key to retrieve, numeric or string -Dim vItemMap As Variant ' Entry in the MapItems array -Dim vArray As Variant ' To get Keys or Values +Dim vItemMap As Variant ' Output of SF_Array._FindItem +Dim lIndex As Long ' Entry in the MapItems array +Dim vArray As Variant ' To get Keys or Items Dim i As Long Dim cstThisSub As String Dim cstSubArgs As String @@ -898,18 +893,19 @@ Dim cstSubArgs As String _PropertyGet = _MapSize - _MapRemoved Case UCase("Item") If Not SF_Utils._Validate(pvKey, "Key", V_STRING) Then GoTo Catch - If Exists(pvKey) Then _PropertyGet = MapItems(MapKeys(pvKey)).Value Else _PropertyGet = Empty + vItemMap = SF_Array._FindItem(MapKeys, pvKey, CaseSensitive, "ASC") + lIndex = vItemMap(1) + If vItemMap(0) Then _PropertyGet = MapItems(MapPositions(lIndex)) Else _PropertyGet = Empty Case UCase("Keys"), UCase("Items") vArray = Array() - If _MapSize - _MapRemoved - 1 >= 0 Then - ReDim vArray(0 To (_MapSize - _MapRemoved - 1)) - i = -1 - For each vItemMap In MapItems() - If Not IsEmpty(vItemMap) Then - i = i + 1 - If UCase(psProperty) = "KEYS" Then vArray(i) = vItemMap.Key Else vArray(i) = vItemMap.Value - End If - Next vItemMap + If UBound(MapKeys) >= 0 Then + ReDim vArray(0 To UBound(MapKeys)) + For i = 0 To UBound(MapKeys) + Select Case UCase(psProperty) + Case "KEYS" : vArray(i) = MapKeys(i) + Case "ITEMS" : vArray(i) = MapItems(MapPositions(i)) + End Select + Next i End If _PropertyGet = vArray End Select diff --git a/wizards/source/scriptforge/SF_L10N.xba b/wizards/source/scriptforge/SF_L10N.xba index 6bc6b236f3f3..f621e4567119 100644 --- a/wizards/source/scriptforge/SF_L10N.xba +++ b/wizards/source/scriptforge/SF_L10N.xba @@ -670,8 +670,8 @@ Dim iContinue As Integer ' 0 = None, 1 = MsgId, 2 = MsgStr Const cstMsgId = 1, cstMsgStr = 2 Try: - ' Initialize dictionary anyway - Set _Dictionary = SF_Services.CreateScriptService("Dictionary") + ' Initialize dictionary anyway with case-sensitive comparison of keys + Set _Dictionary = SF_Services.CreateScriptService("Dictionary", True) Set _Dictionary.[_Parent] = [Me] ' Load PO file diff --git a/wizards/source/scriptforge/SF_Platform.xba b/wizards/source/scriptforge/SF_Platform.xba index 742d138de9ce..ade9681b54c4 100644 --- a/wizards/source/scriptforge/SF_Platform.xba +++ b/wizards/source/scriptforge/SF_Platform.xba @@ -221,7 +221,7 @@ REM ---------------------------------------------------------------------------- Property Get UserData() As Variant ''' Returns a dictionary of all Options + User Data values ''' Example: -''' MsgBox platform.UserData +''' dict = platform.UserData UserData = _PropertyGet("UserData") End Property ' ScriptForge.SF_Platform.UserData (get) @@ -464,8 +464,8 @@ Const cstSubArgs = "" ) ' Get the UserData page from the Options database vUserDataOptions = SF_Utils._GetRegistryKeyContent("org.openoffice.UserProfile/Data") - ' Create and feed the output dictionary - vUserData = CreateScriptService("ScriptForge.Dictionary") + ' Create and feed an output dictionary with case-sensitive comparison of keys + vUserData = CreateScriptService("ScriptForge.Dictionary", True) For i = 0 To UBound(vUserDataExternal) vUserData.Add(vUserDataExternal(i), vUserDataOptions.getByName(vUserDataInternal(i))) Next i diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index 6cc8fc42daca..beb0d16f1306 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -635,7 +635,7 @@ Check: ' Reinterpret arguments one by one into vArgs ' - convert UNO dates/times ' - identify conventional NoArgs/Empty/Null/Missing constants - ' - convert arrays of property values into DictionarY + ' - convert arrays of property values into Dictionary iNbArgs = -1 vArgs = Array() @@ -667,7 +667,8 @@ Check: If IsArray(vArg) Then If UBound(vArg) >= 0 Then If sess.UnoObjectType(vArg(0)) = "com.sun.star.beans.PropertyValue" Then - Set oDict = CreateScriptService("ScriptForge.Dictionary") + ' Create a dictionary - keys in Python dicts are case-sensitive + Set oDict = CreateScriptService("ScriptForge.Dictionary", True) oDict.ImportFromPropertyValues(vArg, Overwrite := True) vArg = oDict End If diff --git a/wizards/source/scriptforge/SF_Services.xba b/wizards/source/scriptforge/SF_Services.xba index 4e6a1130a874..641632b41709 100644 --- a/wizards/source/scriptforge/SF_Services.xba +++ b/wizards/source/scriptforge/SF_Services.xba @@ -41,7 +41,7 @@ Const UNKNOWNFILEERROR = "UNKNOWNFILEERROR" ' Source file doe REM ============================================================== PUBLIC MEMBERS -' Defines an entry in in the services dictionary +' Defines an entry in the services dictionary Type _Service ServiceName As String ServiceType As Integer @@ -494,19 +494,31 @@ Finally: End Function ' ScriptForge.SF_Services._LoadLibraryServices REM ----------------------------------------------------------------------------- -Public Function _NewDictionary() As Variant +Public Function _NewDictionary(Optional ByVal pvArgs As Variant) As Variant ''' Create a new instance of the SF_Dictionary class +''' Args: +''' [0] : If True, the keys are compared case-sensitively. Default = False ''' Returns: the instance or Nothing -Dim oDict As Variant +Dim oDict As Variant ' Reurn value +Dim bCaseSensitive As Boolean ' Keys comparison If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch Check: + If IsMissing(pvArgs) Then pvArgs = Array() + If Not IsArray(pvArgs) Then pvArgs = Array(pvArgs) + If UBound(pvArgs) < 0 Then + bCaseSensitive = False + Else + If Not SF_Utils._Validate(pvArgs(0), "CaseSensitive (Arg0)", V_BOOLEAN) Then GoTo Catch + bCaseSensitive = pvArgs(0) + End If Try: Set oDict = New SF_Dictionary Set oDict.[Me] = oDict + oDict.CaseSensitive = bCaseSensitive Finally: Set _NewDictionary = oDict diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index cc6e576e1c5f..1eb34916a0e3 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -355,8 +355,8 @@ Try: Set oNodePath = SF_Utils._MakePropertyValue("nodepath", "/org.openoffice.Office.Common/Filter/PDF/Export/") Set oOptions = oConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", Array(oNodePath)) - ' Copy the options into a ScriptForge dictionary - Set vDict = CreateScriptService("dictionary") + ' Copy the options into a ScriptForge dictionary with case-sensitive comparison of keys + Set vDict = CreateScriptService("Dictionary", True) vOptionNames = oOptions.getElementNames() vOptionValues = oOptions.getPropertyValues(vOptionNames) ' diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index 47e785edb3d6..770c523acb42 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -1427,7 +1427,7 @@ Check: If IsNull(poComponent) Then GoTo Catch Try: - Set oToolbarsDict = CreateScriptService("Dictionary") + Set oToolbarsDict = CreateScriptService("Dictionary", True) ' with case-sensitive comparison of keys ' 1. Collect all builtin and custom toolbars stored in the LibreOffice configuration files diff --git a/wizards/source/sfdatabases/SF_Dataset.xba b/wizards/source/sfdatabases/SF_Dataset.xba index b888c7f5010a..718d8feac4a2 100644 --- a/wizards/source/sfdatabases/SF_Dataset.xba +++ b/wizards/source/sfdatabases/SF_Dataset.xba @@ -1381,7 +1381,7 @@ Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant Dim vBookmark As Variant ' Bookmark on the current record Dim vValue As Variant ' A single record field value -Dim vValuesDict As Object ' A dictionary (field name, field value) +Dim vValuesDict As Object ' A dictionary (field name, field value) Dim i As Long Dim cstThisSub As String @@ -1397,8 +1397,8 @@ Const cstSubArgs = "" Case "BOF" _PropertyGet = .isBeforeFirst() Case "DefaultValues" - ' Load the pairs field name / field default value in the dictionary - vValuesDict = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary") + ' Load the pairs field name / field default value in the dictionary (with case-sensitive comparison of keys) + vValuesDict = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary", True) For i = 0 To UBound(_DefaultValues) vValuesDict.Add(_Fields(i), _DefaultValues(i)) Next i @@ -1434,8 +1434,8 @@ Const cstSubArgs = "" If .isBeforeFirst() Or .isAfterLast() Or .rowDeleted() Then Set _PropertyGet = Nothing Else - ' Load the pairs field name / field value in the dictionary - vValuesDict = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary") + ' Load the pairs field name / field value in the dictionary (with case-sensitive comparison of keys) + vValuesDict = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary", True) For i = 0 To UBound(_Fields) vValue = _ParentDatabase._GetColumnValue(_RowSet, i + 1, False) vValuesDict.Add(_Fields(i), vValue) diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba index d839538879d6..3b5e236cf670 100644 --- a/wizards/source/sfdocuments/SF_Document.xba +++ b/wizards/source/sfdocuments/SF_Document.xba @@ -2101,7 +2101,7 @@ End Function ' SFDocuments.SF_Document._ListContextMenus REM ----------------------------------------------------------------------------- Private Sub _LoadDocumentProperties() -''' Create dictionary with document properties as entries/ Custom properties are excluded +''' Create dictionary with document properties as entries / Custom properties are excluded ''' Document is presumed still alive ''' Special values: ''' Only valid dates are taken @@ -2169,7 +2169,8 @@ Const cstSubArgs = "" Select Case psProperty Case "CustomProperties" - _CustomProperties = CreateScriptService("Dictionary") ' Always reload as updates could have been done manually by user + _CustomProperties = CreateScriptService("Dictionary", True) ' Always reload as updates could have been done manually by user + ' (with case-sensitive comparison of keys) _CustomProperties.ImportFromPropertyValues(_Component.getDocumentProperties().UserDefinedProperties.getPropertyValues) _PropertyGet = _CustomProperties Case "Description" diff --git a/wizards/source/sfunittests/SF_UnitTest.xba b/wizards/source/sfunittests/SF_UnitTest.xba index baeef90de3b3..6b347457baf4 100644 --- a/wizards/source/sfunittests/SF_UnitTest.xba +++ b/wizards/source/sfunittests/SF_UnitTest.xba @@ -1515,7 +1515,7 @@ Try: bEval = ( Len(A) > 0 ) If bEval Then Set oAliasB = B - bEval = ScriptForge.SF_Array.Contains(oAliasB.Keys(), A, CaseSensitive := True) + bEval = ScriptForge.SF_Array.Contains(oAliasB.Keys(), A, CaseSensitive := oAliasB.CaseSensitive) End If Case Else bEval = False diff --git a/wizards/source/sfwidgets/SF_ContextMenu.xba b/wizards/source/sfwidgets/SF_ContextMenu.xba index e246c5aeb5d6..0694569cf9c0 100644 --- a/wizards/source/sfwidgets/SF_ContextMenu.xba +++ b/wizards/source/sfwidgets/SF_ContextMenu.xba @@ -482,7 +482,7 @@ Dim MainConfigManager As Object ' com.sun.star.ui.XUIConfigurationManager Try: ' Initialize the dictionary - Set MenuTree = ScriptForge.SF_Services.CreateScriptService("Dictionary") + Set MenuTree = ScriptForge.SF_Services.CreateScriptService("Dictionary", True) ' with case-sensitive comparison of keys ' Identify the container of the menu tree ' The container is taken either from the system configuration manager of from the local (= in document) one diff --git a/wizards/source/sfwidgets/SF_PopupMenu.xba b/wizards/source/sfwidgets/SF_PopupMenu.xba index 50b28cab9fa1..467e3f748776 100644 --- a/wizards/source/sfwidgets/SF_PopupMenu.xba +++ b/wizards/source/sfwidgets/SF_PopupMenu.xba @@ -710,10 +710,10 @@ Public Sub _Initialize(ByRef poPeer As Object _ ''' plXPos, plYPos: the coordinates Try: - ' Initialize the dictionaries + ' Initialize the dictionaries (with case-sensitive comparison of keys) With ScriptForge.SF_Services - Set MenuTree = .CreateScriptService("Dictionary") - Set MenuIdentification = .CreateScriptService("Dictionary") + Set MenuTree = .CreateScriptService("Dictionary", True) + Set MenuIdentification = .CreateScriptService("Dictionary", True) End With ' Initialize the root of the menu tree diff --git a/wizards/source/sfwidgets/SF_Toolbar.xba b/wizards/source/sfwidgets/SF_Toolbar.xba index 1cfbc9301753..1f8329ed1423 100644 --- a/wizards/source/sfwidgets/SF_Toolbar.xba +++ b/wizards/source/sfwidgets/SF_Toolbar.xba @@ -372,7 +372,7 @@ Try: ' Force the visibility of the toolbar Visible = True - Set _ToolbarButtons = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary") + Set _ToolbarButtons = ScriptForge.SF_Services.CreateScriptService("ScriptForge.Dictionary", True) ' with case-sensitive comparison of keys Set oElement = _LayoutManager.getElement(_ResourceURL) Set oSettings = oElement.getSettings(True) |