[Libreoffice-commits] core.git: Branch 'feature/vba-export' - oox/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Aug 17 10:12:14 PDT 2015


 oox/source/ole/vbaexport.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 67a7ebb2b5f346ce1dfcd1f4dcae139e874a997e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 17 19:05:59 2015 +0200

    export the vba OLE container correctly
    
    Change-Id: Ic4b0db9dc69079be4ebe686d0c7a8edc91c41fa5

diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 4c27603..619c820 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -19,6 +19,8 @@
 #include "oox/helper/propertyset.hxx"
 #include "oox/token/properties.hxx"
 
+#include <sot/storage.hxx>
+
 #define USE_UTF8_CODEPAGE 0
 #if USE_UTF8_CODEPAGE
 #define CODEPAGE_MS 65001
@@ -592,6 +594,14 @@ void exportDirStream(SvStream& rStrm)
 void VbaExport::exportVBA()
 {
     // start here with the VBA export
+
+    const OUString aVbaStreamLocation("/tmp/vba_out.bin");
+    SvFileStream aVbaStream(aVbaStreamLocation, STREAM_READWRITE);
+
+    tools::SvRef<SotStorage> aStorage(new SotStorage(aVbaStream));
+    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);
 
@@ -601,12 +611,9 @@ void VbaExport::exportVBA()
     aDirStream.Seek(0);
 
     SvMemoryStream aMemoryStream(4096, 4096);
-    OUString aCompressedFileName("/tmp/vba_dir_out_compressed.bin");
-    SvFileStream aCompressedStream(aCompressedFileName, STREAM_READWRITE);
-
     aMemoryStream.WriteStream(aDirStream);
 
-    VBACompression aCompression(aCompressedStream, aMemoryStream);
+    VBACompression aCompression(*pDirStream, aMemoryStream);
     aCompression.write();
 
     css::uno::Reference<css::container::XNameContainer> xNameContainer = getBasicLibrary();
@@ -620,7 +627,9 @@ void VbaExport::exportVBA()
         css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(aElementNames[i]);
         SAL_DEBUG(aModuleInfo.ModuleType);
     }
-
+    pDirStream->Commit();
+    pVBAStream->Commit();
+    aStorage->Commit();
 }
 
 css::uno::Reference<css::container::XNameContainer> VbaExport::getBasicLibrary()


More information about the Libreoffice-commits mailing list