svtools/source/contnr/svimpbox.cxx |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

New commits:
commit f36ca2f32d8f27681b2a1ef9fd7f59db21f67ec6
Author: Niklas Johansson <sleeping.pil...@gmail.com>
Date:   Sun Aug 17 20:53:47 2014 +0200

    Treeview may lose focus when left/right arrow is used
    
    In a treeview, for example the hierarchal view of the
    styles and formatting panel, if your not on a node that is
    expandable or collapsable when you press the left or right
    arrow key, the focus will move away from the tree view in
    a very awkward way. This patch makes the control work more
    like a native treeview.
    
    At this point I don't feel confident about the surrounding
    code to avoid the code duplication that this patch adds.
    
    Reviewed-on: https://gerrit.libreoffice.org/10956
    Reviewed-by: Thomas Arnhold <tho...@arnhold.org>
    Tested-by: Thomas Arnhold <tho...@arnhold.org>
    (cherry picked from commit a6f78bf8fd5dc768cc8c37ca717d7bad8fe2dc81)
    
    Change-Id: Ibd04cf5329b4d226aac102d214a45e45811982e7
    Reviewed-on: https://gerrit.libreoffice.org/11255
    Reviewed-by: Thomas Arnhold <tho...@arnhold.org>
    Tested-by: Thomas Arnhold <tho...@arnhold.org>
    (cherry picked from commit bee7674a602123229b62cad23536f103496a5298)
    Reviewed-on: https://gerrit.libreoffice.org/11310
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svtools/source/contnr/svimpbox.cxx 
b/svtools/source/contnr/svimpbox.cxx
index 0099dd2..07ac082 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -2223,8 +2223,13 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
 
         case KEY_RIGHT:
         {
-            if( bSubLstOpLR && IsNowExpandable() )
-                pView->Expand( pCursor );
+            if( bSubLstOpLR )
+            {
+                // only try to expand if sublist is expandable,
+                // otherwise ignore the key press
+                if( IsNowExpandable() )
+                    pView->Expand( pCursor );
+            }
             else if ( bIsCellFocusEnabled && pCursor )
             {
                 if ( nCurTabPos < ( pView->TabCount() - 1 /*!2*/ ) )
@@ -2290,8 +2295,17 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
                     }
                 }
             }
-            else if( bSubLstOpLR && IsExpandable() )
-                pView->Collapse( pCursor );
+            else if( bSubLstOpLR )
+            {
+                if( IsExpandable() && pView->IsExpanded( pCursor ) )
+                    pView->Collapse( pCursor );
+                else
+                {
+                    pNewCursor = pView->GetParent( pCursor );
+                    if( pNewCursor )
+                        SetCursor( pNewCursor );
+                }
+            }
             else
                 bKeyUsed = false;
             break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to