package/source/xstor/xstorage.cxx |  134 ++++++++++++++++++--------------------
 package/source/xstor/xstorage.hxx |    2 
 2 files changed, 64 insertions(+), 72 deletions(-)

New commits:
commit ddff74993f128bd7b25d4d041b18b43b5836e11d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Mar 16 21:25:30 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 17 08:17:50 2022 +0100

    no need to have duplicate m_bIsRoot fields
    
    Change-Id: I4f8777462d0bb8cb9f1a6065a548a794d842d815
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131678
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/package/source/xstor/xstorage.cxx 
b/package/source/xstor/xstorage.cxx
index 777892d8d841..9c8a165d023b 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1734,7 +1734,6 @@ OStorage::OStorage( uno::Reference< io::XInputStream > 
const & xInputStream,
 : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, 
nStorageType ) )
 , m_xSharedMutex( m_pImpl->m_xMutex )
 , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() )
-, m_bIsRoot( m_pImpl->m_bIsRoot )
 , m_bReadOnlyWrap( false )
 {
     m_pImpl->m_pAntiImpl = this;
@@ -1748,7 +1747,6 @@ OStorage::OStorage( uno::Reference< io::XStream > const & 
xStream,
 : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, 
nStorageType ) )
 , m_xSharedMutex( m_pImpl->m_xMutex )
 , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() )
-, m_bIsRoot( m_pImpl->m_bIsRoot )
 , m_bReadOnlyWrap( false )
 {
     m_pImpl->m_pAntiImpl = this;
@@ -1758,7 +1756,6 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool 
bReadOnlyWrap )
 : m_pImpl( pImpl )
 , m_xSharedMutex( m_pImpl->m_xMutex )
 , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() )
