diff options
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; + } } } |