summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-08-13 23:59:07 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-08-14 00:01:51 +0200
commit651b1d08a19c2770ad6f9ed4a6889faeec73e6ba (patch)
tree16f69a2094bf053f4e40b9e8273515ac98d17e94
parent3423db6f81dfcd3993178a70bde7c69a0c02c302 (diff)
fdo#59524 Also write sheet length so MS Office will open it.
Change-Id: I44407a15ca338bc7a24b5de8f8a60ad4e4f2b03d
-rw-r--r--oox/source/core/DocumentCrypt.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/oox/source/core/DocumentCrypt.cxx b/oox/source/core/DocumentCrypt.cxx
index 5e29ee8a3096..b9056ab09504 100644
--- a/oox/source/core/DocumentCrypt.cxx
+++ b/oox/source/core/DocumentCrypt.cxx
@@ -27,6 +27,8 @@
#include <osl/time.h>
#include <rtl/random.h>
+#include <com/sun/star/io/XSeekable.hpp>
+
namespace oox {
namespace core {
@@ -408,6 +410,13 @@ AesEncoder::AesEncoder(Reference< XStream > xDocumentStream, oox::ole::OleStorag
bool AesEncoder::encode()
{
Reference< XInputStream > xInputStream ( mxDocumentStream->getInputStream(), UNO_SET_THROW );
+ Reference< XSeekable > xSeekable( xInputStream, UNO_QUERY );
+
+ if (!xSeekable.is())
+ return false;
+
+ sal_uInt32 aLength = xSeekable->getLength();
+ printf("%d\n", aLength);
if (!mrOleStorage.isStorage())
return false;
@@ -461,7 +470,7 @@ bool AesEncoder::encode()
sal_Int32 inLength;
int outLength;
- aEncryptedPackageStream.writeValue<sal_uInt32>( 0 ); // size
+ aEncryptedPackageStream.writeValue<sal_uInt32>( aLength ); // size
aEncryptedPackageStream.writeValue<sal_uInt32>( 0 ); // size
do