// If we find a Mnemonic, set the flag. In other case count the // characters, because we need this to set most as possible // Mnemonics
sal_Unicode cMnemonic = ImplFindMnemonic( aKey ); if ( cMnemonic )
{
sal_uInt16 nMnemonicIndex = ImplGetMnemonicIndex( cMnemonic ); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
maMnemonics[nMnemonicIndex] = 0;
} else
{
sal_Int32 nIndex = 0;
sal_Int32 nLen = aKey.getLength(); while ( nIndex < nLen )
{
sal_Unicode c = aKey[ nIndex ];
sal_uInt16 nMnemonicIndex = ImplGetMnemonicIndex( c ); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
{ if ( maMnemonics[nMnemonicIndex] && (maMnemonics[nMnemonicIndex] < 0xFF) )
maMnemonics[nMnemonicIndex]++;
}
// #107889# in CJK versions ALL strings (even those that contain latin characters) // will get mnemonics in the form: xyz (M) // thus steps 1) and 2) are skipped for CJK locales
// #110720#, avoid CJK-style mnemonics for latin-only strings that do not contain useful mnemonic chars if( bCJK )
{ bool bLatinOnly = true; bool bMnemonicIndexFound = false;
sal_Unicode c;
sal_Int32 nIndex;
OUString rKey(_rKey); int nCJK = 0;
sal_uInt16 nMnemonicIndex;
sal_Unicode c;
sal_Int32 nIndex = 0; if( !bCJK )
{ // 1) first try the first character of a word do
{
c = aKey[ nIndex ];
// Search for next word
nIndex++; while ( nIndex < nLen )
{
c = aKey[ nIndex ]; if ( c == ' ' ) break;
nIndex++;
}
nIndex++;
} while ( nIndex < nLen );
// 2) search for a unique/uncommon character if ( !bChanged )
{
sal_uInt16 nBestCount = 0xFFFF;
sal_uInt16 nBestMnemonicIndex = 0;
sal_Int32 nBestIndex = 0;
nIndex = 0; do
{
c = aKey[ nIndex ];
nMnemonicIndex = ImplGetMnemonicIndex( c ); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
{ if ( maMnemonics[nMnemonicIndex] )
{ if ( maMnemonics[nMnemonicIndex] < nBestCount )
{
nBestCount = maMnemonics[nMnemonicIndex];
nBestIndex = nIndex;
nBestMnemonicIndex = nMnemonicIndex; if ( nBestCount == 2 ) break;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.