summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-11-11 19:49:08 +0100
committerJan Holesovsky <kendy@collabora.com>2013-11-11 19:50:37 +0100
commit8620a68163cbddbaa86c3f01dd3294cea1d1da06 (patch)
treef0fc6d7162743a0cad447b20a03c40fc1130b579
parente404d2ed59c7b1b85b750e687226e29031dc9b7d (diff)
startcenter: Don't create the Image with every paint.
Change-Id: I90fa5aff94de38d950a78811dad301b91ced89f3
-rw-r--r--include/sfx2/recentdocsview.hxx4
-rw-r--r--sfx2/source/control/recentdocsview.cxx15
2 files changed, 13 insertions, 6 deletions
diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 8aceeef1bb4b..ac52e674b397 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 cfbfe99dc942..5ea8d0d1693c 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