summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-11 08:48:50 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-11 19:57:43 -0430
commitc1149bb21895d313e57e28237e9dee7800e186e3 (patch)
tree470be1b06ee5f4f65da3b8488b2ea3a94732d3e3 /sfx2/source
parent5b5c81be22c2b9a1097ac48dfd9e015c141f729d (diff)
Fix importing from filesystem and from a remote repository.
Change-Id: Ibf1845b87b2b34b1933e56a61036dbffc69daead
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/control/templatelocalview.cxx60
1 files changed, 36 insertions, 24 deletions
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 78484ba90457..303e4d14b4dc 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -531,29 +531,37 @@ bool TemplateLocalView::moveTemplates(std::set<const ThumbnailViewItem *> &rItem
void TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail,
const OUString &rPath)
{
- sal_uInt16 nId = 0;
sal_uInt16 nRegionId = nRegionItemId - 1;
- if (!mItemList.empty())
- nId = (mItemList.back())->mnId;
+ for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+ {
+ if (mItemList[i]->mnId == nRegionItemId)
+ {
+ sal_uInt16 nId = 0;
+ sal_uInt16 nDocId = 0;
- String aPath(rPath);
+ TemplateLocalViewItem *pRegionItem =
+ static_cast<TemplateLocalViewItem*>(mItemList[i]);
- if (mpDocTemplates->CopyFrom(nRegionId,nId,aPath))
- {
- TemplateItemProperties aTemplate;
- aTemplate.nId = nId+1;
- aTemplate.nDocId = nId;
- aTemplate.nRegionId = nRegionId;
- aTemplate.aName = aPath;
- aTemplate.aThumbnail = rThumbnail;
- aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nId);
- aTemplate.aType = SvFileInformationManager::GetDescription(INetURLObject(aPath));
+ if (!pRegionItem->maTemplates.empty())
+ {
+ nId = (pRegionItem->maTemplates.back()).nId+1;
+ nDocId = (pRegionItem->maTemplates.back()).nDocId+1;
+ }
- for (size_t i = 0, n = mItemList.size(); i < n; ++i)
- {
- if (mItemList[i]->mnId == nRegionItemId)
+ String aPath(rPath);
+
+ if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath))
{
+ TemplateItemProperties aTemplate;
+ aTemplate.nId = nId;
+ aTemplate.nDocId = nDocId;
+ aTemplate.nRegionId = nRegionId;
+ aTemplate.aName = aPath;
+ aTemplate.aThumbnail = rThumbnail;
+ aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nDocId);
+ aTemplate.aType = SvFileInformationManager::GetDescription(INetURLObject(aTemplate.aPath));
+
TemplateLocalViewItem *pItem =
static_cast<TemplateLocalViewItem*>(mItemList[i]);
@@ -561,26 +569,30 @@ void TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
lcl_updateThumbnails(pItem);
}
- }
- CalculateItemPositions();
+ break;
+ }
}
}
void TemplateLocalView::copyFrom (TemplateLocalViewItem *pItem, const rtl::OUString &rPath)
{
sal_uInt16 nId = 0;
+ sal_uInt16 nDocId = 0;
sal_uInt16 nRegionId = pItem->mnId - 1;
String aPath(rPath);
- if (!mItemList.empty())
- nId = (mItemList.back())->mnId+1;
+ if (!pItem->maTemplates.empty())
+ {
+ nId = (pItem->maTemplates.back()).nId+1;
+ nDocId = (pItem->maTemplates.back()).nDocId+1;
+ }
- if (mpDocTemplates->CopyFrom(nRegionId,nId,aPath))
+ if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath))
{
TemplateItemProperties aTemplate;
- aTemplate.nId = nId+1;
- aTemplate.nDocId = nId;
+ aTemplate.nId = nId;
+ aTemplate.nDocId = nDocId;
aTemplate.nRegionId = nRegionId;
aTemplate.aName = aPath;
aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(rPath,