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_SD_SOURCE_UI_INC_TOOLS_ICONCACHE_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_TOOLS_ICONCACHE_HXX
23 #include "SdGlobalResourceContainer.hxx"
24 #include <vcl/image.hxx>
28 /** This simple class stores frequently used icons so that the classes that
29 use the icons do not have to store them in every one of their
32 Icons are addressed over their resource id and are loaded on demand.
34 This cache acts like a singleton with a lifetime equal to that of the sd
38 : public SdGlobalResource
41 /** The lifetime of the returned reference is limited to that of the sd
44 static IconCache
& Instance();
46 /** Return the icon with the given resource id.
48 The returned Image may be empty when there is no icon for the
49 given id or an error occurred. Should not happen under normal
52 Image
GetIcon (sal_uInt16 nResourceId
);
56 ::std::unique_ptr
<Implementation
> mpImpl
;
58 /** The constructor creates the one instance of the cache and registers
59 it at the SdGlobalResourceContainer to limit is lifetime to that of
64 /** This destructor is called by SdGlobalResourceContainer.
69 } // end of namespace sd
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */