Kaydet (Commit) cc599e91 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

fdo#61390: allow arrow keys to show hidden thumbnail items

Change-Id: I70924b4c9578122a1c5a5b6c8a67889d6d003a2e
üst e21114a9
...@@ -273,6 +273,7 @@ protected: ...@@ -273,6 +273,7 @@ protected:
using Window::ImplInit; using Window::ImplInit;
void CalculateItemPositions (); void CalculateItemPositions ();
void MakeItemVisible( sal_uInt16 nId );
SFX2_DLLPRIVATE void ImplInit(); SFX2_DLLPRIVATE void ImplInit();
SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
......
...@@ -550,13 +550,40 @@ void ThumbnailView::KeyInput( const KeyEvent& rKEvt ) ...@@ -550,13 +550,40 @@ void ThumbnailView::KeyInput( const KeyEvent& rKEvt )
Control::KeyInput( rKEvt ); Control::KeyInput( rKEvt );
} }
if ( pNext && pNext->isVisible() ) if ( pNext )
{ {
deselectItems(); deselectItems();
SelectItem(pNext->mnId); 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 ) void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
{ {
if ( rMEvt.IsLeft() ) if ( rMEvt.IsLeft() )
...@@ -700,11 +727,11 @@ void ThumbnailView::LoseFocus() ...@@ -700,11 +727,11 @@ void ThumbnailView::LoseFocus()
void ThumbnailView::Resize() void ThumbnailView::Resize()
{ {
Control::Resize();
CalculateItemPositions(); CalculateItemPositions();
if ( IsReallyVisible() && IsUpdateMode() ) if ( IsReallyVisible() && IsUpdateMode() )
Invalidate(); Invalidate();
Control::Resize();
} }
void ThumbnailView::StateChanged( StateChangedType nType ) void ThumbnailView::StateChanged( StateChangedType nType )
......
...@@ -332,7 +332,7 @@ void SfxTemplateManagerDlg::Resize() ...@@ -332,7 +332,7 @@ void SfxTemplateManagerDlg::Resize()
Point aViewPos = maView->GetPosPixel(); Point aViewPos = maView->GetPosPixel();
aViewPos.setY(nToolbarsHeight); aViewPos.setY(nToolbarsHeight);
aViewPos.setX(0); aViewPos.setX(0);
Size aThumbSize(aWinSize.getWidth(), maTabControl.GetTabPageSizePixel().getWidth() - aViewPos.getY()); Size aThumbSize(aWinSize.getWidth(), maTabControl.GetTabPageSizePixel().getHeight() - aViewPos.getY());
maView->SetPosSizePixel(aViewPos, aThumbSize); maView->SetPosSizePixel(aViewPos, aThumbSize);
if (aWinSize.getHeight() < aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER) if (aWinSize.getHeight() < aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment