summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-02 08:28:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-04 08:52:39 +0100
commit28239c40430ec4e613d9d936614c5c3853c332c4 (patch)
tree0fa6bc36c05f8f42a0799b884ed38eb3e569ff90 /svl
parent85b7e7fdd7f283a3084e2db0dd8e71a48fac228d (diff)
simplify UNO getTypes methods
Change-Id: Ia8b07edec54527fb4904536fabb03a18e8452550 Reviewed-on: https://gerrit.libreoffice.org/68659 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/fsstor/fsstorage.cxx26
-rw-r--r--svl/source/fsstor/ostreamcontainer.cxx37
-rw-r--r--svl/source/fsstor/ostreamcontainer.hxx2
3 files changed, 20 insertions, 45 deletions
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index f928c278500b..d3eae55b363b 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -68,16 +68,11 @@ using namespace ::com::sun::star;
struct FSStorage_Impl
{
OUString const m_aURL;
-
::ucbhelper::Content m_aContent;
sal_Int32 const m_nMode;
-
std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners
- std::unique_ptr<::cppu::OTypeCollection> m_pTypeCollection;
-
uno::Reference< uno::XComponentContext > m_xContext;
-
FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< uno::XComponentContext > const & xContext )
: m_aURL( aContent.getURL() )
, m_aContent( aContent )
@@ -259,21 +254,12 @@ void SAL_CALL FSStorage::release() throw()
uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes()
{
- if ( m_pImpl->m_pTypeCollection == nullptr )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pImpl->m_pTypeCollection == nullptr )
- {
- m_pImpl->m_pTypeCollection.reset(new ::cppu::OTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
- , cppu::UnoType<embed::XStorage>::get()
- , cppu::UnoType<embed::XHierarchicalStorageAccess>::get()
- , cppu::UnoType<beans::XPropertySet>::get()) );
- }
- }
-
- return m_pImpl->m_pTypeCollection->getTypes() ;
+ static const uno::Sequence<uno::Type> aTypes {
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<embed::XStorage>::get(),
+ cppu::UnoType<embed::XHierarchicalStorageAccess>::get(),
+ cppu::UnoType<beans::XPropertySet>::get() };
+ return aTypes;
}
uno::Sequence< sal_Int8 > SAL_CALL FSStorage::getImplementationId()
diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx
index a26077b3c1f4..85a919df2b7c 100644
--- a/svl/source/fsstor/ostreamcontainer.cxx
+++ b/svl/source/fsstor/ostreamcontainer.cxx
@@ -20,6 +20,7 @@
#include "ostreamcontainer.hxx"
#include <cppuhelper/queryinterface.hxx>
+#include <comphelper/sequence.hxx>
using namespace ::com::sun::star;
@@ -28,7 +29,6 @@ OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xS
: m_bDisposed( false )
, m_bInputClosed( false )
, m_bOutputClosed( false )
-, m_pTypeCollection( nullptr )
{
try
{
@@ -137,42 +137,31 @@ void SAL_CALL OFSStreamContainer::release()
// XTypeProvider
uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes()
{
- if ( m_pTypeCollection == nullptr )
+ if ( m_aTypes.getLength() == 0 )
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pTypeCollection == nullptr )
+ if ( m_aTypes.getLength() == 0 )
{
- ::cppu::OTypeCollection aTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
- , cppu::UnoType<embed::XExtendedStorageStream>::get());
+ std::vector<uno::Type> tmp;
+ tmp.push_back(cppu::UnoType<lang::XTypeProvider>::get());
+ tmp.push_back(cppu::UnoType<embed::XExtendedStorageStream>::get());
if ( m_xSeekable.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( cppu::UnoType<io::XSeekable>::get(),
- aTypeCollection.getTypes() );
+ tmp.push_back(cppu::UnoType<io::XSeekable>::get());
if ( m_xInputStream.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( cppu::UnoType<io::XInputStream>::get(),
- aTypeCollection.getTypes() );
-
+ tmp.push_back(cppu::UnoType<io::XInputStream>::get());
if ( m_xOutputStream.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( cppu::UnoType<io::XOutputStream>::get(),
- aTypeCollection.getTypes() );
+ tmp.push_back(cppu::UnoType<io::XOutputStream>::get());
if ( m_xTruncate.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( cppu::UnoType<io::XTruncate>::get(),
- aTypeCollection.getTypes() );
+ tmp.push_back(cppu::UnoType<io::XTruncate>::get());
if ( m_xAsyncOutputMonitor.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( cppu::UnoType<io::XAsyncOutputMonitor>::get(),
- aTypeCollection.getTypes() );
+ tmp.push_back(cppu::UnoType<io::XAsyncOutputMonitor>::get());
- m_pTypeCollection = new ::cppu::OTypeCollection( aTypeCollection );
+ m_aTypes = comphelper::containerToSequence(tmp);
}
}
- return m_pTypeCollection->getTypes() ;
+ return m_aTypes;
}
uno::Sequence< sal_Int8 > SAL_CALL OFSStreamContainer::getImplementationId()
diff --git a/svl/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx
index a631817d05ba..5d255f44aab3 100644
--- a/svl/source/fsstor/ostreamcontainer.hxx
+++ b/svl/source/fsstor/ostreamcontainer.hxx
@@ -58,7 +58,7 @@ class OFSStreamContainer : public cppu::OWeakObject,
bool m_bOutputClosed;
std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners
- ::cppu::OTypeCollection* m_pTypeCollection;
+ css::uno::Sequence<css::uno::Type> m_aTypes;
public:
explicit OFSStreamContainer( const css::uno::Reference < css::io::XStream >& xStream );