diff options
Diffstat (limited to 'cui/source/customize/SvxMenuConfigPage.cxx')
-rw-r--r-- | cui/source/customize/SvxMenuConfigPage.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index 3181a78bbb07..34cee1368d7a 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -172,8 +172,17 @@ void SvxMenuConfigPage::UpdateButtonStates() m_xInsertBtn->set_sensitive(pMenuData != nullptr); - m_xAddCommandButton->set_sensitive(pMenuData != nullptr); - m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr); + SvxConfigEntry* selectedCmd = CreateCommandFromSelection(GetScriptURL()); + + m_xAddCommandButton->set_sensitive( + pMenuData != nullptr && !IsCommandInMenuList(selectedCmd, pMenuData->GetEntries())); + + delete selectedCmd; + + if (bIsValidSelection) + { + m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr); + } //Handle the gear button if (pMenuData && m_bIsMenuBar) |