diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-28 22:36:17 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-29 21:29:27 -0430 |
commit | 3187312a1e2de62fde48e600c97ad891bbf82c5d (patch) | |
tree | 5d7a60f127de04076e80852492c3bf3afbd78f1c /sfx2 | |
parent | 29536cbd49c4bb51cb668f8f2ce45365b29d8333 (diff) |
Erase templates selected in the search view.
Change-Id: I3c1035d061ec6c3e7430a1703d6873dc6d2b1d33
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index bdf48b3cd26d..118e063477e9 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -765,13 +765,43 @@ void SfxTemplateManagerDlg::OnTemplateProperties () void SfxTemplateManagerDlg::OnTemplateDelete () { - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) + if (mpSearchView->IsVisible()) { - if (maView->removeTemplate((*pIter)->mnId,maView->getOverlayRegionId()+1)) - maSelTemplates.erase(pIter++); - else - ++pIter; + std::set<const ThumbnailViewItem*>::const_iterator pIter; + for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) + { + const TemplateSearchViewItem *pItem = + static_cast<const TemplateSearchViewItem*>(*pIter); + + sal_uInt16 nItemId = pItem->mnIdx + 1; + sal_uInt16 nItemRegionId = pItem->mnRegionId + 1; + + if (maView->removeTemplate(nItemId,nItemRegionId)) + maSelTemplates.erase(pIter++); + else + ++pIter; + } + + // Update search results + if (maSelTemplates.empty()) + { + mpTemplateBar->Show(false); + mpViewBar->Show(); + mpActionBar->Show(); + } + + SearchUpdateHdl(mpSearchEdit); + } + else + { + std::set<const ThumbnailViewItem*>::const_iterator pIter; + for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) + { + if (maView->removeTemplate((*pIter)->mnId,maView->getOverlayRegionId()+1)) + maSelTemplates.erase(pIter++); + else + ++pIter; + } } } |