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

New commits:
commit 32cf2f6614526e560623498afe4d80b29fc52649
Author:     Jim Raykowski <rayk...@gmail..com>
AuthorDate: Mon Jul 15 23:41:55 2019 -0800
Commit:     Xisco FaulĂ­ <xiscofa...@libreoffice.org>
CommitDate: Fri Aug 2 17:18:44 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 <rayk...@gmail.com>
    (cherry picked from commit 3e50aea3c723e82ea4acf32aae8d72e875d4b321)
    Reviewed-on: https://gerrit.libreoffice.org/76532
    Reviewed-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>
    (cherry picked from commit f111aba46cbb037bd82d7246bb0a111b87931f03)
    Reviewed-on: https://gerrit.libreoffice.org/76564

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 492c64b3d1c7..587e2e41a353 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1207,6 +1207,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)
@@ -1282,7 +1283,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 )
@@ -1320,14 +1328,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;
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to