diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-10-11 21:42:21 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-10-12 15:24:28 +0200 |
commit | 1e0306be6c3a3bc50f11e7c7814aa8a029f8928d (patch) | |
tree | 31db26df441e1bd133fae622ea88d6e3946eb671 /filter | |
parent | b138d6c12aaeb0b87dce15ea52dd134cf1abf6ac (diff) |
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>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
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; } |