summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/impimagetree.hxx9
-rw-r--r--vcl/source/gdi/impimagetree.cxx38
2 files changed, 37 insertions, 10 deletions
diff --git a/vcl/inc/impimagetree.hxx b/vcl/inc/impimagetree.hxx
index 7e8dda75ea7a..e66e754a1c8d 100644
--- a/vcl/inc/impimagetree.hxx
+++ b/vcl/inc/impimagetree.hxx
@@ -95,8 +95,17 @@ private:
bool findImage(std::vector< OUString > const & paths, BitmapEx & bitmap );
void loadImageLinks();
+
void parseLinkFile(boost::shared_ptr< SvStream > stream);
+
+ /// Return name of a real .png according to links.txt.
OUString const & getRealImageName(OUString const & name);
+
+ /** Rerurn name of the fallback style for the provided one.
+
+ Must not be cyclic :-) The last theme in the chain returns an empty string.
+ */
+ OUString fallbackStyle(const OUString &style);
};
typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef;
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 9ce7fd2e6053..8955902039fe 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -101,21 +101,39 @@ ImplImageTree::~ImplImageTree()
{
}
+OUString ImplImageTree::fallbackStyle(const OUString &style)
+{
+ if (style == "galaxy")
+ return OUString();
+ else if (style == "industrial")
+ return OUString("galaxy");
+ else if (style == "tango")
+ return OUString("industrial");
+ else if (style == "breeze")
+ return OUString("sifr");
+
+ return OUString("tango");
+}
+
bool ImplImageTree::loadImage(OUString const & name, 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;
+ OUString aStyle(style);
+ while (!aStyle.isEmpty())
+ {
+ try {
+ if (doLoadImage(name, aStyle, bitmap, localized))
+ return true;
+ }
+ catch (css::uno::RuntimeException &) {}
+
+ aStyle = fallbackStyle(aStyle);
}
- if (found || !loadMissing)
- return found;
- SAL_INFO("vcl", "ImplImageTree::loadImage exception couldn't load \""
- << name << "\", fetching default image");
+ if (!loadMissing)
+ return false;
+
+ SAL_INFO("vcl", "ImplImageTree::loadImage couldn't load \"" << name << "\", fetching default image");
return loadDefaultImage(style, bitmap);
}