Avoid potential negative array index access to cached text.
[LibreOffice.git] / framework / source / uiconfiguration / CommandImageResolver.hxx
blob0622caf332bb7e041985ad5ee58ab572ae6ac370
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/.
8 */
10 #pragma once
12 #include <vcl/image.hxx>
13 #include <o3tl/enumarray.hxx>
15 #include <com/sun/star/uno/Sequence.hxx>
17 #include "ImageList.hxx"
19 #include <memory>
20 #include <unordered_map>
21 #include <vector>
23 namespace vcl
25 class CommandImageResolver final
27 private:
28 typedef std::unordered_map<OUString, OUString> CommandToImageNameMap;
30 CommandToImageNameMap m_aCommandToImageNameMap;
31 std::vector<OUString> m_aImageCommandNameVector;
32 std::vector<OUString> m_aImageNameVector;
34 o3tl::enumarray<ImageType, std::unique_ptr<ImageList>> m_pImageList;
35 OUString m_sIconTheme;
37 ImageList* getImageList(ImageType nImageType);
39 public:
40 CommandImageResolver();
41 ~CommandImageResolver();
43 void registerCommands(const css::uno::Sequence<OUString>& aCommandSequence);
44 Image getImageFromCommandURL(ImageType nImageType, const OUString& rCommandURL);
46 std::vector<OUString>& getCommandNames() { return m_aImageCommandNameVector; }
48 bool hasImage(const OUString& rCommandURL);
51 } // end namespace vcl
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */