diff options
-rw-r--r-- | include/sfx2/sidebar/TabBar.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 19 |
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()) |