[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Matthew J. Francis mjay.francis at gmail.com
Mon Nov 17 01:57:57 PST 2014


 include/sfx2/recentdocsviewitem.hxx        |    4 ++++
 sfx2/source/control/recentdocsviewitem.cxx |   28 +++++-----------------------
 2 files changed, 9 insertions(+), 23 deletions(-)

New commits:
commit e43f692ef908fd2bc180a5e16fb363ec6bb7eb09
Author: Matthew J. Francis <mjay.francis at gmail.com>
Date:   Sun Nov 16 10:26:18 2014 +0800

    fdo#85478 Avoid destroying bitmaps after VCL is shut down
    
    Change-Id: I1ece738e7f60b6bbbdc802339f8b9deec9396e1b
    Reviewed-on: https://gerrit.libreoffice.org/12469
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sfx2/recentdocsviewitem.hxx b/include/sfx2/recentdocsviewitem.hxx
index b1a51fe..7ee05ee 100644
--- a/include/sfx2/recentdocsviewitem.hxx
+++ b/include/sfx2/recentdocsviewitem.hxx
@@ -49,6 +49,10 @@ private:
 
     /// Is the icon that the user can click to remove the document from the recent documents highlighted?
     bool m_bRemoveIconHighlighted;
+
+    BitmapEx m_aRemoveRecentBitmap;
+
+    BitmapEx m_aRemoveRecentBitmapHighlighted;
 };
 
 #endif // INCLUDED_SFX2_RECENTDOCSVIEWITEM_HXX
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index aa2a7e0..c8f19f4 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -30,31 +30,13 @@ using namespace com::sun::star::uno;
 using namespace drawinglayer::primitive2d;
 using namespace drawinglayer::processor2d;
 
-/// Icon that the user can click to remove the document from the recent documents.
-struct theRemoveRecentBitmap : public rtl::StaticWithInit<BitmapEx, theRemoveRecentBitmap>
-{
-    BitmapEx operator()()
-    {
-        return SfxResId(IMG_RECENTDOC_REMOVE);
-    }
-
-};
-
-/// Highlighted version of icon that the user can click to remove the document from the recent documents.
-struct theRemoveRecentBitmapHighlighted : public rtl::StaticWithInit<BitmapEx, theRemoveRecentBitmapHighlighted>
-{
-    BitmapEx operator()()
-    {
-        return SfxResId(IMG_RECENTDOC_REMOVE_HIGHLIGHTED);
-    }
-
-};
-
 RecentDocsViewItem::RecentDocsViewItem(ThumbnailView &rView, const OUString &rURL,
     const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId)
     : ThumbnailViewItem(rView, nId),
       maURL(rURL),
-      m_bRemoveIconHighlighted(false)
+      m_bRemoveIconHighlighted(false),
+      m_aRemoveRecentBitmap(SfxResId(IMG_RECENTDOC_REMOVE)),
+      m_aRemoveRecentBitmapHighlighted(SfxResId(IMG_RECENTDOC_REMOVE_HIGHLIGHTED))
 {
     OUString aTitle(rTitle);
     INetURLObject aURLObj(rURL);
@@ -151,7 +133,7 @@ Rectangle RecentDocsViewItem::updateHighlight(bool bVisible, const Point& rPoint
 Rectangle RecentDocsViewItem::getRemoveIconArea() const
 {
     Rectangle aArea(getDrawArea());
-    Size aSize(theRemoveRecentBitmap::get().GetSizePixel());
+    Size aSize(m_aRemoveRecentBitmap.GetSizePixel());
 
     return Rectangle(
             Point(aArea.Right() - aSize.Width() - THUMBNAILVIEW_ITEM_CORNER, aArea.Top() + THUMBNAILVIEW_ITEM_CORNER),
@@ -175,7 +157,7 @@ void RecentDocsViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProc
         Point aIconPos(getRemoveIconArea().TopLeft());
 
         aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(new DiscreteBitmapPrimitive2D(
-                    m_bRemoveIconHighlighted? theRemoveRecentBitmapHighlighted::get(): theRemoveRecentBitmap::get(),
+                    m_bRemoveIconHighlighted ? m_aRemoveRecentBitmapHighlighted : m_aRemoveRecentBitmap,
                     B2DPoint(aIconPos.X(), aIconPos.Y())));
 
         pProcessor->process(aSeq);


More information about the Libreoffice-commits mailing list