Kaydet (Commit) 9b1b3c9f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Reduce enum class StorageMode to bool transacted

Change-Id: I04e53d7de9f2f26e9338a82f7d5ae5dab1682712
üst 79d853e3
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/XStorage.hpp>
#include <o3tl/typed_flags_set.hxx>
#include <sot/object.hxx> #include <sot/object.hxx>
#include <sot/factory.hxx> #include <sot/factory.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
...@@ -33,18 +32,6 @@ ...@@ -33,18 +32,6 @@
#include <sot/storinfo.hxx> #include <sot/storinfo.hxx>
#include <sot/sotdllapi.h> #include <sot/sotdllapi.h>
enum class StorageMode {
Default = 0,
Transacted = 0x04
};
namespace o3tl {
template<> struct typed_flags<StorageMode>: is_typed_flags<StorageMode, 0x04>
{};
}
class SotStorage; class SotStorage;
enum class SotClipboardFormatId : sal_uLong; enum class SotClipboardFormatId : sal_uLong;
...@@ -111,7 +98,7 @@ friend class SotStorage; ...@@ -111,7 +98,7 @@ friend class SotStorage;
protected: protected:
virtual ~SotStorage(); virtual ~SotStorage();
void CreateStorage( bool bUCBStorage, StreamMode, StorageMode ); void CreateStorage( bool bUCBStorage, StreamMode, bool transacted );
public: public:
SotStorage( const OUString &, SotStorage( const OUString &,
StreamMode = STREAM_STD_READWRITE, StreamMode = STREAM_STD_READWRITE,
......
...@@ -337,12 +337,12 @@ SotStorage::SotStorage( const OUString & rName, StreamMode nMode, bool transacte ...@@ -337,12 +337,12 @@ SotStorage::SotStorage( const OUString & rName, StreamMode nMode, bool transacte
INIT_SotStorage() INIT_SotStorage()
{ {
m_aName = rName; // Namen merken m_aName = rName; // Namen merken
CreateStorage( true, nMode, transacted ? StorageMode::Transacted : StorageMode::Default ); CreateStorage( true, nMode, transacted );
if ( IsOLEStorage() ) if ( IsOLEStorage() )
m_nVersion = SOFFICE_FILEFORMAT_50; m_nVersion = SOFFICE_FILEFORMAT_50;
} }
void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, StorageMode nStorageMode ) void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, bool transacted )
{ {
DBG_ASSERT( !m_pStorStm && !m_pOwnStg, "Use only in ctor!" ); DBG_ASSERT( !m_pStorStm && !m_pOwnStg, "Use only in ctor!" );
if( !m_aName.isEmpty() ) if( !m_aName.isEmpty() )
...@@ -378,31 +378,31 @@ void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, Storage ...@@ -378,31 +378,31 @@ void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, Storage
if ( !(UCBStorage::GetLinkedFile( *m_pStorStm ).isEmpty()) ) if ( !(UCBStorage::GetLinkedFile( *m_pStorStm ).isEmpty()) )
{ {
// detect special unpacked storages // detect special unpacked storages
m_pOwnStg = new UCBStorage( *m_pStorStm, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new UCBStorage( *m_pStorStm, !transacted );
m_bDelStm = true; m_bDelStm = true;
} }
else else
{ {
// UCBStorage always works directly on the UCB content, so discard the stream first // UCBStorage always works directly on the UCB content, so discard the stream first
DELETEZ( m_pStorStm ); DELETEZ( m_pStorStm );
m_pOwnStg = new UCBStorage( m_aName, nMode, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new UCBStorage( m_aName, nMode, !transacted );
} }
} }
else else
{ {
// OLEStorage can be opened with a stream // OLEStorage can be opened with a stream
m_pOwnStg = new Storage( *m_pStorStm, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new Storage( *m_pStorStm, !transacted );
m_bDelStm = true; m_bDelStm = true;
} }
} }
else if ( bForceUCBStorage ) else if ( bForceUCBStorage )
{ {
m_pOwnStg = new UCBStorage( m_aName, nMode, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new UCBStorage( m_aName, nMode, !transacted );
SetError( ERRCODE_IO_NOTSUPPORTED ); SetError( ERRCODE_IO_NOTSUPPORTED );
} }
else else
{ {
m_pOwnStg = new Storage( m_aName, nMode, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new Storage( m_aName, nMode, !transacted );
SetError( ERRCODE_IO_NOTSUPPORTED ); SetError( ERRCODE_IO_NOTSUPPORTED );
} }
} }
...@@ -410,9 +410,9 @@ void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, Storage ...@@ -410,9 +410,9 @@ void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, Storage
{ {
// temporary storage // temporary storage
if ( bForceUCBStorage ) if ( bForceUCBStorage )
m_pOwnStg = new UCBStorage( m_aName, nMode, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new UCBStorage( m_aName, nMode, !transacted );
else else
m_pOwnStg = new Storage( m_aName, nMode, !(nStorageMode & StorageMode::Transacted) ); m_pOwnStg = new Storage( m_aName, nMode, !transacted );
m_aName = m_pOwnStg->GetName(); m_aName = m_pOwnStg->GetName();
} }
...@@ -425,7 +425,7 @@ SotStorage::SotStorage( bool bUCBStorage, const OUString & rName, StreamMode nMo ...@@ -425,7 +425,7 @@ SotStorage::SotStorage( bool bUCBStorage, const OUString & rName, StreamMode nMo
INIT_SotStorage() INIT_SotStorage()
{ {
m_aName = rName; m_aName = rName;
CreateStorage( bUCBStorage, nMode, StorageMode::Default ); CreateStorage( bUCBStorage, nMode, false );
if ( IsOLEStorage() ) if ( IsOLEStorage() )
m_nVersion = SOFFICE_FILEFORMAT_50; m_nVersion = SOFFICE_FILEFORMAT_50;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment