summaryrefslogtreecommitdiff
path: root/vcl/source/window/mnemonic.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-21 20:07:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-07-21 21:36:49 +0100
commit5488ff0be8ec4625822428781298ffb76ea84041 (patch)
treeeaa2afe1b982dd326ad5dc4e8c2bb0fc8626f4c9 /vcl/source/window/mnemonic.cxx
parent91795dfd726c76db03e5bc731608e7bff8eabacb (diff)
mnemonics in words with Eszett misplaced
because the text is normalized with toUpper and uppercase ß is SS and using the insertion index of the normalized string in the original string is out by one if we normalize with toLower then according to icu/source/data/unidata/SpecialCasing.txt then as long as the language is not Lithuanian its always one to one so just normalize to lower case with blank locale Change-Id: I0ad1c7e2ad0216b7c27ec62105f9a25672ade8a8
Diffstat (limited to 'vcl/source/window/mnemonic.cxx')
-rw-r--r--vcl/source/window/mnemonic.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index fe57879d6444..b95f372f33c3 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -72,14 +72,13 @@ sal_Unicode MnemonicGenerator::ImplFindMnemonic( const OUString& rKey )
void MnemonicGenerator::RegisterMnemonic( const OUString& rKey )
{
- const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass();
// Don't crash even when we don't have access to i18n service
if ( !xCharClass.is() )
return;
- OUString aKey = xCharClass->toUpper( rKey, 0, rKey.getLength(), rLocale );
+ OUString aKey = xCharClass->toLower(rKey, 0, rKey.getLength(), css::lang::Locale());
// If we find a Mnemonic, set the flag. In other case count the
// characters, because we need this to set most as possible
@@ -116,14 +115,13 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
if ( _rKey.isEmpty() || ImplFindMnemonic( _rKey ) )
return _rKey;
- const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass();
// Don't crash even when we don't have access to i18n service
if ( !xCharClass.is() )
return _rKey;
- OUString aKey = xCharClass->toUpper( _rKey, 0, _rKey.getLength(), rLocale );
+ OUString aKey = xCharClass->toLower(_rKey, 0, _rKey.getLength(), css::lang::Locale());
bool bChanged = false;
sal_Int32 nLen = aKey.getLength();
@@ -255,7 +253,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
// Append Ascii Mnemonic
for ( c = MNEMONIC_RANGE_2_START; c <= MNEMONIC_RANGE_2_END; c++ )
{
- nMnemonicIndex = ImplGetMnemonicIndex( c );
+ nMnemonicIndex = ImplGetMnemonicIndex(sal_Unicode(rtl::toAsciiUpperCase(c)));
if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
{
if ( maMnemonics[nMnemonicIndex] )
@@ -316,7 +314,7 @@ OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr )
// check for CJK-style mnemonic
if( i > 0 && (i+2) < nLen )
{
- sal_Unicode c = aStr[i+1];
+ sal_Unicode c = sal_Unicode(rtl::toAsciiUpperCase(aStr[i+1]));
if( aStr[ i-1 ] == '(' &&
aStr[ i+2 ] == ')' &&
c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END )