Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_IMAGE_H
21 : #define INCLUDED_VCL_INC_IMAGE_H
22 :
23 : #include <vcl/bitmapex.hxx>
24 :
25 : #include <boost/unordered_map.hpp>
26 :
27 : // - ImplImageBmp -
28 :
29 : class ImplImageBmp
30 : {
31 : public:
32 :
33 : ImplImageBmp();
34 : ~ImplImageBmp();
35 :
36 : void Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
37 : void ColorTransform();
38 : void Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
39 :
40 : private:
41 :
42 : BitmapEx maBmpEx;
43 : BitmapEx maDisabledBmpEx;
44 : BitmapEx* mpDisplayBmp;
45 : Size maSize;
46 : sal_uInt8* mpInfoAry;
47 : sal_uInt16 mnSize;
48 :
49 : void ImplUpdateDisplayBmp( OutputDevice* pOutDev );
50 : void ImplUpdateDisabledBmpEx( int nPos );
51 :
52 : private: // prevent assignment and copy construction
53 : ImplImageBmp( const ImplImageBmp& );
54 : void operator=( const ImplImageBmp& );
55 : };
56 :
57 : // - ImageTypes -
58 :
59 : enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE };
60 :
61 : // - ImplImageList -
62 :
63 : struct ImageAryData
64 : {
65 : OUString maName;
66 : // Images identified by either name, or by id
67 : sal_uInt16 mnId;
68 : BitmapEx maBitmapEx;
69 :
70 : ImageAryData( const OUString &aName,
71 : sal_uInt16 nId, const BitmapEx &aBitmap );
72 : ImageAryData( const ImageAryData& rData );
73 : ~ImageAryData();
74 :
75 172738 : bool IsLoadable() { return maBitmapEx.IsEmpty() && !maName.isEmpty(); }
76 : void Load(const OUString &rPrefix);
77 :
78 : ImageAryData& operator=( const ImageAryData& rData );
79 : };
80 :
81 : struct ImplImageList
82 : {
83 : typedef std::vector<ImageAryData *> ImageAryDataVec;
84 : typedef boost::unordered_map< OUString, ImageAryData *, OUStringHash >
85 : ImageAryDataNameHash;
86 :
87 : ImageAryDataVec maImages;
88 : ImageAryDataNameHash maNameHash;
89 : OUString maPrefix;
90 : Size maImageSize;
91 : sal_uIntPtr mnRefCount;
92 :
93 : ImplImageList();
94 : ImplImageList( const ImplImageList &aSrc );
95 : ~ImplImageList();
96 :
97 : void AddImage( const OUString &aName,
98 : sal_uInt16 nId, const BitmapEx &aBitmapEx );
99 : void RemoveImage( sal_uInt16 nPos );
100 : };
101 :
102 : // - ImplImageRefData -
103 :
104 : struct ImplImageRefData
105 : {
106 : ImplImageList* mpImplData;
107 : sal_uInt16 mnIndex;
108 :
109 : ImplImageRefData() {} // Um Warning zu umgehen
110 : ~ImplImageRefData();
111 :
112 : bool IsEqual( const ImplImageRefData& rData );
113 : };
114 :
115 : // - ImpImageData -
116 :
117 : struct ImplImageData
118 : {
119 : ImplImageBmp* mpImageBitmap;
120 : BitmapEx maBmpEx;
121 :
122 : ImplImageData( const BitmapEx& rBmpEx );
123 : ~ImplImageData();
124 :
125 : bool IsEqual( const ImplImageData& rData );
126 : };
127 :
128 : // - ImplImage -
129 :
130 : struct ImplImage
131 : {
132 : sal_uIntPtr mnRefCount;
133 : // TODO: use inheritance to get rid of meType+mpData
134 : void* mpData;
135 : ImageType meType;
136 :
137 : ImplImage();
138 : ~ImplImage();
139 :
140 : private: // prevent assignment and copy construction
141 : ImplImage( const ImplImage&);
142 : void operator=( const ImplImage&);
143 : };
144 :
145 : #endif // INCLUDED_VCL_INC_IMAGE_H
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|