icon-themes/galaxy/sfx2/res/logo.png |binary include/sfx2/recentdocsview.hxx | 5 +++++ sfx2/source/control/recentdocsview.cxx | 31 +++++++++++++++++++++++++++++++ sfx2/source/control/templateview.hrc | 2 ++ sfx2/source/control/templateview.src | 10 ++++++++++ 5 files changed, 48 insertions(+)
New commits: commit 8620a68163cbddbaa86c3f01dd3294cea1d1da06 Author: Jan Holesovsky <[email protected]> Date: Mon Nov 11 19:49:08 2013 +0100 startcenter: Don't create the Image with every paint. Change-Id: I90fa5aff94de38d950a78811dad301b91ced89f3 diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx index 8aceeef..ac52e67 100644 --- a/include/sfx2/recentdocsview.hxx +++ b/include/sfx2/recentdocsview.hxx @@ -12,6 +12,7 @@ #include <sfx2/thumbnailview.hxx> #include <sfx2/recentdocsviewitem.hxx> +#include <vcl/image.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -69,6 +70,9 @@ protected: long mnTextHeight; long mnItemPadding; long mnItemMaxTextLength; + + Image maWelcomeImage; + OUString maWelcomeText; }; #endif // INCLUDED_SFX2_RECENTDOCSVIEW_HXX diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index cfbfe99..5ea8d0d 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -45,6 +45,8 @@ RecentDocsView::RecentDocsView( Window* pParent ) , mnTextHeight(30) , mnItemPadding(5) , mnItemMaxTextLength(30) + , maWelcomeImage(SfxResId(IMG_WELCOME)) + , maWelcomeText(SfxResId(STR_WELCOME)) { SetStyle(GetStyle() | WB_VSCROLL); setItemMaxTextLength( mnItemMaxTextLength ); @@ -247,22 +249,23 @@ 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 nTextWidth = GetTextWidth(maWelcomeText); long nTextHeight = GetTextHeight(); - const Size & rImgSize = aImg.GetSizePixel(); + const Size & rImgSize = maWelcomeImage.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); + + DrawImage(aImgPoint, rImgSize, maWelcomeImage, IMAGE_DRAW_SEMITRANSPARENT); + DrawText(aStrPoint, maWelcomeText); + SetFont(aOldFont); } else commit e404d2ed59c7b1b85b750e687226e29031dc9b7d Author: Jan Holesovsky <[email protected]> Date: Mon Nov 11 18:08:57 2013 +0100 startcenter: Paint either the welcome, or the recent docs. Otherwise the background will paint over the graphics... Change-Id: Ic62c563026daa9c4173148cd68652d8aba608089 diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 155c11e..cfbfe99 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -265,7 +265,8 @@ void RecentDocsView::Paint( const Rectangle &aRect ) DrawText(aStrPoint, aStr); SetFont(aOldFont); } - ThumbnailView::Paint(aRect); + else + ThumbnailView::Paint(aRect); } void RecentDocsView::SetThumbnailSize(long thumbnailSize) commit 10ea40afa3d6804a4a6f816f10f71a93412328fa Author: Rodolfo Ribeiro Gomes <[email protected]> Date: Sat Nov 9 22:57:34 2013 -0200 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 <[email protected]> diff --git a/icon-themes/galaxy/sfx2/res/logo.png b/icon-themes/galaxy/sfx2/res/logo.png new file mode 100644 index 0000000..003e188 Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/logo.png differ diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx index 2edace5..8aceeef 100644 --- a/include/sfx2/recentdocsview.hxx +++ b/include/sfx2/recentdocsview.hxx @@ -61,6 +61,7 @@ protected: virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void OnItemDblClicked(ThumbnailViewItem *pItem); void OpenItem( const ThumbnailViewItem *pItem ); + virtual void Paint( const Rectangle& rRect ); bool isAcceptedFile(const OUString &rURL) const; diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 14e8f65..155c11e 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 f3eccee..f0c4dae 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 d242b03..ef2eede 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: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
