1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_framework.hxx" 30*cdf0e10cSrcweir #include "acceleratorexecute.hxx" 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir //=============================================== 33*cdf0e10cSrcweir // includes 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_FRAME_XMODULEMANAGER_HPP_ 36*cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_UI_XUICONFIGURATIONMANAGER_HPP_ 40*cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationManager.hpp> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGERSUPPLIER_HPP_ 44*cdf0e10cSrcweir #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPPLIER_HPP_ 48*cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> 49*cdf0e10cSrcweir #endif 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_ 52*cdf0e10cSrcweir #include <com/sun/star/awt/KeyModifier.hpp> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_UNO_SEQUENCE_HXX_ 56*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 57*cdf0e10cSrcweir #endif 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #ifndef __COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ 60*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 61*cdf0e10cSrcweir #endif 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir //=============================================== 64*cdf0e10cSrcweir // namespace 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir namespace svt 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir namespace css = ::com::sun::star; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir //=============================================== 72*cdf0e10cSrcweir // definitions 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir //----------------------------------------------- 75*cdf0e10cSrcweir AcceleratorExecute::AcceleratorExecute() 76*cdf0e10cSrcweir : TMutexInit ( ) 77*cdf0e10cSrcweir , m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback)) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir //----------------------------------------------- 82*cdf0e10cSrcweir AcceleratorExecute::AcceleratorExecute(const AcceleratorExecute& rCopy) 83*cdf0e10cSrcweir : TMutexInit ( ) 84*cdf0e10cSrcweir , m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback)) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir // copy construction sint supported in real ... 87*cdf0e10cSrcweir // but we need this ctor to init our async callback ... 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //----------------------------------------------- 91*cdf0e10cSrcweir AcceleratorExecute::~AcceleratorExecute() 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir // does nothing real 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir //----------------------------------------------- 97*cdf0e10cSrcweir AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper() 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir AcceleratorExecute* pNew = new AcceleratorExecute(); 100*cdf0e10cSrcweir return pNew; 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir //----------------------------------------------- 104*cdf0e10cSrcweir void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, 105*cdf0e10cSrcweir const css::uno::Reference< css::frame::XFrame >& xEnv ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir // SAFE -> ---------------------------------- 108*cdf0e10cSrcweir ::osl::ResettableMutexGuard aLock(m_aLock); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // take over the uno service manager 111*cdf0e10cSrcweir m_xSMGR = xSMGR; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // specify our internal dispatch provider 114*cdf0e10cSrcweir // frame or desktop?! => document or global config. 115*cdf0e10cSrcweir sal_Bool bDesktopIsUsed = sal_False; 116*cdf0e10cSrcweir m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY); 117*cdf0e10cSrcweir if (!m_xDispatcher.is()) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir aLock.clear(); 120*cdf0e10cSrcweir // <- SAFE ------------------------------ 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatchProvider > xDispatcher( 123*cdf0e10cSrcweir xSMGR->createInstance(SERVICENAME_DESKTOP), 124*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // SAFE -> ------------------------------ 127*cdf0e10cSrcweir aLock.reset(); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir m_xDispatcher = xDispatcher; 130*cdf0e10cSrcweir bDesktopIsUsed = sal_True; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir aLock.clear(); 134*cdf0e10cSrcweir // <- SAFE ---------------------------------- 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // open all needed configuration objects 137*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg; 138*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg; 139*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ; 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir // global cfg 142*cdf0e10cSrcweir xGlobalCfg = AcceleratorExecute::impl_st_openGlobalConfig(xSMGR); 143*cdf0e10cSrcweir if (!bDesktopIsUsed) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir // module cfg 146*cdf0e10cSrcweir xModuleCfg = AcceleratorExecute::impl_st_openModuleConfig(xSMGR, xEnv); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // doc cfg 149*cdf0e10cSrcweir css::uno::Reference< css::frame::XController > xController; 150*cdf0e10cSrcweir css::uno::Reference< css::frame::XModel > xModel; 151*cdf0e10cSrcweir xController = xEnv->getController(); 152*cdf0e10cSrcweir if (xController.is()) 153*cdf0e10cSrcweir xModel = xController->getModel(); 154*cdf0e10cSrcweir if (xModel.is()) 155*cdf0e10cSrcweir xDocCfg = AcceleratorExecute::impl_st_openDocConfig(xModel); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // SAFE -> ------------------------------ 159*cdf0e10cSrcweir aLock.reset(); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir m_xGlobalCfg = xGlobalCfg; 162*cdf0e10cSrcweir m_xModuleCfg = xModuleCfg; 163*cdf0e10cSrcweir m_xDocCfg = xDocCfg ; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir aLock.clear(); 166*cdf0e10cSrcweir // <- SAFE ---------------------------------- 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir //----------------------------------------------- 170*cdf0e10cSrcweir void AcceleratorExecute::execute(const KeyCode& aVCLKey) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir css::awt::KeyEvent aAWTKey = AcceleratorExecute::st_VCLKey2AWTKey(aVCLKey); 173*cdf0e10cSrcweir execute(aAWTKey); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir //----------------------------------------------- 177*cdf0e10cSrcweir void AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir ::rtl::OUString sCommand = impl_ts_findCommand(aAWTKey); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir // No Command found? Do nothing! User isnt interested on any error handling .-) 182*cdf0e10cSrcweir if (!sCommand.getLength()) 183*cdf0e10cSrcweir return; 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir // SAFE -> ---------------------------------- 186*cdf0e10cSrcweir ::osl::ResettableMutexGuard aLock(m_aLock); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir m_lCommandQueue.push_back(sCommand); 189*cdf0e10cSrcweir m_aAsyncCallback.Post(0); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir aLock.clear(); 192*cdf0e10cSrcweir // <- SAFE ---------------------------------- 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir //----------------------------------------------- 196*cdf0e10cSrcweir css::awt::KeyEvent AcceleratorExecute::st_VCLKey2AWTKey(const KeyCode& aVCLKey) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir css::awt::KeyEvent aAWTKey; 199*cdf0e10cSrcweir aAWTKey.Modifiers = 0; 200*cdf0e10cSrcweir aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode(); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir if (aVCLKey.IsShift()) 203*cdf0e10cSrcweir aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT; 204*cdf0e10cSrcweir if (aVCLKey.IsMod1()) 205*cdf0e10cSrcweir aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1; 206*cdf0e10cSrcweir if (aVCLKey.IsMod2()) 207*cdf0e10cSrcweir aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2; 208*cdf0e10cSrcweir if (aVCLKey.IsMod3()) 209*cdf0e10cSrcweir aAWTKey.Modifiers |= css::awt::KeyModifier::MOD3; 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir return aAWTKey; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir /* 215*cdf0e10cSrcweir ViewFrame->GetObjectShell 216*cdf0e10cSrcweir ObjectShell->GetStyleSheetPool 217*cdf0e10cSrcweir */ 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir //----------------------------------------------- 220*cdf0e10cSrcweir KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ); 223*cdf0e10cSrcweir sal_Bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ); 224*cdf0e10cSrcweir sal_Bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ); 225*cdf0e10cSrcweir sal_Bool bMod3 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 ); 226*cdf0e10cSrcweir sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode; 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir return KeyCode(nKey, bShift, bMod1, bMod2, bMod3); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir //----------------------------------------------- 232*cdf0e10cSrcweir ::rtl::OUString AcceleratorExecute::impl_ts_findCommand(const css::awt::KeyEvent& aKey) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir // SAFE -> ---------------------------------- 235*cdf0e10cSrcweir ::osl::ResettableMutexGuard aLock(m_aLock); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg = m_xGlobalCfg; 238*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg = m_xModuleCfg; 239*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg = m_xDocCfg ; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir aLock.clear(); 242*cdf0e10cSrcweir // <- SAFE ---------------------------------- 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir ::rtl::OUString sCommand; 245*cdf0e10cSrcweir try 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir if (xDocCfg.is()) 248*cdf0e10cSrcweir sCommand = xDocCfg->getCommandByKeyEvent(aKey); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir catch(const css::container::NoSuchElementException&) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir try 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir if (xModuleCfg.is()) 255*cdf0e10cSrcweir sCommand = xModuleCfg->getCommandByKeyEvent(aKey); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir catch(const css::container::NoSuchElementException&) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir try 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir if (xGlobalCfg.is()) 262*cdf0e10cSrcweir sCommand = xGlobalCfg->getCommandByKeyEvent(aKey); 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir catch(const css::container::NoSuchElementException&) 265*cdf0e10cSrcweir {} 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir return sCommand; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir //----------------------------------------------- 273*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::impl_st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg( 276*cdf0e10cSrcweir xSMGR->createInstance(SERVICENAME_GLOBALACCELERATORCONFIGURATION), 277*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 278*cdf0e10cSrcweir return xAccCfg; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir //----------------------------------------------- 282*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::impl_st_openModuleConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , 283*cdf0e10cSrcweir const css::uno::Reference< css::frame::XFrame >& xFrame) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir css::uno::Reference< css::frame::XModuleManager > xModuleDetection( 286*cdf0e10cSrcweir xSMGR->createInstance(SERVICENAME_MODULEMANAGER), 287*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir ::rtl::OUString sModule; 290*cdf0e10cSrcweir try 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir sModule = xModuleDetection->identify(xFrame); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir catch(const css::uno::RuntimeException& exRuntime) 295*cdf0e10cSrcweir { throw exRuntime; } 296*cdf0e10cSrcweir catch(const css::uno::Exception&) 297*cdf0e10cSrcweir { return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier( 300*cdf0e10cSrcweir xSMGR->createInstance(SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER), 301*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule); 304*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg (xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); 305*cdf0e10cSrcweir return xAccCfg; 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir //----------------------------------------------- 309*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::impl_st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xUISupplier(xModel, css::uno::UNO_QUERY_THROW); 312*cdf0e10cSrcweir css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(); 313*cdf0e10cSrcweir css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg (xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); 314*cdf0e10cSrcweir return xAccCfg; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir //----------------------------------------------- 318*cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_getURLParser() 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir // SAFE -> ---------------------------------- 321*cdf0e10cSrcweir ::osl::ResettableMutexGuard aLock(m_aLock); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir if (m_xURLParser.is()) 324*cdf0e10cSrcweir return m_xURLParser; 325*cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir aLock.clear(); 328*cdf0e10cSrcweir // <- SAFE ---------------------------------- 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > xParser( 331*cdf0e10cSrcweir xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), 332*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir // SAFE -> ---------------------------------- 335*cdf0e10cSrcweir aLock.reset(); 336*cdf0e10cSrcweir m_xURLParser = xParser; 337*cdf0e10cSrcweir aLock.clear(); 338*cdf0e10cSrcweir // <- SAFE ---------------------------------- 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir return xParser; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir //----------------------------------------------- 344*cdf0e10cSrcweir IMPL_LINK(AcceleratorExecute, impl_ts_asyncCallback, void*, pVoid) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir // SAFE -> ---------------------------------- 347*cdf0e10cSrcweir ::osl::ResettableMutexGuard aLock(m_aLock); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir TCommandQueue::iterator pIt = m_lCommandQueue.begin(); 350*cdf0e10cSrcweir if (pIt == m_lCommandQueue.end()) 351*cdf0e10cSrcweir return 0; 352*cdf0e10cSrcweir ::rtl::OUString sCommand = *pIt; 353*cdf0e10cSrcweir m_lCommandQueue.erase(pIt); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatchProvider > xProvider = m_xDispatcher; 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir aLock.clear(); 358*cdf0e10cSrcweir // <- SAFE ---------------------------------- 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir // convert command in URL structure 361*cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > xParser = impl_ts_getURLParser(); 362*cdf0e10cSrcweir css::util::URL aURL; 363*cdf0e10cSrcweir aURL.Complete = sCommand; 364*cdf0e10cSrcweir xParser->parseStrict(aURL); 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir // ask for dispatch object 367*cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aURL, ::rtl::OUString(), 0); 368*cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue> aArgs; 369*cdf0e10cSrcweir if (xDispatch.is()) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir Sequence<css::beans::PropertyValue> source; 374*cdf0e10cSrcweir ::comphelper::UiEventsLogger::appendDispatchOrigin(OUString::createFromAscii("AcceleratorExecute")); 375*cdf0e10cSrcweir ::comphelper::UiEventsLogger::logDispatch(aURL, source); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir xDispatch->dispatch(aURL, css::uno::Sequence< css::beans::PropertyValue >()); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir return 0; 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir } // namespace svt 383