From 9a9bb1f212bb7eb40dcf34c15a3422e633fc195d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 16 Mar 2022 21:23:35 +0200 Subject: no need to have duplicate m_nStorageType fields Change-Id: I65bfce88e2bb1d32ec6c292e7e5f020904405bed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131677 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/source/xstor/xstorage.cxx | 93 +++++++++++++++++++-------------------- package/source/xstor/xstorage.hxx | 1 - 2 files changed, 45 insertions(+), 49 deletions(-) (limited to 'package') diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index ef437765a7e4..777892d8d841 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1735,7 +1735,6 @@ OStorage::OStorage( uno::Reference< io::XInputStream > const & xInputStream, , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) , m_bIsRoot( m_pImpl->m_bIsRoot ) -, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; @@ -1750,7 +1749,6 @@ OStorage::OStorage( uno::Reference< io::XStream > const & xStream, , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) , m_bIsRoot( m_pImpl->m_bIsRoot ) -, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; @@ -1761,7 +1759,6 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) , m_bIsRoot( m_pImpl->m_bIsRoot ) -, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( bReadOnlyWrap ) { // this call can be done only from OStorage_Impl implementation to create child storage @@ -2045,7 +2042,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) if ( aReturn.hasValue() ) return aReturn ; - if ( m_nStorageType == embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_bIsRoot ) { @@ -2063,7 +2060,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) , static_cast ( this ) ); } } - else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) { aReturn = ::cppu::queryInterface ( rType @@ -2095,7 +2092,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() if (! m_pTypeCollection) { - if ( m_nStorageType == embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_bIsRoot ) { @@ -2125,7 +2122,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() , cppu::UnoType::get())); } } - else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) { m_pTypeCollection.reset(new ::cppu::OTypeCollection ( cppu::UnoType::get() @@ -2225,7 +2222,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_bReadOnlyWrap ) @@ -2314,7 +2311,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( ( nStorageMode & embed::ElementModes::WRITE ) && m_bReadOnlyWrap ) @@ -2445,7 +2442,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const OUStr if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name try @@ -2571,7 +2568,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name try @@ -2647,7 +2644,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const OUString& aElementName ) if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable name SotElement_Impl* pElement = nullptr; @@ -2705,7 +2702,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const OUString& aElementName ) if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); SotElement_Impl* pElement = nullptr; @@ -2766,7 +2763,7 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) throw lang::IllegalArgumentException(THROW_WHERE "Unexpected entry name syntax.", uno::Reference(), 1); - if (m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels") + if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels") throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference(), 1); // TODO: unacceptable name @@ -2845,7 +2842,7 @@ void SAL_CALL OStorage::renameElement( const OUString& aElementName, const OUStr throw lang::IllegalArgumentException(THROW_WHERE "Unexpected entry name syntax.", uno::Reference(), 1); - if (m_nStorageType == embed::StorageFormats::OFOPXML + if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && (aElementName == "_rels" || aNewName == "_rels")) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference(), 0); // TODO: unacceptable element name @@ -2945,7 +2942,7 @@ void SAL_CALL OStorage::copyElementTo( const OUString& aElementName, // || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name try @@ -3032,7 +3029,7 @@ void SAL_CALL OStorage::moveElementTo( const OUString& aElementName, uno::UNO_QUERY)) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference(), 2); - if (m_nStorageType == embed::StorageFormats::OFOPXML + if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && (aElementName == "_rels" || aNewName == "_rels")) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference(), 0); // unacceptable element name @@ -3272,7 +3269,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType == embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // the interface is not supported and must not be accessible if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, false ) ) @@ -3363,7 +3360,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( THROW_WHERE ); if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, false ) ) @@ -3463,7 +3460,7 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const OUString& aStreamName, throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw embed::InvalidStorageException( THROW_WHERE ); if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) @@ -3772,7 +3769,7 @@ uno::Any SAL_CALL OStorage::getByName( const OUString& aName ) if ( aName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name uno::Any aResult; @@ -3858,7 +3855,7 @@ sal_Bool SAL_CALL OStorage::hasByName( const OUString& aName ) if ( aName.isEmpty() ) return false; - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) return false; SotElement_Impl* pElement = nullptr; @@ -4006,7 +4003,7 @@ void SAL_CALL OStorage::removeEncryption() throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage SAL_WARN_IF( !m_bIsRoot, "package.xstor", "removeEncryption() method is not available for nonroot storages!" ); @@ -4067,7 +4064,7 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aEncryptionData.hasElements() ) @@ -4132,7 +4129,7 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aAlgorithms.hasElements() ) @@ -4192,7 +4189,7 @@ void SAL_CALL OStorage::setGpgProperties( const uno::Sequence< uno::Sequence< be throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aProps.hasElements() ) @@ -4252,7 +4249,7 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage uno::Sequence< beans::NamedValue > aResult; @@ -4335,9 +4332,9 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u if ( m_bReadOnlyWrap && aPropertyName != "Version" ) throw uno::RuntimeException( THROW_WHERE ); // TODO: Access denied - if ( m_nStorageType == embed::StorageFormats::ZIP ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::ZIP ) throw beans::UnknownPropertyException( aPropertyName ); - else if ( m_nStorageType == embed::StorageFormats::PACKAGE ) + else if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( aPropertyName == "MediaType" ) { @@ -4371,7 +4368,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u else throw beans::UnknownPropertyException( aPropertyName ); } - else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) { if ( aPropertyName == "RelationsInfoStream" ) { @@ -4426,7 +4423,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType == embed::StorageFormats::PACKAGE + if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName == "MediaType" || aPropertyName == MEDIATYPE_FALLBACK_USED_PROPERTY || aPropertyName == "Version" ) ) { try @@ -4479,7 +4476,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) return uno::makeAny( false ); // RepairPackage } - else if ( m_nStorageType == embed::StorageFormats::PACKAGE + else if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName == HAS_ENCRYPTED_ENTRIES_PROPERTY || aPropertyName == HAS_NONENCRYPTED_ENTRIES_PROPERTY || aPropertyName == ENCRYPTION_GPG_PROPERTIES @@ -4584,7 +4581,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); try @@ -4620,7 +4617,7 @@ OUString SAL_CALL OStorage::getTargetByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -4641,7 +4638,7 @@ OUString SAL_CALL OStorage::getTypeByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -4662,7 +4659,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // TODO/LATER: in future the unification of the ID could be checked @@ -4688,7 +4685,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // TODO/LATER: in future the unification of the ID could be checked @@ -4717,7 +4714,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); uno::Sequence< uno::Sequence< beans::StringPair > > aRet; @@ -4754,7 +4751,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno: throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const beans::StringPair aIDRel("Id", sID); @@ -4804,7 +4801,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -4838,7 +4835,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); OUString aIDTag( "Id" ); @@ -4891,7 +4888,7 @@ void SAL_CALL OStorage::clearRelationships() throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); m_pImpl->m_aRelInfo.realloc( 0 ); @@ -4925,7 +4922,7 @@ void SAL_CALL OStorage::insertStreamElementDirect( if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( m_bReadOnlyWrap ) @@ -5004,7 +5001,7 @@ void SAL_CALL OStorage::copyElementDirectlyTo( if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); // unacceptable name try @@ -5206,7 +5203,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name try @@ -5216,7 +5213,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam throw container::NoSuchElementException( THROW_WHERE ); // TODO/LATER: Currently it is only implemented for MediaType property of substorages, might be changed in future - if ( !pElement->m_bIsStorage || m_nStorageType != embed::StorageFormats::PACKAGE || aPropertyName != "MediaType" ) + if ( !pElement->m_bIsStorage || m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE || aPropertyName != "MediaType" ) throw beans::PropertyVetoException( THROW_WHERE ); if (!pElement->m_xStorage) @@ -5292,7 +5289,7 @@ void SAL_CALL OStorage::copyStreamElementData( const OUString& aStreamName, cons if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable name if ( !xTargetStream.is() ) @@ -5450,7 +5447,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted throw lang::DisposedException( THROW_WHERE ); } - if ( m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( THROW_WHERE ); if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, true ) ) diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 695067a2d018..44d5716b5704 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -282,7 +282,6 @@ class OStorage final : public css::lang::XTypeProvider comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; bool m_bIsRoot; - sal_Int32 m_nStorageType; // the mode in which the storage is used bool m_bReadOnlyWrap; ::rtl::Reference m_pSubElDispListener; ::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector; -- cgit