Kaydet (Commit) 3187eeab authored tarafından Markus Mohrhard's avatar Markus Mohrhard

small refactoring in the vba export code

Change-Id: I68a7c7700b8405f4fe2b75516deff684f21e256c
üst 4389db13
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define CODEPAGE RTL_TEXTENCODING_MS_1252 #define CODEPAGE RTL_TEXTENCODING_MS_1252
#endif #endif
#define VBA_EXPORT_DEBUG 1
namespace { namespace {
void exportString(SvStream& rStrm, const OUString& rString) void exportString(SvStream& rStrm, const OUString& rString)
...@@ -582,11 +584,30 @@ void writePROJECTMODULES(SvStream& rStrm) ...@@ -582,11 +584,30 @@ void writePROJECTMODULES(SvStream& rStrm)
// section 2.3.4.2 // section 2.3.4.2
void exportDirStream(SvStream& rStrm) void exportDirStream(SvStream& rStrm)
{ {
writePROJECTINFORMATION(rStrm); SvMemoryStream aDirStream(4096, 4096);
writePROJECTREFERENCES(rStrm);
writePROJECTMODULES(rStrm); writePROJECTINFORMATION(aDirStream);
rStrm.WriteUInt16(0x0010); // terminator writePROJECTREFERENCES(aDirStream);
rStrm.WriteUInt32(0x00000000); // reserved 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() ...@@ -602,19 +623,8 @@ void VbaExport::exportVBA()
SotStorage* pVBAStream = aStorage->OpenSotStorage("VBA", STREAM_READWRITE); SotStorage* pVBAStream = aStorage->OpenSotStorage("VBA", STREAM_READWRITE);
SotStorageStream* pDirStream = pVBAStream->OpenSotStream("dir", STREAM_READWRITE); SotStorageStream* pDirStream = pVBAStream->OpenSotStream("dir", STREAM_READWRITE);
const OUString aDirFileName("/tmp/vba_dir_out.bin");
SvFileStream aDirStream(aDirFileName, STREAM_READWRITE);
// export // export
exportDirStream(aDirStream); exportDirStream(*pDirStream);
aDirStream.Seek(0);
SvMemoryStream aMemoryStream(4096, 4096);
aMemoryStream.WriteStream(aDirStream);
VBACompression aCompression(*pDirStream, aMemoryStream);
aCompression.write();
css::uno::Reference<css::container::XNameContainer> xNameContainer = getBasicLibrary(); css::uno::Reference<css::container::XNameContainer> xNameContainer = getBasicLibrary();
css::uno::Sequence<OUString> aElementNames = xNameContainer->getElementNames(); css::uno::Sequence<OUString> aElementNames = xNameContainer->getElementNames();
......
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