include/svtools/treelistbox.hxx       |    1 +
 sd/source/ui/dlg/navigatr.cxx         |   14 ++++++++++++++
 svtools/source/contnr/treelistbox.cxx |   13 +++++++++++++
 3 files changed, 28 insertions(+)

New commits:
commit 056c3bf2dcae23cd711d4cbffc3058cf31bfe75e
Author: Kshitij Pathania <kshitijpatha...@gmail.com>
Date:   Sat Jan 27 00:40:50 2018 +0530

    tdf#111837 removed lag in navigator selection update
    
    Change-Id: I0d15f8352ab1d8846df3b03334bda20550d117d2
    Reviewed-on: https://gerrit.libreoffice.org/48717
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index adf8a079a2a2..6803524a7b13 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -746,6 +746,7 @@ public:
 
     SvTreeListEntry*    GetFirstEntryInView() const;
     SvTreeListEntry*    GetNextEntryInView(SvTreeListEntry*) const;
+    SvTreeListEntry*    GetPrevEntryInView(SvTreeListEntry*) const;
     SvTreeListEntry*    GetLastEntryInView() const;
     void            ScrollToAbsPos( long nPos );
 
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 3ffbe5942ed9..0fe0f97481c8 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -222,13 +222,27 @@ IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl, ToolBox 
*, void)
     PageJump ePage = PAGE_NONE;
 
     if (sCommand == "first")
+    {
         ePage = PAGE_FIRST;
+        maTlbObjects->Select( maTlbObjects->GetFirstEntryInView() );
+    }
     else if (sCommand == "previous")
+    {
         ePage = PAGE_PREVIOUS;
+        if( maTlbObjects->GetPrevEntryInView( maTlbObjects->GetCurEntry() ) != 
nullptr )
+            maTlbObjects->Select( maTlbObjects->GetPrevEntryInView( 
maTlbObjects->GetCurEntry() ) );
+    }
     else if (sCommand == "next")
+    {
         ePage = PAGE_NEXT;
+        if( maTlbObjects->GetNextEntryInView( maTlbObjects->GetCurEntry() ) != 
nullptr )
+            maTlbObjects->Select( maTlbObjects->GetNextEntryInView( 
maTlbObjects->GetCurEntry() ) );
+    }
     else if (sCommand == "last")
+    {
         ePage = PAGE_LAST;
+        maTlbObjects->Select( maTlbObjects->GetLastEntryInView() );
+    }
 
     if (ePage != PAGE_NONE)
     {
diff --git a/svtools/source/contnr/treelistbox.cxx 
b/svtools/source/contnr/treelistbox.cxx
index 1a8c07d521a6..64236a8a8d45 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3489,6 +3489,19 @@ SvTreeListEntry* 
SvTreeListBox::GetNextEntryInView(SvTreeListEntry* pEntry ) con
     return pNext;
 }
 
+SvTreeListEntry* SvTreeListBox::GetPrevEntryInView(SvTreeListEntry* pEntry ) 
const
+{
+    SvTreeListEntry* pPrev = PrevVisible( pEntry );
+    if( pPrev )
+    {
+        Point aPos( GetEntryPosition(pPrev) );
+        const Size& rSize = pImpl->GetOutputSize();
+        if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
+            return nullptr;
+    }
+    return pPrev;
+}
+
 SvTreeListEntry* SvTreeListBox::GetLastEntryInView() const
 {
     SvTreeListEntry* pEntry = GetFirstEntryInView();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to