1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
{
41 class ImplImageTree
: private boost::noncopyable
{
47 // check whether the icon style is installed
48 bool checkStyle(OUString
const & style
);
51 OUString
const & name
, OUString
const & style
,
52 BitmapEx
& bitmap
, bool localized
= false, bool loadMissing
= false );
54 bool loadDefaultImage(
55 OUString
const & style
,
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)
65 OUString
const & name
, OUString
const & style
,
66 BitmapEx
& bitmap
, bool localized
);
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
;
81 CheckStyleCache m_checkStyleCache
;
82 IconCache m_iconCache
;
85 void setStyle(OUString
const & style
);
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
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */