diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index ff6a74cdd98c..14902158f6d7 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1749,6 +1749,7 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) get(m_pContents, "contents"); get(m_pContentsLabel, "contentslabel"); get(m_pAddCommandsButton, "add"); + get(m_pAddSeparatorButton, "addseparatorbtn"); get(m_pModifyCommandButton, "modify"); get(m_pDeleteCommandButton, "deletebtn"); get(m_pResetTopLevelButton, "resetbtn"); @@ -1786,6 +1787,7 @@ void SvxConfigPage::dispose() m_pContentsLabel.clear(); m_pEntries.clear(); m_pAddCommandsButton.clear(); + m_pAddSeparatorButton.clear(); m_pModifyCommandButton.clear(); m_pDeleteCommandButton.clear(); m_pResetTopLevelButton.clear(); @@ -2440,6 +2442,9 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pAddCommandsButton->SetClickHdl ( LINK( this, SvxMenuConfigPage, AddCommandsHdl ) ); + m_pAddSeparatorButton->SetClickHdl ( + LINK( this, SvxMenuConfigPage, AddSeparatorHdl ) ); + m_pDeleteCommandButton->SetClickHdl ( LINK( this, SvxMenuConfigPage, DeleteCommandHdl ) ); @@ -2512,8 +2517,8 @@ void SvxMenuConfigPage::UpdateButtonStates() m_pMoveUpButton->Enable( false ); m_pMoveDownButton->Enable( false ); m_pDeleteCommandButton->Enable(false); + m_pAddSeparatorButton->Enable(); - pPopup->EnableItem( "addseparator" ); pPopup->EnableItem( "modrename", false ); m_pDescriptionField->SetText(""); @@ -2532,19 +2537,19 @@ void SvxMenuConfigPage::UpdateButtonStates() if ( pEntryData->IsSeparator() ) { - pPopup->EnableItem( "addseparator", false ); pPopup->EnableItem( "modrename", false ); m_pDescriptionField->SetText(""); + m_pAddSeparatorButton->Enable( false ); m_pDeleteCommandButton->Enable(); } else { - pPopup->EnableItem( "addseparator" ); pPopup->EnableItem( "modrename" ); m_pDeleteCommandButton->Enable(); + m_pAddSeparatorButton->Enable(); m_pDescriptionField->SetText(pEntryData->GetHelpText()); } @@ -2620,6 +2625,7 @@ IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, SelectMenu, ListBox&, void ) m_pModifyTopLevelButton->Enable( pMenuData != nullptr ); m_pModifyCommandButton->Enable( pMenuData != nullptr ); m_pAddCommandsButton->Enable( pMenuData != nullptr ); + m_pAddSeparatorButton->Enable( pMenuData != nullptr ); PopupMenu* pPopup = m_pModifyTopLevelButton->GetPopupMenu(); if ( pMenuData ) @@ -2714,12 +2720,6 @@ IMPL_LINK_TYPED( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void GetSaveInData()->SetModified(); } } - else if (sIdent == "addseparator") - { - SvxConfigEntry* pNewEntryData = new SvxConfigEntry; - pNewEntryData->SetUserDefined(); - InsertEntry( pNewEntryData ); - } else if (sIdent == "modrename") { SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry(); @@ -2793,6 +2793,18 @@ IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, AddCommandsHdl, Button *, void ) m_pSelectorDlg->Execute(); } +IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, AddSeparatorHdl, Button *, void ) +{ + SvxConfigEntry* pNewEntryData = new SvxConfigEntry; + pNewEntryData->SetUserDefined(); + InsertEntry( pNewEntryData ); + + if ( GetSaveInData()->IsModified() ) + { + UpdateButtonStates(); + } +} + IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, DeleteCommandHdl, Button *, void ) { DeleteSelectedContent(); @@ -3121,6 +3133,9 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe m_pAddCommandsButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, AddCommandsHdl ) ); + m_pAddSeparatorButton->SetClickHdl ( + LINK( this, SvxToolbarConfigPage, AddSeparatorHdl ) ); + m_pDeleteCommandButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, DeleteCommandHdl ) ); @@ -3452,20 +3467,6 @@ IMPL_LINK_TYPED( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, vo } break; } - case ID_BEGIN_GROUP: - { - SvxConfigEntry* pNewEntryData = new SvxConfigEntry; - pNewEntryData->SetUserDefined(); - - SvTreeListEntry* pNewLBEntry = InsertEntry( pNewEntryData ); - - m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry ); - m_pContentsListBox->SetCheckButtonState( - pNewLBEntry, SvButtonState::Tristate ); - - bNeedsApply = true; - break; - } case ID_ICON_ONLY: { break; @@ -4469,7 +4470,6 @@ void SvxToolbarConfigPage::UpdateButtonStates() { PopupMenu* pPopup = m_pModifyCommandButton->GetPopupMenu(); pPopup->EnableItem( ID_RENAME, false ); - pPopup->EnableItem( ID_BEGIN_GROUP, false ); pPopup->EnableItem( ID_DEFAULT_COMMAND, false ); pPopup->EnableItem( ID_ICON_ONLY, false ); pPopup->EnableItem( ID_ICON_AND_TEXT, false ); @@ -4477,7 +4477,8 @@ void SvxToolbarConfigPage::UpdateButtonStates() pPopup->EnableItem( ID_CHANGE_SYMBOL, false ); pPopup->EnableItem( ID_RESET_SYMBOL, false ); - m_pDeleteCommandButton->Enable(false); + m_pDeleteCommandButton->Enable( false ); + m_pAddSeparatorButton->Enable( false ); m_pDescriptionField->SetText(""); @@ -4494,7 +4495,6 @@ void SvxToolbarConfigPage::UpdateButtonStates() } else { - pPopup->EnableItem( ID_BEGIN_GROUP ); pPopup->EnableItem( ID_RENAME ); pPopup->EnableItem( ID_ICON_ONLY ); pPopup->EnableItem( ID_ICON_AND_TEXT ); @@ -4502,6 +4502,7 @@ void SvxToolbarConfigPage::UpdateButtonStates() pPopup->EnableItem( ID_CHANGE_SYMBOL ); m_pDeleteCommandButton->Enable(); + m_pAddSeparatorButton->Enable(); if ( !pEntryData->IsUserDefined() ) pPopup->EnableItem( ID_DEFAULT_COMMAND ); @@ -4537,6 +4538,7 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void ) m_pModifyTopLevelButton->Enable( false ); m_pModifyCommandButton->Enable( false ); m_pAddCommandsButton->Enable( false ); + m_pAddSeparatorButton->Enable( false ); m_pDeleteCommandButton->Enable( false ); m_pResetTopLevelButton->Enable( false ); @@ -4677,6 +4679,24 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddCommandsHdl, Button *, void ) m_pSelectorDlg->Execute(); } +IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddSeparatorHdl, Button *, void ) +{ + // get currently selected toolbar + SvxConfigEntry* pToolbar = GetTopLevelSelection(); + + SvxConfigEntry* pNewEntryData = new SvxConfigEntry; + pNewEntryData->SetUserDefined(); + + SvTreeListEntry* pNewLBEntry = InsertEntry( pNewEntryData ); + + m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry ); + m_pContentsListBox->SetCheckButtonState( + pNewLBEntry, SvButtonState::Tristate ); + + static_cast( GetSaveInData())->ApplyToolbar( pToolbar ); + UpdateButtonStates(); +} + IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, DeleteCommandHdl, Button *, void ) { DeleteSelectedContent(); diff --git a/cui/source/customize/cfg.hrc b/cui/source/customize/cfg.hrc index 496b8cff44d3..486206f9b9ea 100644 --- a/cui/source/customize/cfg.hrc +++ b/cui/source/customize/cfg.hrc @@ -23,7 +23,6 @@ #define ID_MOVE (43 + CFG_OFFSET) #define ID_DELETE (44 + CFG_OFFSET) -#define ID_BEGIN_GROUP (46 + CFG_OFFSET) // There is a gap here #define ID_ICONS_ONLY (48 + CFG_OFFSET) #define ID_ICONS_AND_TEXT (49 + CFG_OFFSET) diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src index fd0b5654a40b..d09241dd31e9 100644 --- a/cui/source/customize/cfg.src +++ b/cui/source/customize/cfg.src @@ -87,11 +87,6 @@ Menu MODIFY_TOOLBAR_CONTENT Separator = TRUE ; }; MenuItem - { - Identifier = ID_BEGIN_GROUP ; - Text [ en-US ] = "Add Separator" ; - }; - MenuItem { Separator = TRUE ; }; diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index f17175eb0ceb..eb7a2d7143ef 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -375,6 +375,7 @@ protected: VclPtr m_pContentsListBox; VclPtr m_pAddCommandsButton; + VclPtr m_pAddSeparatorButton; VclPtr m_pModifyCommandButton; VclPtr m_pDeleteCommandButton; // Resets the top level toolbar to default settings @@ -477,6 +478,7 @@ private: DECL_LINK_TYPED( MenuSelectHdl, MenuButton *, void ); DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void ); DECL_LINK_TYPED( AddCommandsHdl, Button *, void ); + DECL_LINK_TYPED( AddSeparatorHdl, Button *, void ); DECL_LINK_TYPED( DeleteCommandHdl, Button *, void ); DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void ); @@ -570,6 +572,7 @@ private: DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void ); DECL_LINK_TYPED( NewToolbarHdl, Button *, void ); DECL_LINK_TYPED( AddCommandsHdl, Button *, void ); + DECL_LINK_TYPED( AddSeparatorHdl, Button *, void ); DECL_LINK_TYPED( DeleteCommandHdl, Button *, void ); DECL_LINK_TYPED( ResetTopLevelHdl, Button *, void ); DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void ); diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui index f13192593d40..03f46d50f5df 100644 --- a/cui/uiconfig/ui/menuassignpage.ui +++ b/cui/uiconfig/ui/menuassignpage.ui @@ -369,7 +369,7 @@ start - Add... + Add Command True True True @@ -381,6 +381,20 @@ 0 + + + Add Separator + True + True + True + True + + + True + True + 1 + + 0 @@ -525,14 +539,6 @@ True - - - True - False - Add Separator - True - - True