diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-05-26 22:38:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-18 14:32:31 +0200 |
commit | 5c213d9f59a131fc80f9b6258771f6df6267041e (patch) | |
tree | 607fae1d4ad2ad65cef7cc43158fb9ee4c7338c0 /basctl | |
parent | 00d244e984589697e9f4d5743ec08e963327e3b9 (diff) |
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@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
(cherry picked from commit 7667dda435b2671f1d78e967669fa0fe725b5af6)
Reviewed-on: https://gerrit.libreoffice.org/55212
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/macrodlg.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
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; } |