diff options
author | Rodolfo Ribeiro Gomes <rodolforg@gmail.com> | 2013-11-09 22:57:34 -0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-11-11 19:49:56 +0100 |
commit | 10ea40afa3d6804a4a6f816f10f71a93412328fa (patch) | |
tree | 428881359796da7f0ad0e89ac1512c11810e92b0 /sfx2 | |
parent | 192d5afa33fc92ae832148312e16613df4b98b5a (diff) |
startcenter: Start center shows a welcome text when recent doc list is empty
The image I got from TDF wiki.
I tried to show the text semitransparent also, but set font color
with any alpha degree (eg. setTransparency(254) ) made it invisible.
Maybe just a gray shade?
Change-Id: Iaf7efb8433e9db03862825148ed2013588a5468f
Signed-off-by: Rodolfo Ribeiro Gomes <rodolforg@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 27 | ||||
-rw-r--r-- | sfx2/source/control/templateview.hrc | 2 | ||||
-rw-r--r-- | sfx2/source/control/templateview.src | 10 |
3 files changed, 39 insertions, 0 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 14e8f655ca72..155c11ea5f03 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <templateview.hrc> using namespace ::com::sun::star; using namespace com::sun::star::uno; @@ -241,6 +242,32 @@ void RecentDocsView::OpenItem( const ThumbnailViewItem *pItem ) } } +void RecentDocsView::Paint( const Rectangle &aRect ) +{ + if ( mItemList.size() == 0 ) + { + // No recent files to be shown yet. Show a welcome screen. + Image aImg(SfxResId(IMG_WELCOME)); + OUString aStr(SfxResId(STR_WELCOME)); + Font aOldFont(GetFont()); + Font aNewFont(aOldFont); + aNewFont.SetHeight(20); + SetFont(aNewFont); + long nTextWidth = GetTextWidth(aStr); + long nTextHeight = GetTextHeight(); + const Size & rImgSize = aImg.GetSizePixel(); + const Size & rScreenSize = GetSizePixel(); + const int nX = (rScreenSize.Width() - rImgSize.Width())/2; + const int nY = (rScreenSize.Height() - nTextHeight*1.5 - rImgSize.Height())/2; + Point aImgPoint(nX, nY); + DrawImage(aImgPoint, rImgSize, aImg, IMAGE_DRAW_SEMITRANSPARENT); + Point aStrPoint((rScreenSize.Width() - nTextWidth)/2, nY + rImgSize.Height() + nTextHeight/2); + DrawText(aStrPoint, aStr); + SetFont(aOldFont); + } + ThumbnailView::Paint(aRect); +} + void RecentDocsView::SetThumbnailSize(long thumbnailSize) { mnItemMaxSize = thumbnailSize; diff --git a/sfx2/source/control/templateview.hrc b/sfx2/source/control/templateview.hrc index f3eccee04603..f0c4daeb08b3 100644 --- a/sfx2/source/control/templateview.hrc +++ b/sfx2/source/control/templateview.hrc @@ -10,5 +10,7 @@ #define BTN_ALL_TEMPLATES 256 #define CONTROL_BUTTONS 257 #define FT_NAME 258 +#define STR_WELCOME 259 +#define IMG_WELCOME 260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templateview.src b/sfx2/source/control/templateview.src index d242b032c463..ef2eedec14bf 100644 --- a/sfx2/source/control/templateview.src +++ b/sfx2/source/control/templateview.src @@ -23,4 +23,14 @@ FixedText FT_NAME Size = MAP_APPFONT( 238, 12 ); }; +String STR_WELCOME +{ + Text [ en-US ] = "Welcome! You can open or create a new document!"; +}; + +Image IMG_WELCOME +{ + ImageBitmap = Bitmap { File = "logo.png" ; }; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |