Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
152c4afe
Kaydet (Commit)
152c4afe
authored
Eki 15, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
package: ZipPackageStream: prefix members
Change-Id: I02a1c3189c6b52f4f539b0eaa8878985cae8b321
üst
3a8bddc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
75 deletions
+75
-75
ZipPackageStream.hxx
package/inc/ZipPackageStream.hxx
+13
-13
ZipPackageStream.cxx
package/source/zippackage/ZipPackageStream.cxx
+62
-62
No files found.
package/inc/ZipPackageStream.hxx
Dosyayı görüntüle @
152c4afe
...
@@ -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
();
...
...
package/source/zippackage/ZipPackageStream.cxx
Dosyayı görüntüle @
152c4afe
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment