Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / framework / source / uiconfiguration / ImageList.hxx
blob7a7af3d1bb6305261c4e6b69d7012ab450af28bf
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 FRAMEWORK_SOURCE_UICONFIGURATION_IMAGELIST_HXX
21 #define FRAMEWORK_SOURCE_UICONFIGURATION_IMAGELIST_HXX
23 #include <vcl/image.hxx>
24 #include <unordered_map>
25 #include <vector>
27 // Images identified by either name, or by id
28 struct ImageAryData
30 OUString maName;
31 sal_uInt16 mnId;
32 Image maImage;
36 class ImageList
38 public:
39 explicit ImageList();
40 ImageList( const std::vector<OUString>& rNameVector,
41 const OUString& rPrefix);
43 void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
44 const std::vector< OUString > &rNameVector );
45 BitmapEx GetAsHorizontalStrip() const;
46 sal_uInt16 GetImageCount() const;
48 void AddImage( const OUString& rImageName, const Image& rImage );
50 void ReplaceImage( const OUString& rImageName, const Image& rImage );
52 void RemoveImage( sal_uInt16 nId );
54 Image GetImage( const OUString& rImageName ) const;
56 sal_uInt16 GetImagePos( const OUString& rImageName ) const;
58 sal_uInt16 GetImageId( sal_uInt16 nPos ) const;
60 OUString GetImageName( sal_uInt16 nPos ) const;
61 void GetImageNames( ::std::vector< OUString >& rNames ) const;
63 private:
65 std::vector< std::unique_ptr<ImageAryData> > maImages;
66 std::unordered_map< OUString, ImageAryData * > maNameHash;
67 OUString maPrefix;
68 Size maImageSize;
70 sal_uInt16 ImplGetImageId( const OUString& rImageName ) const;
71 void ImplAddImage( const OUString &aPrefix, const OUString &aName, sal_uInt16 nId, const Image &aImage );
72 void ImplRemoveImage( sal_uInt16 nPos );
75 #endif // INCLUDED_VCL_IMAGE_HXX
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */