summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2018-10-05 21:46:41 -0800
committerJim Raykowski <raykowj@gmail.com>2018-10-18 01:08:42 +0200
commit6626281b4a123cfb5e2c8f449b55f4acd46ee198 (patch)
tree3540ad24425b07af8a1077d58e8fcf69cb364026
parent044122de1153bd785ed555c96b6aca67e9d0f739 (diff)
tdf#120231 Focus to document on sidebar tabbar deck tab click
Change-Id: Ic93b0171c9862f70311e93d64d1b93baf35a5182 Reviewed-on: https://gerrit.libreoffice.org/61457 Tested-by: Jenkins Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com> Tested-by: Heiko Tietze <tietze.heiko@gmail.com> Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--include/sfx2/sidebar/TabBar.hxx1
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx7
-rw-r--r--sfx2/source/sidebar/TabBar.cxx19
3 files changed, 6 insertions, 21 deletions
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 0c6cd097711c..783741ac7443 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -87,7 +87,6 @@ public:
void HighlightDeck (const OUString& rsDeckId);
void RemoveDeckHighlight ();
OUString const & GetDeckIdForIndex (const sal_Int32 nIndex) const;
- sal_Int32 GetDeckIndexForId (const OUString& rsDeckId);
void ToggleHideFlag (const sal_Int32 nIndex);
void RestoreHideFlags();
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d16195447222..9765f16540bd 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1111,12 +1111,7 @@ void SidebarController::RequestCloseDeck()
mbIsDeckRequestedOpen = false;
UpdateDeckOpenState();
- if (mpCurrentDeck.get())
- {
- sal_Int32 nIndex(mpTabBar->GetDeckIndexForId(mpCurrentDeck->GetId()));
- maFocusManager.GrabFocusButton(nIndex);
- }
- else
+ if (!mpCurrentDeck.get())
mpTabBar->RemoveDeckHighlight();
}
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 4d6a67ed22d2..dd9881b18bac 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -37,6 +37,8 @@
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <sfx2/app.hxx>
+
using namespace css;
using namespace css::uno;
@@ -297,9 +299,10 @@ Image TabBar::GetItemImage(const DeckDescriptor& rDeckDescriptor) const
mxFrame);
}
-IMPL_LINK(TabBar::Item, HandleClick, Button*, pBtn, void)
+IMPL_LINK_NOARG(TabBar::Item, HandleClick, Button*, void)
{
- pBtn->GrabFocus();
+ vcl::Window* pFocusWin = Application::GetFocusWindow();
+ pFocusWin->GrabFocusToDocument();
try
{
maDeckActivationFunctor(msDeckId);
@@ -315,18 +318,6 @@ OUString const & TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
return maItems[nIndex].msDeckId;
}
-sal_Int32 TabBar::GetDeckIndexForId (const OUString& rsDeckId)
-{
- sal_Int32 nIndex(1);
- for (auto const& item : maItems)
- {
- if (item.msDeckId == rsDeckId)
- return nIndex;
- nIndex++;
- }
- return 0;
-}
-
void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
{
if (nIndex<0 || static_cast<size_t>(nIndex) >= maItems.size())