diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-06-07 13:30:10 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-06-08 12:35:16 +0000 |
commit | 06eba148481b9eeeff3ea30ea73f2ea3765bd92f (patch) | |
tree | 28ad7858c69ef9bb4c428f7c6ce9addd9f77314a /sfx2 | |
parent | d1b6149415a07e8de86d955df2f5d9693b3b8408 (diff) |
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@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 4 |
2 files changed, 28 insertions, 2 deletions
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 78e0569069c0..d25e27919a94 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 fe51702eaa12..41224d5a1bf0 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)); } |