diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-06 12:29:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-21 14:01:18 +0100 |
commit | 25ec90bfa85ab829e47f442742c63dd41960b973 (patch) | |
tree | 3d75fe9c0baae5d6db2f6f04cf5ea1fbd7f0ea8a /reportdesign | |
parent | cfaac477e2a23880310070690beb3222b1c8227c (diff) |
Related: #i121442# Adapt existing code in other modules
(cherry picked from commit 6c640ee420df6f7c9f3ab981e49ee304f1d2319e)
Conflicts:
reportdesign/source/ui/misc/statusbarcontroller.cxx
sfx2/inc/sfx2/stbitem.hxx
svtools/inc/svtools/statusbarcontroller.hxx
svtools/source/uno/statusbarcontroller.cxx
Change-Id: If03a201214a4afe09efa4e3e996aded9b6a57bdf
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/ui/inc/statusbarcontroller.hxx | 15 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/statusbarcontroller.cxx | 64 |
2 files changed, 43 insertions, 36 deletions
diff --git a/reportdesign/source/ui/inc/statusbarcontroller.hxx b/reportdesign/source/ui/inc/statusbarcontroller.hxx index 413cca6d2ac9..6e6fda959e5d 100644 --- a/reportdesign/source/ui/inc/statusbarcontroller.hxx +++ b/reportdesign/source/ui/inc/statusbarcontroller.hxx @@ -23,20 +23,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); @@ -75,9 +74,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 6f73dadbdcd5..9bb946e7f132 100644 --- a/reportdesign/source/ui/misc/statusbarcontroller.cxx +++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx @@ -99,19 +99,25 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen break; } } + + SfxStatusBarControl *pController = 0; if ( m_aCommandURL == ".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); } else if ( m_aCommandURL == ".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); @@ -124,7 +130,7 @@ void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEv SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard(m_aMutex); - if ( m_pController.is() ) + if ( m_rController.is() ) { if ( m_aCommandURL == ".uno:ZoomSlider" ) { @@ -133,7 +139,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); } } else if ( m_aCommandURL == ".uno:Zoom" ) @@ -143,7 +149,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); } } } @@ -152,17 +158,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( @@ -172,47 +178,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(); } // ============================================================================= |