[Libreoffice-commits] .: vcl/inc vcl/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Thu Nov 25 05:10:42 PST 2010
vcl/inc/vcl/impimagetree.hxx | 6 +++++-
vcl/source/gdi/impimagetree.cxx | 26 ++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
New commits:
commit 7b0c28fb28e65c156dbad6d1fbe700c54a751ed0
Author: Joachim Trémouroux <joachim.tremouroux at gmail.com>
Date: Thu Nov 25 13:10:12 2010 +0000
Add a 'loadMissing' parameter for loading a special icon if necessary
diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx
index 8b694eb..bfaff19 100644
--- a/vcl/inc/vcl/impimagetree.hxx
+++ b/vcl/inc/vcl/impimagetree.hxx
@@ -58,7 +58,7 @@ public:
bool loadImage(
rtl::OUString const & name, rtl::OUString const & style,
- BitmapEx & bitmap, bool localized = false );
+ BitmapEx & bitmap, bool localized = false, bool loadMissing = false );
void shutDown();
// a crude form of life cycle control (called from DeInitVCL; otherwise,
@@ -66,6 +66,10 @@ public:
// be too late for the destructors of the bitmaps in m_iconCache)
private:
+ bool doLoadImage(
+ rtl::OUString const & name, rtl::OUString const & style,
+ BitmapEx & bitmap, bool localized);
+
typedef std::list<
std::pair<
rtl::OUString,
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 515df75..5bf567d 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -151,6 +151,32 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style)
bool ImplImageTree::loadImage(
rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
+ bool localized, bool loadMissing )
+{
+ bool found = false;
+ try {
+ found = doLoadImage(name, style, bitmap, localized);
+ } catch (css::uno::RuntimeException &) {
+ if (!loadMissing)
+ throw;
+ }
+ if (found || !loadMissing)
+ return found;
+
+ try {
+ OSL_TRACE(
+ "ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png",
+ rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
+ found = doLoadImage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/missing_icon.png")),
+ style, bitmap, false);
+ } catch (css::uno::RuntimeException &) {
+ throw;
+ }
+ return found;
+}
+
+bool ImplImageTree::doLoadImage(
+ rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
bool localized)
{
setStyle(style);
More information about the Libreoffice-commits
mailing list