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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user