Kaydet (Commit) 7667dda4 authored tarafından Julien Nabet's avatar Julien Nabet

tdf#117825: check if macros are allowed when double-click one

Change-Id: I4ebb38bdac543995ee7e73dbd67ff5f1402d1a0a
Reviewed-on: https://gerrit.libreoffice.org/54867Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst f9de5f7e
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment