Kaydet (Commit) 152c4afe authored tarafından Matúš Kukan's avatar Matúš Kukan

package: ZipPackageStream: prefix members

Change-Id: I02a1c3189c6b52f4f539b0eaa8878985cae8b321
üst 3a8bddc1
...@@ -47,10 +47,10 @@ class ZipPackageStream : public cppu::ImplInheritanceHelper2 ...@@ -47,10 +47,10 @@ class ZipPackageStream : public cppu::ImplInheritanceHelper2
> >
{ {
private: private:
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream; com::sun::star::uno::Reference < com::sun::star::io::XInputStream > m_xStream;
const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext; const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
ZipPackage &rZipPackage; ZipPackage &m_rZipPackage;
bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted; bool m_bToBeCompressed, m_bToBeEncrypted, m_bHaveOwnKey, m_bIsEncrypted;
::rtl::Reference< BaseEncryptionData > m_xBaseEncryptionData; ::rtl::Reference< BaseEncryptionData > m_xBaseEncryptionData;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
...@@ -76,10 +76,10 @@ private: ...@@ -76,10 +76,10 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream(); ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream();
public: public:
bool HasOwnKey () const { return bHaveOwnKey;} bool HasOwnKey () const { return m_bHaveOwnKey;}
bool IsToBeCompressed () const { return bToBeCompressed;} bool IsToBeCompressed () const { return m_bToBeCompressed;}
bool IsToBeEncrypted () const { return bToBeEncrypted;} bool IsToBeEncrypted () const { return m_bToBeEncrypted;}
bool IsEncrypted () const { return bIsEncrypted;} bool IsEncrypted () const { return m_bIsEncrypted;}
bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;} bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;}
bool IsFromManifest() const { return m_bFromManifest; } bool IsFromManifest() const { return m_bFromManifest; }
...@@ -108,18 +108,18 @@ public: ...@@ -108,18 +108,18 @@ public:
sal_Int32 GetEncryptionAlgorithm() const; sal_Int32 GetEncryptionAlgorithm() const;
sal_Int32 GetBlockSize() const; sal_Int32 GetBlockSize() const;
void SetToBeCompressed (bool bNewValue) { bToBeCompressed = bNewValue;} void SetToBeCompressed (bool bNewValue) { m_bToBeCompressed = bNewValue;}
void SetIsEncrypted (bool bNewValue) { bIsEncrypted = bNewValue;} void SetIsEncrypted (bool bNewValue) { m_bIsEncrypted = bNewValue;}
void SetImportedStartKeyAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedStartKeyAlgorithm = nAlgorithm; } void SetImportedStartKeyAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedStartKeyAlgorithm = nAlgorithm; }
void SetImportedEncryptionAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedEncryptionAlgorithm = nAlgorithm; } void SetImportedEncryptionAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedEncryptionAlgorithm = nAlgorithm; }
void SetImportedChecksumAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedChecksumAlgorithm = nAlgorithm; } void SetImportedChecksumAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedChecksumAlgorithm = nAlgorithm; }
void SetImportedDerivedKeySize( sal_Int32 nSize ) { m_nImportedDerivedKeySize = nSize; } void SetImportedDerivedKeySize( sal_Int32 nSize ) { m_nImportedDerivedKeySize = nSize; }
void SetToBeEncrypted (bool bNewValue) void SetToBeEncrypted (bool bNewValue)
{ {
bToBeEncrypted = bNewValue; m_bToBeEncrypted = bNewValue;
if ( bToBeEncrypted && !m_xBaseEncryptionData.is()) if ( m_bToBeEncrypted && !m_xBaseEncryptionData.is())
m_xBaseEncryptionData = new BaseEncryptionData; m_xBaseEncryptionData = new BaseEncryptionData;
else if ( !bToBeEncrypted && m_xBaseEncryptionData.is() ) else if ( !m_bToBeEncrypted && m_xBaseEncryptionData.is() )
m_xBaseEncryptionData.clear(); m_xBaseEncryptionData.clear();
} }
void SetPackageMember (bool bNewValue); void SetPackageMember (bool bNewValue);
...@@ -136,7 +136,7 @@ public: ...@@ -136,7 +136,7 @@ public:
{ m_xBaseEncryptionData->m_nIterationCount = nNewCount;} { m_xBaseEncryptionData->m_nIterationCount = nNewCount;}
void setSize (const sal_Int64 nNewSize); void setSize (const sal_Int64 nNewSize);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; } ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return m_xStream; }
void CloseOwnStreamIfAny(); void CloseOwnStreamIfAny();
......
...@@ -71,11 +71,11 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage, ...@@ -71,11 +71,11 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
const uno::Reference< XComponentContext >& xContext, const uno::Reference< XComponentContext >& xContext,
bool bAllowRemoveOnInsert ) bool bAllowRemoveOnInsert )
: m_xContext( xContext ) : m_xContext( xContext )
, rZipPackage( rNewPackage ) , m_rZipPackage( rNewPackage )
, bToBeCompressed ( true ) , m_bToBeCompressed ( true )
, bToBeEncrypted ( false ) , m_bToBeEncrypted ( false )
, bHaveOwnKey ( false ) , m_bHaveOwnKey ( false )
, bIsEncrypted ( false ) , m_bIsEncrypted ( false )
, m_nImportedStartKeyAlgorithm( 0 ) , m_nImportedStartKeyAlgorithm( 0 )
, m_nImportedEncryptionAlgorithm( 0 ) , m_nImportedEncryptionAlgorithm( 0 )
, m_nImportedChecksumAlgorithm( 0 ) , m_nImportedChecksumAlgorithm( 0 )
...@@ -124,36 +124,36 @@ void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry ) ...@@ -124,36 +124,36 @@ void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry )
aEntry.nExtraLen = rInEntry.nExtraLen; aEntry.nExtraLen = rInEntry.nExtraLen;
if ( aEntry.nMethod == STORED ) if ( aEntry.nMethod == STORED )
bToBeCompressed = false; m_bToBeCompressed = false;
} }
void ZipPackageStream::CloseOwnStreamIfAny() void ZipPackageStream::CloseOwnStreamIfAny()
{ {
if ( xStream.is() ) if ( m_xStream.is() )
{ {
xStream->closeInput(); m_xStream->closeInput();
xStream = uno::Reference< io::XInputStream >(); m_xStream = uno::Reference< io::XInputStream >();
m_bHasSeekable = false; m_bHasSeekable = false;
} }
} }
uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream() uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream()
{ {
if ( !m_bHasSeekable && xStream.is() ) if ( !m_bHasSeekable && m_xStream.is() )
{ {
// The package component requires that every stream either be FROM a package or it must support XSeekable! // The package component requires that every stream either be FROM a package or it must support XSeekable!
// The only exception is a nonseekable stream that is provided only for storing, if such a stream // The only exception is a nonseekable stream that is provided only for storing, if such a stream
// is accessed before commit it MUST be wrapped. // is accessed before commit it MUST be wrapped.
// Wrap the stream in case it is not seekable // Wrap the stream in case it is not seekable
xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xContext ); m_xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xStream, m_xContext );
uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY ); uno::Reference< io::XSeekable > xSeek( m_xStream, UNO_QUERY );
if ( !xSeek.is() ) if ( !xSeek.is() )
throw RuntimeException( THROW_WHERE "The stream must support XSeekable!" ); throw RuntimeException( THROW_WHERE "The stream must support XSeekable!" );
m_bHasSeekable = true; m_bHasSeekable = true;
} }
return xStream; return m_xStream;
} }
uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCopy() uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCopy()
...@@ -188,7 +188,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop ...@@ -188,7 +188,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
sal_Int32 ZipPackageStream::GetEncryptionAlgorithm() const sal_Int32 ZipPackageStream::GetEncryptionAlgorithm() const
{ {
return m_nImportedEncryptionAlgorithm ? m_nImportedEncryptionAlgorithm : rZipPackage.GetEncAlgID(); return m_nImportedEncryptionAlgorithm ? m_nImportedEncryptionAlgorithm : m_rZipPackage.GetEncAlgID();
} }
sal_Int32 ZipPackageStream::GetBlockSize() const sal_Int32 ZipPackageStream::GetBlockSize() const
...@@ -204,8 +204,8 @@ sal_Int32 ZipPackageStream::GetBlockSize() const ...@@ -204,8 +204,8 @@ sal_Int32 ZipPackageStream::GetBlockSize() const
*m_xBaseEncryptionData, *m_xBaseEncryptionData,
GetEncryptionKey( bUseWinEncoding ), GetEncryptionKey( bUseWinEncoding ),
GetEncryptionAlgorithm(), GetEncryptionAlgorithm(),
m_nImportedChecksumAlgorithm ? m_nImportedChecksumAlgorithm : rZipPackage.GetChecksumAlgID(), m_nImportedChecksumAlgorithm ? m_nImportedChecksumAlgorithm : m_rZipPackage.GetChecksumAlgID(),
m_nImportedDerivedKeySize ? m_nImportedDerivedKeySize : rZipPackage.GetDefaultDerivedKeySize(), m_nImportedDerivedKeySize ? m_nImportedDerivedKeySize : m_rZipPackage.GetDefaultDerivedKeySize(),
GetStartKeyGenID() ); GetStartKeyGenID() );
return xResult; return xResult;
...@@ -217,7 +217,7 @@ uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncodi ...@@ -217,7 +217,7 @@ uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncodi
sal_Int32 nKeyGenID = GetStartKeyGenID(); sal_Int32 nKeyGenID = GetStartKeyGenID();
bUseWinEncoding = ( bUseWinEncoding || m_bUseWinEncoding ); bUseWinEncoding = ( bUseWinEncoding || m_bUseWinEncoding );
if ( bHaveOwnKey && m_aStorageEncryptionKeys.getLength() ) if ( m_bHaveOwnKey && m_aStorageEncryptionKeys.getLength() )
{ {
OUString aNameToFind; OUString aNameToFind;
if ( nKeyGenID == xml::crypto::DigestID::SHA256 ) if ( nKeyGenID == xml::crypto::DigestID::SHA256 )
...@@ -241,8 +241,8 @@ uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncodi ...@@ -241,8 +241,8 @@ uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncodi
else else
aResult = m_aEncryptionKey; aResult = m_aEncryptionKey;
if ( !aResult.getLength() || !bHaveOwnKey ) if ( !aResult.getLength() || !m_bHaveOwnKey )
aResult = rZipPackage.GetEncryptionKey(); aResult = m_rZipPackage.GetEncryptionKey();
return aResult; return aResult;
} }
...@@ -251,17 +251,17 @@ sal_Int32 ZipPackageStream::GetStartKeyGenID() ...@@ -251,17 +251,17 @@ sal_Int32 ZipPackageStream::GetStartKeyGenID()
{ {
// generally should all the streams use the same Start Key // generally should all the streams use the same Start Key
// but if raw copy without password takes place, we should preserve the imported algorithm // but if raw copy without password takes place, we should preserve the imported algorithm
return m_nImportedStartKeyAlgorithm ? m_nImportedStartKeyAlgorithm : rZipPackage.GetStartKeyGenID(); return m_nImportedStartKeyAlgorithm ? m_nImportedStartKeyAlgorithm : m_rZipPackage.GetStartKeyGenID();
} }
uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( bool bAddHeaderForEncr ) uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( bool bAddHeaderForEncr )
{ {
if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || ( bAddHeaderForEncr && !bToBeEncrypted ) ) if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || ( bAddHeaderForEncr && !m_bToBeEncrypted ) )
throw packages::NoEncryptionException(THROW_WHERE ); throw packages::NoEncryptionException(THROW_WHERE );
Sequence< sal_Int8 > aKey; Sequence< sal_Int8 > aKey;
if ( bToBeEncrypted ) if ( m_bToBeEncrypted )
{ {
aKey = GetEncryptionKey(); aKey = GetEncryptionKey();
if ( !aKey.getLength() ) if ( !aKey.getLength() )
...@@ -291,7 +291,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( ...@@ -291,7 +291,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
throw RuntimeException(THROW_WHERE ); throw RuntimeException(THROW_WHERE );
xNewPackStream->setDataStream( static_cast< io::XInputStream* >( xNewPackStream->setDataStream( static_cast< io::XInputStream* >(
new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ) ) ); new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() ) ) );
uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY ); uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
if ( !xNewPSProps.is() ) if ( !xNewPSProps.is() )
...@@ -299,8 +299,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( ...@@ -299,8 +299,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
// copy all the properties of this stream to the new stream // copy all the properties of this stream to the new stream
xNewPSProps->setPropertyValue("MediaType", makeAny( msMediaType ) ); xNewPSProps->setPropertyValue("MediaType", makeAny( msMediaType ) );
xNewPSProps->setPropertyValue("Compressed", makeAny( bToBeCompressed ) ); xNewPSProps->setPropertyValue("Compressed", makeAny( m_bToBeCompressed ) );
if ( bToBeEncrypted ) if ( m_bToBeEncrypted )
{ {
xNewPSProps->setPropertyValue(ENCRYPTION_KEY_PROPERTY, makeAny( aKey ) ); xNewPSProps->setPropertyValue(ENCRYPTION_KEY_PROPERTY, makeAny( aKey ) );
xNewPSProps->setPropertyValue("Encrypted", makeAny( true ) ); xNewPSProps->setPropertyValue("Encrypted", makeAny( true ) );
...@@ -426,7 +426,7 @@ bool ZipPackageStream::ParsePackageRawStream() ...@@ -426,7 +426,7 @@ bool ZipPackageStream::ParsePackageRawStream()
m_xBaseEncryptionData = xTempEncrData; m_xBaseEncryptionData = xTempEncrData;
SetIsEncrypted ( true ); SetIsEncrypted ( true );
// it's already compressed and encrypted // it's already compressed and encrypted
bToBeEncrypted = bToBeCompressed = false; m_bToBeEncrypted = m_bToBeCompressed = false;
return true; return true;
} }
...@@ -448,7 +448,7 @@ void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInput ...@@ -448,7 +448,7 @@ void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInput
throw( RuntimeException, std::exception ) throw( RuntimeException, std::exception )
{ {
// if seekable access is required the wrapping will be done on demand // if seekable access is required the wrapping will be done on demand
xStream = aStream; m_xStream = aStream;
m_nImportedEncryptionAlgorithm = 0; m_nImportedEncryptionAlgorithm = 0;
m_bHasSeekable = false; m_bHasSeekable = false;
SetPackageMember ( false ); SetPackageMember ( false );
...@@ -463,11 +463,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData() ...@@ -463,11 +463,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
{ {
if ( IsPackageMember() ) if ( IsPackageMember() )
{ {
return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); return m_rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
} }
else if ( GetOwnSeekStream().is() ) else if ( GetOwnSeekStream().is() )
{ {
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ); return new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() );
} }
else else
return uno::Reference < io::XInputStream > (); return uno::Reference < io::XInputStream > ();
...@@ -491,11 +491,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream() ...@@ -491,11 +491,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream()
{ {
if ( IsPackageMember() ) if ( IsPackageMember() )
{ {
return rZipPackage.getZipFile().getInputStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); return m_rZipPackage.getZipFile().getInputStream( aEntry, GetEncryptionData(), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
} }
else if ( GetOwnSeekStream().is() ) else if ( GetOwnSeekStream().is() )
{ {
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ); return new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() );
} }
else else
return uno::Reference < io::XInputStream > (); return uno::Reference < io::XInputStream > ();
...@@ -533,11 +533,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() ...@@ -533,11 +533,11 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
uno::Reference< io::XInputStream > xResult; uno::Reference< io::XInputStream > xResult;
try try
{ {
xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); xResult = m_rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
} }
catch( const packages::WrongPasswordException& ) catch( const packages::WrongPasswordException& )
{ {
if ( rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 ) if ( m_rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 )
{ {
try try
{ {
...@@ -548,7 +548,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() ...@@ -548,7 +548,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
// force SHA256 and see if that works // force SHA256 and see if that works
m_nImportedStartKeyAlgorithm = xml::crypto::DigestID::SHA256; m_nImportedStartKeyAlgorithm = xml::crypto::DigestID::SHA256;
xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); xResult = m_rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
return xResult; return xResult;
} }
catch (const packages::WrongPasswordException&) catch (const packages::WrongPasswordException&)
...@@ -561,7 +561,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() ...@@ -561,7 +561,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
// workaround for the encrypted documents generated with the old OOo1.x bug. // workaround for the encrypted documents generated with the old OOo1.x bug.
if ( !m_bUseWinEncoding ) if ( !m_bUseWinEncoding )
{ {
xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); xResult = m_rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
m_bUseWinEncoding = true; m_bUseWinEncoding = true;
} }
else else
...@@ -576,7 +576,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() ...@@ -576,7 +576,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
return ZipFile::StaticGetDataFromRawStream( m_xContext, GetOwnSeekStream(), GetEncryptionData() ); return ZipFile::StaticGetDataFromRawStream( m_xContext, GetOwnSeekStream(), GetEncryptionData() );
else if ( GetOwnSeekStream().is() ) else if ( GetOwnSeekStream().is() )
{ {
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ); return new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() );
} }
else else
return uno::Reference< io::XInputStream >(); return uno::Reference< io::XInputStream >();
...@@ -597,18 +597,18 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream() ...@@ -597,18 +597,18 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
if ( IsPackageMember() ) if ( IsPackageMember() )
{ {
if ( !bIsEncrypted || !GetEncryptionData().is() ) if ( !m_bIsEncrypted || !GetEncryptionData().is() )
throw packages::NoEncryptionException(THROW_WHERE ); throw packages::NoEncryptionException(THROW_WHERE );
return rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), msMediaType, rZipPackage.GetSharedMutexRef() ); return m_rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), msMediaType, m_rZipPackage.GetSharedMutexRef() );
} }
else if ( GetOwnSeekStream().is() ) else if ( GetOwnSeekStream().is() )
{ {
if ( m_nStreamMode == PACKAGE_STREAM_RAW ) if ( m_nStreamMode == PACKAGE_STREAM_RAW )
{ {
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ); return new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() );
} }
else if ( m_nStreamMode == PACKAGE_STREAM_DATA && bToBeEncrypted ) else if ( m_nStreamMode == PACKAGE_STREAM_DATA && m_bToBeEncrypted )
return TryToGetRawFromDataStream( true ); return TryToGetRawFromDataStream( true );
} }
...@@ -636,11 +636,11 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt ...@@ -636,11 +636,11 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt
throw RuntimeException(THROW_WHERE "The stream must support XSeekable!" ); throw RuntimeException(THROW_WHERE "The stream must support XSeekable!" );
xSeek->seek( 0 ); xSeek->seek( 0 );
uno::Reference< io::XInputStream > xOldStream = xStream; uno::Reference< io::XInputStream > xOldStream = m_xStream;
xStream = xNewStream; m_xStream = xNewStream;
if ( !ParsePackageRawStream() ) if ( !ParsePackageRawStream() )
{ {
xStream = xOldStream; m_xStream = xOldStream;
throw packages::NoRawFormatException(THROW_WHERE ); throw packages::NoRawFormatException(THROW_WHERE );
} }
...@@ -666,7 +666,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( ...@@ -666,7 +666,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
if ( IsPackageMember() ) if ( IsPackageMember() )
{ {
return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); return m_rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), m_bIsEncrypted, m_rZipPackage.GetSharedMutexRef() );
} }
else if ( GetOwnSeekStream().is() ) else if ( GetOwnSeekStream().is() )
{ {
...@@ -700,7 +700,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -700,7 +700,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
{ {
if ( aPropertyName == "MediaType" ) if ( aPropertyName == "MediaType" )
{ {
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && rZipPackage.getFormat() != embed::StorageFormats::OFOPXML ) if ( m_rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && m_rZipPackage.getFormat() != embed::StorageFormats::OFOPXML )
throw beans::PropertyVetoException(THROW_WHERE ); throw beans::PropertyVetoException(THROW_WHERE );
if ( aValue >>= msMediaType ) if ( aValue >>= msMediaType )
...@@ -709,9 +709,9 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -709,9 +709,9 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
{ {
if ( msMediaType.indexOf ( "text" ) != -1 if ( msMediaType.indexOf ( "text" ) != -1
|| msMediaType == "application/vnd.sun.star.oleobject" ) || msMediaType == "application/vnd.sun.star.oleobject" )
bToBeCompressed = true; m_bToBeCompressed = true;
else if ( !m_bCompressedIsSetFromOutside ) else if ( !m_bCompressedIsSetFromOutside )
bToBeCompressed = false; m_bToBeCompressed = false;
} }
} }
else else
...@@ -729,7 +729,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -729,7 +729,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
} }
else if ( aPropertyName == "Encrypted" ) else if ( aPropertyName == "Encrypted" )
{ {
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE ) if ( m_rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException(THROW_WHERE ); throw beans::PropertyVetoException(THROW_WHERE );
bool bEnc = false; bool bEnc = false;
...@@ -741,8 +741,8 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -741,8 +741,8 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
uno::Reference< XInterface >(), uno::Reference< XInterface >(),
2 ); 2 );
bToBeEncrypted = bEnc; m_bToBeEncrypted = bEnc;
if ( bToBeEncrypted && !m_xBaseEncryptionData.is() ) if ( m_bToBeEncrypted && !m_xBaseEncryptionData.is() )
m_xBaseEncryptionData = new BaseEncryptionData; m_xBaseEncryptionData = new BaseEncryptionData;
} }
else else
...@@ -753,7 +753,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -753,7 +753,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
} }
else if ( aPropertyName == ENCRYPTION_KEY_PROPERTY ) else if ( aPropertyName == ENCRYPTION_KEY_PROPERTY )
{ {
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE ) if ( m_rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException(THROW_WHERE ); throw beans::PropertyVetoException(THROW_WHERE );
uno::Sequence< sal_Int8 > aNewKey; uno::Sequence< sal_Int8 > aNewKey;
...@@ -784,13 +784,13 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -784,13 +784,13 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
m_aEncryptionKey = aNewKey; m_aEncryptionKey = aNewKey;
// In case of new raw stream, the stream must not be encrypted on storing // In case of new raw stream, the stream must not be encrypted on storing
bHaveOwnKey = true; m_bHaveOwnKey = true;
if ( m_nStreamMode != PACKAGE_STREAM_RAW ) if ( m_nStreamMode != PACKAGE_STREAM_RAW )
bToBeEncrypted = true; m_bToBeEncrypted = true;
} }
else else
{ {
bHaveOwnKey = false; m_bHaveOwnKey = false;
m_aEncryptionKey.realloc( 0 ); m_aEncryptionKey.realloc( 0 );
} }
...@@ -798,7 +798,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -798,7 +798,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
} }
else if ( aPropertyName == STORAGE_ENCRYPTION_KEYS_PROPERTY ) else if ( aPropertyName == STORAGE_ENCRYPTION_KEYS_PROPERTY )
{ {
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE ) if ( m_rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException(THROW_WHERE ); throw beans::PropertyVetoException(THROW_WHERE );
uno::Sequence< beans::NamedValue > aKeys; uno::Sequence< beans::NamedValue > aKeys;
...@@ -817,13 +817,13 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -817,13 +817,13 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
m_aStorageEncryptionKeys = aKeys; m_aStorageEncryptionKeys = aKeys;
// In case of new raw stream, the stream must not be encrypted on storing // In case of new raw stream, the stream must not be encrypted on storing
bHaveOwnKey = true; m_bHaveOwnKey = true;
if ( m_nStreamMode != PACKAGE_STREAM_RAW ) if ( m_nStreamMode != PACKAGE_STREAM_RAW )
bToBeEncrypted = true; m_bToBeEncrypted = true;
} }
else else
{ {
bHaveOwnKey = false; m_bHaveOwnKey = false;
m_aStorageEncryptionKeys.realloc( 0 ); m_aStorageEncryptionKeys.realloc( 0 );
} }
...@@ -841,7 +841,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -841,7 +841,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
uno::Reference< XInterface >(), uno::Reference< XInterface >(),
2 ); 2 );
bToBeCompressed = bCompr; m_bToBeCompressed = bCompr;
m_bCompressedIsSetFromOutside = true; m_bCompressedIsSetFromOutside = true;
} }
else else
...@@ -869,17 +869,17 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName ) ...@@ -869,17 +869,17 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
} }
else if ( PropertyName == "Encrypted" ) else if ( PropertyName == "Encrypted" )
{ {
aAny <<= ((m_nStreamMode == PACKAGE_STREAM_RAW) || bToBeEncrypted); aAny <<= ((m_nStreamMode == PACKAGE_STREAM_RAW) || m_bToBeEncrypted);
return aAny; return aAny;
} }
else if ( PropertyName == "WasEncrypted" ) else if ( PropertyName == "WasEncrypted" )
{ {
aAny <<= bIsEncrypted; aAny <<= m_bIsEncrypted;
return aAny; return aAny;
} }
else if ( PropertyName == "Compressed" ) else if ( PropertyName == "Compressed" )
{ {
aAny <<= bToBeCompressed; aAny <<= m_bToBeCompressed;
return aAny; return aAny;
} }
else if ( PropertyName == ENCRYPTION_KEY_PROPERTY ) else if ( PropertyName == ENCRYPTION_KEY_PROPERTY )
......
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