summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-07-05 22:39:50 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-07-05 22:39:50 -0430
commitfa99c1ea4f6d450cc12998d4513ed8cf77bafcc9 (patch)
treea5fbe489b9698c562fc3963db11fdbe05ee81e8e /sfx2
parent23c3e635a2c048692deb327bbc21866d19f1806e (diff)
Update thumnails for all template operations.
Change-Id: I7370e2ec459f64366277217b30875172104a72f6
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/templatefolderview.cxx56
1 files changed, 27 insertions, 29 deletions
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index ef58cfe26d6c..c66148d5bbfe 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -297,41 +297,30 @@ void TemplateFolderView::Populate ()
sal_uInt16 nEntries = mpDocTemplates->GetCount(i);
- if (nEntries)
+ for (sal_uInt16 j = 0; j < nEntries; ++j)
{
- /// Preview first 2 thumbnails for folder
- pItem->maPreview1 = lcl_fetchThumbnail(mpDocTemplates->GetPath(i,0),
- THUMBNAIL_MAX_WIDTH*0.75,
- THUMBNAIL_MAX_HEIGHT*0.75);
+ rtl::OUString aName = mpDocTemplates->GetName(i,j);
+ rtl::OUString aURL = mpDocTemplates->GetPath(i,j);
+ rtl::OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
- if ( nEntries > 2 )
- pItem->maPreview2 = lcl_fetchThumbnail(mpDocTemplates->GetPath(i,1),
- THUMBNAIL_MAX_WIDTH*0.75,
- THUMBNAIL_MAX_HEIGHT*0.75);
-
- for (sal_uInt16 j = 0; j < nEntries; ++j)
+ if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
{
- rtl::OUString aName = mpDocTemplates->GetName(i,j);
- rtl::OUString aURL = mpDocTemplates->GetPath(i,j);
- rtl::OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
-
- if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
- {
- aName = aName.copy(0,mpItemAttrs->nMaxTextLenght-3);
- aName += "...";
- }
+ aName = aName.copy(0,mpItemAttrs->nMaxTextLenght-3);
+ aName += "...";
+ }
- TemplateViewItem *pTemplateItem = new TemplateViewItem(*mpItemView,mpItemView);
- pTemplateItem->mnId = j+1;
- pTemplateItem->maText = aName;
- pTemplateItem->setPath(aURL);
- pTemplateItem->setFileType(aType);
- pTemplateItem->maPreview1 = lcl_fetchThumbnail(aURL,THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
+ TemplateViewItem *pTemplateItem = new TemplateViewItem(*mpItemView,mpItemView);
+ pTemplateItem->mnId = j+1;
+ pTemplateItem->maText = aName;
+ pTemplateItem->setPath(aURL);
+ pTemplateItem->setFileType(aType);
+ pTemplateItem->maPreview1 = lcl_fetchThumbnail(aURL,THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
- pItem->maTemplates.push_back(pTemplateItem);
- }
+ pItem->maTemplates.push_back(pTemplateItem);
}
+ lcl_updateThumbnails(pItem);
+
mItemList.push_back(pItem);
}
@@ -486,10 +475,15 @@ bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId)
pItem->maTemplates.erase(pIter);
mpItemView->RemoveItem(nItemId);
+
break;
}
}
+ lcl_updateThumbnails(pItem);
+
+ CalculateItemPositions();
+
break;
}
}
@@ -609,6 +603,10 @@ void TemplateFolderView::copyFrom (TemplateFolderViewItem *pItem, const rtl::OUS
pTemplate->setFileType(SvFileInformationManager::GetDescription(INetURLObject(rPath)));
pItem->maTemplates.push_back(pTemplate);
+
+ lcl_updateThumbnails(pItem);
+
+ CalculateItemPositions();
}
}
@@ -699,7 +697,7 @@ void lcl_updateThumbnails (TemplateFolderViewItem *pItem)
}
else
{
- pItem->maPreview1 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
+ pItem->maPreview2 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
THUMBNAIL_MAX_WIDTH*0.75,
THUMBNAIL_MAX_HEIGHT*0.75);
}