[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sfx2/source
Cédric Bosdonnat
cedric.bosdonnat at free.fr
Fri Mar 22 09:35:04 PDT 2013
sfx2/source/control/thumbnailview.cxx | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 8396ef6b53bc2363aff158be34eeb93cd21fc2be
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed Mar 20 17:06:31 2013 +0100
Template Manager: select first item when getting focus if no selection
Change-Id: Ie012e010ca92728725535345c76fc9f5eb31a254
(cherry picked from commit ec2f84b376f595b0553297d25b7716f6b97e1b87)
Reviewed-on: https://gerrit.libreoffice.org/2910
Reviewed-by: Michael Meeks <michael.meeks at suse.com>
Tested-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index c996f0f..57dba07 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -579,12 +579,29 @@ void ThumbnailView::Paint( const Rectangle &aRect)
void ThumbnailView::GetFocus()
{
- Control::GetFocus();
+ // Select the first item if nothing selected
+ int nSelected = -1;
+ for (size_t i = 0, n = mItemList.size(); i < n && nSelected == -1; ++i)
+ {
+ if (mItemList[i]->isSelected())
+ nSelected = i;
+ }
+
+ if ( nSelected == -1 && mItemList.size( ) > 0 )
+ {
+ mItemList[0]->setSelection(true);
+ maItemStateHdl.Call(mItemList[0]);
+
+ if (IsReallyVisible() && IsUpdateMode())
+ Invalidate();
+ }
// Tell the accessible object that we got the focus.
ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation( GetAccessible( sal_False ) );
if( pAcc )
pAcc->GetFocus();
+
+ Control::GetFocus();
}
void ThumbnailView::LoseFocus()
More information about the Libreoffice-commits
mailing list