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_svtools.hxx" 30*cdf0e10cSrcweir #include <svtools/statusbarcontroller.hxx> 31*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 36*cdf0e10cSrcweir #include <vos/mutex.hxx> 37*cdf0e10cSrcweir #include <vcl/svapp.hxx> 38*cdf0e10cSrcweir #include <vcl/window.hxx> 39*cdf0e10cSrcweir #include <vcl/status.hxx> 40*cdf0e10cSrcweir #include <svtools/imgdef.hxx> 41*cdf0e10cSrcweir #include <svtools/miscopt.hxx> 42*cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace ::cppu; 45*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 46*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 47*cdf0e10cSrcweir using namespace ::com::sun::star::util; 48*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 49*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 50*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 51*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir namespace svt 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir StatusbarController::StatusbarController( 57*cdf0e10cSrcweir const Reference< XMultiServiceFactory >& rServiceManager, 58*cdf0e10cSrcweir const Reference< XFrame >& xFrame, 59*cdf0e10cSrcweir const ::rtl::OUString& aCommandURL, 60*cdf0e10cSrcweir unsigned short nID ) : 61*cdf0e10cSrcweir OWeakObject() 62*cdf0e10cSrcweir , m_bInitialized( sal_False ) 63*cdf0e10cSrcweir , m_bDisposed( sal_False ) 64*cdf0e10cSrcweir , m_nID( nID ) 65*cdf0e10cSrcweir , m_xFrame( xFrame ) 66*cdf0e10cSrcweir , m_xServiceManager( rServiceManager ) 67*cdf0e10cSrcweir , m_aCommandURL( aCommandURL ) 68*cdf0e10cSrcweir , m_aListenerContainer( m_aMutex ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir } 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir StatusbarController::StatusbarController() : 73*cdf0e10cSrcweir OWeakObject() 74*cdf0e10cSrcweir , m_bInitialized( sal_False ) 75*cdf0e10cSrcweir , m_bDisposed( sal_False ) 76*cdf0e10cSrcweir , m_nID( 0 ) 77*cdf0e10cSrcweir , m_aListenerContainer( m_aMutex ) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir StatusbarController::~StatusbarController() 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir Reference< XFrame > StatusbarController::getFrameInterface() const 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 88*cdf0e10cSrcweir return m_xFrame; 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir Reference< XMultiServiceFactory > StatusbarController::getServiceManager() const 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 94*cdf0e10cSrcweir return m_xServiceManager; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir Reference< XLayoutManager > StatusbarController::getLayoutManager() const 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 100*cdf0e10cSrcweir Reference< XLayoutManager > xLayoutManager; 101*cdf0e10cSrcweir Reference< XPropertySet > xPropSet( m_xFrame, UNO_QUERY ); 102*cdf0e10cSrcweir if ( xPropSet.is() ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir try 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir Any a; 107*cdf0e10cSrcweir a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); 108*cdf0e10cSrcweir a >>= xLayoutManager; 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir catch ( Exception& ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir return xLayoutManager; 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir Reference< XURLTransformer > StatusbarController::getURLTransformer() const 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 121*cdf0e10cSrcweir if ( !m_xURLTransformer.is() && m_xServiceManager.is() ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir m_xURLTransformer = Reference< XURLTransformer >( 124*cdf0e10cSrcweir m_xServiceManager->createInstance( 125*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), 126*cdf0e10cSrcweir UNO_QUERY ); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir return m_xURLTransformer; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir // XInterface 133*cdf0e10cSrcweir Any SAL_CALL StatusbarController::queryInterface( const Type& rType ) 134*cdf0e10cSrcweir throw ( RuntimeException ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir Any a = ::cppu::queryInterface( 137*cdf0e10cSrcweir rType , 138*cdf0e10cSrcweir static_cast< XStatusbarController* >( this ), 139*cdf0e10cSrcweir static_cast< XStatusListener* >( this ), 140*cdf0e10cSrcweir static_cast< XEventListener* >( this ), 141*cdf0e10cSrcweir static_cast< XInitialization* >( this ), 142*cdf0e10cSrcweir static_cast< XComponent* >( this ), 143*cdf0e10cSrcweir static_cast< XUpdatable* >( this )); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir if ( a.hasValue() ) 146*cdf0e10cSrcweir return a; 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir return OWeakObject::queryInterface( rType ); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir void SAL_CALL StatusbarController::acquire() throw () 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir OWeakObject::acquire(); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void SAL_CALL StatusbarController::release() throw () 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir OWeakObject::release(); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void SAL_CALL StatusbarController::initialize( const Sequence< Any >& aArguments ) 162*cdf0e10cSrcweir throw ( Exception, RuntimeException ) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 165*cdf0e10cSrcweir const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )); 166*cdf0e10cSrcweir const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 167*cdf0e10cSrcweir const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 168*cdf0e10cSrcweir const rtl::OUString aIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir bool bInitialized( true ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir if ( m_bDisposed ) 176*cdf0e10cSrcweir throw DisposedException(); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir bInitialized = m_bInitialized; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir if ( !bInitialized ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 184*cdf0e10cSrcweir m_bInitialized = sal_True; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir PropertyValue aPropValue; 187*cdf0e10cSrcweir for ( int i = 0; i < aArguments.getLength(); i++ ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir if ( aArguments[i] >>= aPropValue ) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir if ( aPropValue.Name.equalsAscii( "Frame" )) 192*cdf0e10cSrcweir aPropValue.Value >>= m_xFrame; 193*cdf0e10cSrcweir else if ( aPropValue.Name.equalsAscii( "CommandURL" )) 194*cdf0e10cSrcweir aPropValue.Value >>= m_aCommandURL; 195*cdf0e10cSrcweir else if ( aPropValue.Name.equalsAscii( "ServiceManager" )) 196*cdf0e10cSrcweir aPropValue.Value >>= m_xServiceManager; 197*cdf0e10cSrcweir else if ( aPropValue.Name.equalsAscii( "ParentWindow" )) 198*cdf0e10cSrcweir aPropValue.Value >>= m_xParentWindow; 199*cdf0e10cSrcweir else if ( aPropValue.Name.equalsAscii( "Identifier" )) 200*cdf0e10cSrcweir aPropValue.Value >>= m_nID; 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir if ( m_aCommandURL.getLength() ) 205*cdf0e10cSrcweir m_aListenerMap.insert( URLToDispatchMap::value_type( m_aCommandURL, Reference< XDispatch >() )); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir void SAL_CALL StatusbarController::update() 210*cdf0e10cSrcweir throw ( RuntimeException ) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 214*cdf0e10cSrcweir if ( m_bDisposed ) 215*cdf0e10cSrcweir throw DisposedException(); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir // Bind all registered listeners to their dispatch objects 219*cdf0e10cSrcweir bindListener(); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir // XComponent 223*cdf0e10cSrcweir void SAL_CALL StatusbarController::dispose() 224*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 230*cdf0e10cSrcweir if ( m_bDisposed ) 231*cdf0e10cSrcweir throw DisposedException(); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir com::sun::star::lang::EventObject aEvent( xThis ); 235*cdf0e10cSrcweir m_aListenerContainer.disposeAndClear( aEvent ); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 238*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); 239*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 240*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); 241*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 242*cdf0e10cSrcweir while ( pIter != m_aListenerMap.end() ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir try 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir Reference< XDispatch > xDispatch( pIter->second ); 247*cdf0e10cSrcweir aTargetURL.Complete = pIter->first; 248*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir if ( xDispatch.is() && xStatusListener.is() ) 251*cdf0e10cSrcweir xDispatch->removeStatusListener( xStatusListener, aTargetURL ); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir catch ( Exception& ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir ++pIter; 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir // clear hash map 261*cdf0e10cSrcweir m_aListenerMap.clear(); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir // release references 264*cdf0e10cSrcweir m_xURLTransformer.clear(); 265*cdf0e10cSrcweir m_xServiceManager.clear(); 266*cdf0e10cSrcweir m_xFrame.clear(); 267*cdf0e10cSrcweir m_xParentWindow.clear(); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir m_bDisposed = sal_True; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir void SAL_CALL StatusbarController::addEventListener( const Reference< XEventListener >& xListener ) 273*cdf0e10cSrcweir throw ( RuntimeException ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir void SAL_CALL StatusbarController::removeEventListener( const Reference< XEventListener >& aListener ) 279*cdf0e10cSrcweir throw ( RuntimeException ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), aListener ); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // XEventListener 285*cdf0e10cSrcweir void SAL_CALL StatusbarController::disposing( const EventObject& Source ) 286*cdf0e10cSrcweir throw ( RuntimeException ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir Reference< XInterface > xSource( Source.Source ); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir if ( m_bDisposed ) 293*cdf0e10cSrcweir return; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); 296*cdf0e10cSrcweir while ( pIter != m_aListenerMap.end() ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir // Compare references and release dispatch references if they are equal. 299*cdf0e10cSrcweir Reference< XInterface > xIfac( pIter->second, UNO_QUERY ); 300*cdf0e10cSrcweir if ( xSource == xIfac ) 301*cdf0e10cSrcweir pIter->second.clear(); 302*cdf0e10cSrcweir pIter++; 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); 306*cdf0e10cSrcweir if ( xIfac == xSource ) 307*cdf0e10cSrcweir m_xFrame.clear(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir // XStatusListener 311*cdf0e10cSrcweir void SAL_CALL StatusbarController::statusChanged( const FeatureStateEvent& Event ) 312*cdf0e10cSrcweir throw ( RuntimeException ) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if ( m_bDisposed ) 317*cdf0e10cSrcweir return; 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow ); 320*cdf0e10cSrcweir if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir rtl::OUString aStrValue; 323*cdf0e10cSrcweir StatusBar* pStatusBar = (StatusBar *)pWindow; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir if ( Event.State >>= aStrValue ) 326*cdf0e10cSrcweir pStatusBar->SetItemText( m_nID, aStrValue ); 327*cdf0e10cSrcweir else if ( !Event.State.hasValue() ) 328*cdf0e10cSrcweir pStatusBar->SetItemText( m_nID, String() ); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // XStatusbarController 333*cdf0e10cSrcweir ::sal_Bool SAL_CALL StatusbarController::mouseButtonDown( 334*cdf0e10cSrcweir const ::com::sun::star::awt::MouseEvent& ) 335*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir return sal_False; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir ::sal_Bool SAL_CALL StatusbarController::mouseMove( 341*cdf0e10cSrcweir const ::com::sun::star::awt::MouseEvent& ) 342*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir return sal_False; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir ::sal_Bool SAL_CALL StatusbarController::mouseButtonUp( 348*cdf0e10cSrcweir const ::com::sun::star::awt::MouseEvent& ) 349*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir return sal_False; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir void SAL_CALL StatusbarController::command( 355*cdf0e10cSrcweir const ::com::sun::star::awt::Point&, 356*cdf0e10cSrcweir ::sal_Int32, 357*cdf0e10cSrcweir ::sal_Bool, 358*cdf0e10cSrcweir const ::com::sun::star::uno::Any& ) 359*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir void SAL_CALL StatusbarController::paint( 364*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >&, 365*cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle&, 366*cdf0e10cSrcweir ::sal_Int32, 367*cdf0e10cSrcweir ::sal_Int32 ) 368*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir void SAL_CALL StatusbarController::click() 373*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir void SAL_CALL StatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException) 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir if ( m_bDisposed ) 382*cdf0e10cSrcweir return; 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir Sequence< PropertyValue > aArgs; 385*cdf0e10cSrcweir execute( aArgs ); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir void StatusbarController::addStatusListener( const rtl::OUString& aCommandURL ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir Reference< XDispatch > xDispatch; 391*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener; 392*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 396*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir // Already in the list of status listener. Do nothing. 399*cdf0e10cSrcweir if ( pIter != m_aListenerMap.end() ) 400*cdf0e10cSrcweir return; 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir // Check if we are already initialized. Implementation starts adding itself as status listener when 403*cdf0e10cSrcweir // intialize is called. 404*cdf0e10cSrcweir if ( !m_bInitialized ) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir // Put into the hash_map of status listener. Will be activated when initialized is called 407*cdf0e10cSrcweir m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() )); 408*cdf0e10cSrcweir return; 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir else 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir // Add status listener directly as intialize has already been called. 413*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 414*cdf0e10cSrcweir if ( m_xServiceManager.is() && xDispatchProvider.is() ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 417*cdf0e10cSrcweir aTargetURL.Complete = aCommandURL; 418*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 419*cdf0e10cSrcweir xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ); 422*cdf0e10cSrcweir URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL ); 423*cdf0e10cSrcweir if ( aIter != m_aListenerMap.end() ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir Reference< XDispatch > xOldDispatch( aIter->second ); 426*cdf0e10cSrcweir aIter->second = xDispatch; 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir try 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir if ( xOldDispatch.is() ) 431*cdf0e10cSrcweir xOldDispatch->removeStatusListener( xStatusListener, aTargetURL ); 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir catch ( Exception& ) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir else 438*cdf0e10cSrcweir m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, xDispatch )); 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // Call without locked mutex as we are called back from dispatch implementation 444*cdf0e10cSrcweir try 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir if ( xDispatch.is() ) 447*cdf0e10cSrcweir xDispatch->addStatusListener( xStatusListener, aTargetURL ); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir catch ( Exception& ) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir void StatusbarController::removeStatusListener( const rtl::OUString& aCommandURL ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); 459*cdf0e10cSrcweir if ( pIter != m_aListenerMap.end() ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir Reference< XDispatch > xDispatch( pIter->second ); 462*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); 463*cdf0e10cSrcweir m_aListenerMap.erase( pIter ); 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir try 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 468*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 469*cdf0e10cSrcweir aTargetURL.Complete = aCommandURL; 470*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir if ( xDispatch.is() && xStatusListener.is() ) 473*cdf0e10cSrcweir xDispatch->removeStatusListener( xStatusListener, aTargetURL ); 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir catch ( Exception& ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir void StatusbarController::bindListener() 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir std::vector< Listener > aDispatchVector; 484*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener; 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir if ( !m_bInitialized ) 490*cdf0e10cSrcweir return; 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir // Collect all registered command URL's and store them temporary 493*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 494*cdf0e10cSrcweir if ( m_xServiceManager.is() && xDispatchProvider.is() ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ); 497*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); 498*cdf0e10cSrcweir while ( pIter != m_aListenerMap.end() ) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 501*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 502*cdf0e10cSrcweir aTargetURL.Complete = pIter->first; 503*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir Reference< XDispatch > xDispatch( pIter->second ); 506*cdf0e10cSrcweir if ( xDispatch.is() ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir // We already have a dispatch object => we have to requery. 509*cdf0e10cSrcweir // Release old dispatch object and remove it as listener 510*cdf0e10cSrcweir try 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir xDispatch->removeStatusListener( xStatusListener, aTargetURL ); 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir catch ( Exception& ) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir pIter->second.clear(); 520*cdf0e10cSrcweir xDispatch.clear(); 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir // Query for dispatch object. Old dispatch will be released with this, too. 523*cdf0e10cSrcweir try 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir catch ( Exception& ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir pIter->second = xDispatch; 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir Listener aListener( aTargetURL, xDispatch ); 533*cdf0e10cSrcweir aDispatchVector.push_back( aListener ); 534*cdf0e10cSrcweir ++pIter; 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir // Call without locked mutex as we are called back from dispatch implementation 540*cdf0e10cSrcweir if ( xStatusListener.is() ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir try 543*cdf0e10cSrcweir { 544*cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < aDispatchVector.size(); i++ ) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir Listener& rListener = aDispatchVector[i]; 547*cdf0e10cSrcweir if ( rListener.xDispatch.is() ) 548*cdf0e10cSrcweir rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL ); 549*cdf0e10cSrcweir else if ( rListener.aURL.Complete == m_aCommandURL ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir try 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir // Send status changed for the main URL, if we cannot get a valid dispatch object. 554*cdf0e10cSrcweir // UI disables the button. Catch exception as we release our mutex, it is possible 555*cdf0e10cSrcweir // that someone else already disposed this instance! 556*cdf0e10cSrcweir FeatureStateEvent aFeatureStateEvent; 557*cdf0e10cSrcweir aFeatureStateEvent.IsEnabled = sal_False; 558*cdf0e10cSrcweir aFeatureStateEvent.FeatureURL = rListener.aURL; 559*cdf0e10cSrcweir aFeatureStateEvent.State = Any(); 560*cdf0e10cSrcweir xStatusListener->statusChanged( aFeatureStateEvent ); 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir catch ( Exception& ) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir catch ( Exception& ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir void StatusbarController::unbindListener() 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir if ( !m_bInitialized ) 579*cdf0e10cSrcweir return; 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir // Collect all registered command URL's and store them temporary 582*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 583*cdf0e10cSrcweir if ( m_xServiceManager.is() && xDispatchProvider.is() ) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); 586*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); 587*cdf0e10cSrcweir while ( pIter != m_aListenerMap.end() ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 590*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 591*cdf0e10cSrcweir aTargetURL.Complete = pIter->first; 592*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir Reference< XDispatch > xDispatch( pIter->second ); 595*cdf0e10cSrcweir if ( xDispatch.is() ) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir // We already have a dispatch object => we have to requery. 598*cdf0e10cSrcweir // Release old dispatch object and remove it as listener 599*cdf0e10cSrcweir try 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir xDispatch->removeStatusListener( xStatusListener, aTargetURL ); 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir catch ( Exception& ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir pIter->second.clear(); 608*cdf0e10cSrcweir ++pIter; 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir sal_Bool StatusbarController::isBound() const 614*cdf0e10cSrcweir { 615*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir if ( !m_bInitialized ) 618*cdf0e10cSrcweir return sal_False; 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir URLToDispatchMap::const_iterator pIter = m_aListenerMap.find( m_aCommandURL ); 621*cdf0e10cSrcweir if ( pIter != m_aListenerMap.end() ) 622*cdf0e10cSrcweir return ( pIter->second.is() ); 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir return sal_False; 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir void StatusbarController::updateStatus() 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir bindListener(); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir void StatusbarController::updateStatus( const rtl::OUString aCommandURL ) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir Reference< XDispatch > xDispatch; 635*cdf0e10cSrcweir Reference< XStatusListener > xStatusListener; 636*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir if ( !m_bInitialized ) 642*cdf0e10cSrcweir return; 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir // Try to find a dispatch object for the requested command URL 645*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 646*cdf0e10cSrcweir xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ); 647*cdf0e10cSrcweir if ( m_xServiceManager.is() && xDispatchProvider.is() ) 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer = getURLTransformer(); 650*cdf0e10cSrcweir aTargetURL.Complete = aCommandURL; 651*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 652*cdf0e10cSrcweir xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir if ( xDispatch.is() && xStatusListener.is() ) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir // Catch exception as we release our mutex, it is possible that someone else 659*cdf0e10cSrcweir // has already disposed this instance! 660*cdf0e10cSrcweir // Add/remove status listener to get a update status information from the 661*cdf0e10cSrcweir // requested command. 662*cdf0e10cSrcweir try 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir xDispatch->addStatusListener( xStatusListener, aTargetURL ); 665*cdf0e10cSrcweir xDispatch->removeStatusListener( xStatusListener, aTargetURL ); 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir catch ( Exception& ) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir ::Rectangle StatusbarController::getControlRect() const 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir ::Rectangle aRect; 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir if ( m_bDisposed ) 681*cdf0e10cSrcweir throw DisposedException(); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir if ( m_xParentWindow.is() ) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir StatusBar* pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow )); 686*cdf0e10cSrcweir if ( pStatusBar && pStatusBar->GetType() == WINDOW_STATUSBAR ) 687*cdf0e10cSrcweir aRect = pStatusBar->GetItemRect( m_nID ); 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir return aRect; 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir void StatusbarController::execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir Reference< XDispatch > xDispatch; 697*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer; 698*cdf0e10cSrcweir rtl::OUString aCommandURL; 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir if ( m_bDisposed ) 704*cdf0e10cSrcweir throw DisposedException(); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir if ( m_bInitialized && 707*cdf0e10cSrcweir m_xFrame.is() && 708*cdf0e10cSrcweir m_xServiceManager.is() && 709*cdf0e10cSrcweir m_aCommandURL.getLength() ) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir xURLTransformer = getURLTransformer(); 712*cdf0e10cSrcweir aCommandURL = m_aCommandURL; 713*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL ); 714*cdf0e10cSrcweir if ( pIter != m_aListenerMap.end() ) 715*cdf0e10cSrcweir xDispatch = pIter->second; 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir if ( xDispatch.is() && xURLTransformer.is() ) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir try 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir aTargetURL.Complete = aCommandURL; 726*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 727*cdf0e10cSrcweir xDispatch->dispatch( aTargetURL, aArgs ); 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir catch ( DisposedException& ) 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir void StatusbarController::execute( 736*cdf0e10cSrcweir const rtl::OUString& aCommandURL, 737*cdf0e10cSrcweir const Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir Reference< XDispatch > xDispatch; 740*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir if ( m_bDisposed ) 746*cdf0e10cSrcweir throw DisposedException(); 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir if ( m_bInitialized && 749*cdf0e10cSrcweir m_xFrame.is() && 750*cdf0e10cSrcweir m_xServiceManager.is() && 751*cdf0e10cSrcweir m_aCommandURL.getLength() ) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir Reference< XURLTransformer > xURLTransformer( getURLTransformer() ); 754*cdf0e10cSrcweir aTargetURL.Complete = aCommandURL; 755*cdf0e10cSrcweir xURLTransformer->parseStrict( aTargetURL ); 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); 758*cdf0e10cSrcweir if ( pIter != m_aListenerMap.end() ) 759*cdf0e10cSrcweir xDispatch = pIter->second; 760*cdf0e10cSrcweir else 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir Reference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider( 763*cdf0e10cSrcweir m_xFrame->getController(), UNO_QUERY ); 764*cdf0e10cSrcweir if ( xDispatchProvider.is() ) 765*cdf0e10cSrcweir xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir if ( xDispatch.is() ) 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir try 773*cdf0e10cSrcweir { 774*cdf0e10cSrcweir xDispatch->dispatch( aTargetURL, aArgs ); 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir catch ( DisposedException& ) 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir } // svt 783