[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Akshay Deep
akshaydeepiitr at gmail.com
Wed Jun 8 12:35:40 UTC 2016
include/sfx2/thumbnailview.hxx | 3 +++
sfx2/source/control/thumbnailview.cxx | 26 ++++++++++++++++++++++++--
sfx2/source/doc/templatedlg.cxx | 4 ++++
3 files changed, 31 insertions(+), 2 deletions(-)
New commits:
commit 06eba148481b9eeeff3ea30ea73f2ea3765bd92f
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date: Tue Jun 7 13:30:10 2016 +0530
Disable multiselection in Impress Template Selection
Added possibility to select single item in ThumbnailView.
Then, used it in Template Selection dialog.
Change-Id: I39b2ea83479ae1536285d4037fb1d24455a52ddc
Reviewed-on: https://gerrit.libreoffice.org/25998
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 4af3061..721503e 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -226,6 +226,8 @@ public:
void ShowTooltips( bool bShowTooltips );
+ void SetMultiSelectionEnabled( bool bIsMultiSelectionEnabled = true );
+
void filterItems (const std::function<bool (const ThumbnailViewItem*) > &func);
void setItemStateHdl (const Link<const ThumbnailViewItem*,void> &aLink) { maItemStateHdl = aLink; }
@@ -312,6 +314,7 @@ protected:
bool mbIsTransientChildrenDisabled : 1;
bool mbHasVisibleItems : 1;
bool mbShowTooltips : 1;
+ bool mbIsMultiSelectionEnabled: 1;
Color maFillColor; ///< Background color of the thumbnail view widget.
Color maTextColor; ///< Text color.
Color maHighlightColor; ///< Color of the highlight (background) of the hovered item.
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 78e0569..d25e279 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -145,6 +145,7 @@ void ThumbnailView::ImplInit()
mbScroll = false;
mbHasVisibleItems = false;
mbShowTooltips = false;
+ mbIsMultiSelectionEnabled = true;
maFilterFunc = ViewFilterAll();
maFillColor = GetSettings().GetStyleSettings().GetFieldColor();
maTextColor = GetSettings().GetStyleSettings().GetWindowTextColor();
@@ -611,7 +612,7 @@ void ThumbnailView::KeyInput( const KeyEvent& rKEvt )
Control::KeyInput( rKEvt );
}
- if ( pNext )
+ if ( pNext && mbIsMultiSelectionEnabled)
{
if (aKeyCode.IsShift() && bValidRange)
{
@@ -676,6 +677,12 @@ void ThumbnailView::KeyInput( const KeyEvent& rKEvt )
MakeItemVisible(pNext->mnId);
}
+ else if(pNext && !mbIsMultiSelectionEnabled)
+ {
+ deselectItems();
+ SelectItem(pNext->mnId);
+ MakeItemVisible(pNext->mnId);
+ }
}
void ThumbnailView::MakeItemVisible( sal_uInt16 nItemId )
@@ -728,7 +735,17 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
return;
}
- if ( rMEvt.GetClicks() == 1 )
+ if ( rMEvt.GetClicks() == 1 && !mbIsMultiSelectionEnabled )
+ {
+ deselectItems();
+ pItem->setSelection(!pItem->isSelected());
+
+ if (!pItem->isHighlighted())
+ DrawItem(pItem);
+
+ maItemStateHdl.Call(pItem);
+ }
+ else if(rMEvt.GetClicks() == 1)
{
if (rMEvt.IsMod1())
{
@@ -1159,6 +1176,11 @@ void ThumbnailView::ShowTooltips( bool bShowTooltips )
mbShowTooltips = bShowTooltips;
}
+void ThumbnailView::SetMultiSelectionEnabled( bool bIsMultiSelectionEnabled )
+{
+ mbIsMultiSelectionEnabled = bIsMultiSelectionEnabled;
+}
+
void ThumbnailView::filterItems(const std::function<bool (const ThumbnailViewItem*)> &func)
{
mnFirstLine = 0; // start at the top of the list instead of the current position
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fe51702..41224d5 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1678,6 +1678,10 @@ SfxTemplateSelectionDlg::SfxTemplateSelectionDlg(vcl::Window* pParent):
mpLocalView->setOpenTemplateHdl(LINK(this,SfxTemplateSelectionDlg, OpenTemplateHdl));
mpSearchView->setOpenTemplateHdl(LINK(this,SfxTemplateSelectionDlg, OpenTemplateHdl));
+
+ mpLocalView->SetMultiSelectionEnabled(false);
+ mpSearchView->SetMultiSelectionEnabled(false);
+
mpOKButton->SetClickHdl(LINK(this, SfxTemplateSelectionDlg, OkClickHdl));
}
More information about the Libreoffice-commits
mailing list