[Libreoffice-commits] core.git: basctl/source
Julien Nabet
serval2412 at yahoo.fr
Sat Jun 2 16:58:18 UTC 2018
basctl/source/basicide/macrodlg.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 7667dda435b2671f1d78e967669fa0fe725b5af6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat May 26 22:38:24 2018 +0200
tdf#117825: check if macros are allowed when double-click one
Change-Id: I4ebb38bdac543995ee7e73dbd67ff5f1402d1a0a
Reviewed-on: https://gerrit.libreoffice.org/54867
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 986dfecb635e..ca0b9161de7d 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -460,10 +460,23 @@ void MacroChooser::CheckButtons()
IMPL_LINK_NOARG(MacroChooser, MacroDoubleClickHdl, SvTreeListBox*, bool)
{
+ SbMethod* pMethod = GetMacro();
+ SbModule* pModule = pMethod ? pMethod->GetModule() : nullptr;
+ StarBASIC* pBasic = pModule ? static_cast<StarBASIC*>(pModule->GetParent()) : nullptr;
+ BasicManager* pBasMgr = pBasic ? FindBasicManager(pBasic) : nullptr;
+ ScriptDocument aDocument(ScriptDocument::getDocumentForBasicManager(pBasMgr));
+ if (aDocument.isDocument() && !aDocument.allowMacros())
+ {
+ std::unique_ptr<weld::MessageDialog> xError(
+ Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning,
+ VclButtonsType::Ok, IDEResId(RID_STR_CANNOTRUNMACRO)));
+ xError->run();
+ return false;
+ }
+
StoreMacroDescription();
if (nMode == Recording)
{
- SbMethod* pMethod = GetMacro();
if (pMethod && !QueryReplaceMacro(pMethod->GetName(), GetFrameWeld()))
return false;
}
More information about the Libreoffice-commits
mailing list