/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX #define INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX #include "svtools/svtdllapi.h" #include #include #include #include #include #include #include #include #include #include #include namespace svt { struct TMutexInit { ::osl::Mutex m_aLock; }; //=============================================== /** @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 Because exceution of an accelerator command can be dangerous (in case it force an office shutdown for key "ALT+F4"!) all internal dispatches are done asynchronous. Menas that the trigger call doesnt 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 ... */ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit { //------------------------------------------- // const, types private: /** @deprecated replaced by internal class AsyncAccelExec ... remove this resource here if we go forwards to next major */ typedef ::std::vector< ::std::pair< css::util::URL, css::uno::Reference< css::frame::XDispatch > > > TCommandQueue; //------------------------------------------- // member private: /** TODO document me */ css::uno::Reference< css::uno::XComponentContext > m_xContext; /** TODO document me */ css::uno::Reference< css::util::XURLTransformer > m_xURLParser; /** TODO document me */ css::uno::Reference< css::frame::XDispatchProvider > m_xDispatcher; /** TODO document me */ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalCfg; css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleCfg; css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocCfg; /** @deprecated replaced by internal class AsyncAccelExec ... remove this resource here if we go forwards to next major */ TCommandQueue m_lCommandQueue; /** @deprecated replaced by internal class AsyncAccelExec ... remove this resource here if we go forwards to next major */ ::vcl::EventPoster m_aAsyncCallback; //------------------------------------------- // interface public: //--------------------------------------- /** @short 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! */ static AcceleratorExecute* createAcceleratorHelper(); //--------------------------------------- /** @short fight against inlining ... */ virtual ~AcceleratorExecute(); //--------------------------------------- /** @short init this instance. @descr It must be called as first method after creation. And further it can be called more then once ... but at least its should be used one times only. Otherwhise nobody can say, which asynchronous executions will be used inside the old and which one will be used inside the new environment. @param rxContext reference to an uno service manager. @param 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. */ virtual void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xEnv ); //--------------------------------------- /** @short trigger this accelerator. @descr The internal configuartions are used to find as suitable command for this key code. This command will be queued and executed later asynchronous. @param aKey specify the accelerator for execute. @return [sal_Bool] sal_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 its done asynchronous! */ virtual sal_Bool execute(const KeyCode& aKey); virtual sal_Bool execute(const css::awt::KeyEvent& aKey); /** search the command for the given key event. * * @param aKey The key event * @return The command or an empty string if the key event could not be found. */ OUString findCommand(const ::com::sun::star::awt::KeyEvent& aKey); //--------------------------------------- /** TODO document me */ static css::awt::KeyEvent st_VCLKey2AWTKey(const KeyCode& aKey); static KeyCode st_AWTKey2VCLKey(const css::awt::KeyEvent& aKey); //--------------------------------------- /** TODO document me */ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openGlobalConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- /** TODO document me */ 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 */ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel); //------------------------------------------- // internal private: //--------------------------------------- /** @short allow creation of instances of this class by using our factory only! */ SVT_DLLPRIVATE AcceleratorExecute(); AcceleratorExecute(const AcceleratorExecute& rCopy); void operator=(const AcceleratorExecute&) {}; //--------------------------------------- /** TODO document me */ SVT_DLLPRIVATE OUString impl_ts_findCommand(const css::awt::KeyEvent& aKey); //--------------------------------------- /** TODO document me */ SVT_DLLPRIVATE css::uno::Reference< css::util::XURLTransformer > impl_ts_getURLParser(); //--------------------------------------- /** @deprecated replaced by internal class AsyncAccelExec ... remove this resource here if we go forwards to next major */ DECL_DLLPRIVATE_LINK(impl_ts_asyncCallback, void*); }; } // namespace svt #endif // INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ eature/SOSAW080 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/dtrans
AgeCommit message (Expand)Author
2015-01-24Fix warning C4101: ´ex´ : unreferenced local variableMatteo Casalin
2015-01-24cppcheck: selfAssignmentCaolán McNamara
2015-01-08brute-force find-and-remove of unused #define constants.Noel Grandin
2015-01-02Fix simple typos.Andrea Gelmini
2014-12-20TyposJulien Nabet
2014-12-18dtrans: Use appropriate OUString functions on string constantsStephan Bergmann
2014-12-12fdo#39440 reduce scope of local variablesMichael Weghorn
2014-11-18cppuhelper: clean up public headers with include-what-you-useMichael Stahl
2014-11-17sal: clean up public headers with include-what-you-useMichael Stahl
2014-10-29remove unnecessary 'using namespace rtl' declarationsNoel Grandin
2014-10-08spelling: instanciated -> instantiatedNoel Grandin
2014-10-02dtrans (Windows): std::auto_ptr -> std::unique_ptrStephan Bergmann
2014-08-28Fix some *_component_getFactory function typesStephan Bergmann
2014-08-25set names on the Win32-only threadsMichael Stahl
2014-08-01typo: more then -> more thanTakeshi Abe
2014-05-22Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part19Julien Nabet
2014-05-17Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part14Julien Nabet
2014-05-15Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold
2014-05-10Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part8Julien Nabet
2014-04-30Many spelling fixes: directories a* - g*.Pedro Giffuni
2014-04-22dtrans: sal_Bool->boolNoel Grandin
2014-04-15whitespace for include statementsThomas Arnhold
2014-04-14typo: dependend -> dependentThomas Arnhold
2014-03-29typo: inteface -> interfaceThomas Arnhold
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2014-02-26Remove visual noise from dtransAlexander Wilms
2014-02-25(a/A)utomaticaly -> (a/A)utomaticallyJulien Nabet
2014-02-23Remove unneccessary commentsAlexander Wilms
2014-02-21Resolves: #i124085# improved support for PNG clipboard format on windowsArmin Le Grand
2014-02-21Update comment.Jan Holesovsky
2014-02-20fdo#74584: These tags should be lowercase for correct clipboard handling.Kohei Yoshida
2014-02-04fdo#54938 Convert dtrans, remoteb., reportd., ucbhelper to cppu::supportsSer..Alexandre Vicenzi
2014-01-30Resolves: #i124085# disabled CF_DIBV5...Armin Le Grand
2014-01-21Fix bogus mass-conversion equalsAsciiL -> startsWithStephan Bergmann
2014-01-06Resolves: #i123817# prepare codebase for updating to boost 1.55Herbert Dürr
2013-12-22Fix other typosJulien Nabet
2013-12-17Adapt all (non-extension, SharedLibrary) .components to environment="..."Stephan Bergmann
2013-12-17Remove unnecessary use of OUString constructor in + expressionsNoel Grandin
2013-11-27Unwind occurrences of deprecated sal_sChar, sal_uCharStephan Bergmann
2013-11-20convert equalsAsciiL calls to startsWith callsNoel Grandin
2013-11-19remove most use of RTL_CONSTASCII_USTRINGPARAM macroNoel Grandin
2013-11-11remove unnecessary use of OUString constructor in DTRANS moduleNoel Grandin
2013-11-04remove redundant calls to OUString constructor in if expressionNoel Grandin
2013-10-15Resolves: #i123407# Do not insist on CF_DIBV5 for clipboard dataArmin Le Grand
2013-10-07fdo#54938: Adapt supportsService implementations to cppu::supportsServiceMarcos Paulo de Souza
2013-09-29cppcheck: some cleaningsJulien Nabet
2013-09-04WaE: use number() instead of valueOf()Tor Lillqvist
2013-07-16#i122752# check iterator in each iteration of CFormatEtcContainer::nextFormat...Herbert Dürr
2013-06-29remove OUString wrap for string literalsThomas Arnhold