LibreOffice Module framework (master) 1
|
implements a cache for any accelerator configuration. More...
#include <acceleratorcache.hxx>
Public Types | |
typedef ::std::vector< css::awt::KeyEvent > | TKeyList |
commands -> keys More... | |
Public Member Functions | |
bool | hasKey (const css::awt::KeyEvent &aKey) const |
checks if the specified key exists. More... | |
bool | hasCommand (const OUString &sCommand) const |
TKeyList | getAllKeys () const |
void | setKeyCommandPair (const css::awt::KeyEvent &aKey, const OUString &sCommand) |
add a new or change an existing key-command pair of this container. More... | |
TKeyList | getKeysByCommand (const OUString &sCommand) const |
returns the list of keys, which are registered for this command. More... | |
OUString | getCommandByKey (const css::awt::KeyEvent &aKey) const |
void | removeKey (const css::awt::KeyEvent &aKey) |
void | removeCommand (const OUString &sCommand) |
Private Types | |
typedef std::unordered_map< OUString, TKeyList > | TCommand2Keys |
typedef std::unordered_map< css::awt::KeyEvent, OUString, KeyEventHashCode, KeyEventEqualsFunc > | TKey2Commands |
keys -> commands More... | |
Private Attributes | |
TCommand2Keys | m_lCommand2Keys |
map commands to keys in relation 1:n. More... | |
TKey2Commands | m_lKey2Commands |
map keys to commands in relation 1:1. More... | |
implements a cache for any accelerator configuration.
@descr It's implemented threadsafe, supports copy-on-write pattern and a flush mechanism to support concurrent access to the same configuration.
copy-on-write ... How? Do the following:
Definition at line 43 of file acceleratorcache.hxx.
|
private |
Definition at line 54 of file acceleratorcache.hxx.
|
private |
keys -> commands
Definition at line 62 of file acceleratorcache.hxx.
typedef ::std::vector< css::awt::KeyEvent > framework::AcceleratorCache::TKeyList |
commands -> keys
Definition at line 50 of file acceleratorcache.hxx.
AcceleratorCache::TKeyList framework::AcceleratorCache::getAllKeys | ( | ) | const |
Definition at line 38 of file acceleratorcache.cxx.
References m_lKey2Commands.
Referenced by framework::AcceleratorConfigurationWriter::flush(), framework::XMLBasedAcceleratorConfiguration::getAllKeyEvents(), framework::XCUBasedAcceleratorConfiguration::getAllKeyEvents(), framework::XCUBasedAcceleratorConfiguration::impl_ts_save(), and framework::XCUBasedAcceleratorConfiguration::storeToStorage().
OUString framework::AcceleratorCache::getCommandByKey | ( | const css::awt::KeyEvent & | aKey | ) | const |
Definition at line 69 of file acceleratorcache.cxx.
References m_lKey2Commands.
Referenced by framework::AcceleratorConfigurationWriter::flush(), framework::XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(), framework::XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(), framework::XCUBasedAcceleratorConfiguration::impl_ts_save(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), framework::XCUBasedAcceleratorConfiguration::setKeyEvent(), and framework::XCUBasedAcceleratorConfiguration::storeToStorage().
AcceleratorCache::TKeyList framework::AcceleratorCache::getKeysByCommand | ( | const OUString & | sCommand | ) | const |
returns the list of keys, which are registered for this command.
sCommand | describe the command. |
Definition at line 61 of file acceleratorcache.cxx.
References m_lCommand2Keys.
Referenced by framework::XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(), framework::XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(), framework::XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(), framework::XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(), removeCommand(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), and framework::XCUBasedAcceleratorConfiguration::setKeyEvent().
bool framework::AcceleratorCache::hasCommand | ( | const OUString & | sCommand | ) | const |
Definition at line 33 of file acceleratorcache.cxx.
References m_lCommand2Keys.
Referenced by framework::XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(), framework::XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(), framework::XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(), framework::XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(), framework::XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(), framework::XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), and framework::XCUBasedAcceleratorConfiguration::setKeyEvent().
bool framework::AcceleratorCache::hasKey | ( | const css::awt::KeyEvent & | aKey | ) | const |
checks if the specified key exists.
aKey | the key, which should be checked. |
Definition at line 28 of file acceleratorcache.cxx.
References m_lKey2Commands.
Referenced by framework::XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(), framework::XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(), framework::XCUBasedAcceleratorConfiguration::impl_ts_load(), framework::XCUBasedAcceleratorConfiguration::impl_ts_save(), framework::XMLBasedAcceleratorConfiguration::removeKeyEvent(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), framework::XCUBasedAcceleratorConfiguration::setKeyEvent(), and framework::AcceleratorConfigurationReader::startElement().
void framework::AcceleratorCache::removeCommand | ( | const OUString & | sCommand | ) |
Definition at line 112 of file acceleratorcache.cxx.
References getKeysByCommand(), and removeKey().
Referenced by framework::XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(), and framework::XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents().
void framework::AcceleratorCache::removeKey | ( | const css::awt::KeyEvent & | aKey | ) |
Definition at line 77 of file acceleratorcache.cxx.
References m_lCommand2Keys, and m_lKey2Commands.
Referenced by framework::XCUBasedAcceleratorConfiguration::reloadChanged(), removeCommand(), framework::XMLBasedAcceleratorConfiguration::removeKeyEvent(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), and framework::XCUBasedAcceleratorConfiguration::setKeyEvent().
void framework::AcceleratorCache::setKeyCommandPair | ( | const css::awt::KeyEvent & | aKey, |
const OUString & | sCommand | ||
) |
add a new or change an existing key-command pair of this container.
aKey | describe the key. |
sCommand | describe the command. |
Definition at line 51 of file acceleratorcache.cxx.
References m_lCommand2Keys, and m_lKey2Commands.
Referenced by framework::XCUBasedAcceleratorConfiguration::impl_ts_load(), framework::XCUBasedAcceleratorConfiguration::reloadChanged(), framework::XCUBasedAcceleratorConfiguration::removeKeyEvent(), framework::XMLBasedAcceleratorConfiguration::setKeyEvent(), framework::XCUBasedAcceleratorConfiguration::setKeyEvent(), framework::AcceleratorConfigurationReader::startElement(), and framework::XCUBasedAcceleratorConfiguration::storeToStorage().
|
private |
map commands to keys in relation 1:n.
First key is interpreted as preferred one!
Definition at line 66 of file acceleratorcache.hxx.
Referenced by getKeysByCommand(), hasCommand(), removeKey(), and setKeyCommandPair().
|
private |
map keys to commands in relation 1:1.
Definition at line 69 of file acceleratorcache.hxx.
Referenced by getAllKeys(), getCommandByKey(), hasKey(), removeKey(), and setKeyCommandPair().