MenuItemData* pFirstMatch = nullptr;
size_t nFirstPos(0); for ( rPos = 0; rPos < nListCount; rPos++)
{
MenuItemData* pData = maItemList[ rPos ].get(); if ( pData->bEnabled )
{
sal_Int32 n = pData->aText.indexOf('~'); if ( n != -1 )
{
KeyCode nKeyCode;
sal_Unicode nUnicode = pData->aText[n+1];
vcl::Window* pDefWindow = ImplGetDefaultWindow(); if( ( pDefWindow
&& pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( nUnicode,
Application::GetSettings().GetUILanguageTag().getLanguageType(), nKeyCode )
&& aKeyCode.GetCode() == nKeyCode.GetCode()
)
|| ( ascii
&& rI18nHelper.MatchMnemonic( pData->aText, ascii )
)
)
{ if (nDuplicates == 1) return pData; if (rPos > nCurrentPos) return pData; // select next entry with the same mnemonic if (!pFirstMatch) // stash the first match for use if nothing follows nCurrentPos
{
pFirstMatch = pData;
nFirstPos = rPos;
}
}
}
}
} if (pFirstMatch)
{
rPos = nFirstPos; return pFirstMatch;
}
}
return nullptr;
}
size_t MenuItemList::GetItemCount( sal_Unicode cSelectChar ) const
{ // returns number of entries with same mnemonic const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
size_t MenuItemList::GetItemCount( KeyCode aKeyCode ) const
{ // returns number of entries with same mnemonic // uses key codes instead of character codes const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); char ascii = 0; if( aKeyCode.GetCode() >= KEY_A && aKeyCode.GetCode() <= KEY_Z )
ascii = sal::static_int_cast<char>('A' + (aKeyCode.GetCode() - KEY_A));
size_t nItems = 0; for ( size_t nPos = maItemList.size(); nPos; )
{
MenuItemData* pData = maItemList[ --nPos ].get(); if ( pData->bEnabled )
{
sal_Int32 n = pData->aText.indexOf('~'); if (n != -1)
{
KeyCode nKeyCode; // if MapUnicodeToKeyCode fails or is unsupported we try the pure ascii mapping of the keycodes // so we have working shortcuts when ascii mnemonics are used
vcl::Window* pDefWindow = ImplGetDefaultWindow(); if( ( pDefWindow
&& pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( pData->aText[n+1],
Application::GetSettings().GetUILanguageTag().getLanguageType(), nKeyCode )
&& aKeyCode.GetCode() == nKeyCode.GetCode()
)
|| ( ascii
&& rI18nHelper.MatchMnemonic( pData->aText, ascii )
)
)
nItems++;
}
}
}
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.