-, m_bIsRoot( m_pImpl->m_bIsRoot )
 , m_bReadOnlyWrap( bReadOnlyWrap )
 {
     // this call can be done only from OStorage_Impl implementation to create 
child storage
@@ -1852,7 +1849,7 @@ void OStorage::InternalDispose( bool bNotifyImpl )
 
         if ( bNotifyImpl )
         {
-            if ( m_bIsRoot )
+            if ( m_pImpl->m_bIsRoot )
                 delete m_pImpl;
             else
             {
@@ -2044,7 +2041,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const 
uno::Type& rType )
 
     if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE )
     {
-        if ( m_bIsRoot )
+        if ( m_pImpl->m_bIsRoot )
         {
             aReturn = ::cppu::queryInterface
                         (   rType
@@ -2094,7 +2091,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
         {
             if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE )
             {
-                if ( m_bIsRoot )
+                if ( m_pImpl->m_bIsRoot )
                 {
                     m_pTypeCollection.reset(new ::cppu::OTypeCollection
                                     (   
cppu::UnoType<lang::XTypeProvider>::get()
@@ -4006,8 +4003,8 @@ void SAL_CALL OStorage::removeEncryption()
     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!" );
-    if ( !m_bIsRoot )
+    SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", "removeEncryption() 
method is not available for nonroot storages!" );
+    if ( !m_pImpl->m_bIsRoot )
         return;
 
     try {
@@ -4070,8 +4067,8 @@ void SAL_CALL OStorage::setEncryptionData( const 
uno::Sequence< beans::NamedValu
     if ( !aEncryptionData.hasElements() )
         throw uno::RuntimeException( THROW_WHERE "Unexpected empty encryption 
data!" );
 
-    SAL_WARN_IF( !m_bIsRoot, "package.xstor", "setEncryptionData() method is 
not available for nonroot storages!" );
-    if ( !m_bIsRoot )
+    SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", "setEncryptionData() 
method is not available for nonroot storages!" );
+    if ( !m_pImpl->m_bIsRoot )
         return;
 
     try {
@@ -4135,8 +4132,8 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const 
uno::Sequence< beans::Nam
     if ( !aAlgorithms.hasElements() )
         throw uno::RuntimeException( THROW_WHERE "Unexpected empty encryption 
algorithms list!" );
 
-    SAL_WARN_IF( !m_bIsRoot, "package.xstor", "setEncryptionAlgorithms() 
method is not available for nonroot storages!" );
-    if ( !m_bIsRoot )
+    SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", 
"setEncryptionAlgorithms() method is not available for nonroot storages!" );
+    if ( !m_pImpl->m_bIsRoot )
         return;
 
     try {
@@ -4195,8 +4192,8 @@ void SAL_CALL OStorage::setGpgProperties( const 
uno::Sequence< uno::Sequence< be
     if ( !aProps.hasElements() )
         throw uno::RuntimeException( THROW_WHERE "Unexpected empty encryption 
algorithms list!" );
 
-    SAL_WARN_IF( !m_bIsRoot, "package.xstor", "setGpgProperties() method is 
not available for nonroot storages!" );
-    if ( !m_bIsRoot )
+    SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", "setGpgProperties() 
method is not available for nonroot storages!" );
+    if ( !m_pImpl->m_bIsRoot )
         return;
 
     try {
@@ -4253,8 +4250,8 @@ uno::Sequence< beans::NamedValue > SAL_CALL 
OStorage::getEncryptionAlgorithms()
         throw uno::RuntimeException( THROW_WHERE ); // the interface must be 
visible only for package storage
 
     uno::Sequence< beans::NamedValue > aResult;
-    SAL_WARN_IF( !m_bIsRoot, "package.xstor", "getEncryptionAlgorithms() 
method is not available for nonroot storages!" );
-    if ( m_bIsRoot )
+    SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", 
"getEncryptionAlgorithms() method is not available for nonroot storages!" );
+    if ( m_pImpl->m_bIsRoot )
     {
         try {
             m_pImpl->ReadContents();
@@ -4356,7 +4353,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& 
aPropertyName, const u
                 m_pImpl->m_bIsModified = true;
             }
         }
-        else if ( ( m_bIsRoot && ( aPropertyName == 
HAS_ENCRYPTED_ENTRIES_PROPERTY
+        else if ( ( m_pImpl->m_bIsRoot && ( aPropertyName == 
HAS_ENCRYPTED_ENTRIES_PROPERTY
                                     || aPropertyName == 
HAS_NONENCRYPTED_ENTRIES_PROPERTY
                                     || aPropertyName == 
IS_INCONSISTENT_PROPERTY
                                     || aPropertyName == "URL"
@@ -4401,7 +4398,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& 
aPropertyName, const u
             m_pImpl->m_bBroadcastModified = true;
             m_pImpl->m_bIsModified = true;
         }
-        else if ( ( m_bIsRoot && ( aPropertyName == "URL" || aPropertyName == 
"RepairPackage") )
+        else if ( ( m_pImpl->m_bIsRoot && ( aPropertyName == "URL" || 
aPropertyName == "RepairPackage") )
                  || aPropertyName == "IsRoot" )
             throw beans::PropertyVetoException( THROW_WHERE );
         else
@@ -4455,13 +4452,13 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const 
OUString& aPropertyName )
     }
     else if ( aPropertyName == "IsRoot" )
     {
-        return uno::makeAny( m_bIsRoot );
+        return uno::makeAny( m_pImpl->m_bIsRoot );
     }
     else if ( aPropertyName == "OpenMode" )
     {
         return uno::makeAny( m_pImpl->m_nStorageMode );
     }
-    else if ( m_bIsRoot )
+    else if ( m_pImpl->m_bIsRoot )
     {
         if ( aPropertyName == "URL"
           || aPropertyName == "RepairPackage" )
@@ -5074,7 +5071,7 @@ void SAL_CALL OStorage::writeAndAttachToStream( const 
uno::Reference< io::XStrea
         throw lang::DisposedException( THROW_WHERE );
     }
 
-    if ( !m_bIsRoot )
+    if ( !m_pImpl->m_bIsRoot )
         throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< 
uno::XInterface >(), 0 );
 
     if ( !m_pImpl->m_pSwitchStream )
@@ -5132,7 +5129,7 @@ void SAL_CALL OStorage::attachToURL( const OUString& sURL,
         throw lang::DisposedException( THROW_WHERE );
     }
 
-    if ( !m_bIsRoot )
+    if ( !m_pImpl->m_bIsRoot )
         throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< 
uno::XInterface >(), 0 );
 
     if ( !m_pImpl->m_pSwitchStream )
diff --git a/package/source/xstor/xstorage.hxx 
b/package/source/xstor/xstorage.hxx
index 44d5716b5704..35a80e717704 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -281,7 +281,6 @@ class OStorage final : public css::lang::XTypeProvider
     rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex;
     comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // 
list of listeners
     ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection;
-    bool m_bIsRoot;
     bool m_bReadOnlyWrap;
     ::rtl::Reference<OChildDispListener_Impl> m_pSubElDispListener;
     ::std::vector< css::uno::WeakReference< css::lang::XComponent > > 
m_aOpenSubComponentsVector;
commit 9a9bb1f212bb7eb40dcf34c15a3422e633fc195d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Mar 16 21:23:35 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 17 08:17:36 2022 +0100

    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 <noel.gran...@collabora.co.uk>

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<embed::XStorageRawAccess*> ( 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<beans::XPropertySet>::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<lang::XTypeProvider>::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<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
 
@@ -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<uno::XInterface>(), 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<uno::XInterface>(),
                                                  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<uno::XInterface>(), 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<uno::XInterface>(),
                                                  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<OChildDispListener_Impl> m_pSubElDispListener;
     ::std::vector< css::uno::WeakReference< css::lang::XComponent > > 
m_aOpenSubComponentsVector;

Reply via email to