diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-25 02:07:04 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-25 06:43:04 +0200 |
commit | 4d9b0e2af84760dc136154017f5cf6b637caba02 (patch) | |
tree | 0b0679755590c3ed8832271a7f2ad8401fbf6bf1 /oox | |
parent | 589143bc486058e42df5484c111df38c236bc9b7 (diff) |
export correct id for workbook stream
Change-Id: I03fa8243fa6472a75fc0881ba47c631e3730e5d3
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/ole/vbaexport.cxx | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index f61e493e25ec..9f8a5dc1a0c0 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -66,6 +66,12 @@ void exportUTF16String(SvStream& rStrm, const OUString& rString) } } +bool isWorkbook(css::uno::Reference<css::uno::XInterface> xInterface) +{ + css::uno::Reference<ooo::vba::excel::XWorkbook> xWorkbook(xInterface, css::uno::UNO_QUERY); + return xWorkbook.is(); +} + } VBACompressionChunk::VBACompressionChunk(SvStream& rCompressedStream, const sal_uInt8* pData, sal_Size nChunkSize) @@ -636,14 +642,18 @@ void exportDirStream(SvStream& rStrm, css::uno::Reference<css::container::XNameC } // section 2.3.4.3 Module Stream -void exportModuleStream(SvStream& rStrm, const OUString& rSourceCode, const OUString& aElementName, sal_Int32 nModuleType) +void exportModuleStream(SvStream& rStrm, const OUString& rSourceCode, const OUString& aElementName, css::script::ModuleInfo& rInfo) { SvMemoryStream aModuleStream(4096, 4096); exportString(aModuleStream, "Attribute VB_Name = \"" + aElementName + "\"\r\n"); - if (nModuleType == 4) + if (rInfo.ModuleType == 4) { - exportString(aModuleStream, "Attribute VB_Base = \"0{00020820-0000-0000-C000-000000000046}\"\r\n"); + if (isWorkbook(rInfo.ModuleObject)) + exportString(aModuleStream, "Attribute VB_Base = \"0{00020819-0000-0000-C000-000000000046}\"\r\n"); + else + exportString(aModuleStream, "Attribute VB_Base = \"0{00020820-0000-0000-C000-000000000046}\"\r\n"); + exportString(aModuleStream, "Attribute VB_GlobalNameSpace = False\r\n"); exportString(aModuleStream, "Attribute VB_Creatable = False\r\n"); exportString(aModuleStream, "Attribute VB_PredeclaredId = True\r\n"); @@ -834,8 +844,8 @@ void getCorrectExportOrder(css::uno::Reference<css::container::XNameContainer> x for (sal_Int32 i = 0; i < n; ++i) { css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(aElementNames[i]); - css::uno::Reference<ooo::vba::excel::XWorkbook> xWorkbook(aModuleInfo.ModuleObject, css::uno::UNO_QUERY); - if (xWorkbook.is()) + bool bWorkbook = isWorkbook(aModuleInfo.ModuleObject); + if (bWorkbook) { nWorkbookIndex = i; rLibraryMap[nCurrentId] = i; @@ -952,7 +962,7 @@ void VbaExport::exportVBA(SotStorage* pRootStorage) css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(rModuleName); OUString aSourceCode; aCode >>= aSourceCode; - exportModuleStream(*pModuleStream, aSourceCode, rModuleName, aModuleInfo.ModuleType); + exportModuleStream(*pModuleStream, aSourceCode, rModuleName, aModuleInfo); pModuleStream->Commit(); } |