summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-12-13 09:05:29 +0100
committerJan Holesovsky <kendy@collabora.com>2013-12-13 13:03:46 +0100
commitaa05543b83d9780f0139c6c6584e12a8a9209e55 (patch)
treee7b542dd7db5088f0f9faa3c3ed71254f835136f /sfx2
parentd3c0eb59a7faa90054d55d1624e9ea7dee4ce378 (diff)
startcenter: Make the default icons appear as on a piece of paper.
So that the frame around the picture is similar to the previews; otherwise looks disturbing. Change-Id: Ie7f973e15c29a34c0f368b5e0f5a152d5cead39f
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/source/control/recentdocsviewitem.cxx24
2 files changed, 24 insertions, 1 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 16fd84a5f523..b6e0962bbf9f 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,sfx,\
drawinglayer \
fwe \
i18nlangtag \
+ i18nutil \
sal \
sax \
sb \
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 3817d0d169fb..137193d18ca8 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -9,6 +9,7 @@
#include <sfx2/recentdocsviewitem.hxx>
+#include <i18nutil/paper.hxx>
#include <sfx2/templateabstractview.hxx>
#include <sfx2/recentdocsview.hxx>
#include <tools/urlobj.hxx>
@@ -32,7 +33,28 @@ RecentDocsViewItem::RecentDocsViewItem(ThumbnailView &rView, const OUString &rUR
if( aThumbnail.IsEmpty() )
{
// Use the default thumbnail if we have nothing else
- aThumbnail = RecentDocsView::getDefaultThumbnail(rURL);
+ BitmapEx aExt(RecentDocsView::getDefaultThumbnail(rURL));
+ Size aExtSize(aExt.GetSizePixel());
+
+ // attempt to make it appear as if it is on a piece of paper
+ static PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+ double ratio = double(nThumbnailSize) / double(std::max(aInfo.getWidth(), aInfo.getHeight()));
+ Size aThumbnailSize(aInfo.getWidth() * ratio, aInfo.getHeight() * ratio);
+
+ if (aExtSize.Width() > aThumbnailSize.Width() || aExtSize.Height() > aThumbnailSize.Height())
+ {
+ aExt = TemplateAbstractView::scaleImg(aExt, aThumbnailSize.Width(), aThumbnailSize.Height());
+ aExtSize = aExt.GetSizePixel();
+ }
+
+ // create empty, and copy the default thumbnail in
+ sal_uInt8 nAlpha = 255;
+ aThumbnail = BitmapEx(Bitmap(aThumbnailSize, 24), AlphaMask(aThumbnailSize, &nAlpha));
+
+ aThumbnail.CopyPixel(
+ Rectangle(Point((aThumbnailSize.Width() - aExtSize.Width()) / 2, (aThumbnailSize.Height() - aExtSize.Height()) / 2), aExtSize),
+ Rectangle(Point(0, 0), aExtSize),
+ &aExt);
}
maURL = rURL;