merge the formfield patch from ooo-build
[ooovba.git] / svtools / source / uno / statusbarcontroller.cxx
blob8e07b257504aaa0d51035db77ea29e987645bd35
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: statusbarcontroller.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
33 #include <statusbarcontroller.hxx>
34 #include <com/sun/star/beans/PropertyValue.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/frame/XDispatchProvider.hpp>
37 #include <com/sun/star/lang/DisposedException.hpp>
38 #include <com/sun/star/frame/XLayoutManager.hpp>
39 #include <vos/mutex.hxx>
40 #include <vcl/svapp.hxx>
41 #include <vcl/window.hxx>
42 #include <vcl/status.hxx>
43 #include <imgdef.hxx>
44 #include <svtools/miscopt.hxx>
45 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
46 #include <toolkit/unohlp.hxx>
47 #endif
49 using namespace ::cppu;
50 using namespace ::com::sun::star::awt;
51 using namespace ::com::sun::star::uno;
52 using namespace ::com::sun::star::util;
53 using namespace ::com::sun::star::beans;
54 using namespace ::com::sun::star::lang;
55 using namespace ::com::sun::star::frame;
56 using namespace ::com::sun::star::frame;
58 namespace svt
61 StatusbarController::StatusbarController(
62 const Reference< XMultiServiceFactory >& rServiceManager,
63 const Reference< XFrame >& xFrame,
64 const ::rtl::OUString& aCommandURL,
65 unsigned short nID ) :
66 OWeakObject()
67 , m_bInitialized( sal_False )
68 , m_bDisposed( sal_False )
69 , m_nID( nID )
70 , m_xFrame( xFrame )
71 , m_xServiceManager( rServiceManager )
72 , m_aCommandURL( aCommandURL )
73 , m_aListenerContainer( m_aMutex )
77 StatusbarController::StatusbarController() :
78 OWeakObject()
79 , m_bInitialized( sal_False )
80 , m_bDisposed( sal_False )
81 , m_nID( 0 )
82 , m_aListenerContainer( m_aMutex )
86 StatusbarController::~StatusbarController()
90 Reference< XFrame > StatusbarController::getFrameInterface() const
92 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
93 return m_xFrame;
96 Reference< XMultiServiceFactory > StatusbarController::getServiceManager() const
98 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
99 return m_xServiceManager;
102 Reference< XLayoutManager > StatusbarController::getLayoutManager() const
104 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
105 Reference< XLayoutManager > xLayoutManager;
106 Reference< XPropertySet > xPropSet( m_xFrame, UNO_QUERY );
107 if ( xPropSet.is() )
111 Any a;
112 a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
113 a >>= xLayoutManager;
115 catch ( Exception& )
120 return xLayoutManager;
123 Reference< XURLTransformer > StatusbarController::getURLTransformer() const
125 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
126 if ( !m_xURLTransformer.is() && m_xServiceManager.is() )
128 m_xURLTransformer = Reference< XURLTransformer >(
129 m_xServiceManager->createInstance(
130 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
131 UNO_QUERY );
134 return m_xURLTransformer;
137 // XInterface
138 Any SAL_CALL StatusbarController::queryInterface( const Type& rType )
139 throw ( RuntimeException )
141 Any a = ::cppu::queryInterface(
142 rType ,
143 static_cast< XStatusbarController* >( this ),
144 static_cast< XStatusListener* >( this ),
145 static_cast< XEventListener* >( this ),
146 static_cast< XInitialization* >( this ),
147 static_cast< XComponent* >( this ),
148 static_cast< XUpdatable* >( this ));
150 if ( a.hasValue() )
151 return a;
153 return OWeakObject::queryInterface( rType );
156 void SAL_CALL StatusbarController::acquire() throw ()
158 OWeakObject::acquire();
161 void SAL_CALL StatusbarController::release() throw ()
163 OWeakObject::release();
166 void SAL_CALL StatusbarController::initialize( const Sequence< Any >& aArguments )
167 throw ( Exception, RuntimeException )
169 const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
170 const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
171 const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
172 const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
173 const rtl::OUString aIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Identifier" ));
175 bool bInitialized( true );
178 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
180 if ( m_bDisposed )
181 throw DisposedException();
183 bInitialized = m_bInitialized;
186 if ( !bInitialized )
188 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
189 m_bInitialized = sal_True;
191 PropertyValue aPropValue;
192 for ( int i = 0; i < aArguments.getLength(); i++ )
194 if ( aArguments[i] >>= aPropValue )
196 if ( aPropValue.Name.equalsAscii( "Frame" ))
197 aPropValue.Value >>= m_xFrame;
198 else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
199 aPropValue.Value >>= m_aCommandURL;
200 else if ( aPropValue.Name.equalsAscii( "ServiceManager" ))
201 aPropValue.Value >>= m_xServiceManager;
202 else if ( aPropValue.Name.equalsAscii( "ParentWindow" ))
203 aPropValue.Value >>= m_xParentWindow;
204 else if ( aPropValue.Name.equalsAscii( "Identifier" ))
205 aPropValue.Value >>= m_nID;
209 if ( m_aCommandURL.getLength() )
210 m_aListenerMap.insert( URLToDispatchMap::value_type( m_aCommandURL, Reference< XDispatch >() ));
214 void SAL_CALL StatusbarController::update()
215 throw ( RuntimeException )
218 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
219 if ( m_bDisposed )
220 throw DisposedException();
223 // Bind all registered listeners to their dispatch objects
224 bindListener();
227 // XComponent
228 void SAL_CALL StatusbarController::dispose()
229 throw (::com::sun::star::uno::RuntimeException)
231 Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
234 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
235 if ( m_bDisposed )
236 throw DisposedException();
239 com::sun::star::lang::EventObject aEvent( xThis );
240 m_aListenerContainer.disposeAndClear( aEvent );
242 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
243 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
244 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
245 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
246 com::sun::star::util::URL aTargetURL;
247 while ( pIter != m_aListenerMap.end() )
251 Reference< XDispatch > xDispatch( pIter->second );
252 aTargetURL.Complete = pIter->first;
253 xURLTransformer->parseStrict( aTargetURL );
255 if ( xDispatch.is() && xStatusListener.is() )
256 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
258 catch ( Exception& )
262 ++pIter;
265 // clear hash map
266 m_aListenerMap.clear();
268 // release references
269 m_xURLTransformer.clear();
270 m_xServiceManager.clear();
271 m_xFrame.clear();
272 m_xParentWindow.clear();
274 m_bDisposed = sal_True;
277 void SAL_CALL StatusbarController::addEventListener( const Reference< XEventListener >& xListener )
278 throw ( RuntimeException )
280 m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
283 void SAL_CALL StatusbarController::removeEventListener( const Reference< XEventListener >& aListener )
284 throw ( RuntimeException )
286 m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), aListener );
289 // XEventListener
290 void SAL_CALL StatusbarController::disposing( const EventObject& Source )
291 throw ( RuntimeException )
293 Reference< XInterface > xSource( Source.Source );
295 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
297 if ( m_bDisposed )
298 return;
300 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
301 while ( pIter != m_aListenerMap.end() )
303 // Compare references and release dispatch references if they are equal.
304 Reference< XInterface > xIfac( pIter->second, UNO_QUERY );
305 if ( xSource == xIfac )
306 pIter->second.clear();
307 pIter++;
310 Reference< XInterface > xIfac( m_xFrame, UNO_QUERY );
311 if ( xIfac == xSource )
312 m_xFrame.clear();
315 // XStatusListener
316 void SAL_CALL StatusbarController::statusChanged( const FeatureStateEvent& Event )
317 throw ( RuntimeException )
319 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
321 if ( m_bDisposed )
322 return;
324 Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
325 if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 )
327 rtl::OUString aStrValue;
328 StatusBar* pStatusBar = (StatusBar *)pWindow;
330 if ( Event.State >>= aStrValue )
331 pStatusBar->SetItemText( m_nID, aStrValue );
332 else if ( !Event.State.hasValue() )
333 pStatusBar->SetItemText( m_nID, String() );
337 // XStatusbarController
338 ::sal_Bool SAL_CALL StatusbarController::mouseButtonDown(
339 const ::com::sun::star::awt::MouseEvent& )
340 throw (::com::sun::star::uno::RuntimeException)
342 return sal_False;
345 ::sal_Bool SAL_CALL StatusbarController::mouseMove(
346 const ::com::sun::star::awt::MouseEvent& )
347 throw (::com::sun::star::uno::RuntimeException)
349 return sal_False;
352 ::sal_Bool SAL_CALL StatusbarController::mouseButtonUp(
353 const ::com::sun::star::awt::MouseEvent& )
354 throw (::com::sun::star::uno::RuntimeException)
356 return sal_False;
359 void SAL_CALL StatusbarController::command(
360 const ::com::sun::star::awt::Point&,
361 ::sal_Int32,
362 ::sal_Bool,
363 const ::com::sun::star::uno::Any& )
364 throw (::com::sun::star::uno::RuntimeException)
368 void SAL_CALL StatusbarController::paint(
369 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >&,
370 const ::com::sun::star::awt::Rectangle&,
371 ::sal_Int32,
372 ::sal_Int32 )
373 throw (::com::sun::star::uno::RuntimeException)
377 void SAL_CALL StatusbarController::click()
378 throw (::com::sun::star::uno::RuntimeException)
382 void SAL_CALL StatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
384 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
386 if ( m_bDisposed )
387 return;
389 Sequence< PropertyValue > aArgs;
390 execute( aArgs );
393 void StatusbarController::addStatusListener( const rtl::OUString& aCommandURL )
395 Reference< XDispatch > xDispatch;
396 Reference< XStatusListener > xStatusListener;
397 com::sun::star::util::URL aTargetURL;
400 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
401 URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL );
403 // Already in the list of status listener. Do nothing.
404 if ( pIter != m_aListenerMap.end() )
405 return;
407 // Check if we are already initialized. Implementation starts adding itself as status listener when
408 // intialize is called.
409 if ( !m_bInitialized )
411 // Put into the hash_map of status listener. Will be activated when initialized is called
412 m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() ));
413 return;
415 else
417 // Add status listener directly as intialize has already been called.
418 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
419 if ( m_xServiceManager.is() && xDispatchProvider.is() )
421 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
422 aTargetURL.Complete = aCommandURL;
423 xURLTransformer->parseStrict( aTargetURL );
424 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
426 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
427 URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL );
428 if ( aIter != m_aListenerMap.end() )
430 Reference< XDispatch > xOldDispatch( aIter->second );
431 aIter->second = xDispatch;
435 if ( xOldDispatch.is() )
436 xOldDispatch->removeStatusListener( xStatusListener, aTargetURL );
438 catch ( Exception& )
442 else
443 m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, xDispatch ));
448 // Call without locked mutex as we are called back from dispatch implementation
451 if ( xDispatch.is() )
452 xDispatch->addStatusListener( xStatusListener, aTargetURL );
454 catch ( Exception& )
459 void StatusbarController::removeStatusListener( const rtl::OUString& aCommandURL )
461 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
463 URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL );
464 if ( pIter != m_aListenerMap.end() )
466 Reference< XDispatch > xDispatch( pIter->second );
467 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
468 m_aListenerMap.erase( pIter );
472 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
473 com::sun::star::util::URL aTargetURL;
474 aTargetURL.Complete = aCommandURL;
475 xURLTransformer->parseStrict( aTargetURL );
477 if ( xDispatch.is() && xStatusListener.is() )
478 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
480 catch ( Exception& )
486 void StatusbarController::bindListener()
488 std::vector< Listener > aDispatchVector;
489 Reference< XStatusListener > xStatusListener;
492 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
494 if ( !m_bInitialized )
495 return;
497 // Collect all registered command URL's and store them temporary
498 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
499 if ( m_xServiceManager.is() && xDispatchProvider.is() )
501 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
502 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
503 while ( pIter != m_aListenerMap.end() )
505 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
506 com::sun::star::util::URL aTargetURL;
507 aTargetURL.Complete = pIter->first;
508 xURLTransformer->parseStrict( aTargetURL );
510 Reference< XDispatch > xDispatch( pIter->second );
511 if ( xDispatch.is() )
513 // We already have a dispatch object => we have to requery.
514 // Release old dispatch object and remove it as listener
517 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
519 catch ( Exception& )
524 pIter->second.clear();
525 xDispatch.clear();
527 // Query for dispatch object. Old dispatch will be released with this, too.
530 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
532 catch ( Exception& )
535 pIter->second = xDispatch;
537 Listener aListener( aTargetURL, xDispatch );
538 aDispatchVector.push_back( aListener );
539 ++pIter;
544 // Call without locked mutex as we are called back from dispatch implementation
545 if ( xStatusListener.is() )
549 for ( sal_uInt32 i = 0; i < aDispatchVector.size(); i++ )
551 Listener& rListener = aDispatchVector[i];
552 if ( rListener.xDispatch.is() )
553 rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
554 else if ( rListener.aURL.Complete == m_aCommandURL )
558 // Send status changed for the main URL, if we cannot get a valid dispatch object.
559 // UI disables the button. Catch exception as we release our mutex, it is possible
560 // that someone else already disposed this instance!
561 FeatureStateEvent aFeatureStateEvent;
562 aFeatureStateEvent.IsEnabled = sal_False;
563 aFeatureStateEvent.FeatureURL = rListener.aURL;
564 aFeatureStateEvent.State = Any();
565 xStatusListener->statusChanged( aFeatureStateEvent );
567 catch ( Exception& )
573 catch ( Exception& )
579 void StatusbarController::unbindListener()
581 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
583 if ( !m_bInitialized )
584 return;
586 // Collect all registered command URL's and store them temporary
587 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
588 if ( m_xServiceManager.is() && xDispatchProvider.is() )
590 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
591 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
592 while ( pIter != m_aListenerMap.end() )
594 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
595 com::sun::star::util::URL aTargetURL;
596 aTargetURL.Complete = pIter->first;
597 xURLTransformer->parseStrict( aTargetURL );
599 Reference< XDispatch > xDispatch( pIter->second );
600 if ( xDispatch.is() )
602 // We already have a dispatch object => we have to requery.
603 // Release old dispatch object and remove it as listener
606 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
608 catch ( Exception& )
612 pIter->second.clear();
613 ++pIter;
618 sal_Bool StatusbarController::isBound() const
620 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
622 if ( !m_bInitialized )
623 return sal_False;
625 URLToDispatchMap::const_iterator pIter = m_aListenerMap.find( m_aCommandURL );
626 if ( pIter != m_aListenerMap.end() )
627 return ( pIter->second.is() );
629 return sal_False;
632 void StatusbarController::updateStatus()
634 bindListener();
637 void StatusbarController::updateStatus( const rtl::OUString aCommandURL )
639 Reference< XDispatch > xDispatch;
640 Reference< XStatusListener > xStatusListener;
641 com::sun::star::util::URL aTargetURL;
644 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
646 if ( !m_bInitialized )
647 return;
649 // Try to find a dispatch object for the requested command URL
650 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
651 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
652 if ( m_xServiceManager.is() && xDispatchProvider.is() )
654 Reference< XURLTransformer > xURLTransformer = getURLTransformer();
655 aTargetURL.Complete = aCommandURL;
656 xURLTransformer->parseStrict( aTargetURL );
657 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
661 if ( xDispatch.is() && xStatusListener.is() )
663 // Catch exception as we release our mutex, it is possible that someone else
664 // has already disposed this instance!
665 // Add/remove status listener to get a update status information from the
666 // requested command.
669 xDispatch->addStatusListener( xStatusListener, aTargetURL );
670 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
672 catch ( Exception& )
678 ::Rectangle StatusbarController::getControlRect() const
680 ::Rectangle aRect;
683 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
685 if ( m_bDisposed )
686 throw DisposedException();
688 if ( m_xParentWindow.is() )
690 StatusBar* pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ));
691 if ( pStatusBar && pStatusBar->GetType() == WINDOW_STATUSBAR )
692 aRect = pStatusBar->GetItemRect( m_nID );
696 return aRect;
699 void StatusbarController::execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs )
701 Reference< XDispatch > xDispatch;
702 Reference< XURLTransformer > xURLTransformer;
703 rtl::OUString aCommandURL;
706 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
708 if ( m_bDisposed )
709 throw DisposedException();
711 if ( m_bInitialized &&
712 m_xFrame.is() &&
713 m_xServiceManager.is() &&
714 m_aCommandURL.getLength() )
716 xURLTransformer = getURLTransformer();
717 aCommandURL = m_aCommandURL;
718 URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
719 if ( pIter != m_aListenerMap.end() )
720 xDispatch = pIter->second;
724 if ( xDispatch.is() && xURLTransformer.is() )
728 com::sun::star::util::URL aTargetURL;
730 aTargetURL.Complete = aCommandURL;
731 xURLTransformer->parseStrict( aTargetURL );
732 xDispatch->dispatch( aTargetURL, aArgs );
734 catch ( DisposedException& )
740 void StatusbarController::execute(
741 const rtl::OUString& aCommandURL,
742 const Sequence< ::com::sun::star::beans::PropertyValue >& aArgs )
744 Reference< XDispatch > xDispatch;
745 com::sun::star::util::URL aTargetURL;
748 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
750 if ( m_bDisposed )
751 throw DisposedException();
753 if ( m_bInitialized &&
754 m_xFrame.is() &&
755 m_xServiceManager.is() &&
756 m_aCommandURL.getLength() )
758 Reference< XURLTransformer > xURLTransformer( getURLTransformer() );
759 aTargetURL.Complete = aCommandURL;
760 xURLTransformer->parseStrict( aTargetURL );
762 URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL );
763 if ( pIter != m_aListenerMap.end() )
764 xDispatch = pIter->second;
765 else
767 Reference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider(
768 m_xFrame->getController(), UNO_QUERY );
769 if ( xDispatchProvider.is() )
770 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
775 if ( xDispatch.is() )
779 xDispatch->dispatch( aTargetURL, aArgs );
781 catch ( DisposedException& )
787 } // svt