diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-07-29 09:53:56 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-07-29 15:21:46 +0200 |
commit | 62992442e44787abd5d2fd14fcac9b46856d11d4 (patch) | |
tree | 85d52d865457fe78dcb23b4636fcc63e52fd6e94 /package | |
parent | 18ed2be7f1406b879c1add35f8f86e68202d0876 (diff) |
Simplify a bit
Change-Id: I0aeb003cd1e1846da729514a39e9190751996fd1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171167
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/ohierarchyholder.hxx | 8 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 18 | ||||
-rw-r--r-- | package/source/xstor/xstorage.hxx | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 10e6ca379800..4b6b27ee6e2a 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -61,7 +61,7 @@ public: : m_xOwnStorage(std::move( xStorage )) {} - explicit OHierarchyElement_Impl( unotools::WeakReference< OStorage > xWeakStorage ) + explicit OHierarchyElement_Impl( unotools::WeakReference< OStorage >&& xWeakStorage ) : m_xWeakOwnStorage(std::move( xWeakStorage )) {} @@ -92,12 +92,12 @@ public: }; -class OHierarchyHolder_Impl : public ::cppu::OWeakObject +class OHierarchyHolder_Impl { ::rtl::Reference< OHierarchyElement_Impl > m_xChild; public: - explicit OHierarchyHolder_Impl( const rtl::Reference< OStorage >& xOwnStorage ) - : m_xChild( new OHierarchyElement_Impl( unotools::WeakReference< OStorage >( xOwnStorage ) ) ) + explicit OHierarchyHolder_Impl(unotools::WeakReference<OStorage>&& xOwnStorage) + : m_xChild( new OHierarchyElement_Impl( std::move(xOwnStorage) ) ) {} static std::vector<OUString> GetListPathFromString( std::u16string_view aPath ); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 9f72b0fd458a..38f713c883fb 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -5388,10 +5388,10 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle else { // there are still storages in between - if ( !m_rHierarchyHolder.is() ) - m_rHierarchyHolder = new OHierarchyHolder_Impl( rtl::Reference< OStorage >( this ) ); + if (!m_pHierarchyHolder) + m_pHierarchyHolder.reset(new OHierarchyHolder_Impl(this)); - xResult = m_rHierarchyHolder->GetStreamHierarchically( + xResult = m_pHierarchyHolder->GetStreamHierarchically( ( m_pImpl->m_nStorageMode & embed::ElementModes::READWRITE ), aListPath, nOpenMode ); @@ -5427,10 +5427,10 @@ void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const OUString& a std::vector<OUString> aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); - if ( !m_rHierarchyHolder.is() ) - m_rHierarchyHolder = new OHierarchyHolder_Impl( rtl::Reference< OStorage >( this ) ); + if (!m_pHierarchyHolder) + m_pHierarchyHolder.reset(new OHierarchyHolder_Impl(this)); - m_rHierarchyHolder->RemoveStreamHierarchically( aListPath ); + m_pHierarchyHolder->RemoveStreamHierarchically(aListPath); } // XHierarchicalStorageAccess2 @@ -5475,10 +5475,10 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted else { // there are still storages in between - if ( !m_rHierarchyHolder.is() ) - m_rHierarchyHolder = new OHierarchyHolder_Impl( rtl::Reference< OStorage >( this ) ); + if (!m_pHierarchyHolder) + m_pHierarchyHolder.reset(new OHierarchyHolder_Impl(this)); - xResult = m_rHierarchyHolder->GetStreamHierarchically( + xResult = m_pHierarchyHolder->GetStreamHierarchically( ( m_pImpl->m_nStorageMode & embed::ElementModes::READWRITE ), aListPath, nOpenMode, diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 3d6186106de1..93d5f8dd32ae 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -286,7 +286,7 @@ class OStorage final : public css::lang::XTypeProvider bool m_bReadOnlyWrap; ::rtl::Reference<OChildDispListener_Impl> m_pSubElDispListener; ::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector; - ::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder; + std::unique_ptr<OHierarchyHolder_Impl> m_pHierarchyHolder; SotElement_Impl* OpenStreamElement_Impl( const OUString& aStreamName, sal_Int32 nOpenMode, bool bEncr ); |