LibreOffice Module svtools (master) 1
|
@descr implements a helper, which can be used to convert vcl key codes into awt key codes ... and reverse. More...
#include <acceleratorexecute.hxx>
Public Member Functions | |
~AcceleratorExecute () | |
fight against inlining ... More... | |
void | init (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &xEnv) |
init this instance. More... | |
bool | execute (const vcl::KeyCode &aKey) |
trigger this accelerator. More... | |
bool | execute (const css::awt::KeyEvent &aKey) |
OUString | findCommand (const css::awt::KeyEvent &aKey) |
search the command for the given key event. More... | |
void | lok_setModuleConfig (css::uno::Reference< css::ui::XAcceleratorConfiguration > acceleratorConfig) |
Static Public Member Functions | |
static std::unique_ptr< AcceleratorExecute > | createAcceleratorHelper () |
factory method to create new accelerator helper instance. More... | |
static css::awt::KeyEvent | st_VCLKey2AWTKey (const vcl::KeyCode &aKey) |
TODO document me. More... | |
static vcl::KeyCode | st_AWTKey2VCLKey (const css::awt::KeyEvent &aKey) |
static css::uno::Reference< css::ui::XAcceleratorConfiguration > | st_openModuleConfig (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &xFrame) |
TODO document me. More... | |
static css::uno::Reference< css::ui::XAcceleratorConfiguration > | lok_createNewAcceleratorConfiguration (const css::uno::Reference< css::uno::XComponentContext > &rxContext, OUString sModule) |
static css::uno::Reference< css::ui::XAcceleratorConfiguration > | st_openDocConfig (const css::uno::Reference< css::frame::XModel > &xModel) |
TODO document me. More... | |
Private Member Functions | |
SVT_DLLPRIVATE | AcceleratorExecute () |
allow creation of instances of this class by using our factory only! More... | |
AcceleratorExecute (const AcceleratorExecute &rCopy)=delete | |
void | operator= (const AcceleratorExecute &)=delete |
SVT_DLLPRIVATE OUString | impl_ts_findCommand (const css::awt::KeyEvent &aKey) |
TODO document me. More... | |
SVT_DLLPRIVATE css::uno::Reference< css::util::XURLTransformer > | impl_ts_getURLParser () |
TODO document me. More... | |
Private Attributes | |
std::mutex | m_aLock |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
TODO document me. More... | |
css::uno::Reference< css::util::XURLTransformer > | m_xURLParser |
TODO document me. More... | |
css::uno::Reference< css::frame::XDispatchProvider > | m_xDispatcher |
TODO document me. More... | |
css::uno::Reference< css::ui::XAcceleratorConfiguration > | m_xGlobalCfg |
TODO document me. More... | |
css::uno::Reference< css::ui::XAcceleratorConfiguration > | m_xModuleCfg |
css::uno::Reference< css::ui::XAcceleratorConfiguration > | m_xDocCfg |
@descr implements a helper, which can be used to convert vcl key codes into awt key codes ... and reverse.
Further such key code can be triggered. Doing so different accelerator configurations are merged together; a suitable command registered for the given key code is searched and will be dispatched.
Because execution of an accelerator command can be dangerous (in case it force an office shutdown for key "ALT+F4"!) all internal dispatches are done asynchronous. Means that the trigger call doesn't wait till the dispatch is finished. You can call very often. All requests will be queued internal and dispatched ASAP. Of course this queue will be stopped if the environment will be destructed...
Definition at line 65 of file acceleratorexecute.hxx.
svt::AcceleratorExecute::~AcceleratorExecute | ( | ) |
fight against inlining ...
Definition at line 95 of file acceleratorexecute.cxx.
|
private |
allow creation of instances of this class by using our factory only!
Definition at line 91 of file acceleratorexecute.cxx.
|
privatedelete |
|
static |
factory method to create new accelerator helper instance.
@descr Such helper instance must be initialized at first. So it can know its environment (global/module or document specific).
Afterwards it can be used to execute incoming accelerator requests.
The "end of life" of such helper can be reached as follow:
Definition at line 101 of file acceleratorexecute.cxx.
bool svt::AcceleratorExecute::execute | ( | const css::awt::KeyEvent & | aKey | ) |
Definition at line 178 of file acceleratorexecute.cxx.
References aURL, impl_ts_findCommand(), impl_ts_getURLParser(), vcl::lok::isUnipoll(), m_aLock, m_xContext, m_xDispatcher, SAL_INFO, xDispatch, and xFrame.
bool svt::AcceleratorExecute::execute | ( | const vcl::KeyCode & | aKey | ) |
trigger this accelerator.
@descr The internal configurations are used to find as suitable command for this key code. This command will be queued and executed later asynchronous.
aKey | specify the accelerator for execute. |
Definition at line 171 of file acceleratorexecute.cxx.
References execute(), and st_VCLKey2AWTKey().
Referenced by execute().
OUString svt::AcceleratorExecute::findCommand | ( | const css::awt::KeyEvent & | aKey | ) |
search the command for the given key event.
aKey | The key event |
Definition at line 260 of file acceleratorexecute.cxx.
References impl_ts_findCommand().
|
private |
TODO document me.
Definition at line 265 of file acceleratorexecute.cxx.
References m_aLock, m_xDocCfg, m_xGlobalCfg, and m_xModuleCfg.
Referenced by execute(), and findCommand().
|
private |
TODO document me.
Definition at line 450 of file acceleratorexecute.cxx.
References m_aLock, m_xContext, and m_xURLParser.
Referenced by execute().
void svt::AcceleratorExecute::init | ( | const css::uno::Reference< css::uno::XComponentContext > & | rxContext, |
const css::uno::Reference< css::frame::XFrame > & | xEnv | ||
) |
init this instance.
@descr It must be called as first method after creation. And further it can be called more than once... but at least it should be used one times only. Otherwise nobody can say, which asynchronous executions will be used inside the old and which one will be used inside the new environment.
rxContext | reference to a uno service manager. |
xEnv | if it points to a valid frame it will be used to execute the dispatch there. Further the frame is used to locate the right module configuration and use it merged together with the document and the global configuration. |
If this parameter is set to NULL, the global configuration is used only. Further the global Desktop instance is used for dispatch.
Definition at line 107 of file acceleratorexecute.cxx.
References m_aLock, m_xContext, m_xDispatcher, m_xDocCfg, m_xGlobalCfg, m_xModuleCfg, st_openDocConfig(), st_openModuleConfig(), xController, and xModel.
|
static |
Definition at line 413 of file acceleratorexecute.cxx.
References t.
void svt::AcceleratorExecute::lok_setModuleConfig | ( | css::uno::Reference< css::ui::XAcceleratorConfiguration > | acceleratorConfig | ) |
Definition at line 432 of file acceleratorexecute.cxx.
References m_xModuleCfg.
|
privatedelete |
|
static |
Definition at line 249 of file acceleratorexecute.cxx.
|
static |
TODO document me.
Definition at line 437 of file acceleratorexecute.cxx.
References xModel.
Referenced by init().
|
static |
TODO document me.
Definition at line 383 of file acceleratorexecute.cxx.
References xFrame.
Referenced by init().
|
static |
TODO document me.
Definition at line 231 of file acceleratorexecute.cxx.
References vcl::KeyCode::GetCode(), if(), vcl::KeyCode::IsMod1(), vcl::KeyCode::IsMod2(), vcl::KeyCode::IsMod3(), and vcl::KeyCode::IsShift().
Referenced by execute().
|
private |
Definition at line 69 of file acceleratorexecute.hxx.
Referenced by execute(), impl_ts_findCommand(), impl_ts_getURLParser(), and init().
|
private |
TODO document me.
Definition at line 72 of file acceleratorexecute.hxx.
Referenced by execute(), impl_ts_getURLParser(), and init().
|
private |
TODO document me.
Definition at line 78 of file acceleratorexecute.hxx.
|
private |
Definition at line 83 of file acceleratorexecute.hxx.
Referenced by impl_ts_findCommand(), and init().
|
private |
TODO document me.
Definition at line 81 of file acceleratorexecute.hxx.
Referenced by impl_ts_findCommand(), and init().
|
private |
Definition at line 82 of file acceleratorexecute.hxx.
Referenced by impl_ts_findCommand(), init(), and lok_setModuleConfig().
|
private |
TODO document me.
Definition at line 75 of file acceleratorexecute.hxx.
Referenced by impl_ts_getURLParser().