[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 17 23:09:43 UTC 2018


 include/sfx2/sidebar/TabBar.hxx           |    1 -
 sfx2/source/sidebar/SidebarController.cxx |    7 +------
 sfx2/source/sidebar/TabBar.cxx            |   19 +++++--------------
 3 files changed, 6 insertions(+), 21 deletions(-)

New commits:
commit 6626281b4a123cfb5e2c8f449b55f4acd46ee198
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Fri Oct 5 21:46:41 2018 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Oct 18 01:08:42 2018 +0200

    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 at gmail.com>
    Tested-by: Heiko Tietze <tietze.heiko at gmail.com>
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

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())


More information about the Libreoffice-commits mailing list