summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-05-26 22:38:24 +0200
committerJulien Nabet <serval2412@yahoo.fr>2018-06-02 18:57:57 +0200
commit7667dda435b2671f1d78e967669fa0fe725b5af6 (patch)
treedd29eb741f6227d9a9f0be1d351a50ed3e720072 /basctl
parentf9de5f7ea0130a9bad889f9702ac311d6be3deb6 (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>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/macrodlg.cxx15
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;
}