vcl/source/image/ImplImageTree.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
New commits: commit 5cdb0821d2b59145cf83ea3652a5df72a6a3c8c8 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Jan 23 22:01:38 2019 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Jan 25 11:55:10 2019 +0100 tdf#122259 resolve image link as both - png and svg This is needed to prevent mismatches when we have a image defined as png and we have a svg available. As we currently support both png and svg icon themes we need to try both or some resolvable icons just won't be resolved. Once svg support is in a good shape that we can get rid of png, we can also possibly get rid of this. Change-Id: I34e9c24ac1016ef3af46be06330b60aaab730da0 Reviewed-on: https://gerrit.libreoffice.org/66826 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 2b1603dbdaa9..c24d3e4221eb 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -594,15 +594,26 @@ void ImplImageTree::parseLinkFile(std::shared_ptr<SvStream> const & xStream) } } -OUString const & ImplImageTree::getRealImageName(OUString const & name) +OUString const & ImplImageTree::getRealImageName(OUString const & rIconName) { IconLinkHash & rLinkHash = maIconSets[maCurrentStyle].maLinkHash; - IconLinkHash::iterator it(rLinkHash.find(name)); - if (it == rLinkHash.end()) - return name; + OUString sNameWithNoExtension = getNameNoExtension(rIconName); - return it->second; + IconLinkHash::iterator it; + + // PNG is priority + it = rLinkHash.find(sNameWithNoExtension + ".png"); + if (it != rLinkHash.end()) + return it->second; + + // also check SVG name + it = rLinkHash.find(sNameWithNoExtension + ".svg"); + if (it != rLinkHash.end()) + return it->second; + + // neither was found so just return the original name + return rIconName; } bool ImplImageTree::checkPathAccess() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits