diff options
author | Rosemary <rosemaryseb8@gmail.com> | 2015-09-05 17:18:49 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-10 04:14:52 +0200 |
commit | 32b7619ced25de5f215b7f31902dc1cf0537df98 (patch) | |
tree | b2e5b9ae5be6616673bd6e86c8475320b974033f | |
parent | 4f4a668e04bdd68655a0f574027f486cea953857 (diff) |
Fix the module export code
Change-Id: I56d239927d8a83b2b71f52da36394710a52b0a06
-rw-r--r-- | oox/source/ole/vbaexport.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 3435e3649ede..49713a289a7c 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -615,15 +615,17 @@ void exportDirStream(SvStream& rStrm, css::uno::Reference<css::container::XNameC aCompression.write(); } -void exportModuleStream(SvStream& rStrm, css::uno::Reference<css::container::XNameContainer> xNameContainer, OUString aSourceCode) +// section 2.3.4.3 Module Stream +void exportModuleStream(SvStream& rStrm, OUString aSourceCode, OUString aElementName) { SvMemoryStream aModuleStream(4096, 4096); + exportString(aModuleStream, "Attribute VB_Name = \"" + aElementName + "\"\r\n"); exportString(aModuleStream, aSourceCode); aModuleStream.Seek(0); #if VBA_EXPORT_DEBUG - const OUString aModuleFileName("/tmp/vba_module_out.bin"); + OUString aModuleFileName("/tmp/vba_" + aElementName + "_out.bin"); SvFileStream aModuleStreamDebug(aModuleFileName, STREAM_READWRITE); aModuleStreamDebug.WriteStream(aModuleStream); aModuleStream.Seek(0); @@ -637,6 +639,7 @@ void exportModuleStream(SvStream& rStrm, css::uno::Reference<css::container::XNa aCompression.write(); } +// section 2.3.4.1 _VBA_PROJECT Stream void exportVBAProjectStream(SvStream& rStrm) { rStrm.WriteUInt16(0x61CC); // Reserved1 @@ -670,7 +673,7 @@ void VbaExport::exportVBA(SotStorage* pRootStorage) css::uno::Any aCode = xNameContainer->getByName(aElementNames[i]); OUString aSourceCode; aCode >>= aSourceCode; - exportModuleStream(*pModuleStream[i], xNameContainer, aSourceCode); + exportModuleStream(*pModuleStream[i], aSourceCode, aElementNames[i]); } exportVBAProjectStream(*pVBAProjectStream); |