diff options
-rw-r--r-- | toolkit/source/controls/grid/gridcolumn.cxx | 51 | ||||
-rw-r--r-- | toolkit/source/controls/grid/gridcolumn.hxx | 19 |
2 files changed, 33 insertions, 37 deletions
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index fa2119d434bc..6d94ecb9a72b 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -39,8 +39,7 @@ namespace toolkit GridColumn::GridColumn() - :GridColumn_Base( m_aMutex ) - ,m_nIndex(-1) + :m_nIndex(-1) ,m_nDataColumnIndex(-1) ,m_nColumnWidth(4) ,m_nMaxWidth(0) @@ -53,9 +52,7 @@ namespace toolkit GridColumn::GridColumn( GridColumn const & i_copySource ) - :cppu::BaseMutex() - ,GridColumn_Base( m_aMutex ) - ,m_aIdentifier( i_copySource.m_aIdentifier ) + :m_aIdentifier( i_copySource.m_aIdentifier ) ,m_nIndex( -1 ) ,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex ) ,m_nColumnWidth( i_copySource.m_nColumnWidth ) @@ -76,7 +73,7 @@ namespace toolkit void GridColumn::broadcast_changed( char const * const i_asciiAttributeName, const Any& i_oldValue, const Any& i_newValue, - ::comphelper::ComponentGuard& i_Guard ) + std::unique_lock<std::mutex>& i_Guard ) { Reference< XInterface > const xSource( static_cast< ::cppu::OWeakObject* >( this ) ); GridColumnEvent const aEvent( @@ -84,31 +81,28 @@ namespace toolkit i_oldValue, i_newValue, m_nIndex ); - ::cppu::OInterfaceContainerHelper* pIter = rBHelper.getContainer( cppu::UnoType<XGridColumnListener>::get() ); - - i_Guard.clear(); - if( pIter ) - pIter->notifyEach( &XGridColumnListener::columnChanged, aEvent ); + i_Guard.unlock(); + maGridColumnListeners.notifyEach( &XGridColumnListener::columnChanged, aEvent ); } css::uno::Any SAL_CALL GridColumn::getIdentifier() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_aIdentifier; } void SAL_CALL GridColumn::setIdentifier(const css::uno::Any & value) { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); m_aIdentifier = value; } ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nColumnWidth; } @@ -121,7 +115,7 @@ namespace toolkit ::sal_Int32 SAL_CALL GridColumn::getMaxWidth() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nMaxWidth; } @@ -134,7 +128,7 @@ namespace toolkit ::sal_Int32 SAL_CALL GridColumn::getMinWidth() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nMinWidth; } @@ -147,7 +141,7 @@ namespace toolkit OUString SAL_CALL GridColumn::getTitle() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_sTitle; } @@ -160,7 +154,7 @@ namespace toolkit OUString SAL_CALL GridColumn::getHelpText() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_sHelpText; } @@ -173,7 +167,7 @@ namespace toolkit sal_Bool SAL_CALL GridColumn::getResizeable() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_bResizeable; } @@ -186,7 +180,7 @@ namespace toolkit ::sal_Int32 SAL_CALL GridColumn::getFlexibility() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nFlexibility; } @@ -201,7 +195,7 @@ namespace toolkit HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_eHorizontalAlign; } @@ -214,19 +208,20 @@ namespace toolkit void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener ) { - rBHelper.addListener( cppu::UnoType<XGridColumnListener>::get(), xListener ); + std::unique_lock aGuard( m_aMutex ); + maGridColumnListeners.addInterface( xListener ); } void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener ) { - rBHelper.removeListener( cppu::UnoType<XGridColumnListener>::get(), xListener ); + std::unique_lock aGuard( m_aMutex ); + maGridColumnListeners.removeInterface( xListener ); } - void SAL_CALL GridColumn::disposing() + void GridColumn::disposing(std::unique_lock<std::mutex>&) { - ::osl::MutexGuard aGuard( m_aMutex ); m_aIdentifier.clear(); m_sTitle.clear(); m_sHelpText.clear(); @@ -235,21 +230,21 @@ namespace toolkit ::sal_Int32 SAL_CALL GridColumn::getIndex() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nIndex; } void GridColumn::setIndex( sal_Int32 const i_index ) { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); m_nIndex = i_index; } ::sal_Int32 SAL_CALL GridColumn::getDataColumnIndex() { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard( m_aMutex ); return m_nDataColumnIndex; } diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx index e533a72e5ce5..cd3a8c5cd531 100644 --- a/toolkit/source/controls/grid/gridcolumn.hxx +++ b/toolkit/source/controls/grid/gridcolumn.hxx @@ -25,19 +25,17 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/style/HorizontalAlignment.hpp> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> -#include <comphelper/componentguard.hxx> +#include <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> namespace toolkit { -typedef ::cppu::WeakComponentImplHelper < css::awt::grid::XGridColumn +typedef comphelper::WeakComponentImplHelper < css::awt::grid::XGridColumn , css::lang::XServiceInfo , css::lang::XUnoTunnel > GridColumn_Base; -class GridColumn :public ::cppu::BaseMutex - ,public GridColumn_Base +class GridColumn final : public GridColumn_Base { public: GridColumn(); @@ -70,7 +68,7 @@ public: virtual void SAL_CALL removeGridColumnListener( const css::uno::Reference< css::awt::grid::XGridColumnListener >& xListener ) override; // OComponentHelper - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; // XCloneable (base of XGridColumn) virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; @@ -92,13 +90,15 @@ private: char const * const i_asciiAttributeName, const css::uno::Any& i_oldValue, const css::uno::Any& i_newValue, - ::comphelper::ComponentGuard& i_Guard + std::unique_lock<std::mutex>& i_Guard ); template< class TYPE > void impl_set( TYPE & io_attribute, TYPE const & i_newValue, char const * i_attributeName ) { - ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + std::unique_lock aGuard(m_aMutex); + if (m_bDisposed) + throw css::lang::DisposedException( OUString(), static_cast<cppu::OWeakObject*>(this) ); if ( io_attribute == i_newValue ) return; @@ -118,6 +118,7 @@ private: OUString m_sTitle; OUString m_sHelpText; css::style::HorizontalAlignment m_eHorizontalAlign; + comphelper::OInterfaceContainerHelper4<css::awt::grid::XGridColumnListener> maGridColumnListeners; }; } |