diff options
4 files changed, 30 insertions, 50 deletions
diff --git a/framework/inc/uielement/progressbarwrapper.hxx b/framework/inc/uielement/progressbarwrapper.hxx index 5b6ca9019e16..5b44e1bb740b 100644 --- a/framework/inc/uielement/progressbarwrapper.hxx +++ b/framework/inc/uielement/progressbarwrapper.hxx @@ -23,9 +23,10 @@ #include <com/sun/star/awt/XWindow.hpp> -#include <cppuhelper/weakref.hxx> +#include <unotools/weakref.hxx> namespace framework{ +class StatusIndicatorInterfaceWrapper; class ProgressBarWrapper final : public UIElementWrapperBase { @@ -70,7 +71,7 @@ class ProgressBarWrapper final : public UIElementWrapperBase private: css::uno::Reference< css::awt::XWindow > m_xStatusBar; // Reference to our status bar XWindow - css::uno::WeakReference< css::uno::XInterface > m_xProgressBarIfacWrapper; + unotools::WeakReference< StatusIndicatorInterfaceWrapper > m_xProgressBarIfacWrapper; bool m_bOwnsInstance; // Indicator that we are owner of the XWindow sal_Int32 m_nRange; sal_Int32 m_nValue; diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx index abfae53e754f..000405848cce 100644 --- a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx +++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx @@ -23,16 +23,18 @@ #include <com/sun/star/lang/XComponent.hpp> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/weakref.hxx> +#include <unotools/weakref.hxx> namespace framework { +class ProgressBarWrapper; class StatusIndicatorInterfaceWrapper final : public ::cppu::WeakImplHelper< css::task::XStatusIndicator> { public: - StatusIndicatorInterfaceWrapper( const css::uno::Reference< css::lang::XComponent >& rStatusIndicatorImpl ); + StatusIndicatorInterfaceWrapper( const rtl::Reference< ProgressBarWrapper >& rStatusIndicatorImpl ); virtual ~StatusIndicatorInterfaceWrapper() override; // XStatusIndicator @@ -45,7 +47,7 @@ class StatusIndicatorInterfaceWrapper final : public ::cppu::WeakImplHelper< css virtual void SAL_CALL setValue( sal_Int32 nValue ) override; private: - css::uno::WeakReference< css::lang::XComponent > m_xStatusIndicatorImpl; + unotools::WeakReference< ProgressBarWrapper > m_xStatusIndicatorImpl; }; } diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx index ad147111ff50..d92027c92c3a 100644 --- a/framework/source/uielement/progressbarwrapper.cxx +++ b/framework/source/uielement/progressbarwrapper.cxx @@ -291,17 +291,14 @@ uno::Reference< uno::XInterface > SAL_CALL ProgressBarWrapper::getRealInterface( return uno::Reference< uno::XInterface >(); else { - uno::Reference< uno::XInterface > xComp( m_xProgressBarIfacWrapper ); - if ( !xComp.is() ) + rtl::Reference< StatusIndicatorInterfaceWrapper > pWrapper( m_xProgressBarIfacWrapper ); + if ( !pWrapper.is() ) { - rtl::Reference<StatusIndicatorInterfaceWrapper> pWrapper = - new StatusIndicatorInterfaceWrapper( uno::Reference< lang::XComponent >(this) ); - xComp.set(static_cast< cppu::OWeakObject* >( pWrapper.get() ), - uno::UNO_QUERY ); - m_xProgressBarIfacWrapper = xComp; + pWrapper = new StatusIndicatorInterfaceWrapper( this ); + m_xProgressBarIfacWrapper = pWrapper.get(); } - return xComp; + return static_cast<cppu::OWeakObject*>(pWrapper.get()); } } diff --git a/framework/source/uielement/statusindicatorinterfacewrapper.cxx b/framework/source/uielement/statusindicatorinterfacewrapper.cxx index 6082f2aa5c3f..22ecc104bec3 100644 --- a/framework/source/uielement/statusindicatorinterfacewrapper.cxx +++ b/framework/source/uielement/statusindicatorinterfacewrapper.cxx @@ -28,7 +28,7 @@ namespace framework { StatusIndicatorInterfaceWrapper::StatusIndicatorInterfaceWrapper( - const css::uno::Reference< css::lang::XComponent >& rStatusIndicatorImpl ) : + const rtl::Reference< ProgressBarWrapper >& rStatusIndicatorImpl ) : m_xStatusIndicatorImpl( rStatusIndicatorImpl ) { } @@ -39,61 +39,41 @@ StatusIndicatorInterfaceWrapper::~StatusIndicatorInterfaceWrapper() void SAL_CALL StatusIndicatorInterfaceWrapper::start( const OUString& sText, - sal_Int32 nRange ) + sal_Int32 nRange ) { - Reference< XComponent > xComp( m_xStatusIndicatorImpl ); - if ( xComp.is() ) - { - ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get()); - if ( pProgressBar ) - pProgressBar->start( sText, nRange ); - } + rtl::Reference< ProgressBarWrapper > xProgressBar( m_xStatusIndicatorImpl ); + if ( xProgressBar.is() ) + xProgressBar->start( sText, nRange ); } void SAL_CALL StatusIndicatorInterfaceWrapper::end() { - Reference< XComponent > xComp( m_xStatusIndicatorImpl ); - if ( xComp.is() ) - { - ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get()); - if ( pProgressBar ) - pProgressBar->end(); - } + rtl::Reference< ProgressBarWrapper > xProgressBar( m_xStatusIndicatorImpl ); + if ( xProgressBar.is() ) + xProgressBar->end(); } void SAL_CALL StatusIndicatorInterfaceWrapper::reset() { - Reference< XComponent > xComp( m_xStatusIndicatorImpl ); - if ( xComp.is() ) - { - ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get()); - if ( pProgressBar ) - pProgressBar->reset(); - } + rtl::Reference< ProgressBarWrapper > xProgressBar( m_xStatusIndicatorImpl ); + if ( xProgressBar.is() ) + xProgressBar->reset(); } void SAL_CALL StatusIndicatorInterfaceWrapper::setText( const OUString& sText ) { - Reference< XComponent > xComp( m_xStatusIndicatorImpl ); - if ( xComp.is() ) - { - ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get()); - if ( pProgressBar ) - pProgressBar->setText( sText ); - } + rtl::Reference< ProgressBarWrapper > xProgressBar( m_xStatusIndicatorImpl ); + if ( xProgressBar.is() ) + xProgressBar->setText( sText ); } void SAL_CALL StatusIndicatorInterfaceWrapper::setValue( sal_Int32 nValue ) { - Reference< XComponent > xComp( m_xStatusIndicatorImpl ); - if ( xComp.is() ) - { - ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get()); - if ( pProgressBar ) - pProgressBar->setValue( nValue ); - } + rtl::Reference< ProgressBarWrapper > xProgressBar( m_xStatusIndicatorImpl ); + if ( xProgressBar.is() ) + xProgressBar->setValue( nValue ); } } // namespace framework |