summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-08-23 19:37:48 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-09-10 02:12:41 +0200
commit3187eeab10df77a6c0dd6397be993a68276d7141 (patch)
treeda2bfbd0c280912bbed02341ad9957f511f965c3 /oox
parent4389db13ed20a85fbe2d213ddc833b39e572936d (diff)
small refactoring in the vba export code
Change-Id: I68a7c7700b8405f4fe2b75516deff684f21e256c
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ole/vbaexport.cxx44
1 files changed, 27 insertions, 17 deletions
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 619c82050f39..dbcc2560c48c 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -30,6 +30,8 @@
#define CODEPAGE RTL_TEXTENCODING_MS_1252
#endif
+#define VBA_EXPORT_DEBUG 1
+
namespace {
void exportString(SvStream& rStrm, const OUString& rString)
@@ -582,11 +584,30 @@ void writePROJECTMODULES(SvStream& rStrm)
// section 2.3.4.2
void exportDirStream(SvStream& rStrm)
{
- writePROJECTINFORMATION(rStrm);
- writePROJECTREFERENCES(rStrm);
- writePROJECTMODULES(rStrm);
- rStrm.WriteUInt16(0x0010); // terminator
- rStrm.WriteUInt32(0x00000000); // reserved
+ SvMemoryStream aDirStream(4096, 4096);
+
+ writePROJECTINFORMATION(aDirStream);
+ writePROJECTREFERENCES(aDirStream);
+ writePROJECTMODULES(aDirStream);
+ aDirStream.WriteUInt16(0x0010); // terminator
+ aDirStream.WriteUInt32(0x00000000); // reserved
+
+ aDirStream.Seek(0);
+
+#if VBA_EXPORT_DEBUG
+ const OUString aDirFileName("/tmp/vba_dir_out.bin");
+ SvFileStream aDirStreamDebug(aDirFileName, STREAM_READWRITE);
+
+ aDirStreamDebug.WriteStream(aDirStream);
+ aDirStream.Seek(0);
+#endif
+
+ // the stream for the compression
+ SvMemoryStream aMemoryStream(4096, 4096);
+ aMemoryStream.WriteStream(aDirStream);
+
+ VBACompression aCompression(rStrm, aDirStream);
+ aCompression.write();
}
}
@@ -602,19 +623,8 @@ void VbaExport::exportVBA()
SotStorage* pVBAStream = aStorage->OpenSotStorage("VBA", STREAM_READWRITE);
SotStorageStream* pDirStream = pVBAStream->OpenSotStream("dir", STREAM_READWRITE);
- const OUString aDirFileName("/tmp/vba_dir_out.bin");
- SvFileStream aDirStream(aDirFileName, STREAM_READWRITE);
-
// export
- exportDirStream(aDirStream);
-
- aDirStream.Seek(0);
-
- SvMemoryStream aMemoryStream(4096, 4096);
- aMemoryStream.WriteStream(aDirStream);
-
- VBACompression aCompression(*pDirStream, aMemoryStream);
- aCompression.write();
+ exportDirStream(*pDirStream);
css::uno::Reference<css::container::XNameContainer> xNameContainer = getBasicLibrary();
css::uno::Sequence<OUString> aElementNames = xNameContainer->getElementNames();