diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-03-25 16:40:37 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-03-25 18:18:21 +0100 |
commit | cc599e914e7ade9f10da460fc1c77ea07454d7ff (patch) | |
tree | 9bb866a7558eea8891857de6dcb88a9fa2734008 /sfx2/source/control | |
parent | e21114a9282096e2b7e5ebbc4dd74e2f85c7e36c (diff) |
fdo#61390: allow arrow keys to show hidden thumbnail items
Change-Id: I70924b4c9578122a1c5a5b6c8a67889d6d003a2e
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index cc05d70eca7a..400b5ab97b81 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -550,13 +550,40 @@ void ThumbnailView::KeyInput( const KeyEvent& rKEvt ) Control::KeyInput( rKEvt ); } - if ( pNext && pNext->isVisible() ) + if ( pNext ) { deselectItems(); SelectItem(pNext->mnId); + MakeItemVisible(pNext->mnId); } } +void ThumbnailView::MakeItemVisible( sal_uInt16 nItemId ) +{ + // Get the item row + size_t nPos = 0; + bool bFound = false; + for ( size_t i = 0; !bFound && i < mFilteredItemList.size(); ++i ) + { + ThumbnailViewItem* pItem = mFilteredItemList[i]; + if ( pItem->mnId == nItemId ) + { + nPos = i; + bFound = true; + } + } + sal_uInt16 nRow = nPos / mnCols; + + // Move the visible rows as little as possible to include that one + if ( nRow < mnFirstLine ) + mnFirstLine = nRow; + else if ( nRow > mnFirstLine + mnVisLines ) + mnFirstLine = nRow - mnVisLines; + + CalculateItemPositions(); + Invalidate(); +} + void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) @@ -700,11 +727,11 @@ void ThumbnailView::LoseFocus() void ThumbnailView::Resize() { + Control::Resize(); CalculateItemPositions(); if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - Control::Resize(); } void ThumbnailView::StateChanged( StateChangedType nType ) |