summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2012-12-06 12:29:42 +0000
committerAriel Constenla-Haile <arielch@apache.org>2012-12-06 12:29:42 +0000
commit6c640ee420df6f7c9f3ab981e49ee304f1d2319e (patch)
tree4361d3228bf4af5ba58b740fa86c59f7d815807c
parent0b3a77478cf2cfd245a87bc528f851e959a2e6c7 (diff)
#i121442# - Adapt existing code in other modules
Notes
-rw-r--r--reportdesign/source/ui/inc/statusbarcontroller.hxx15
-rw-r--r--reportdesign/source/ui/misc/statusbarcontroller.cxx64
-rw-r--r--sfx2/inc/sfx2/stbitem.hxx8
-rw-r--r--sfx2/source/statbar/stbitem.cxx7
-rw-r--r--svtools/inc/svtools/statusbarcontroller.hxx15
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx132
6 files changed, 116 insertions, 125 deletions
diff --git a/reportdesign/source/ui/inc/statusbarcontroller.hxx b/reportdesign/source/ui/inc/statusbarcontroller.hxx
index 3f8824dbf6a1..303819cd2ca1 100644
--- a/reportdesign/source/ui/inc/statusbarcontroller.hxx
+++ b/reportdesign/source/ui/inc/statusbarcontroller.hxx
@@ -27,20 +27,19 @@
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase1.hxx>
-#include <comphelper/implementationreference.hxx>
class SfxStatusBarControl;
namespace rptui
{
- typedef ::comphelper::ImplementationReference<SfxStatusBarControl,::com::sun::star::frame::XStatusbarController> TStatusbarHelper;
+ typedef com::sun::star::uno::Reference< com::sun::star::frame::XStatusbarController > TStatusbarRef;
typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> OStatusbarController_BASE;
class OStatusbarController : public ::svt::StatusbarController,
public OStatusbarController_BASE
{
- TStatusbarHelper m_pController;
- sal_uInt16 m_nSlotId;
- sal_uInt16 m_nId;
+ TStatusbarRef m_rController;
+ sal_uInt16 m_nSlotId;
+ sal_uInt16 m_nId;
public:
OStatusbarController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
@@ -79,9 +78,9 @@ namespace rptui
const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
const ::com::sun::star::awt::Rectangle& rOutputRectangle,
- ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
};
}
#endif // DBAUI_STATUSBARCONTROLLER_HXX
diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx
index 9bfc6bfefb57..969915345e64 100644
--- a/reportdesign/source/ui/misc/statusbarcontroller.cxx
+++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx
@@ -105,19 +105,25 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen
break;
}
}
+
+ SfxStatusBarControl *pController = 0;
if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
{
- m_pController = TStatusbarHelper::createFromQuery(new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar));
+ pController = new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar);
} // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
else if ( m_aCommandURL.equalsAscii(".uno:Zoom") )
{
- m_pController = TStatusbarHelper::createFromQuery(new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar));
+ pController = new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar);
}
- if ( m_pController.is() )
+ if ( pController )
{
- m_pController->initialize(_rArguments);
- m_pController->update();
+ m_rController.set( pController );
+ if ( m_rController.is() )
+ {
+ m_rController->initialize(_rArguments);
+ m_rController->update();
+ }
}
addStatusListener(m_aCommandURL);
@@ -130,7 +136,7 @@ void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEv
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::MutexGuard aGuard(m_aMutex);
- if ( m_pController.is() )
+ if ( m_rController.is() )
{
if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
{
@@ -139,7 +145,7 @@ void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEv
{
SvxZoomSliderItem aZoomSlider(100,20,400);
aZoomSlider.PutValue(_aEvent.State);
- static_cast<SvxZoomSliderControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider);
+ static_cast<SvxZoomSliderControl*>(m_rController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider);
}
} // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
else if ( m_aCommandURL.equalsAscii(".uno:Zoom") )
@@ -149,7 +155,7 @@ void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEv
{
SvxZoomItem aZoom;
aZoom.PutValue(_aEvent.State);
- static_cast<SvxZoomStatusBarControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom);
+ static_cast<SvxZoomStatusBarControl*>(m_rController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom);
}
}
}
@@ -158,17 +164,17 @@ void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEv
// XStatusbarController
::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
{
- return m_pController.is() && m_pController.getRef()->mouseButtonDown(_aEvent);
+ return m_rController.is() && m_rController->mouseButtonDown(_aEvent);
}
::sal_Bool SAL_CALL OStatusbarController::mouseMove( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
{
- return m_pController.is() && m_pController.getRef()->mouseMove(_aEvent);
+ return m_rController.is() && m_rController->mouseMove(_aEvent);
}
::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
{
- return m_pController.is() && m_pController.getRef()->mouseButtonUp(_aEvent);
+ return m_rController.is() && m_rController->mouseButtonUp(_aEvent);
}
void SAL_CALL OStatusbarController::command(
@@ -178,47 +184,49 @@ void SAL_CALL OStatusbarController::command(
const ::com::sun::star::uno::Any& aData )
throw (::com::sun::star::uno::RuntimeException)
{
- if ( m_pController.is() )
- m_pController.getRef()->command( aPos, nCommand, bMouseEvent, aData );
+ if ( m_rController.is() )
+ m_rController->command( aPos, nCommand, bMouseEvent, aData );
}
void SAL_CALL OStatusbarController::paint(
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
const ::com::sun::star::awt::Rectangle& rOutputRectangle,
- ::sal_Int32 nItemId,
::sal_Int32 nStyle )
throw (::com::sun::star::uno::RuntimeException)
{
- if ( m_pController.is() )
- m_pController.getRef()->paint( xGraphics, rOutputRectangle, nItemId, nStyle );
+ if ( m_rController.is() )
+ m_rController->paint( xGraphics, rOutputRectangle, nStyle );
}
-void SAL_CALL OStatusbarController::click() throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL OStatusbarController::click(
+ const ::com::sun::star::awt::Point& aPos )
+throw (::com::sun::star::uno::RuntimeException)
{
- if ( m_pController.is() )
- m_pController.getRef()->click();
+ if ( m_rController.is() )
+ m_rController->click( aPos );
}
-void SAL_CALL OStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL OStatusbarController::doubleClick(
+ const ::com::sun::star::awt::Point& aPos )
+throw (::com::sun::star::uno::RuntimeException)
{
- if ( m_pController.is() )
- m_pController.getRef()->doubleClick();
+ if ( m_rController.is() )
+ m_rController->doubleClick( aPos );
}
// -----------------------------------------------------------------------------
void SAL_CALL OStatusbarController::update() throw ( RuntimeException )
{
::svt::StatusbarController::update();
- Reference< XUpdatable > xUp(m_pController.getRef(),UNO_QUERY);
- if ( xUp.is() )
- xUp->update();
+ if ( m_rController.is() )
+ m_rController->update();
}
// -----------------------------------------------------------------------------
// XComponent
void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XComponent > xComp( m_pController.getRef(), UNO_QUERY );
- ::comphelper::disposeComponent(xComp);
- m_pController.dispose();
+ if ( m_rController.is() )
+ ::comphelper::disposeComponent( m_rController );
+
svt::StatusbarController::dispose();
}
// =============================================================================
diff --git a/sfx2/inc/sfx2/stbitem.hxx b/sfx2/inc/sfx2/stbitem.hxx
index 5907b87ee40f..148a8809523e 100644
--- a/sfx2/inc/sfx2/stbitem.hxx
+++ b/sfx2/inc/sfx2/stbitem.hxx
@@ -94,10 +94,10 @@ protected:
::sal_Bool bMouseEvent,
const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
- const ::com::sun::star::awt::Rectangle& rOutputRectangle,
- ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ const ::com::sun::star::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
// Old sfx2 interface
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index 193d5c519af7..715abc73d55c 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -396,7 +396,6 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL SfxStatusBarControl::paint(
const uno::Reference< awt::XGraphics >& xGraphics,
const awt::Rectangle& rOutputRectangle,
- ::sal_Int32 nItemId,
::sal_Int32 nStyle )
throw ( ::uno::RuntimeException )
{
@@ -406,14 +405,14 @@ throw ( ::uno::RuntimeException )
if ( pOutDev )
{
::Rectangle aRect = VCLRectangle( rOutputRectangle );
- UserDrawEvent aUserDrawEvent( pOutDev, aRect, (sal_uInt16)nItemId, (sal_uInt16)nStyle );
+ UserDrawEvent aUserDrawEvent( pOutDev, aRect, pBar->GetCurItemId(), (sal_uInt16)nStyle );
Paint( aUserDrawEvent );
}
}
//--------------------------------------------------------------------
-void SAL_CALL SfxStatusBarControl::click()
+void SAL_CALL SfxStatusBarControl::click( const awt::Point& )
throw ( uno::RuntimeException )
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -422,7 +421,7 @@ throw ( uno::RuntimeException )
//--------------------------------------------------------------------
-void SAL_CALL SfxStatusBarControl::doubleClick()
+void SAL_CALL SfxStatusBarControl::doubleClick( const awt::Point& )
throw ( uno::RuntimeException )
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
diff --git a/svtools/inc/svtools/statusbarcontroller.hxx b/svtools/inc/svtools/statusbarcontroller.hxx
index 8bd6e3fd20f3..348aa1ccff44 100644
--- a/svtools/inc/svtools/statusbarcontroller.hxx
+++ b/svtools/inc/svtools/statusbarcontroller.hxx
@@ -25,12 +25,10 @@
#define _SVTOOLS_STATUSBARCONTROLLER_HXX
#include "svtools/svtdllapi.h"
+#include <com/sun/star/ui/XStatusbarItem.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XStatusbarController.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -48,10 +46,8 @@
namespace svt
{
-class SVT_DLLPUBLIC StatusbarController : public ::com::sun::star::frame::XStatusListener,
+class SVT_DLLPUBLIC StatusbarController :
public ::com::sun::star::frame::XStatusbarController,
- public ::com::sun::star::lang::XInitialization,
- public ::com::sun::star::util::XUpdatable,
public ::com::sun::star::lang::XComponent,
public ::comphelper::OBaseMutex,
public ::cppu::OWeakObject
@@ -106,9 +102,9 @@ class SVT_DLLPUBLIC StatusbarController : public ::com::sun::star::frame::XStatu
const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
const ::com::sun::star::awt::Rectangle& rOutputRectangle,
- ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
protected:
struct Listener
@@ -147,6 +143,7 @@ class SVT_DLLPUBLIC StatusbarController : public ::com::sun::star::frame::XStatu
URLToDispatchMap m_aListenerMap;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XStatusbarItem > m_xStatusbarItem;
};
}
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 8b239ab4b315..a89e2d26c90d 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -35,7 +35,7 @@
#include <vcl/status.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/miscopt.hxx>
-#include <toolkit/unohlp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
using namespace ::cppu;
using namespace ::com::sun::star::awt;
@@ -157,12 +157,6 @@ void SAL_CALL StatusbarController::release() throw ()
void SAL_CALL StatusbarController::initialize( const Sequence< Any >& aArguments )
throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
- const rtl::OUString aIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Identifier" ));
-
bool bInitialized( true );
{
@@ -184,16 +178,18 @@ throw ( Exception, RuntimeException )
{
if ( aArguments[i] >>= aPropValue )
{
- if ( aPropValue.Name.equalsAscii( "Frame" ))
+ if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Frame" )))
aPropValue.Value >>= m_xFrame;
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CommandURL" )))
aPropValue.Value >>= m_aCommandURL;
- else if ( aPropValue.Name.equalsAscii( "ServiceManager" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ServiceManager" )))
aPropValue.Value >>= m_xServiceManager;
- else if ( aPropValue.Name.equalsAscii( "ParentWindow" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" )))
aPropValue.Value >>= m_xParentWindow;
- else if ( aPropValue.Name.equalsAscii( "Identifier" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Identifier" )))
aPropValue.Value >>= m_nID;
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StatusbarItem" )))
+ aPropValue.Value >>= m_xStatusbarItem;
}
}
@@ -261,6 +257,7 @@ throw (::com::sun::star::uno::RuntimeException)
m_xServiceManager.clear();
m_xFrame.clear();
m_xParentWindow.clear();
+ m_xStatusbarItem.clear();
m_bDisposed = sal_True;
}
@@ -281,26 +278,31 @@ throw ( RuntimeException )
void SAL_CALL StatusbarController::disposing( const EventObject& Source )
throw ( RuntimeException )
{
- Reference< XInterface > xSource( Source.Source );
-
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
if ( m_bDisposed )
return;
+ Reference< XFrame > xFrame( Source.Source, UNO_QUERY );
+ if ( xFrame.is() )
+ {
+ if ( xFrame == m_xFrame )
+ m_xFrame.clear();
+ return;
+ }
+
+ Reference< XDispatch > xDispatch( Source.Source, UNO_QUERY );
+ if ( !xDispatch.is() )
+ return;
+
URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
while ( pIter != m_aListenerMap.end() )
{
// Compare references and release dispatch references if they are equal.
- Reference< XInterface > xIfac( pIter->second, UNO_QUERY );
- if ( xSource == xIfac )
+ if ( xDispatch == pIter->second )
pIter->second.clear();
pIter++;
}
-
- Reference< XInterface > xIfac( m_xFrame, UNO_QUERY );
- if ( xIfac == xSource )
- m_xFrame.clear();
}
// XStatusListener
@@ -359,18 +361,17 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL StatusbarController::paint(
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >&,
const ::com::sun::star::awt::Rectangle&,
- ::sal_Int32,
::sal_Int32 )
throw (::com::sun::star::uno::RuntimeException)
{
}
-void SAL_CALL StatusbarController::click()
+void SAL_CALL StatusbarController::click( const ::com::sun::star::awt::Point& )
throw (::com::sun::star::uno::RuntimeException)
{
}
-void SAL_CALL StatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL StatusbarController::doubleClick( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException)
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
@@ -533,37 +534,29 @@ void StatusbarController::bindListener()
}
// Call without locked mutex as we are called back from dispatch implementation
- if ( xStatusListener.is() )
+ if ( !xStatusListener.is() )
+ return;
+
+ for ( sal_uInt32 i = 0; i < aDispatchVector.size(); i++ )
{
try
{
- for ( sal_uInt32 i = 0; i < aDispatchVector.size(); i++ )
+ Listener& rListener = aDispatchVector[i];
+ if ( rListener.xDispatch.is() )
+ rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
+ else if ( rListener.aURL.Complete == m_aCommandURL )
{
- Listener& rListener = aDispatchVector[i];
- if ( rListener.xDispatch.is() )
- rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
- else if ( rListener.aURL.Complete == m_aCommandURL )
- {
- try
- {
- // Send status changed for the main URL, if we cannot get a valid dispatch object.
- // UI disables the button. Catch exception as we release our mutex, it is possible
- // that someone else already disposed this instance!
- FeatureStateEvent aFeatureStateEvent;
- aFeatureStateEvent.IsEnabled = sal_False;
- aFeatureStateEvent.FeatureURL = rListener.aURL;
- aFeatureStateEvent.State = Any();
- xStatusListener->statusChanged( aFeatureStateEvent );
- }
- catch ( Exception& )
- {
- }
- }
+ // Send status changed for the main URL, if we cannot get a valid dispatch object.
+ // UI disables the button. Catch exception as we release our mutex, it is possible
+ // that someone else already disposed this instance!
+ FeatureStateEvent aFeatureStateEvent;
+ aFeatureStateEvent.IsEnabled = sal_False;
+ aFeatureStateEvent.FeatureURL = rListener.aURL;
+ aFeatureStateEvent.State = Any();
+ xStatusListener->statusChanged( aFeatureStateEvent );
}
}
- catch ( Exception& )
- {
- }
+ catch ( ... ){}
}
}
@@ -574,35 +567,30 @@ void StatusbarController::unbindListener()
if ( !m_bInitialized )
return;
- // Collect all registered command URL's and store them temporary
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( m_xServiceManager.is() && xDispatchProvider.is() )
+ Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
+ while ( pIter != m_aListenerMap.end() )
{
- Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
- URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
- while ( pIter != m_aListenerMap.end() )
- {
- Reference< XURLTransformer > xURLTransformer = getURLTransformer();
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = pIter->first;
- xURLTransformer->parseStrict( aTargetURL );
+ Reference< XURLTransformer > xURLTransformer = getURLTransformer();
+ com::sun::star::util::URL aTargetURL;
+ aTargetURL.Complete = pIter->first;
+ xURLTransformer->parseStrict( aTargetURL );
- Reference< XDispatch > xDispatch( pIter->second );
- if ( xDispatch.is() )
+ Reference< XDispatch > xDispatch( pIter->second );
+ if ( xDispatch.is() )
+ {
+ // We already have a dispatch object => we have to requery.
+ // Release old dispatch object and remove it as listener
+ try
+ {
+ xDispatch->removeStatusListener( xStatusListener, aTargetURL );
+ }
+ catch ( Exception& )
{
- // We already have a dispatch object => we have to requery.
- // Release old dispatch object and remove it as listener
- try
- {
- xDispatch->removeStatusListener( xStatusListener, aTargetURL );
- }
- catch ( Exception& )
- {
- }
}
- pIter->second.clear();
- ++pIter;
}
+ pIter->second.clear();
+ ++pIter;
}
}