diff options
Diffstat (limited to 'chart2/source/tools/CachedDataSequence.cxx')
-rw-r--r-- | chart2/source/tools/CachedDataSequence.cxx | 66 |
1 files changed, 17 insertions, 49 deletions
diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx index 6c8826701779..7ddc9a010408 100644 --- a/chart2/source/tools/CachedDataSequence.cxx +++ b/chart2/source/tools/CachedDataSequence.cxx @@ -23,7 +23,6 @@ #include <comphelper/sequenceashashmap.hxx> #include <cppuhelper/supportsservice.hxx> -#include <tools/diagnose_ex.h> #include <algorithm> @@ -35,14 +34,11 @@ using ::com::sun::star::uno::Any; using ::osl::MutexGuard; // necessary for MS compiler -using ::comphelper::OPropertyContainer; -using ::comphelper::OMutexAndBroadcastHelper; -using ::comphelper::OPropertyArrayUsageHelper; using ::chart::impl::CachedDataSequence_Base; namespace { -constexpr OUStringLiteral lcl_aServiceName = u"com.sun.star.comp.chart.CachedDataSequence"; +constexpr OUString lcl_aServiceName = u"com.sun.star.comp.chart.CachedDataSequence"_ustr; enum { @@ -56,41 +52,31 @@ namespace chart { CachedDataSequence::CachedDataSequence() - : OPropertyContainer( GetBroadcastHelper()), - CachedDataSequence_Base( GetMutex()), - m_eCurrentDataType( NUMERICAL ), - m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) + : m_eCurrentDataType( NUMERICAL ), + m_xModifyEventForwarder( new ModifyEventForwarder() ) { registerProperties(); } CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ ) - : OPropertyContainer( GetBroadcastHelper()), - CachedDataSequence_Base( GetMutex()), - m_eCurrentDataType( MIXED ), - m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder( )) + : m_eCurrentDataType( MIXED ), + m_xModifyEventForwarder( new ModifyEventForwarder() ) { registerProperties(); } CachedDataSequence::CachedDataSequence( const OUString & rSingleText ) - : OPropertyContainer( GetBroadcastHelper()), - CachedDataSequence_Base( GetMutex()), - m_eCurrentDataType( TEXTUAL ), + : m_eCurrentDataType( TEXTUAL ), m_aTextualSequence({rSingleText}), - m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) + m_xModifyEventForwarder( new ModifyEventForwarder() ) { registerProperties(); } CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource ) - : OMutexAndBroadcastHelper(), - OPropertyContainer( GetBroadcastHelper()), - OPropertyArrayUsageHelper< CachedDataSequence >(), - CachedDataSequence_Base( GetMutex()), - m_nNumberFormatKey( rSource.m_nNumberFormatKey ), + : m_nNumberFormatKey( rSource.m_nNumberFormatKey ), m_sRole( rSource.m_sRole ), m_eCurrentDataType( rSource.m_eCurrentDataType ), - m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) + m_xModifyEventForwarder( new ModifyEventForwarder() ) { switch( m_eCurrentDataType ) { @@ -218,8 +204,8 @@ Sequence< Any > CachedDataSequence::Impl_getMixedData() const return aResult; } -IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer ) -IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer ) +IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, comphelper::OPropertyContainer2 ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, comphelper::OPropertyContainer2 ) // ____ XPropertySet ____ Reference< beans::XPropertySetInfo > SAL_CALL CachedDataSequence::getPropertySetInfo() @@ -266,7 +252,7 @@ css::uno::Sequence< OUString > SAL_CALL CachedDataSequence::getSupportedServiceN // ________ XNumericalDataSequence ________ Sequence< double > SAL_CALL CachedDataSequence::getNumericalData() { - MutexGuard aGuard( GetMutex() ); + std::unique_lock aGuard( m_aMutex ); if( m_eCurrentDataType == NUMERICAL ) return m_aNumericalSequence; @@ -277,7 +263,7 @@ Sequence< double > SAL_CALL CachedDataSequence::getNumericalData() // ________ XTextualDataSequence ________ Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData() { - MutexGuard aGuard( GetMutex() ); + std::unique_lock aGuard( m_aMutex ); if( m_eCurrentDataType == TEXTUAL ) return m_aTextualSequence; @@ -288,7 +274,7 @@ Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData() // ________ XDataSequence ________ Sequence< Any > SAL_CALL CachedDataSequence::getData() { - MutexGuard aGuard( GetMutex() ); + std::unique_lock aGuard( m_aMutex ); return Impl_getMixedData(); } @@ -310,35 +296,17 @@ Sequence< OUString > SAL_CALL CachedDataSequence::generateLabel( chart2::data::L Reference< util::XCloneable > SAL_CALL CachedDataSequence::createClone() { - CachedDataSequence * pNewSeq = new CachedDataSequence( *this ); - - return Reference< util::XCloneable >( pNewSeq ); + return new CachedDataSequence( *this ); } void SAL_CALL CachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener ) { - try - { - Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW ); - xBroadcaster->addModifyListener( aListener ); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + m_xModifyEventForwarder->addModifyListener( aListener ); } void SAL_CALL CachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener ) { - try - { - Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW ); - xBroadcaster->removeModifyListener( aListener ); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + m_xModifyEventForwarder->removeModifyListener( aListener ); } // lang::XInitialization: |