Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2910
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/10/2910/1
Template Manager: select first item when getting focus if no selection
Change-Id: Ie012e010ca92728725535345c76fc9f5eb31a254
(cherry picked from commit ec2f84b376f595b0553297d25b7716f6b97e1b87)
---
M sfx2/source/control/thumbnailview.cxx
1 file changed, 18 insertions(+), 1 deletion(-)
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::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()
--
To view, visit https://gerrit.libreoffice.org/2910
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie012e010ca92728725535345c76fc9f5eb31a254
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Context
- [PATCH libreoffice-4-0] Template Manager: select first item when getting focus if no... · Bosdonnat Cedric (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.