basic/source/classes/sb.cxx |    5 +----
 basic/source/sbx/sbxvar.cxx |    8 +++++++-
 include/basic/sbxvar.hxx    |    1 +
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b32c85d0beb219e9f4ba9f043ae712b5d3ce2c18
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Apr 5 09:38:11 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Apr 5 11:30:24 2022 +0200

    Move creation of case-insensitive variable name to a central place
    
    SbxVariable::NameToCaseInsensitiveName might then be used wherever
    such names may be needed (see e.g. tdf#148358).
    
    Change-Id: I7749a12a05225398848cbf72700c6f0bc119bc22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132561
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 902f7adfd91f..def34b3718d6 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -47,9 +47,6 @@
 #include <memory>
 #include <unordered_map>
 
-#include <global.hxx>
-#include <unotools/transliterationwrapper.hxx>
-
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/ModuleInfo.hpp>
 
@@ -2079,7 +2076,7 @@ sal_Int32 BasicCollection::implGetIndexForName(const 
OUString& rName)
         if (pVar->GetHashCode() == nNameHash)
         {
             if (aNameCI.isEmpty() && !rName.isEmpty())
-                aNameCI = SbGlobal::GetTransliteration().transliterate(rName, 
0, rName.getLength());
+                aNameCI = SbxVariable::NameToCaseInsensitiveName(rName);
             if (aNameCI == pVar->GetName(SbxNameType::CaseInsensitive))
                 return i;
         }
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index a08122961b66..f0d99d7f3654 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -181,6 +181,12 @@ void SbxVariable::SetParameters( SbxArray* p )
 
 // Name of the variables
 
+// static
+OUString SbxVariable::NameToCaseInsensitiveName(const OUString& rName)
+{
+    return SbGlobal::GetTransliteration().transliterate(rName, 0, 
rName.getLength());
+}
+
 void SbxVariable::SetName( const OUString& rName )
 {
     maName = rName;
@@ -198,7 +204,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
     if (t == SbxNameType::CaseInsensitive)
     {
         if (maNameCI.isEmpty() && !maName.isEmpty())
-            maNameCI = SbGlobal::GetTransliteration().transliterate(maName, 0, 
maName.getLength());
+            maNameCI = NameToCaseInsensitiveName(maName);
         return maNameCI;
     }
     // Request parameter-information (not for objects)
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index d302f26637bd..01f5b650ebe0 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -271,6 +271,7 @@ public:
     void SetName( const OUString& );
     const OUString& GetName( SbxNameType = SbxNameType::NONE ) const;
     sal_uInt16 GetHashCode() const          { return nHash; }
+    static OUString NameToCaseInsensitiveName(const OUString& rName);
 
     virtual void SetModified( bool ) override;
 

Reply via email to