From 74fd959945dbbfbc3dcc331a08ff8fc7c6410295 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Wed, 14 Sep 2016 02:02:38 +0300 Subject: tdf#74377 Keyboard shortcuts for context menus Configurable through the options dialog. The default behavior depends on the current vclplug (hide for gtk2/3 and OS X, show otherwise). Menus currently affected by this change: - SfxDispatcher based context menus - chart2 context menus - vcl's Edit control context menu - Several MenuBarManager based toolbar dropdowns. Change-Id: Iad9fb99dc90e01c17cba9c07c1a2b262b920e11d Reviewed-on: https://gerrit.libreoffice.org/28849 Reviewed-by: Maxim Monastirsky Tested-by: Maxim Monastirsky --- cui/source/options/optgdlg.cxx | 17 +++++++++++++++++ cui/source/options/optgdlg.hxx | 1 + cui/uiconfig/ui/optviewpage.ui | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) (limited to 'cui') diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 0371321bc041..4c59db28ebe3 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -630,6 +630,7 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet) get(m_pAAPointLimitLabel, "aafrom"); get(m_pAAPointLimit, "aanf"); get(m_pMenuIconsLB, "menuicons"); + get(m_pContextMenuShortcutsLB, "contextmenushortcuts"); get(m_pFontShowCB, "showfontpreview"); get(m_pUseHardwareAccell, "useaccel"); get(m_pUseAntiAliase, "useaa"); @@ -711,6 +712,7 @@ void OfaViewTabPage::dispose() m_pAAPointLimitLabel.clear(); m_pAAPointLimit.clear(); m_pMenuIconsLB.clear(); + m_pContextMenuShortcutsLB.clear(); m_pFontShowCB.clear(); m_pUseHardwareAccell.clear(); m_pUseAntiAliase.clear(); @@ -867,6 +869,16 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) bAppearanceChanged = true; } + if(m_pContextMenuShortcutsLB->IsValueChangedFromSaved()) + { + aMenuOpt.SetContextMenuShortcuts(m_pContextMenuShortcutsLB->GetSelectEntryPos() == 0 ? + TRISTATE_INDET : + static_cast(m_pContextMenuShortcutsLB->GetSelectEntryPos() - 1)); + bModified = true; + bMenuOptModified = true; + bAppearanceChanged = true; + } + // #i95644# if disabled, do not use value, see in ::Reset() if(m_pUseHardwareAccell->IsEnabled()) { @@ -994,6 +1006,11 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_pMenuIconsLB->SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1); m_pMenuIconsLB->SaveValue(); + TriState eContextMenuShortcuts = aMenuOpt.GetContextMenuShortcuts(); + bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE; + m_pContextMenuShortcutsLB->SelectEntryPos(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0); + m_pContextMenuShortcutsLB->SaveValue(); + { // #i95644# HW accel (unified to disable mechanism) if(pCanvasSettings->IsHardwareAccelerationAvailable()) { diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 9ec785123266..b204930eb035 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -89,6 +89,7 @@ private: VclPtr m_pAAPointLimit; VclPtr m_pMenuIconsLB; + VclPtr m_pContextMenuShortcutsLB; VclPtr m_pFontShowCB; diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui index 834b8000d450..66296b77aea6 100644 --- a/cui/uiconfig/ui/optviewpage.ui +++ b/cui/uiconfig/ui/optviewpage.ui @@ -1,5 +1,5 @@ - + @@ -195,6 +195,40 @@ 0 + + + True + False + + Automatic + Hide + Show + + + + 1 + 2 + + + + + True + False + 6 + 6 + Shortcuts in context menus: + True + contextmenushortcuts + + + 0 + 1 + 2 + + + + + -- cgit