[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Akshay Deep
akshaydeepiitr at gmail.com
Fri Jun 3 14:38:37 UTC 2016
include/sfx2/templateabstractview.hxx | 2 +-
sfx2/source/control/templateabstractview.cxx | 14 ++++++++++++--
sfx2/source/control/templatelocalview.cxx | 4 ++--
sfx2/source/control/templatesearchview.cxx | 2 ++
sfx2/source/dialog/backingwindow.cxx | 21 +++++++++++++++++----
sfx2/source/doc/templatedlg.cxx | 4 ++--
6 files changed, 36 insertions(+), 11 deletions(-)
New commits:
commit 9b7bf60536bfab26445c0165f50392c1258c4cda
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date: Fri Jun 3 03:43:09 2016 +0530
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 at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index 9d368c6..5b70fe1 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -74,7 +74,7 @@ public:
virtual void dispose() override;
// Fill view with new item list
- void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
+ void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true);
// Fill view with template folders thumbnails
virtual void Populate () { }
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 27dd8ff..7bfd0a2 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 14d5c39..5174778 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 9f85171..3075d40 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 5c81eb8..20e97a7 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 a05a304..54b22b3 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))
{
More information about the Libreoffice-commits
mailing list