LibreOffice Module svtools (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
svt::AcceleratorExecute Class Referencefinal

@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< AcceleratorExecutecreateAcceleratorHelper ()
 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
 

Detailed Description

@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.

Attention: \n
    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.

Constructor & Destructor Documentation

◆ ~AcceleratorExecute()

svt::AcceleratorExecute::~AcceleratorExecute ( )

fight against inlining ...

Definition at line 95 of file acceleratorexecute.cxx.

◆ AcceleratorExecute() [1/2]

svt::AcceleratorExecute::AcceleratorExecute ( )
private

allow creation of instances of this class by using our factory only!

Definition at line 91 of file acceleratorexecute.cxx.

◆ AcceleratorExecute() [2/2]

svt::AcceleratorExecute::AcceleratorExecute ( const AcceleratorExecute rCopy)
privatedelete

Member Function Documentation

◆ createAcceleratorHelper()

std::unique_ptr< AcceleratorExecute > svt::AcceleratorExecute::createAcceleratorHelper ( )
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:

  • delete the object => If it stands currently in its execute method, they will be finished. All further queued requests will be removed and further not executed!
  • "let it stay alone" => All currently queued events will be finished. The helper kills itself afterwards. A shutdown of the environment will be recognized ... The helper stop its work immediately then!

Definition at line 101 of file acceleratorexecute.cxx.

◆ execute() [1/2]

bool svt::AcceleratorExecute::execute ( const css::awt::KeyEvent &  aKey)

◆ execute() [2/2]

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.

Parameters
aKeyspecify the accelerator for execute.
Returns
[bool] true if this key is configured and match to a command. Attention: This state does not mean the success state of the corresponding execute. Because it's done asynchronously!

Definition at line 171 of file acceleratorexecute.cxx.

References execute(), and st_VCLKey2AWTKey().

Referenced by execute().

◆ findCommand()

OUString svt::AcceleratorExecute::findCommand ( const css::awt::KeyEvent &  aKey)

search the command for the given key event.

Parameters
aKeyThe key event
Returns
The command or an empty string if the key event could not be found.

Definition at line 260 of file acceleratorexecute.cxx.

References impl_ts_findCommand().

◆ impl_ts_findCommand()

OUString svt::AcceleratorExecute::impl_ts_findCommand ( const css::awt::KeyEvent &  aKey)
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().

◆ impl_ts_getURLParser()

css::uno::Reference< css::util::XURLTransformer > svt::AcceleratorExecute::impl_ts_getURLParser ( )
private

TODO document me.

Definition at line 450 of file acceleratorexecute.cxx.

References m_aLock, m_xContext, and m_xURLParser.

Referenced by execute().

◆ init()

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.

Parameters
rxContextreference to a uno service manager.
xEnvif 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.

◆ lok_createNewAcceleratorConfiguration()

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::lok_createNewAcceleratorConfiguration ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
OUString  sModule 
)
static

Definition at line 413 of file acceleratorexecute.cxx.

References t.

◆ lok_setModuleConfig()

void svt::AcceleratorExecute::lok_setModuleConfig ( css::uno::Reference< css::ui::XAcceleratorConfiguration >  acceleratorConfig)

Definition at line 432 of file acceleratorexecute.cxx.

References m_xModuleCfg.

◆ operator=()

void svt::AcceleratorExecute::operator= ( const AcceleratorExecute )
privatedelete

◆ st_AWTKey2VCLKey()

vcl::KeyCode svt::AcceleratorExecute::st_AWTKey2VCLKey ( const css::awt::KeyEvent &  aKey)
static

Definition at line 249 of file acceleratorexecute.cxx.

◆ st_openDocConfig()

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::st_openDocConfig ( const css::uno::Reference< css::frame::XModel > &  xModel)
static

TODO document me.

Definition at line 437 of file acceleratorexecute.cxx.

References xModel.

Referenced by init().

◆ st_openModuleConfig()

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::st_openModuleConfig ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const css::uno::Reference< css::frame::XFrame > &  xFrame 
)
static

TODO document me.

Definition at line 383 of file acceleratorexecute.cxx.

References xFrame.

Referenced by init().

◆ st_VCLKey2AWTKey()

css::awt::KeyEvent svt::AcceleratorExecute::st_VCLKey2AWTKey ( const vcl::KeyCode aKey)
static

Member Data Documentation

◆ m_aLock

std::mutex svt::AcceleratorExecute::m_aLock
private

Definition at line 69 of file acceleratorexecute.hxx.

Referenced by execute(), impl_ts_findCommand(), impl_ts_getURLParser(), and init().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > svt::AcceleratorExecute::m_xContext
private

TODO document me.

Definition at line 72 of file acceleratorexecute.hxx.

Referenced by execute(), impl_ts_getURLParser(), and init().

◆ m_xDispatcher

css::uno::Reference< css::frame::XDispatchProvider > svt::AcceleratorExecute::m_xDispatcher
private

TODO document me.

Definition at line 78 of file acceleratorexecute.hxx.

Referenced by execute(), and init().

◆ m_xDocCfg

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::m_xDocCfg
private

Definition at line 83 of file acceleratorexecute.hxx.

Referenced by impl_ts_findCommand(), and init().

◆ m_xGlobalCfg

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::m_xGlobalCfg
private

TODO document me.

Definition at line 81 of file acceleratorexecute.hxx.

Referenced by impl_ts_findCommand(), and init().

◆ m_xModuleCfg

css::uno::Reference< css::ui::XAcceleratorConfiguration > svt::AcceleratorExecute::m_xModuleCfg
private

Definition at line 82 of file acceleratorexecute.hxx.

Referenced by impl_ts_findCommand(), init(), and lok_setModuleConfig().

◆ m_xURLParser

css::uno::Reference< css::util::XURLTransformer > svt::AcceleratorExecute::m_xURLParser
private

TODO document me.

Definition at line 75 of file acceleratorexecute.hxx.

Referenced by impl_ts_getURLParser().


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