diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-06-03 03:43:09 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-06-03 14:38:04 +0000 |
commit | 9b7bf60536bfab26445c0165f50392c1258c4cda (patch) | |
tree | 3641e6ac753f0cc0423a6eb262b03af5aab6ba25 /sfx2 | |
parent | a4740c8ea92cc50c1dc6e87d06db190800269a5d (diff) |
tdf#100195 Enable Keyboard Navigation in Template Manager and Start Center
Change-Id: Ic5447a4af091a4e3dcab4d909fc6bfb9e559defb
Reviewed-on: https://gerrit.libreoffice.org/25848
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/templateabstractview.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/control/templatelocalview.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/templatesearchview.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 4 |
5 files changed, 35 insertions, 10 deletions
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx index 27dd8ff03687..7bfd0a272b38 100644 --- a/sfx2/source/control/templateabstractview.cxx +++ b/sfx2/source/control/templateabstractview.cxx @@ -104,14 +104,21 @@ void TemplateAbstractView::dispose() ThumbnailView::dispose(); } -void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates) +void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected) { + mItemList.clear(); + std::vector<ThumbnailViewItem*> aItems(rTemplates.size()); for (size_t i = 0, n = rTemplates.size(); i < n; ++i ) { const TemplateItemProperties *pCur = &rTemplates[i]; - TemplateViewItem *pChild = new TemplateViewItem(*this, pCur->nId); + TemplateViewItem *pChild; + if(isRegionSelected) + pChild = new TemplateViewItem(*this, pCur->nId); + else + pChild = new TemplateViewItem(*this, i+1); + pChild->mnDocId = pCur->nDocId; pChild->mnRegionId = pCur->nRegionId; pChild->maTitle = pCur->aName; @@ -140,8 +147,11 @@ void TemplateAbstractView::updateThumbnailDimensions(long itemMaxSize) void TemplateAbstractView::MouseButtonDown( const MouseEvent& rMEvt ) { + GrabFocus(); + if (rMEvt.IsRight()) { + deselectItems(); size_t nPos = ImplGetItem(rMEvt.GetPosPixel()); Point aPosition (rMEvt.GetPosPixel()); maPosition = aPosition; diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 14d5c3991ce9..5174778f6c9f 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -143,7 +143,7 @@ void TemplateLocalView::showAllTemplates() mnCurRegionId = 0; maCurRegionName.clear(); - insertItems(maAllTemplates); + insertItems(maAllTemplates, false); maOpenRegionHdl.Call(nullptr); } @@ -575,7 +575,7 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s if (pPropIter->nDocId == pViewItem->mnDocId) { pPropIter = pSrc->maTemplates.erase(pPropIter); - aItemIds.push_back(pViewItem->mnId); + aItemIds.push_back(pViewItem->mnDocId + 1);//mnid } else { diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx index 9f851715ad89..3075d4087a67 100644 --- a/sfx2/source/control/templatesearchview.cxx +++ b/sfx2/source/control/templatesearchview.cxx @@ -33,8 +33,10 @@ VCL_BUILDER_FACTORY(TemplateSearchView) void TemplateSearchView::MouseButtonDown( const MouseEvent& rMEvt ) { + GrabFocus(); if (rMEvt.IsRight()) { + deselectItems(); size_t nPos = ImplGetItem(rMEvt.GetPosPixel()); Point aPosition (rMEvt.GetPosPixel()); maPosition = aPosition; diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 5c81eb842c53..20e97a7ae2a9 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -392,7 +392,7 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) { if( rKeyCode.IsShift() ) // Shift + F6 { - if( mpAllRecentThumbnails->HasFocus() ) + if( mpAllRecentThumbnails->HasFocus() || mpLocalView->HasFocus()) { mpOpenButton->GrabFocus(); return true; @@ -400,16 +400,29 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) } else if ( rKeyCode.IsMod1() ) // Ctrl + F6 { - mpAllRecentThumbnails->GrabFocus(); - return true; + if(mpAllRecentThumbnails->IsVisible()) + { + mpAllRecentThumbnails->GrabFocus(); + return true; + } + else if(mpLocalView->IsVisible()) + { + mpLocalView->GrabFocus(); + return true; + } } else // F6 { - if( mpAllButtonsBox->HasChildPathFocus() ) + if(mpAllRecentThumbnails->IsVisible()) { mpAllRecentThumbnails->GrabFocus(); return true; } + else if(mpLocalView->IsVisible()) + { + mpLocalView->GrabFocus(); + return true; + } } } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index a05a30467323..54b22b329132 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -830,7 +830,7 @@ IMPL_LINK_TYPED(SfxTemplateManagerDlg, DeleteTemplateHdl, ThumbnailViewItem*, pI TemplateViewItem *pViewItem = static_cast<TemplateViewItem*>(pItem); sal_uInt16 nRegionItemId = mpLocalView->getRegionId(pViewItem->mnRegionId); - if (!mpLocalView->removeTemplate((pViewItem)->mnId,nRegionItemId)) + if (!mpLocalView->removeTemplate((pViewItem)->mnDocId + 1, nRegionItemId))//mnId w.r.t. region is mnDocId + 1; { aDeletedTemplate = (pItem)->maTitle; } @@ -1113,7 +1113,7 @@ void SfxTemplateManagerDlg::OnTemplateExport() OUString aPath = aPathObj.GetMainURL( INetURLObject::NO_DECODE ); - if (!mpLocalView->exportTo(pItem->mnId, + if (!mpLocalView->exportTo(pItem->mnDocId + 1, //mnId w.r.t. region = mDocId + 1 mpLocalView->getRegionId(pItem->mnRegionId), //pItem->mnRegionId does not store actual region Id aPath)) { |