LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/misc - acceleratorexecute.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 195 3.6 %
Date: 2012-12-17 Functions: 1 23 4.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svtools/acceleratorexecute.hxx>
      21             : 
      22             : #include <com/sun/star/frame/ModuleManager.hpp>
      23             : #include <com/sun/star/frame/XDesktop.hpp>
      24             : #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
      25             : #include <com/sun/star/ui/XUIConfigurationManager.hpp>
      26             : #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
      27             : #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
      28             : #include <com/sun/star/awt/XTopWindow.hpp>
      29             : #include <com/sun/star/awt/KeyModifier.hpp>
      30             : #include <com/sun/star/uno/Sequence.hxx>
      31             : #include <com/sun/star/beans/PropertyValue.hpp>
      32             : #include <com/sun/star/lang/DisposedException.hpp>
      33             : #include <com/sun/star/util/URLTransformer.hpp>
      34             : #include <toolkit/helper/vclunohelper.hxx>
      35             : #include <comphelper/processfactory.hxx>
      36             : 
      37             : #include <vcl/window.hxx>
      38             : #include <vcl/svapp.hxx>
      39             : #include <osl/mutex.hxx>
      40             : 
      41             : 
      42             : namespace svt
      43             : {
      44             : 
      45             : 
      46             : //-----------------------------------------------
      47           0 : class SVT_DLLPRIVATE AsyncAccelExec
      48             : {
      49             :     public:
      50             :         //---------------------------------------
      51             :         /** creates a new instance of this class, which can be used
      52             :             one times only!
      53             : 
      54             :             This instance can be forced to execute it's internal set request
      55             :             asynchronous. After that it deletes itself !
      56             :          */
      57             :         static AsyncAccelExec* createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
      58             :                                                     const css::util::URL&                               aURL     );
      59             : 
      60             :         void execAsync();
      61             : 
      62             :     private:
      63             :         //---------------------------------------
      64             :         /** @short  allow creation of instances of this class
      65             :                     by using our factory only!
      66             :          */
      67             :         SVT_DLLPRIVATE AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
      68             :                                       const css::util::URL&                               aURL     );
      69             : 
      70             :         DECL_DLLPRIVATE_LINK(impl_ts_asyncCallback, void*);
      71             : 
      72             :     private:
      73             :         ::vcl::EventPoster m_aAsyncCallback;
      74             :         css::uno::Reference< css::frame::XDispatch > m_xDispatch;
      75             :         css::util::URL m_aURL;
      76             : };
      77             : 
      78             : //-----------------------------------------------
      79           0 : AcceleratorExecute::AcceleratorExecute()
      80             :     : TMutexInit      (                                                     )
      81           0 :     , m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback))
      82             : {
      83           0 : }
      84             : 
      85             : //-----------------------------------------------
      86           0 : AcceleratorExecute::AcceleratorExecute(const AcceleratorExecute&)
      87             :     : TMutexInit      (                                                     )
      88           0 :     , m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback))
      89             : {
      90             :     // copy construction sint supported in real ...
      91             :     // but we need this ctor to init our async callback ...
      92           0 : }
      93             : 
      94             : //-----------------------------------------------
      95           0 : AcceleratorExecute::~AcceleratorExecute()
      96             : {
      97             :     // does nothing real
      98           0 : }
      99             : 
     100             : //-----------------------------------------------
     101           0 : AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper()
     102             : {
     103           0 :     AcceleratorExecute* pNew = new AcceleratorExecute();
     104           0 :     return pNew;
     105             : }
     106             : 
     107             : //-----------------------------------------------
     108           0 : void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
     109             :                               const css::uno::Reference< css::frame::XFrame >&              xEnv )
     110             : {
     111             :     // SAFE -> ----------------------------------
     112           0 :     ::osl::ResettableMutexGuard aLock(m_aLock);
     113             : 
     114             :     // take over the uno service manager
     115           0 :     m_xSMGR = xSMGR;
     116             : 
     117             :     // specify our internal dispatch provider
     118             :     // frame or desktop?! => document or global config.
     119           0 :     sal_Bool bDesktopIsUsed = sal_False;
     120           0 :              m_xDispatcher  = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY);
     121           0 :     if (!m_xDispatcher.is())
     122             :     {
     123           0 :         aLock.clear();
     124             :         // <- SAFE ------------------------------
     125             : 
     126             :         css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(
     127           0 :                             xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))),
     128           0 :                             css::uno::UNO_QUERY_THROW);
     129             : 
     130             :         // SAFE -> ------------------------------
     131           0 :         aLock.reset();
     132             : 
     133           0 :         m_xDispatcher  = xDispatcher;
     134           0 :         bDesktopIsUsed = sal_True;
     135             :     }
     136             : 
     137           0 :     aLock.clear();
     138             :     // <- SAFE ----------------------------------
     139             : 
     140             :     // open all needed configuration objects
     141           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg;
     142           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg;
     143           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg   ;
     144             : 
     145             :     // global cfg
     146           0 :     xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(xSMGR));
     147           0 :     if (!bDesktopIsUsed)
     148             :     {
     149             :         // module cfg
     150           0 :         xModuleCfg = AcceleratorExecute::st_openModuleConfig(comphelper::getComponentContext(xSMGR), xEnv);
     151             : 
     152             :         // doc cfg
     153           0 :         css::uno::Reference< css::frame::XController > xController;
     154           0 :         css::uno::Reference< css::frame::XModel >      xModel;
     155           0 :         xController = xEnv->getController();
     156           0 :         if (xController.is())
     157           0 :             xModel = xController->getModel();
     158           0 :         if (xModel.is())
     159           0 :             xDocCfg = AcceleratorExecute::st_openDocConfig(xModel);
     160             :     }
     161             : 
     162             :     // SAFE -> ------------------------------
     163           0 :     aLock.reset();
     164             : 
     165           0 :     m_xGlobalCfg = xGlobalCfg;
     166           0 :     m_xModuleCfg = xModuleCfg;
     167           0 :     m_xDocCfg    = xDocCfg   ;
     168             : 
     169           0 :     aLock.clear();
     170             :     // <- SAFE ----------------------------------
     171           0 : }
     172             : 
     173             : //-----------------------------------------------
     174           0 : sal_Bool AcceleratorExecute::execute(const KeyCode& aVCLKey)
     175             : {
     176           0 :     css::awt::KeyEvent aAWTKey = AcceleratorExecute::st_VCLKey2AWTKey(aVCLKey);
     177           0 :     return execute(aAWTKey);
     178             : }
     179             : 
     180             : //-----------------------------------------------
     181           0 : sal_Bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey)
     182             : {
     183           0 :     ::rtl::OUString sCommand = impl_ts_findCommand(aAWTKey);
     184             : 
     185             :     // No Command found? Do nothing! User isnt interested on any error handling .-)
     186           0 :     if (sCommand.isEmpty())
     187           0 :         return sal_False;
     188             : 
     189             :     // SAFE -> ----------------------------------
     190           0 :     ::osl::ResettableMutexGuard aLock(m_aLock);
     191             : 
     192           0 :     css::uno::Reference< css::frame::XDispatchProvider > xProvider = m_xDispatcher;
     193             : 
     194           0 :     aLock.clear();
     195             :     // <- SAFE ----------------------------------
     196             : 
     197             :     // convert command in URL structure
     198           0 :     css::uno::Reference< css::util::XURLTransformer > xParser = impl_ts_getURLParser();
     199           0 :     css::util::URL aURL;
     200           0 :     aURL.Complete = sCommand;
     201           0 :     xParser->parseStrict(aURL);
     202             : 
     203             :     // ask for dispatch object
     204           0 :     css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aURL, ::rtl::OUString(), 0);
     205           0 :     sal_Bool bRet = xDispatch.is();
     206           0 :     if ( bRet )
     207             :     {
     208             :         // Note: Such instance can be used one times only and destroy itself afterwards .-)
     209           0 :         AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xDispatch, aURL);
     210           0 :         pExec->execAsync();
     211             :     }
     212             : 
     213           0 :     return bRet;
     214             : }
     215             : 
     216             : //-----------------------------------------------
     217           0 : css::awt::KeyEvent AcceleratorExecute::st_VCLKey2AWTKey(const KeyCode& aVCLKey)
     218             : {
     219           0 :     css::awt::KeyEvent aAWTKey;
     220           0 :     aAWTKey.Modifiers = 0;
     221           0 :     aAWTKey.KeyCode   = (sal_Int16)aVCLKey.GetCode();
     222             : 
     223           0 :     if (aVCLKey.IsShift())
     224           0 :         aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT;
     225           0 :     if (aVCLKey.IsMod1())
     226           0 :         aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1;
     227           0 :     if (aVCLKey.IsMod2())
     228           0 :         aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2;
     229           0 :         if (aVCLKey.IsMod3())
     230           0 :         aAWTKey.Modifiers |= css::awt::KeyModifier::MOD3;
     231           0 :     return aAWTKey;
     232             : }
     233             : 
     234             : //-----------------------------------------------
     235          98 : KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey)
     236             : {
     237          98 :     sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT );
     238          98 :     sal_Bool bMod1  = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1  );
     239          98 :     sal_Bool bMod2  = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2  );
     240          98 :     sal_Bool bMod3  = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3  );
     241          98 :     sal_uInt16   nKey   = (sal_uInt16)aAWTKey.KeyCode;
     242             : 
     243          98 :     return KeyCode(nKey, bShift, bMod1, bMod2, bMod3);
     244             : }
     245             : //-----------------------------------------------
     246           0 : ::rtl::OUString AcceleratorExecute::findCommand(const css::awt::KeyEvent& aKey)
     247             : {
     248           0 :     return impl_ts_findCommand(aKey);
     249             : }
     250             : //-----------------------------------------------
     251           0 : ::rtl::OUString AcceleratorExecute::impl_ts_findCommand(const css::awt::KeyEvent& aKey)
     252             : {
     253             :     // SAFE -> ----------------------------------
     254           0 :     ::osl::ResettableMutexGuard aLock(m_aLock);
     255             : 
     256           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg = m_xGlobalCfg;
     257           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg = m_xModuleCfg;
     258           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg    = m_xDocCfg   ;
     259             : 
     260           0 :     aLock.clear();
     261             :     // <- SAFE ----------------------------------
     262             : 
     263           0 :     ::rtl::OUString sCommand;
     264             : 
     265             :     try
     266             :     {
     267           0 :         if (xDocCfg.is())
     268           0 :             sCommand = xDocCfg->getCommandByKeyEvent(aKey);
     269           0 :         if (!sCommand.isEmpty())
     270           0 :             return sCommand;
     271             :     }
     272           0 :     catch(const css::container::NoSuchElementException&)
     273             :         {}
     274             : 
     275             :     try
     276             :     {
     277           0 :         if (xModuleCfg.is())
     278           0 :             sCommand = xModuleCfg->getCommandByKeyEvent(aKey);
     279           0 :         if (!sCommand.isEmpty())
     280           0 :             return sCommand;
     281             :     }
     282           0 :     catch(const css::container::NoSuchElementException&)
     283             :         {}
     284             : 
     285             :     try
     286             :     {
     287           0 :         if (xGlobalCfg.is())
     288           0 :             sCommand = xGlobalCfg->getCommandByKeyEvent(aKey);
     289           0 :         if (!sCommand.isEmpty())
     290           0 :             return sCommand;
     291             :     }
     292           0 :     catch(const css::container::NoSuchElementException&)
     293             :         {}
     294             : 
     295             :     // fall back to functional key codes
     296           0 :     if( aKey.Modifiers == 0 )
     297             :     {
     298           0 :         switch( aKey.KeyCode )
     299             :         {
     300             :         case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE:
     301           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfLine" ) );
     302             :         case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE:
     303           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfLine" ) );
     304             :         case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
     305           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfPara" ) );
     306             :         case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
     307           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfPara" ) );
     308             :         case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
     309           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfWord" ) );
     310             :         case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
     311           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfWord" ) );
     312             :         case com::sun::star::awt::Key::INSERT_LINEBREAK:
     313           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertLinebreak" ) );
     314             :         case com::sun::star::awt::Key::INSERT_PARAGRAPH:
     315           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara" ) );
     316             :         case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
     317           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToPrevWord" ) );
     318             :         case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
     319           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToNextWord" ) );
     320             :         case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
     321           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine" ) );
     322             :         case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
     323           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine" ) );
     324             :         case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
     325           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfPara" ) );
     326             :         case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
     327           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfPara" ) );
     328             :         case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
     329           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc" ) );
     330             :         case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
     331           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc" ) );
     332             :         case com::sun::star::awt::Key::SELECT_BACKWARD:
     333           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharLeftSel" ) );
     334             :         case com::sun::star::awt::Key::SELECT_FORWARD:
     335           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharRightSel" ) );
     336             :         case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
     337           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordLeftSel" ) );
     338             :         case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
     339           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordRightSel" ) );
     340             :         case com::sun::star::awt::Key::SELECT_WORD:
     341           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectWord" ) );
     342             :         case com::sun::star::awt::Key::SELECT_LINE:
     343           0 :             return rtl::OUString();
     344             :         case com::sun::star::awt::Key::SELECT_PARAGRAPH:
     345           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectText" ) );
     346             :         case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
     347           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfLineSel" ) );
     348             :         case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
     349           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfLineSel" ) );
     350             :         case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
     351           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfParaSel" ) );
     352             :         case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
     353           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfParaSel" ) );
     354             :         case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
     355           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfDocumentSel" ) );
     356             :         case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
     357           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfDocumentSel" ) );
     358             :         case com::sun::star::awt::Key::SELECT_ALL:
     359           0 :             return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectAll" ) );
     360             :         default:
     361           0 :             break;
     362             :         }
     363             :     }
     364             : 
     365           0 :     return ::rtl::OUString();
     366             : }
     367             : 
     368             : //-----------------------------------------------
     369           0 : css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
     370             :                                                                                                    const css::uno::Reference< css::frame::XFrame >&              xFrame)
     371             : {
     372             :     css::uno::Reference< css::frame::XModuleManager2 > xModuleDetection(
     373           0 :         css::frame::ModuleManager::create(rxContext));
     374             : 
     375           0 :     ::rtl::OUString sModule;
     376             :     try
     377             :     {
     378           0 :         sModule = xModuleDetection->identify(xFrame);
     379             :     }
     380           0 :     catch(const css::uno::RuntimeException&rEx)
     381           0 :         { (void) rEx; throw; }
     382           0 :     catch(const css::uno::Exception&)
     383           0 :         { return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); }
     384             : 
     385             :     css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier(
     386           0 :         css::ui::ModuleUIConfigurationManagerSupplier::create(rxContext) );
     387             : 
     388           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg;
     389             :     try
     390             :     {
     391           0 :         css::uno::Reference< css::ui::XUIConfigurationManager >   xUIManager = xUISupplier->getUIConfigurationManager(sModule);
     392           0 :         xAccCfg = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
     393             :     }
     394           0 :     catch(const css::container::NoSuchElementException&)
     395             :         {}
     396           0 :     return xAccCfg;
     397             : }
     398             : 
     399             : //-----------------------------------------------
     400           0 : css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel)
     401             : {
     402           0 :     css::uno::Reference< css::ui::XAcceleratorConfiguration >       xAccCfg;
     403           0 :     css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xUISupplier(xModel, css::uno::UNO_QUERY);
     404           0 :     if (xUISupplier.is())
     405             :     {
     406           0 :         css::uno::Reference< css::ui::XUIConfigurationManager >     xUIManager = xUISupplier->getUIConfigurationManager();
     407           0 :         xAccCfg.set(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
     408             :     }
     409           0 :     return xAccCfg;
     410             : }
     411             : 
     412             : //-----------------------------------------------
     413           0 : css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_getURLParser()
     414             : {
     415             :     // SAFE -> ----------------------------------
     416           0 :     ::osl::ResettableMutexGuard aLock(m_aLock);
     417             : 
     418           0 :     if (m_xURLParser.is())
     419           0 :         return m_xURLParser;
     420           0 :     css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
     421             : 
     422           0 :     aLock.clear();
     423             :     // <- SAFE ----------------------------------
     424             : 
     425             :     css::uno::Reference< css::util::XURLTransformer > xParser(
     426           0 :                 css::util::URLTransformer::create( ::comphelper::getComponentContext(xSMGR) ) );
     427             : 
     428             :     // SAFE -> ----------------------------------
     429           0 :     aLock.reset();
     430           0 :     m_xURLParser = xParser;
     431           0 :     aLock.clear();
     432             :     // <- SAFE ----------------------------------
     433             : 
     434           0 :     return xParser;
     435             : }
     436             : 
     437             : //-----------------------------------------------
     438           0 : IMPL_LINK_NOARG(AcceleratorExecute, impl_ts_asyncCallback)
     439             : {
     440             :     // replaced by AsyncAccelExec!
     441           0 :     return 0;
     442             : }
     443             : 
     444             : //-----------------------------------------------
     445           0 : AsyncAccelExec::AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
     446             :                                const css::util::URL&                               aURL     )
     447             :     : m_aAsyncCallback(LINK(this, AsyncAccelExec, impl_ts_asyncCallback))
     448             :     , m_xDispatch     (xDispatch                                        )
     449           0 :     , m_aURL          (aURL                                             )
     450             : {
     451           0 : }
     452             : 
     453             : //-----------------------------------------------
     454           0 : AsyncAccelExec* AsyncAccelExec::createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
     455             :                                                      const css::util::URL&                               aURL     )
     456             : {
     457           0 :     AsyncAccelExec* pExec = new AsyncAccelExec(xDispatch, aURL);
     458           0 :     return pExec;
     459             : }
     460             : 
     461             : //-----------------------------------------------
     462           0 : void AsyncAccelExec::execAsync()
     463             : {
     464           0 :     m_aAsyncCallback.Post(0);
     465           0 : }
     466             : 
     467             : //-----------------------------------------------
     468           0 : IMPL_LINK(AsyncAccelExec, impl_ts_asyncCallback, void*,)
     469             : {
     470           0 :     if (! m_xDispatch.is())
     471           0 :         return 0;
     472             : 
     473             :     try
     474             :     {
     475           0 :         m_xDispatch->dispatch(m_aURL, css::uno::Sequence< css::beans::PropertyValue >());
     476             :     }
     477           0 :     catch(const css::lang::DisposedException&)
     478             :         {}
     479           0 :     catch(const css::uno::RuntimeException& )
     480           0 :         { throw; }
     481           0 :     catch(const css::uno::Exception&)
     482             :         {}
     483             : 
     484           0 :     delete this;
     485             : 
     486           0 :     return 0;
     487             : }
     488             : 
     489             : } // namespace svt
     490             : 
     491             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10