Kaydet (Commit) 10ea40af authored tarafından Rodolfo Ribeiro Gomes's avatar Rodolfo Ribeiro Gomes Kaydeden (comit) Jan Holesovsky

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: 's avatarRodolfo Ribeiro Gomes <rodolforg@gmail.com>
üst 192d5afa
...@@ -61,6 +61,7 @@ protected: ...@@ -61,6 +61,7 @@ protected:
virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void OnItemDblClicked(ThumbnailViewItem *pItem); virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
void OpenItem( const ThumbnailViewItem *pItem ); void OpenItem( const ThumbnailViewItem *pItem );
virtual void Paint( const Rectangle& rRect );
bool isAcceptedFile(const OUString &rURL) const; bool isAcceptedFile(const OUString &rURL) const;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <templateview.hrc>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
...@@ -241,6 +242,32 @@ void RecentDocsView::OpenItem( const ThumbnailViewItem *pItem ) ...@@ -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) void RecentDocsView::SetThumbnailSize(long thumbnailSize)
{ {
mnItemMaxSize = thumbnailSize; mnItemMaxSize = thumbnailSize;
......
...@@ -10,5 +10,7 @@ ...@@ -10,5 +10,7 @@
#define BTN_ALL_TEMPLATES 256 #define BTN_ALL_TEMPLATES 256
#define CONTROL_BUTTONS 257 #define CONTROL_BUTTONS 257
#define FT_NAME 258 #define FT_NAME 258
#define STR_WELCOME 259
#define IMG_WELCOME 260
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -23,4 +23,14 @@ FixedText FT_NAME ...@@ -23,4 +23,14 @@ FixedText FT_NAME
Size = MAP_APPFONT( 238, 12 ); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment