summaryrefslogtreecommitdiff
path: root/sfx2/source/control/templatelocalview.cxx
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-19 14:08:08 -0430
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-08-20 06:40:49 +0200
commit6b697baf5bbfede880e1564111aa92503e4f3102 (patch)
treefee74155f0cad2cf444d8f5c1301e6e088ea0f6e /sfx2/source/control/templatelocalview.cxx
parentc0667d15539c0834ef69dda2267ba29084958658 (diff)
Ask user if it wants to overwrite a template
Change-Id: I4e0aa8938ebd197b4b77767b9930a389569ba98d
Diffstat (limited to 'sfx2/source/control/templatelocalview.cxx')
-rw-r--r--sfx2/source/control/templatelocalview.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 89704b402f95..79e382f13dee 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -679,6 +679,29 @@ bool TemplateLocalView::saveTemplateAs(const TemplateLocalViewItem *pDstItem,
return true;
}
+bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, const OUString &rName) const
+{
+ for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+ {
+ if (mItemList[i]->mnId == nRegionItemId)
+ {
+ TemplateLocalViewItem *pRegItem =
+ static_cast<TemplateLocalViewItem*>(mItemList[i]);
+
+ std::vector<TemplateItemProperties>::iterator aIter;
+ for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter)
+ {
+ if (aIter->aName == rName)
+ return false;
+ }
+
+ break;
+ }
+ }
+
+ return true;
+}
+
void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
{
// Fill templates