[Libreoffice-commits] core.git: sc/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 23 05:58:59 UTC 2019


 sc/source/ui/cctrl/checklistmenu.cxx |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 3e50aea3c723e82ea4acf32aae8d72e875d4b321
Author:     Jim Raykowski <raykowj at gmail..com>
AuthorDate: Mon Jul 15 23:41:55 2019 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Tue Jul 23 07:58:10 2019 +0200

    tdf#122774 Make all ScCheckListMenuWindow items keyboard accessible
    
    This patch provides keyboard tab navigation to the menu window menu
    items.
    
    In addition to the Ok button being already disabled when search is empty
    the patch disables the check list box, toggle all check box select,
    single button and unselect single button. This prevents keyboard focus
    from being trapped in the check list box and from tab navigation visting
    useless controls when search is empty.
    
    This patch also provides a hack fix for tdf#122772
    
    Change-Id: I7677d544ae63acc8eca08877ecd001d394fcfaca
    Reviewed-on: https://gerrit.libreoffice.org/75684
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 2b74bfd3d605..43553d305f38 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1210,6 +1210,7 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, TriStateHdl, Button*, void)
     }
 
     mePrevToggleAllState = maChkToggleAll->GetState();
+    maTabStops.SetTabStop(maChkToggleAll); // Needed for when accelerator is used
 }
 
 IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
@@ -1285,7 +1286,14 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
         maChkToggleAll->SetState( TRISTATE_INDET );
 
     if ( !maConfig.mbAllowEmptySet )
-        maBtnOk->Enable( nSelCount != 0);
+    {
+        const bool bEmptySet( nSelCount == 0 );
+        maChecks->Enable( !bEmptySet );
+        maChkToggleAll->Enable( !bEmptySet );
+        maBtnSelectSingle->Enable( !bEmptySet );
+        maBtnUnselectSingle->Enable( !bEmptySet );
+        maBtnOk->Enable( !bEmptySet );
+    }
 }
 
 IMPL_LINK( ScCheckListMenuWindow, CheckHdl, SvTreeListBox*, pChecks, void )
@@ -1323,14 +1331,27 @@ void ScCheckListMenuWindow::MouseMove(const MouseEvent& rMEvt)
 
 bool ScCheckListMenuWindow::EventNotify(NotifyEvent& rNEvt)
 {
-    if (rNEvt.GetType() == MouseNotifyEvent::KEYUP)
+    MouseNotifyEvent nType = rNEvt.GetType();
+    if (HasFocus() && nType == MouseNotifyEvent::GETFOCUS)
+    {
+        setSelectedMenuItem( 0 , false, false );
+        return true;
+    }
+    if (nType == MouseNotifyEvent::KEYINPUT)
     {
         const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
         const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
-        bool bShift = rCode.IsShift();
-        if (rCode.GetCode() == KEY_TAB)
+        const sal_uInt16 nCode = rCode.GetCode();
+        if (rCode.IsMod2()) // Hack to prevent tdf#122772
+        {
+            if (nCode == KEY_DOWN || nCode == KEY_RIGHT)
+                return true;
+        }
+        else
         {
-            maTabStops.CycleFocus(bShift);
+            bool bShift = rCode.IsShift();
+            if (nCode == KEY_TAB)
+                maTabStops.CycleFocus(bShift);
             return true;
         }
     }


More information about the Libreoffice-commits mailing list