26#include <com/sun/star/i18n/XCharacterClassification.hpp>
29#include <rtl/character.hxx>
35 : m_cMnemonic(cMnemonic)
53 sal_uInt16 nMnemonicIndex = 0;
56 if ( (c >= aImplMnemonicRangeTab[
i*2]) &&
57 (c <= aImplMnemonicRangeTab[
i*2+1]) )
58 return nMnemonicIndex+c-aImplMnemonicRangeTab[
i*2];
60 nMnemonicIndex += aImplMnemonicRangeTab[
i*2+1]-aImplMnemonicRangeTab[
i*2];
71 if (
nIndex == rKey.getLength() - 1) {
72 SAL_WARN(
"vcl",
"key \"" << rKey <<
"\" ends in lone mnemonic prefix");
86 uno::Reference < i18n::XCharacterClassification > xCharClass =
GetCharClass();
89 if ( !xCharClass.is() )
92 OUString aKey = xCharClass->toLower(rKey, 0, rKey.getLength(), css::lang::Locale());
107 sal_Int32 nLen = aKey.getLength();
129 uno::Reference < i18n::XCharacterClassification > xCharClass =
GetCharClass();
132 if ( !xCharClass.is() )
135 OUString aKey = xCharClass->toLower(_rKey, 0, _rKey.getLength(), css::lang::Locale());
137 bool bChanged =
false;
138 sal_Int32 nLen = aKey.getLength();
149 bool bLatinOnly =
true;
150 bool bMnemonicIndexFound =
false;
157 if ( ((c >= 0x3000) && (c <= 0xD7FF)) ||
158 ((c >= 0xFF61) && (c <= 0xFFDC)) )
164 bMnemonicIndexFound =
true;
166 if( bLatinOnly && !bMnemonicIndexFound )
170 OUString rKey(_rKey);
172 sal_uInt16 nMnemonicIndex;
184 if ( ((c >= 0x3000) && (c <= 0xD7FF)) ||
185 ((c >= 0xFF61) && (c <= 0xFFDC)) )
187 else if ( ((c >= 0x0030) && (c <= 0x0039)) ||
188 ((c >= 0x0041) && (c <= 0x005A)) ||
189 ((c >= 0x0061) && (c <= 0x007A)) ||
190 ((c >= 0x0370) && (c <= 0x037F)) ||
191 ((c >= 0x0400) && (c <= 0x04FF)) )
223 sal_uInt16 nBestCount = 0xFFFF;
224 sal_uInt16 nBestMnemonicIndex = 0;
225 sal_Int32 nBestIndex = 0;
239 nBestMnemonicIndex = nMnemonicIndex;
240 if ( nBestCount == 2 )
250 if ( nBestCount != 0xFFFF )
253 rKey = rKey.replaceAt( nBestIndex, 0, rtl::OUStringChar(
m_cMnemonic) );
262 if ( !bChanged && (nCJK == 1) && !rKey.isEmpty() )
274 OUStringChar(
sal_Unicode(rtl::toAsciiUpperCase(c))) +
276 nIndex = rKey.getLength();
279 if ( ( rKey[
nIndex-2] ==
'>' && rKey[
nIndex-1] ==
'>' ) ||
280 ( rKey[
nIndex-2] == 0xFF1E && rKey[
nIndex-1] == 0xFF1E ) )
286 ( rKey[
nIndex-3] == 0xFF0E && rKey[
nIndex-2] == 0xFF0E && rKey[
nIndex-1] == 0xFF0E ) )
292 if ( (cLastChar ==
':') || (cLastChar == 0xFF1A) ||
293 (cLastChar ==
'.') || (cLastChar == 0xFF0E) ||
294 (cLastChar ==
'?') || (cLastChar == 0xFF1F) ||
317 OUString
aStr = rStr;
318 sal_Int32 nLen =
aStr.getLength();
323 if (
aStr[
i ] ==
'~' )
326 if(
i > 0 && (
i+2) < nLen )
329 if(
aStr[
i-1 ] ==
'(' &&
330 aStr[
i+2 ] ==
')' &&
static const AllSettings & GetSettings()
Gets the application's settings.
MnemonicGenerator(sal_Unicode cMnemonic=MNEMONIC_CHAR)
sal_uInt8 maMnemonics[MAX_MNEMONICS]
css::uno::Reference< css::i18n::XCharacterClassification > const & GetCharClass()
static SAL_DLLPRIVATE sal_uInt16 ImplGetMnemonicIndex(sal_Unicode c)
void RegisterMnemonic(const OUString &rKey)
SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic(const OUString &rKey)
static OUString EraseAllMnemonicChars(const OUString &rStr)
css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass
OUString CreateMnemonic(const OUString &rKey)
MnemonicGenerator & operator=(MnemonicGenerator const &)
static bool isCJK(LanguageType nLang)
#define SAL_WARN(area, stream)
#define MNEMONIC_RANGE_2_START
#define MNEMONIC_RANGE_1_START
#define MNEMONIC_INDEX_NOTFOUND
#define MNEMONIC_RANGE_3_END
#define MNEMONIC_RANGE_1_END
#define MNEMONIC_RANGE_3_START
#define MNEMONIC_RANGE_4_START
#define MNEMONIC_RANGE_2_END
#define MNEMONIC_RANGE_4_END
css::uno::Reference< css::i18n::XCharacterClassification > CreateCharacterClassification()