diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2013-03-27 18:19:53 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2013-03-28 00:21:15 -0430 |
commit | 85b567374edb6456fcf7d1c78dc0ba5d8a3afb10 (patch) | |
tree | d067ad692b9eb5a104087dd12f89a25362bb6ec4 /sfx2/source/control/templatelocalview.cxx | |
parent | a544f366867cb03ccc3a90703fc437e81fabc7a2 (diff) |
fdo#60581 Import templates into current directory.
Change-Id: I965586748ab51ddb6face485e0db292c4c7b5274
Diffstat (limited to 'sfx2/source/control/templatelocalview.cxx')
-rw-r--r-- | sfx2/source/control/templatelocalview.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index a73fa23ce3b9..b6fcc50b44d0 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -590,6 +590,42 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx return false; } +bool TemplateLocalView::copyFrom(const OUString &rPath) +{ + assert(mnCurRegionId); + + TemplateContainerItem *pRegItem = maRegions[mnCurRegionId-1]; + + sal_uInt16 nId = getNextItemId(); + sal_uInt16 nDocId = 0; + sal_uInt16 nRegionId = pRegItem->mnRegionId; + + String aPath(rPath); + + if (!pRegItem->maTemplates.empty()) + nDocId = (pRegItem->maTemplates.back()).nDocId+1; + + if (!mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath)) + return false; + + TemplateItemProperties aTemplate; + aTemplate.aIsFolder = false; + aTemplate.nId = nId; + aTemplate.nDocId = nDocId; + aTemplate.nRegionId = nRegionId; + aTemplate.aName = aPath; + aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(rPath, + TEMPLATE_THUMBNAIL_MAX_WIDTH, + TEMPLATE_THUMBNAIL_MAX_HEIGHT); + aTemplate.aPath = rPath; + + pRegItem->maTemplates.push_back(aTemplate); + + insertItem(aTemplate); + + return true; +} + bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString &rPath) { sal_uInt16 nId = 1; |