diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-17 10:50:34 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-08-17 20:23:08 +0200 |
commit | bc28d51cb88c796da241d1ab914bbe6bb174cc49 (patch) | |
tree | 8bb7a1d28971f76a54df67a6a344c81f651e140a /sc/source/core | |
parent | 2291c110738266abb42cb592df04c1220ddc4998 (diff) |
ofz: make ValidNewTabName faster wrt collisions
Change-Id: Id2058719c3bc822518faa922a6cd0409b4088ac7
Reviewed-on: https://gerrit.libreoffice.org/59253
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/data/document.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 6f68e4669338..5df5d77c2365 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -375,13 +375,18 @@ bool ScDocument::ValidTabName( const OUString& rName ) bool ScDocument::ValidNewTabName( const OUString& rName ) const { bool bValid = ValidTabName(rName); - TableContainer::const_iterator it = maTabs.begin(); - for (; it != maTabs.end() && bValid; ++it) - if ( *it ) - { - OUString aOldName = (*it)->GetName(); - bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName ); - } + if (!bValid) + return false; + OUString aUpperName = ScGlobal::pCharClass->uppercase(rName); + for (const auto& a : maTabs) + { + if (!a) + continue; + const OUString& rOldName = a->GetUpperName(); + bValid = rOldName != aUpperName; + if (!bValid) + break; + } return bValid; } |