LibreOffice Module framework (master) 1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
framework::KeyMapping Class Reference

can be used to map key identifier to the corresponding key codes ... More...

#include <keymapping.hxx>

Collaboration diagram for framework::KeyMapping:
[legend]

Classes

struct  KeyIdentifierInfo
 is used to map a key code to the right key identifier, which is used to make the xml file "human readable" More...
 

Public Member Functions

 KeyMapping ()
 
sal_uInt16 mapIdentifierToCode (const OUString &sIdentifier)
 return a suitable key code for the specified key identifier. More...
 
OUString mapCodeToIdentifier (sal_uInt16 nCode)
 return a suitable key identifier for the specified key code. More...
 

Static Public Member Functions

static KeyMappingget ()
 

Private Types

typedef std::unordered_map< OUString, sal_Int16 > Identifier2CodeHash
 hash structure to map identifier to key codes. More...
 
typedef std::unordered_map< sal_Int16, OUString > Code2IdentifierHash
 hash structure to map key codes to identifier. More...
 

Private Member Functions

bool impl_st_interpretIdentifierAsPureKeyCode (std::u16string_view sIdentifier, sal_uInt16 &rCode)
 check if the given string describe a numeric value ... and convert it. More...
 

Private Attributes

Identifier2CodeHash m_lIdentifierHash
 hash to map identifier to key codes. More...
 
Code2IdentifierHash m_lCodeHash
 hash to map key codes to identifier. More...
 

Static Private Attributes

static KeyIdentifierInfo const KeyIdentifierMap []
 

Detailed Description

can be used to map key identifier to the corresponding key codes ...

Definition at line 34 of file keymapping.hxx.

Member Typedef Documentation

◆ Code2IdentifierHash

typedef std::unordered_map<sal_Int16, OUString> framework::KeyMapping::Code2IdentifierHash
private

hash structure to map key codes to identifier.

Definition at line 55 of file keymapping.hxx.

◆ Identifier2CodeHash

typedef std::unordered_map<OUString, sal_Int16> framework::KeyMapping::Identifier2CodeHash
private

hash structure to map identifier to key codes.

Definition at line 52 of file keymapping.hxx.

Constructor & Destructor Documentation

◆ KeyMapping()

framework::KeyMapping::KeyMapping ( )

Member Function Documentation

◆ get()

KeyMapping & framework::KeyMapping::get ( )
static

◆ impl_st_interpretIdentifierAsPureKeyCode()

bool framework::KeyMapping::impl_st_interpretIdentifierAsPureKeyCode ( std::u16string_view  sIdentifier,
sal_uInt16 &  rCode 
)
private

check if the given string describe a numeric value ... and convert it.

Parameters
sIdentifierthe string value, which should be converted.
rCodecontains the converted code, but is defined only if this method returns sal_True!
Returns
[boolean] sal_True if conversion was successful.

Definition at line 192 of file keymapping.cxx.

References o3tl::toInt32(), and u.

Referenced by mapIdentifierToCode().

◆ mapCodeToIdentifier()

OUString framework::KeyMapping::mapCodeToIdentifier ( sal_uInt16  nCode)

return a suitable key identifier for the specified key code.

Parameters
nCodeshort value, which describe the key.
Returns
The corresponding string identifier.

Definition at line 182 of file keymapping.cxx.

References m_lCodeHash.

Referenced by framework::AcceleratorConfigurationWriter::impl_ts_writeKeyCommandPair().

◆ mapIdentifierToCode()

sal_uInt16 framework::KeyMapping::mapIdentifierToCode ( const OUString &  sIdentifier)

return a suitable key code for the specified key identifier.

Parameters
sIdentifierstring value, which describe the key.
Returns
[css::awt::KeyEvent] the corresponding key code as short value.
Exceptions
[css::lang::IllegalArgumentException]if the given identifier does not describe a well known key code.

Definition at line 164 of file keymapping.cxx.

References impl_st_interpretIdentifierAsPureKeyCode(), and m_lIdentifierHash.

Referenced by framework::XCUBasedAcceleratorConfiguration::impl_ts_load(), framework::XCUBasedAcceleratorConfiguration::reloadChanged(), and framework::AcceleratorConfigurationReader::startElement().

Member Data Documentation

◆ KeyIdentifierMap

KeyMapping::KeyIdentifierInfo const framework::KeyMapping::KeyIdentifierMap
staticprivate

Definition at line 61 of file keymapping.hxx.

Referenced by KeyMapping().

◆ m_lCodeHash

Code2IdentifierHash framework::KeyMapping::m_lCodeHash
private

hash to map key codes to identifier.

Definition at line 67 of file keymapping.hxx.

Referenced by KeyMapping(), and mapCodeToIdentifier().

◆ m_lIdentifierHash

Identifier2CodeHash framework::KeyMapping::m_lIdentifierHash
private

hash to map identifier to key codes.

Definition at line 64 of file keymapping.hxx.

Referenced by KeyMapping(), and mapIdentifierToCode().


The documentation for this class was generated from the following files: