diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-06 12:17:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-06 13:48:42 +0200 |
commit | a5dbe5a8a9e98f2d79f2c535182fc557b561ed0f (patch) | |
tree | 1e99bc70ad0c923996d2eccc35cec6caee6354f3 /svl | |
parent | 62fc21675ccbfa5dcadbb2407729b804aac75ae2 (diff) |
use rtl::Reference in svl,sfx2
instead of manual ref-counting
Change-Id: Icb6472ffadfb57c9723b26f6f247e78fff45e528
Reviewed-on: https://gerrit.libreoffice.org/43193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/numfmuno.cxx | 44 | ||||
-rw-r--r-- | svl/source/numbers/numfmuno.hxx | 12 |
2 files changed, 26 insertions, 30 deletions
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index bc0b44675cfc..8b09da2f7fd3 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -346,15 +346,13 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServic } SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex const & _rMutex ) - :rSupplier( _rParent ) + :m_xSupplier( &_rParent ) ,m_aMutex( _rMutex ) { - rSupplier.acquire(); } SvNumberFormatsObj::~SvNumberFormatsObj() { - rSupplier.release(); } // XNumberFormats @@ -363,12 +361,12 @@ uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_I { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr; if (!pFormat) throw uno::RuntimeException(); - return new SvNumberFormatObj( rSupplier, nKey, m_aMutex ); + return new SvNumberFormatObj( *m_xSupplier, nKey, m_aMutex ); } uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType, @@ -377,7 +375,7 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if ( !pFormatter ) throw uno::RuntimeException(); @@ -402,7 +400,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const OUString& aFormat, { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -421,7 +419,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat, ::osl::MutexGuard aGuard( m_aMutex ); sal_Int32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -450,7 +448,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat, ::osl::MutexGuard aGuard( m_aMutex ); sal_Int32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -476,7 +474,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat, void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (pFormatter) { @@ -492,7 +490,7 @@ OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -507,7 +505,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLo { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -520,7 +518,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -536,7 +534,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const l { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -556,7 +554,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -583,16 +581,14 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNames() } SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, sal_uLong nK, const ::comphelper::SharedMutex& _rMutex ) - :rSupplier( rParent ) + :m_xSupplier( &rParent ) ,nKey( nK ) ,m_aMutex( _rMutex ) { - rSupplier.acquire(); } SvNumberFormatObj::~SvNumberFormatObj() { - rSupplier.release(); } // XPropertySet @@ -616,7 +612,7 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr; if (!pFormat) throw uno::RuntimeException(); @@ -730,7 +726,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr; if (!pFormat) throw uno::RuntimeException(); @@ -796,15 +792,13 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceNames() } SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex ) - :rSupplier( rParent ) + :m_xSupplier( &rParent ) ,m_aMutex( _rMutex ) { - rSupplier.acquire(); } SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() { - rSupplier.release(); } // XPropertySet @@ -822,7 +816,7 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const OUString& aProp { ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); @@ -860,7 +854,7 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + SvNumberFormatter* pFormatter = m_xSupplier->GetNumberFormatter(); if (!pFormatter) throw uno::RuntimeException(); diff --git a/svl/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx index 3885e2d4a17f..f68f73459b75 100644 --- a/svl/source/numbers/numfmuno.hxx +++ b/svl/source/numbers/numfmuno.hxx @@ -87,8 +87,8 @@ class SvNumberFormatsObj : public cppu::WeakImplHelper< css::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj& rSupplier; - mutable ::comphelper::SharedMutex m_aMutex; + rtl::Reference<SvNumberFormatsSupplierObj> m_xSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex const & _rMutex); @@ -135,8 +135,9 @@ class SvNumberFormatObj : public cppu::WeakImplHelper< css::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj& rSupplier; - sal_uLong nKey; + rtl::Reference<SvNumberFormatsSupplierObj> + m_xSupplier; + sal_uLong nKey; mutable ::comphelper::SharedMutex m_aMutex; public: @@ -181,7 +182,8 @@ class SvNumberFormatSettingsObj : public cppu::WeakImplHelper< css::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj& rSupplier; + rtl::Reference<SvNumberFormatsSupplierObj> + m_xSupplier; mutable ::comphelper::SharedMutex m_aMutex; public: |