toolboxcontroller.cxx (dccf82be) toolboxcontroller.cxx (d21a9fb0)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 52 unchanged lines hidden (view full) ---

61 Reference< XDispatch > mxDispatch;
62 const URL maURL;
63 const Sequence< PropertyValue > maArgs;
64
65 DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
66 : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
67};
68
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 52 unchanged lines hidden (view full) ---

61 Reference< XDispatch > mxDispatch;
62 const URL maURL;
63 const Sequence< PropertyValue > maArgs;
64
65 DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
66 : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
67};
68
69struct ToolboxController_Impl
70{
71 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParentWindow;
72 ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer;
73 rtl::OUString m_sModuleName;
74 sal_uInt16 m_nToolBoxId;
75
76 DECL_STATIC_LINK( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo* );
77
78 ToolboxController_Impl()
79 : m_nToolBoxId( SAL_MAX_UINT16 )
80 {}
81};
82
83ToolboxController::ToolboxController(
84
85 const Reference< XMultiServiceFactory >& rServiceManager,
86 const Reference< XFrame >& xFrame,
87 const ::rtl::OUString& aCommandURL ) :
88 OPropertyContainer(GetBroadcastHelper())
89 , OWeakObject()
90 , m_bInitialized( sal_False )
91 , m_bDisposed( sal_False )
69ToolboxController::ToolboxController(
70
71 const Reference< XMultiServiceFactory >& rServiceManager,
72 const Reference< XFrame >& xFrame,
73 const ::rtl::OUString& aCommandURL ) :
74 OPropertyContainer(GetBroadcastHelper())
75 , OWeakObject()
76 , m_bInitialized( sal_False )
77 , m_bDisposed( sal_False )
78 , m_nToolBoxId( SAL_MAX_UINT16 )
92 , m_xFrame(xFrame)
93 , m_xServiceManager( rServiceManager )
94 , m_aCommandURL( aCommandURL )
95 , m_aListenerContainer( m_aMutex )
96{
97 //registger Propertyh by shizhoubo
98 registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
99 &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
100
79 , m_xFrame(xFrame)
80 , m_xServiceManager( rServiceManager )
81 , m_aCommandURL( aCommandURL )
82 , m_aListenerContainer( m_aMutex )
83{
84 //registger Propertyh by shizhoubo
85 registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
86 &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
87
101 m_pImpl = new ToolboxController_Impl;
102
103 try
104 {
88 try
89 {
105 m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance(
90 m_xUrlTransformer.set( m_xServiceManager->createInstance(
106 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
107 UNO_QUERY );
108 }
109 catch(const Exception&)
110 {
111 }
112}
113
114ToolboxController::ToolboxController() :
115 OPropertyContainer(GetBroadcastHelper())
116 , OWeakObject()
117 , m_bInitialized( sal_False )
118 , m_bDisposed( sal_False )
91 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
92 UNO_QUERY );
93 }
94 catch(const Exception&)
95 {
96 }
97}
98
99ToolboxController::ToolboxController() :
100 OPropertyContainer(GetBroadcastHelper())
101 , OWeakObject()
102 , m_bInitialized( sal_False )
103 , m_bDisposed( sal_False )
104 , m_nToolBoxId( SAL_MAX_UINT16 )
119 , m_aListenerContainer( m_aMutex )
120{
121 //registger Propertyh by shizhoubo
122 registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
123 &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
105 , m_aListenerContainer( m_aMutex )
106{
107 //registger Propertyh by shizhoubo
108 registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
109 &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
124
125 m_pImpl = new ToolboxController_Impl;
126}
127
128ToolboxController::~ToolboxController()
129{
110}
111
112ToolboxController::~ToolboxController()
113{
130 delete m_pImpl;
131}
132
133Reference< XFrame > ToolboxController::getFrameInterface() const
134{
135 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
136 return m_xFrame;
137}
138

--- 87 unchanged lines hidden (view full) ---

226 {
227 if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Frame") ))
228 m_xFrame.set(aPropValue.Value,UNO_QUERY);
229 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CommandURL") ))
230 aPropValue.Value >>= m_aCommandURL;
231 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ServiceManager") ))
232 m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
233 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") ))
114}
115
116Reference< XFrame > ToolboxController::getFrameInterface() const
117{
118 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
119 return m_xFrame;
120}
121

--- 87 unchanged lines hidden (view full) ---

209 {
210 if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Frame") ))
211 m_xFrame.set(aPropValue.Value,UNO_QUERY);
212 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CommandURL") ))
213 aPropValue.Value >>= m_aCommandURL;
214 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ServiceManager") ))
215 m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
216 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") ))
234 m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
217 m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
235 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ModuleIdentifier" ) ) )
218 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ModuleIdentifier" ) ) )
236 aPropValue.Value >>= m_pImpl->m_sModuleName;
219 aPropValue.Value >>= m_sModuleName;
220 else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Identifier" ) ) )
221 aPropValue.Value >>= m_nToolBoxId;
237 }
238 }
239
240 try
241 {
222 }
223 }
224
225 try
226 {
242 if ( !m_pImpl->m_xUrlTransformer.is() && m_xServiceManager.is() )
243 m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance(
227 if ( !m_xUrlTransformer.is() && m_xServiceManager.is() )
228 m_xUrlTransformer.set( m_xServiceManager->createInstance(
244 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
245 UNO_QUERY );
246 }
247 catch(const Exception&)
248 {
249 }
250
251 if ( m_aCommandURL.getLength() )

--- 35 unchanged lines hidden (view full) ---

287 while ( pIter != m_aListenerMap.end() )
288 {
289 try
290 {
291 Reference< XDispatch > xDispatch( pIter->second );
292
293 com::sun::star::util::URL aTargetURL;
294 aTargetURL.Complete = pIter->first;
229 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
230 UNO_QUERY );
231 }
232 catch(const Exception&)
233 {
234 }
235
236 if ( m_aCommandURL.getLength() )

--- 35 unchanged lines hidden (view full) ---

272 while ( pIter != m_aListenerMap.end() )
273 {
274 try
275 {
276 Reference< XDispatch > xDispatch( pIter->second );
277
278 com::sun::star::util::URL aTargetURL;
279 aTargetURL.Complete = pIter->first;
295 if ( m_pImpl->m_xUrlTransformer.is() )
296 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
280 if ( m_xUrlTransformer.is() )
281 m_xUrlTransformer->parseStrict( aTargetURL );
297
298 if ( xDispatch.is() && xStatusListener.is() )
299 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
300 }
301 catch ( Exception& )
302 {
303 }
304

--- 81 unchanged lines hidden (view full) ---

386 com::sun::star::util::URL aTargetURL;
387 Sequence<PropertyValue> aArgs( 1 );
388
389 // Provide key modifier information to dispatch function
390 aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
391 aArgs[0].Value = makeAny( KeyModifier );
392
393 aTargetURL.Complete = aCommandURL;
282
283 if ( xDispatch.is() && xStatusListener.is() )
284 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
285 }
286 catch ( Exception& )
287 {
288 }
289

--- 81 unchanged lines hidden (view full) ---

371 com::sun::star::util::URL aTargetURL;
372 Sequence<PropertyValue> aArgs( 1 );
373
374 // Provide key modifier information to dispatch function
375 aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
376 aArgs[0].Value = makeAny( KeyModifier );
377
378 aTargetURL.Complete = aCommandURL;
394 if ( m_pImpl->m_xUrlTransformer.is() )
395 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
379 if ( m_xUrlTransformer.is() )
380 m_xUrlTransformer->parseStrict( aTargetURL );
396 xDispatch->dispatch( aTargetURL, aArgs );
397 }
398 catch ( DisposedException& )
399 {
400 }
401 }
402}
403

