filter/source/msfilter/msvbahelper.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 1e0306be6c3a3bc50f11e7c7814aa8a029f8928d Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Oct 11 21:42:21 2022 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Oct 12 15:24:28 2022 +0200 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 <jl...@mail.com> diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index c7e84138f8dd..923aecb9c3dd 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; }