summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-10-08 12:15:35 -0400
committerJustin Luth <jluth@mail.com>2022-10-11 20:39:04 +0200
commitffc15725b58d0988b4e2ed836c5751223ad00984 (patch)
treefccc8fe6d1e38b9d12f5dca96e0f71a8d3a5bf82 /filter
parentb320ef30977144c52de9b39bc4db0db540727c79 (diff)
tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheet
Unlike Word, ThisWorksheet cannot hold auto-running subroutines for Open/Close/New. This fixes a LO 7.4 regression caused by commit beb6c62e990599d91ac5d9183164c94d269027d3. Change-Id: Idb8f72775d9392b306cb924ee776821272b12f3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141127 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/msvbahelper.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 59d34ca5cec1..c7e84138f8dd 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -172,7 +172,7 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
// if sMod is empty and a macro is found then sMod is updated
// if sMod is empty, only standard modules will be searched (no class, document, form modules)
static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUString& sMod,
- const OUString& sMacro, bool bOnlyPublic)
+ const OUString& sMacro, bool bOnlyPublic, const OUString& sSkipModule)
{
#if !HAVE_FEATURE_SCRIPTING
(void) pShell;
@@ -180,6 +180,7 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS
(void) sMod;
(void) sMacro;
(void) bOnlyPublic;
+ (void) sSkipModule;
#else
if (sLibrary.isEmpty() || sMacro.isEmpty())
return false;
@@ -212,7 +213,8 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS
SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method);
if (pMeth)
{
- if (bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private))
+ if ((bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private))
+ || rModuleRef->GetName() == sSkipModule)
continue;
sMod = rModuleRef->GetName();
return true;
@@ -263,7 +265,7 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString&
OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName,
const OUString& rModuleName, const OUString& rMacroName,
- bool bOnlyPublic)
+ bool bOnlyPublic, const OUString& sSkipModule)
{
#if !HAVE_FEATURE_SCRIPTING
(void) pShell;
@@ -271,12 +273,13 @@ OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName,
(void) rModuleName;
(void) rMacroName;
(void) bOnlyPublic;
+ (void) sSkipModule;
#else
if( pShell )
{
OUString aLibName = rLibName.isEmpty() ? getDefaultProjectName( pShell ) : rLibName ;
OUString aModuleName = rModuleName;
- if (hasMacro( pShell, aLibName, aModuleName, rMacroName, bOnlyPublic))
+ if (hasMacro(pShell, aLibName, aModuleName, rMacroName, bOnlyPublic, sSkipModule))
return aLibName + "." + aModuleName + "." + rMacroName;
}
#endif
@@ -447,7 +450,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
for (auto const& search : sSearchList)
{
- aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false);
+ aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false, "");
if ( aRes.mbFound )
{
sContainer = search;