--- 43 unchanged lines hidden (view full) ---

447 }
448 else
449 {
450 // Add status listener directly as intialize has already been called.
451 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
452 if ( m_xServiceManager.is() && xDispatchProvider.is() )
453 {
454 aTargetURL.Complete = aCommandURL;
381 xDispatch->dispatch( aTargetURL, aArgs );
382 }
383 catch ( DisposedException& )
384 {
385 }
386 }
387}
388

--- 43 unchanged lines hidden (view full) ---

432 }
433 else
434 {
435 // Add status listener directly as intialize has already been called.
436 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
437 if ( m_xServiceManager.is() && xDispatchProvider.is() )
438 {
439 aTargetURL.Complete = aCommandURL;
455 if ( m_pImpl->m_xUrlTransformer.is() )
456 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
440 if ( m_xUrlTransformer.is() )
441 m_xUrlTransformer->parseStrict( aTargetURL );
457 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
458
459 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
460 URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL );
461 if ( aIter != m_aListenerMap.end() )
462 {
463 Reference< XDispatch > xOldDispatch( aIter->second );
464 aIter->second = xDispatch;

--- 34 unchanged lines hidden (view full) ---

499 Reference< XDispatch > xDispatch( pIter->second );
500 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
501 m_aListenerMap.erase( pIter );
502
503 try
504 {
505 com::sun::star::util::URL aTargetURL;
506 aTargetURL.Complete = aCommandURL;
442 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
443
444 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
445 URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL );
446 if ( aIter != m_aListenerMap.end() )
447 {
448 Reference< XDispatch > xOldDispatch( aIter->second );
449 aIter->second = xDispatch;

--- 34 unchanged lines hidden (view full) ---

484 Reference< XDispatch > xDispatch( pIter->second );
485 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
486 m_aListenerMap.erase( pIter );
487
488 try
489 {
490 com::sun::star::util::URL aTargetURL;
491 aTargetURL.Complete = aCommandURL;
507 if ( m_pImpl->m_xUrlTransformer.is() )
508 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
492 if ( m_xUrlTransformer.is() )
493 m_xUrlTransformer->parseStrict( aTargetURL );
509
510 if ( xDispatch.is() && xStatusListener.is() )
511 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
512 }
513 catch ( Exception& )
514 {
515 }
516 }

--- 15 unchanged lines hidden (view full) ---

532 if ( m_xServiceManager.is() && xDispatchProvider.is() )
533 {
534 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
535 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
536 while ( pIter != m_aListenerMap.end() )
537 {
538 com::sun::star::util::URL aTargetURL;
539 aTargetURL.Complete = pIter->first;
494
495 if ( xDispatch.is() && xStatusListener.is() )
496 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
497 }
498 catch ( Exception& )
499 {
500 }
501 }

--- 15 unchanged lines hidden (view full) ---

517 if ( m_xServiceManager.is() && xDispatchProvider.is() )
518 {
519 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
520 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
521 while ( pIter != m_aListenerMap.end() )
522 {
523 com::sun::star::util::URL aTargetURL;
524 aTargetURL.Complete = pIter->first;
540 if ( m_pImpl->m_xUrlTransformer.is() )
541 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
525 if ( m_xUrlTransformer.is() )
526 m_xUrlTransformer->parseStrict( aTargetURL );
542
543 Reference< XDispatch > xDispatch( pIter->second );
544 if ( xDispatch.is() )
545 {
546 // We already have a dispatch object => we have to requery.
547 // Release old dispatch object and remove it as listener
548 try
549 {

--- 71 unchanged lines hidden (view full) ---

621 if ( m_xServiceManager.is() && xDispatchProvider.is() )
622 {
623 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
624 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
625 while ( pIter != m_aListenerMap.end() )
626 {
627 com::sun::star::util::URL aTargetURL;
628 aTargetURL.Complete = pIter->first;
527
528 Reference< XDispatch > xDispatch( pIter->second );
529 if ( xDispatch.is() )
530 {
531 // We already have a dispatch object => we have to requery.
532 // Release old dispatch object and remove it as listener
533 try
534 {

--- 71 unchanged lines hidden (view full) ---

606 if ( m_xServiceManager.is() && xDispatchProvider.is() )
607 {
608 Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
609 URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
610 while ( pIter != m_aListenerMap.end() )
611 {
612 com::sun::star::util::URL aTargetURL;
613 aTargetURL.Complete = pIter->first;
629 if ( m_pImpl->m_xUrlTransformer.is() )
630 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
614 if ( m_xUrlTransformer.is() )
615 m_xUrlTransformer->parseStrict( aTargetURL );
631
632 Reference< XDispatch > xDispatch( pIter->second );
633 if ( xDispatch.is() )
634 {
635 // We already have a dispatch object => we have to requery.
636 // Release old dispatch object and remove it as listener
637 try
638 {

--- 27 unchanged lines hidden (view full) ---

666{
667 return SvtMiscOptions().AreCurrentSymbolsLarge();
668}
669
670sal_Bool ToolboxController::isHighContrast() const
671{
672 sal_Bool bHighContrast( sal_False );
673
616
617 Reference< XDispatch > xDispatch( pIter->second );
618 if ( xDispatch.is() )
619 {
620 // We already have a dispatch object => we have to requery.
621 // Release old dispatch object and remove it as listener
622 try
623 {

--- 27 unchanged lines hidden (view full) ---

651{
652 return SvtMiscOptions().AreCurrentSymbolsLarge();
653}
654
655sal_Bool ToolboxController::isHighContrast() const
656{
657 sal_Bool bHighContrast( sal_False );
658
674 Reference< XWindow > xWindow = m_pImpl->m_xParentWindow;
659 Reference< XWindow > xWindow = m_xParentWindow;
675 if ( xWindow.is() )
676 {
677 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
678 Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
679 if ( pWindow )
680 bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() );
681 }
682

--- 18 unchanged lines hidden (view full) ---

701 return;
702
703 // Try to find a dispatch object for the requested command URL
704 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
705 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
706 if ( m_xServiceManager.is() && xDispatchProvider.is() )
707 {
708 aTargetURL.Complete = aCommandURL;
660 if ( xWindow.is() )
661 {
662 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
663 Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
664 if ( pWindow )
665 bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() );
666 }
667

--- 18 unchanged lines hidden (view full) ---

686 return;
687
688 // Try to find a dispatch object for the requested command URL
689 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
690 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
691 if ( m_xServiceManager.is() && xDispatchProvider.is() )
692 {
693 aTargetURL.Complete = aCommandURL;
709 if ( m_pImpl->m_xUrlTransformer.is() )
710 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
694 if ( m_xUrlTransformer.is() )
695 m_xUrlTransformer->parseStrict( aTargetURL );
711 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
712 }
713 }
714
715 if ( xDispatch.is() && xStatusListener.is() )
716 {
717 // Catch exception as we release our mutex, it is possible that someone else
718 // has already disposed this instance!

--- 7 unchanged lines hidden (view full) ---

726 catch ( Exception& )
727 {
728 }
729 }
730}
731
732Reference< XURLTransformer > ToolboxController::getURLTransformer() const
733{
696 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
697 }
698 }
699
700 if ( xDispatch.is() && xStatusListener.is() )
701 {
702 // Catch exception as we release our mutex, it is possible that someone else
703 // has already disposed this instance!

--- 7 unchanged lines hidden (view full) ---

711 catch ( Exception& )
712 {
713 }
714 }
715}
716
717Reference< XURLTransformer > ToolboxController::getURLTransformer() const
718{
734 return m_pImpl->m_xUrlTransformer;
719 return m_xUrlTransformer;
735}
736
737Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
738{
720}
721
722Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
723{
739 return m_pImpl->m_xParentWindow;
724 return m_xParentWindow;
740}
741
725}
726
742const rtl::OUString& ToolboxController::getModuleName() const
743{
744 return m_pImpl->m_sModuleName;
745}
746
747void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
748{
749 try
750 {
751 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
752 URL aURL;
753 aURL.Complete = sCommandURL;
754 getURLTransformer()->parseStrict( aURL );
755
756 Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
757
727void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
728{
729 try
730 {
731 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
732 URL aURL;
733 aURL.Complete = sCommandURL;
734 getURLTransformer()->parseStrict( aURL );
735
736 Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
737
758 Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
738 Application::PostUserEvent( STATIC_LINK(0, ToolboxController, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
759
760 }
761 catch( Exception& )
762 {
763 }
764}
765
766//

--- 57 unchanged lines hidden (view full) ---

824 sal_Bool rValue(sal_False);
825 if (( aValue >>= rValue ) && m_bInitialized)
826 this->setSupportVisiableProperty( rValue );
827 }
828}
829
830//--------------------------------------------------------------------
831
739
740 }
741 catch( Exception& )
742 {
743 }
744}
745
746//

--- 57 unchanged lines hidden (view full) ---

804 sal_Bool rValue(sal_False);
805 if (( aValue >>= rValue ) && m_bInitialized)
806 this->setSupportVisiableProperty( rValue );
807 }
808}
809
810//--------------------------------------------------------------------
811
832IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo )
812IMPL_STATIC_LINK_NOINSTANCE( ToolboxController, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo )
833{
834 pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
835 delete pDispatchInfo;
836 return 0;
837}
838
839void ToolboxController::enable( bool bEnable )
840{
841 ToolBox* pToolBox = 0;
842 sal_uInt16 nItemId = 0;
843 if( getToolboxId( nItemId, &pToolBox ) )
844 {
845 pToolBox->EnableItem( nItemId, bEnable ? sal_True : sal_False );
846 }
847}
848
849bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
850{
813{
814 pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
815 delete pDispatchInfo;
816 return 0;
817}
818
819void ToolboxController::enable( bool bEnable )
820{
821 ToolBox* pToolBox = 0;
822 sal_uInt16 nItemId = 0;
823 if( getToolboxId( nItemId, &pToolBox ) )
824 {
825 pToolBox->EnableItem( nItemId, bEnable ? sal_True : sal_False );
826 }
827}
828
829bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
830{
851 if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
852 return m_pImpl->m_nToolBoxId;
831 if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
832 return m_nToolBoxId;
853
854 ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
855
833
834 ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
835
856 if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
836 if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
857 {
858 const sal_uInt16 nCount = pToolBox->GetItemCount();
859 for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
860 {
861 const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
862 if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
863 {
837 {
838 const sal_uInt16 nCount = pToolBox->GetItemCount();
839 for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
840 {
841 const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
842 if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
843 {
864 m_pImpl->m_nToolBoxId = nItemId;
844 m_nToolBoxId = nItemId;
865 break;
866 }
867 }
868 }
869
870 if( ppToolBox )
871 *ppToolBox = pToolBox;
872
845 break;
846 }
847 }
848 }
849
850 if( ppToolBox )
851 *ppToolBox = pToolBox;
852
873 rItemId = m_pImpl->m_nToolBoxId;
853 rItemId = m_nToolBoxId;
874
875 return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) );
876}
877//end
878
879} // svt
854
855 return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) );
856}
857//end
858
859} // svt