From 6834fda784f3066a89838cd6cda4fe945f4c7904 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 6 Oct 2022 20:00:07 -0400 Subject: related tdf#148806 xls/x vba: no auto_open if Auto_Open module The presence of an Auto_Close module prevents any auto_close subroutines from running. Interestingly, Word is different. It doesn't care at all if such a module is present. (In fact, it uses that module's main() as an AutoClose if there is no Sub AutoClose.) Change-Id: I83a80b7f016dcf2ad3b7fd931acacb6f788241a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141036 Tested-by: Jenkins Reviewed-by: Justin Luth --- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 1f92e449a156..dbd345c9bac7 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -320,6 +320,23 @@ void VbaEventsHelperBase::ensureVBALibrary() } } +bool VbaEventsHelperBase::hasModule(const OUString& rModuleName) +{ + if (rModuleName.isEmpty()) + return false; + + bool bRet = false; + try + { + ensureVBALibrary(); + bRet = mxModuleInfos->hasModuleInfo(rModuleName); + } + catch (uno::Exception&) + {} + + return bRet; +} + sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) { // make sure the VBA library exists -- cgit