bump product version to 4.1.6.2
[LibreOffice.git] / vcl / inc / impimagetree.hxx
blobf42a0391bc90dd5c33c649eabf6476517f203147
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_IMPIMAGETREE_HXX
21 #define INCLUDED_VCL_IMPIMAGETREE_HXX
23 #include "sal/config.h"
25 #include <list>
26 #include <utility>
27 #include <vector>
29 #include <boost/unordered_map.hpp>
31 #include "boost/noncopyable.hpp"
32 #include "com/sun/star/uno/Reference.hxx"
33 #include "rtl/ustring.hxx"
34 #include "salhelper/singletonref.hxx"
36 namespace com { namespace sun { namespace star { namespace container {
37 class XNameAccess;
38 } } } }
39 class BitmapEx;
41 class ImplImageTree: private boost::noncopyable {
42 public:
43 ImplImageTree();
45 ~ImplImageTree();
47 // check whether the icon style is installed
48 bool checkStyle(OUString const & style);
50 bool loadImage(
51 OUString const & name, OUString const & style,
52 BitmapEx & bitmap, bool localized = false, bool loadMissing = false );
54 bool loadDefaultImage(
55 OUString const & style,
56 BitmapEx& bitmap);
58 void shutDown();
59 // a crude form of life cycle control (called from DeInitVCL; otherwise,
60 // if the ImplImageTree singleton were destroyed during exit that would
61 // be too late for the destructors of the bitmaps in m_iconCache)
63 private:
64 bool doLoadImage(
65 OUString const & name, OUString const & style,
66 BitmapEx & bitmap, bool localized);
68 typedef std::list<
69 std::pair<
70 OUString,
71 com::sun::star::uno::Reference<
72 com::sun::star::container::XNameAccess > > > Paths;
74 typedef boost::unordered_map<
75 OUString, bool, OUStringHash > CheckStyleCache;
76 typedef boost::unordered_map<
77 OUString, std::pair< bool, BitmapEx >, OUStringHash > IconCache;
79 OUString m_style;
80 Paths m_paths;
81 CheckStyleCache m_checkStyleCache;
82 IconCache m_iconCache;
83 bool m_cacheIcons;
85 void setStyle(OUString const & style );
87 void resetPaths();
89 bool checkStyleCacheLookup( OUString const & style, bool &exists );
90 bool iconCacheLookup( OUString const & name, bool localized, BitmapEx & bitmap );
92 bool find(std::vector< OUString > const & paths, BitmapEx & bitmap );
95 typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef;
97 #endif
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */