diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-09-01 01:22:57 -0800 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-11-01 10:18:54 +0100 |
commit | 27ea5f66c788443aef38cfc5378ec6410d722a9f (patch) | |
tree | 5e7a3abda86c9a54202e4e5b940efa2470419780 /sfx2/source/sidebar | |
parent | ab58646b3eefcdee9e6ad786b8eed27390da4419 (diff) |
tdf#119631 Keyboard navigation: Skip hidden tabs in sidebar tab bar
Change-Id: I6ac001c27d6947f379c9923ff8518f9983faa356
Reviewed-on: https://gerrit.libreoffice.org/62716
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2/source/sidebar')
-rw-r--r-- | sfx2/source/sidebar/FocusManager.cxx | 35 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 1 |
2 files changed, 28 insertions, 8 deletions
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index a95b4405ffd0..b55c356364a2 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -453,21 +453,34 @@ void FocusManager::HandleKeyEvent ( else if (IsDeckTitleVisible()) FocusDeckTitle(); else - FocusButton(maButtons.size()-1); + { + // Focus the last button. + sal_Int32 nIndex(maButtons.size()-1); + while(!maButtons[nIndex].get()->IsVisible() && --nIndex > 0); + FocusButton(nIndex); + } break; case PC_DeckTitle: case PC_DeckToolBox: + { // Focus the last button. - FocusButton(maButtons.size()-1); + sal_Int32 nIndex(maButtons.size()-1); + while(!maButtons[nIndex].get()->IsVisible() && --nIndex > 0); + FocusButton(nIndex); break; + } case PC_TabBar: // Go to previous tab bar item. if (aLocation.mnIndex == 0) FocusPanel(maPanels.size()-1, true); else - FocusButton((aLocation.mnIndex + maButtons.size() - 1) % maButtons.size()); + { + sal_Int32 nIndex((aLocation.mnIndex + maButtons.size() - 1) % maButtons.size()); + while(!maButtons[nIndex].get()->IsVisible() && --nIndex > 0); + FocusButton(nIndex); + } break; default: @@ -501,13 +514,19 @@ void FocusManager::HandleKeyEvent ( case PC_TabBar: // Go to next tab bar item. if (aLocation.mnIndex < static_cast<sal_Int32>(maButtons.size())-1) - FocusButton(aLocation.mnIndex + 1); - else { - FocusPanel(0, true); - if (IsDeckTitleVisible()) - FocusDeckTitle(); + sal_Int32 nIndex(aLocation.mnIndex + 1); + while(!maButtons[nIndex].get()->IsVisible() && ++nIndex < static_cast<sal_Int32>(maButtons.size())); + if (nIndex < static_cast<sal_Int32>(maButtons.size())) + { + FocusButton(nIndex); + break; + } } + if (IsDeckTitleVisible()) + FocusDeckTitle(); + else + FocusPanel(0, true); break; default: diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 82f4eceebd28..338fd9d6137d 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1097,6 +1097,7 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu, bool) // Notify the tab bar about the updated set of decks. mpTabBar->SetDecks(aDecks); mpTabBar->HighlightDeck(mpCurrentDeck->GetId()); + mpTabBar->UpdateFocusManager(maFocusManager); } mpParentWindow->GrabFocusToDocument(); } |