summaryrefslogtreecommitdiff
path: root/vcl/source/window/mnemonic.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-13 15:31:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-14 01:52:44 +0200
commit9c8a6a4396ebbe8ecb15591cc291c388c82c8ed6 (patch)
tree0dba376d730f88542efb12dd4f13bc83360d463e /vcl/source/window/mnemonic.cxx
parent22d2dbeaa6667e4c66978fb3bad11f835f569ef0 (diff)
gtk3: generate missing mnemonics
Change-Id: Ib0e94b8484dabb7e859c53aeb0e4adf75727fcd6 Reviewed-on: https://gerrit.libreoffice.org/52839 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window/mnemonic.cxx')
-rw-r--r--vcl/source/window/mnemonic.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index fe26cd14c152..43db6dea1493 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -28,7 +28,8 @@
using namespace ::com::sun::star;
-MnemonicGenerator::MnemonicGenerator()
+MnemonicGenerator::MnemonicGenerator(sal_Unicode cMnemonic)
+ : m_cMnemonic(cMnemonic)
{
memset( maMnemonics, 1, sizeof( maMnemonics ) );
}
@@ -59,10 +60,10 @@ sal_uInt16 MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c )
sal_Unicode MnemonicGenerator::ImplFindMnemonic( const OUString& rKey )
{
sal_Int32 nIndex = 0;
- while ( (nIndex = rKey.indexOf( MNEMONIC_CHAR, nIndex )) != -1 )
+ while ( (nIndex = rKey.indexOf( m_cMnemonic, nIndex )) != -1 )
{
sal_Unicode cMnemonic = rKey[ nIndex+1 ];
- if ( cMnemonic != MNEMONIC_CHAR )
+ if ( cMnemonic != m_cMnemonic )
return cMnemonic;
nIndex += 2;
}
@@ -187,7 +188,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
if ( maMnemonics[nMnemonicIndex] )
{
maMnemonics[nMnemonicIndex] = 0;
- rKey = rKey.replaceAt( nIndex, 0, OUString(MNEMONIC_CHAR) );
+ rKey = rKey.replaceAt( nIndex, 0, OUString(m_cMnemonic) );
bChanged = true;
break;
}
@@ -239,7 +240,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
if ( nBestCount != 0xFFFF )
{
maMnemonics[nBestMnemonicIndex] = 0;
- rKey = rKey.replaceAt( nBestIndex, 0, OUString(MNEMONIC_CHAR) );
+ rKey = rKey.replaceAt( nBestIndex, 0, OUString(m_cMnemonic) );
bChanged = true;
}
}
@@ -260,7 +261,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
{
maMnemonics[nMnemonicIndex] = 0;
OUString aStr = OUStringBuffer().
- append('(').append(MNEMONIC_CHAR).append(sal_Unicode(rtl::toAsciiUpperCase(c))).
+ append('(').append(m_cMnemonic).append(sal_Unicode(rtl::toAsciiUpperCase(c))).
append(')').makeStringAndClear();
nIndex = rKey.getLength();
if( nIndex >= 2 )