tdf#148806 vba: IsCompiled is required for SbxFlagBits::Private
Two step approach:
-putting this here where I need it - fairly targeted.
-put it in FindMethod before returning,
so that everything gets it in a valid state.
Of course the second will probably cause consternations,
but then when it gets reverted at least this will still work.
Change-Id: I8772f85c9b9ae6ed9a25ba7966b50519afe0d6ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141243
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index c7e8413..923aecb 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -205,6 +205,11 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS
if (!pModule)
return false;
SbMethod* pMeth = pModule->FindMethod(sMacro, SbxClassType::Method);
// Must be compiled before we can trust SbxFlagBits::Private
if (pMeth && bOnlyPublic && !pModule->IsCompiled())
pModule->Compile();
return pMeth && (!bOnlyPublic || !pMeth->IsSet(SbxFlagBits::Private));
}
@@ -213,9 +218,17 @@ 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))
|| rModuleRef->GetName() == sSkipModule)
if (rModuleRef->GetName() == sSkipModule)
continue;
if (bOnlyPublic)
{
if (!rModuleRef->IsCompiled())
rModuleRef->Compile();
if (pMeth->IsSet(SbxFlagBits::Private))
continue;
}
sMod = rModuleRef->GetName();
return true;
}