diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-16 10:36:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-17 19:09:51 +0000 |
commit | a04bf69bccfbc266643b418ef57030a42bbb5c05 (patch) | |
tree | 785dc34a97856679630d5ba677939a6845ab5207 /package | |
parent | c4341c95a2be2e0210d5f8f15d4dd80d9077c4af (diff) |
XUnoTunnel->dynamic_cast in ZipPackageEntry
Change-Id: I0c49ebcb0ed16ab5b90c0cfa1417f002b5dad7b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145632
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/inc/ZipPackageEntry.hxx | 4 | ||||
-rw-r--r-- | package/inc/ZipPackageFolder.hxx | 9 | ||||
-rw-r--r-- | package/inc/ZipPackageStream.hxx | 5 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 5 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.hxx | 1 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 30 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 1 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 44 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageEntry.cxx | 2 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 24 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolderEnumeration.cxx | 3 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 27 |
12 files changed, 54 insertions, 101 deletions
diff --git a/package/inc/ZipPackageEntry.hxx b/package/inc/ZipPackageEntry.hxx index 2617e6275628..27ad017aa859 100644 --- a/package/inc/ZipPackageEntry.hxx +++ b/package/inc/ZipPackageEntry.hxx @@ -23,7 +23,6 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include "ZipEntry.hxx" @@ -39,7 +38,6 @@ class ZipPackageEntry : public cppu::WeakImplHelper < css::container::XNamed, css::container::XChild, - css::lang::XUnoTunnel, css::beans::XPropertySet, css::lang::XServiceInfo > @@ -82,8 +80,6 @@ public: // XChild virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override = 0; // XPropertySet virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override = 0; diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index 82582293158f..cfdcd99d1694 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -23,9 +23,9 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include "ZipPackageEntry.hxx" #include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> #include <string_view> #include <unordered_map> @@ -38,7 +38,7 @@ class ZipPackageStream; struct ZipContentInfo { - css::uno::Reference < css::lang::XUnoTunnel > xTunnel; + rtl::Reference < ZipPackageEntry > xPackageEntry; bool bFolder; union { @@ -91,8 +91,6 @@ public: ZipContentInfo& doGetByName( const OUString& aName ); - static const css::uno::Sequence < sal_Int8 > & getUnoTunnelId(); - void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; } void setRemoveOnInsertMode_Impl( bool bRemove ) { mbAllowRemoveOnInsert = bRemove; } @@ -136,9 +134,6 @@ public: virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; diff --git a/package/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx index aa150717474d..194ff729adbe 100644 --- a/package/inc/ZipPackageStream.hxx +++ b/package/inc/ZipPackageStream.hxx @@ -137,8 +137,6 @@ public: void setZipEntryOnLoading( const ZipEntry &rInEntry); void successfullyWritten( ZipEntry const *pEntry ); - static const css::uno::Sequence < sal_Int8 > & getUnoTunnelId(); - // XActiveDataSink virtual void SAL_CALL setInputStream( const css::uno::Reference< css::io::XInputStream >& aStream ) override; virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( ) override; @@ -152,9 +150,6 @@ public: const css::uno::Reference< css::io::XInputStream >& aStream ) override; virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getPlainRawStream() override; - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - // XPropertySet virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 72792e21fcb9..5da3f2199470 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -28,7 +28,6 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/io/NotConnectedException.hpp> #include <com/sun/star/io/TempFile.hpp> @@ -324,8 +323,8 @@ void OWriteStream_Impl::InsertIntoPackageFolder( const OUString& aName, if ( m_bFlushed ) { SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "An inserted stream is incomplete!" ); - uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageStream, uno::UNO_QUERY_THROW ); - xParentPackageFolder->insertByName( aName, uno::Any( xTunnel ) ); + uno::Reference< uno::XInterface > xTmp( m_xPackageStream, uno::UNO_QUERY_THROW ); + xParentPackageFolder->insertByName( aName, uno::Any( xTmp ) ); m_bFlushed = false; m_bHasInsertedStreamOptimization = false; diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 16f5291eccfc..bd677110f1ef 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -28,7 +28,6 @@ #include <com/sun/star/packages/XDataSinkEncrSupport.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/XRelationshipAccess.hpp> diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 31aa1924048b..51fb867f1be5 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -40,7 +40,6 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/util/XChangesBatch.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -932,8 +931,8 @@ void OStorage_Impl::InsertIntoPackageFolder( const OUString& aName, ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_xPackageFolder.is(), "package.xstor", "An inserted storage is incomplete!" ); - uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageFolder, uno::UNO_QUERY_THROW ); - xParentPackageFolder->insertByName( aName, uno::Any( xTunnel ) ); + uno::Reference< uno::XInterface > xTmp( m_xPackageFolder, uno::UNO_QUERY_THROW ); + xParentPackageFolder->insertByName( aName, uno::Any( xTmp ) ); m_bCommited = false; } @@ -1281,8 +1280,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( const OUString& aName, bool bEncr throw embed::InvalidStorageException( THROW_WHERE); uno::Sequence< uno::Any > aSeq{ uno::Any(false) }; - uno::Reference< lang::XUnoTunnel > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY ); + uno::Reference< uno::XInterface > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ) ); SAL_WARN_IF( !xNewElement.is(), "package.xstor", "Not possible to create a new stream!" ); if ( !xNewElement.is() ) @@ -1320,8 +1318,7 @@ void OStorage_Impl::InsertRawStream( const OUString& aName, const uno::Reference GetSeekableTempCopy( xInStream ); uno::Sequence< uno::Any > aSeq{ uno::Any(false) }; - uno::Reference< lang::XUnoTunnel > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY ); + uno::Reference< uno::XInterface > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ) ); SAL_WARN_IF( !xNewElement.is(), "package.xstor", "Not possible to create a new stream!" ); if ( !xNewElement.is() ) @@ -1348,8 +1345,7 @@ std::unique_ptr<OStorage_Impl> OStorage_Impl::CreateNewStorageImpl( sal_Int32 nS throw embed::InvalidStorageException( THROW_WHERE ); uno::Sequence< uno::Any > aSeq{ uno::Any(true) }; - uno::Reference< lang::XUnoTunnel > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY ); + uno::Reference< uno::XInterface > xNewElement( m_xPackage->createInstanceWithArguments( aSeq ) ); SAL_WARN_IF( !xNewElement.is(), "package.xstor", "Not possible to create a new storage!" ); if ( !xNewElement.is() ) @@ -1423,12 +1419,12 @@ void OStorage_Impl::OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorag { SAL_WARN_IF( pElement->m_bIsInserted, "package.xstor", "Inserted element must be created already!" ); - uno::Reference< lang::XUnoTunnel > xTunnel; - m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTunnel; - if ( !xTunnel.is() ) + uno::Reference< uno::XInterface > xTmp; + m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTmp; + if ( !xTmp.is() ) throw container::NoSuchElementException( THROW_WHERE ); - uno::Reference< container::XNameContainer > xPackageSubFolder( xTunnel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameContainer > xPackageSubFolder( xTmp, uno::UNO_QUERY_THROW ); pElement->m_xStorage.reset(new OStorage_Impl(this, nStorageMode, xPackageSubFolder, m_xPackage, m_xContext, m_nStorageType)); } } @@ -1445,12 +1441,12 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement ) SAL_WARN_IF( pElement->m_bIsInserted, "package.xstor", "Inserted element must be created already!" ); - uno::Reference< lang::XUnoTunnel > xTunnel; - m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTunnel; - if ( !xTunnel.is() ) + uno::Reference< uno::XInterface > xTmp; + m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTmp; + if ( !xTmp.is() ) throw container::NoSuchElementException( THROW_WHERE ); - uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xTunnel, uno::UNO_QUERY_THROW ); + uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xTmp, uno::UNO_QUERY_THROW ); // the stream can never be inserted here, because inserted stream element holds the stream till commit or destruction pElement->m_xStream.reset(new OWriteStream_Impl(this, xPackageSubStream, m_xPackage, m_xContext, false, m_nStorageType, false, GetRelInfoStreamForName(pElement->m_aOriginalName))); diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 42e1972d1d07..f7cb9df4d309 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -20,7 +20,6 @@ #include <com/sun/star/io/BufferSizeExceededException.hpp> #include <com/sun/star/io/NotConnectedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/packages/NoEncryptionException.hpp> #include <com/sun/star/packages/WrongPasswordException.hpp> #include <com/sun/star/packages/zip/ZipConstants.hpp> diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 9bf6f5e9b24c..e03a17e8016a 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -171,15 +171,14 @@ void ZipPackage::parseManifest() { try { static const OUStringLiteral sManifest (u"manifest.xml"); - uno::Reference< XUnoTunnel > xTunnel; Any aAny = m_xRootFolder->getByName( sMeta ); - aAny >>= xTunnel; - uno::Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY ); + uno::Reference< XNameContainer > xMetaInfFolder; + aAny >>= xMetaInfFolder; if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) ) { + uno::Reference < XActiveDataSink > xSink; aAny = xMetaInfFolder->getByName( sManifest ); - aAny >>= xTunnel; - uno::Reference < XActiveDataSink > xSink ( xTunnel, UNO_QUERY ); + aAny >>= xSink; if ( xSink.is() ) { uno::Reference < XManifestReader > xReader = ManifestReader::create( m_xContext ); @@ -238,14 +237,14 @@ void ZipPackage::parseManifest() if ( !sPath.isEmpty() && hasByHierarchicalName ( sPath ) ) { aAny = getByHierarchicalName( sPath ); - uno::Reference < XUnoTunnel > xUnoTunnel; - aAny >>= xUnoTunnel; - if (auto pFolder = comphelper::getFromUnoTunnel<ZipPackageFolder>(xUnoTunnel)) + uno::Reference < XInterface > xTmp; + aAny >>= xTmp; + if (auto pFolder = dynamic_cast<ZipPackageFolder*>(xTmp.get())) { pFolder->SetMediaType ( sMediaType ); pFolder->SetVersion ( sVersion ); } - else if (auto pStream = comphelper::getFromUnoTunnel<ZipPackageStream>(xUnoTunnel)) + else if (auto pStream = dynamic_cast<ZipPackageStream*>(xTmp.get())) { pStream->SetMediaType ( sMediaType ); pStream->SetFromManifest( true ); @@ -374,9 +373,8 @@ void ZipPackage::parseManifest() { // get mediatype from the "mimetype" stream OUString aPackageMediatype; - uno::Reference< lang::XUnoTunnel > xMimeTypeTunnel; - m_xRootFolder->getByName( sMimetype ) >>= xMimeTypeTunnel; - uno::Reference < io::XActiveDataSink > xMimeSink( xMimeTypeTunnel, UNO_QUERY ); + uno::Reference < io::XActiveDataSink > xMimeSink; + m_xRootFolder->getByName( sMimetype ) >>= xMimeSink; if ( xMimeSink.is() ) { uno::Reference< io::XInputStream > xMimeInStream = xMimeSink->getInputStream(); @@ -452,10 +450,9 @@ void ZipPackage::parseContentType() if ( !m_xRootFolder->hasByName( aContentTypes ) ) throw io::IOException(THROW_WHERE "Wrong format!" ); - uno::Reference< lang::XUnoTunnel > xTunnel; + uno::Reference < io::XActiveDataSink > xSink; uno::Any aAny = m_xRootFolder->getByName( aContentTypes ); - aAny >>= xTunnel; - uno::Reference < io::XActiveDataSink > xSink( xTunnel, UNO_QUERY ); + aAny >>= xSink; if ( xSink.is() ) { uno::Reference< io::XInputStream > xInStream = xSink->getInputStream(); @@ -484,9 +481,9 @@ void ZipPackage::parseContentType() if ( !aPath.isEmpty() && hasByHierarchicalName( aPath ) ) { uno::Any aIterAny = getByHierarchicalName( aPath ); - uno::Reference < lang::XUnoTunnel > xIterTunnel; - aIterAny >>= xIterTunnel; - if (auto pStream = comphelper::getFromUnoTunnel<ZipPackageStream>(xIterTunnel)) + uno::Reference < XInterface > xIterTmp; + aIterAny >>= xIterTmp; + if (auto pStream = dynamic_cast<ZipPackageStream*>(xIterTmp.get())) { // this is a package stream, in OFOPXML format only streams can have mediatype pStream->SetMediaType( rPair.Second ); @@ -800,7 +797,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) if (aName == "/") // root directory. - return Any ( uno::Reference < XUnoTunnel > ( m_xRootFolder ) ); + return Any ( uno::Reference < XInterface > ( static_cast<cppu::OWeakObject*>(m_xRootFolder.get()) ) ); nStreamIndex = aName.lastIndexOf ( '/' ); bool bFolder = nStreamIndex == nIndex-1; // last character is '/'. @@ -823,7 +820,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); if (pFolder && sTemp == pFolder->getName()) - return Any(uno::Reference<XUnoTunnel>(pFolder)); + return Any(uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(pFolder))); } else { @@ -869,7 +866,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) { if ( nStreamIndex != -1 ) m_aRecent[sDirName] = pPrevious; // cache it. - return Any ( uno::Reference < XUnoTunnel > ( pCurrent ) ); + return Any ( uno::Reference < XInterface > ( static_cast<cppu::OWeakObject*>(pCurrent) ) ); } sTemp = aName.copy( nOldIndex ); @@ -1217,10 +1214,9 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() { static const OUStringLiteral sManifest (u"manifest.xml"); - uno::Reference< XUnoTunnel > xTunnel; + uno::Reference< XNameContainer > xMetaInfFolder; Any aAny = m_xRootFolder->getByName( sMeta ); - aAny >>= xTunnel; - uno::Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY ); + aAny >>= xMetaInfFolder; if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) ) xMetaInfFolder->removeByName( sManifest ); } diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index df18f0874f25..cbbcf5e9a468 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -93,7 +93,7 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN { if ( !xNewParent.is() ) throw NoSupportException(THROW_WHERE ); - ZipPackageFolder* pNewParent = comphelper::getFromUnoTunnel<ZipPackageFolder>(xNewParent); + ZipPackageFolder* pNewParent = dynamic_cast<ZipPackageFolder*>(xNewParent.get()); if (!pNewParent) throw NoSupportException(THROW_WHERE ); diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 7e7168805f72..175536415a48 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -143,26 +143,20 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair& } } -const css::uno::Sequence < sal_Int8 > & ZipPackageFolder::getUnoTunnelId() -{ - static const comphelper::UnoIdInit lcl_CachedImplId; - return lcl_CachedImplId.getSeq(); -} - // XNameContainer void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const uno::Any& aElement ) { if (hasByName(aName)) throw ElementExistException(THROW_WHERE ); - uno::Reference < XUnoTunnel > xRef; + uno::Reference < XInterface > xRef; aElement >>= xRef; if ( !(aElement >>= xRef) ) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); - ZipPackageEntry* pEntry = comphelper::getFromUnoTunnel<ZipPackageFolder>(xRef); + ZipPackageEntry* pEntry = dynamic_cast<ZipPackageFolder*>(xRef.get()); if (!pEntry) - pEntry = comphelper::getFromUnoTunnel<ZipPackageStream>(xRef); + pEntry = dynamic_cast<ZipPackageStream*>(xRef.get()); if (!pEntry) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); @@ -186,7 +180,7 @@ uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( ) // XElementAccess uno::Type SAL_CALL ZipPackageFolder::getElementType( ) { - return cppu::UnoType<XUnoTunnel>::get(); + return cppu::UnoType<XInterface>::get(); } sal_Bool SAL_CALL ZipPackageFolder::hasElements( ) { @@ -203,7 +197,7 @@ ZipContentInfo& ZipPackageFolder::doGetByName( const OUString& aName ) uno::Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName ) { - return uno::Any ( doGetByName ( aName ).xTunnel ); + return uno::Any ( uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(doGetByName ( aName ).xPackageEntry.get())) ); } uno::Sequence< OUString > SAL_CALL ZipPackageFolder::getElementNames( ) { @@ -329,10 +323,6 @@ void ZipPackageFolder::saveContents( } } -sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) -{ - return comphelper::getSomethingImpl(aIdentifier, this); -} void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) { if ( aPropertyName == "MediaType" ) @@ -395,14 +385,14 @@ sal_Bool SAL_CALL ZipPackageFolder::supportsService( OUString const & rServiceNa ZipContentInfo::ZipContentInfo ( ZipPackageStream * pNewStream ) -: xTunnel ( pNewStream ) +: xPackageEntry ( pNewStream ) , bFolder ( false ) , pStream ( pNewStream ) { } ZipContentInfo::ZipContentInfo ( ZipPackageFolder * pNewFolder ) -: xTunnel ( pNewFolder ) +: xPackageEntry ( pNewFolder ) , bFolder ( true ) , pFolder ( pNewFolder ) { diff --git a/package/source/zippackage/ZipPackageFolderEnumeration.cxx b/package/source/zippackage/ZipPackageFolderEnumeration.cxx index 7b08e18909ce..5d091de0e1e4 100644 --- a/package/source/zippackage/ZipPackageFolderEnumeration.cxx +++ b/package/source/zippackage/ZipPackageFolderEnumeration.cxx @@ -46,7 +46,8 @@ uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement() uno::Any aAny; if (aIterator == rContents.end()) throw container::NoSuchElementException(THROW_WHERE); - aAny <<= (*aIterator).second.xTunnel; + aAny <<= uno::Reference<XInterface>( + static_cast<cppu::OWeakObject*>((*aIterator).second.xPackageEntry.get())); ++aIterator; return aAny; } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index a63683c771cd..353216694f8a 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -73,12 +73,6 @@ using namespace cppu; #define THROW_WHERE "" #endif -const css::uno::Sequence < sal_Int8 > & ZipPackageStream::getUnoTunnelId() -{ - static const comphelper::UnoIdInit lcl_CachedImplId; - return lcl_CachedImplId.getSeq(); -} - ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage, const uno::Reference< XComponentContext >& xContext, sal_Int32 nFormat, @@ -300,13 +294,13 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( } // insert a new stream in the package - uno::Reference< XUnoTunnel > xTunnel; + uno::Reference< XInterface > xTmp; Any aRoot = pPackage->getByHierarchicalName("/"); - aRoot >>= xTunnel; - uno::Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY_THROW ); + aRoot >>= xTmp; + uno::Reference< container::XNameContainer > xRootNameContainer( xTmp, UNO_QUERY_THROW ); - uno::Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY ); - xRootNameContainer->insertByName("dummy", Any( xNPSTunnel ) ); + uno::Reference< XInterface > xNPSDummy( xNewPackStream, UNO_QUERY ); + xRootNameContainer->insertByName("dummy", Any( xNPSDummy ) ); // commit the temporary package pPackage->commitChanges(); @@ -330,9 +324,9 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( // close raw stream, package stream and folder xInRaw.clear(); xNewPSProps.clear(); - xNPSTunnel.clear(); + xNPSDummy.clear(); xNewPackStream.clear(); - xTunnel.clear(); + xTmp.clear(); xRootNameContainer.clear(); // return the stream representing the first temporary file @@ -1095,13 +1089,6 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( return uno::Reference< io::XInputStream >(); } -// XUnoTunnel - -sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& aIdentifier ) -{ - return comphelper::getSomethingImpl(aIdentifier, this); -} - // XPropertySet void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) { |