Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / image.h
blobf16b595c2709666c31398b80e555742b06868752
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 _SV_IMAGE_H
21 #define _SV_IMAGE_H
23 #include <vcl/bitmapex.hxx>
25 #include <boost/unordered_map.hpp>
27 // ----------------
28 // - ImplImageBmp -
29 // ----------------
31 class ImplImageBmp
33 public:
35 ImplImageBmp();
36 ~ImplImageBmp();
38 void Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
39 void ColorTransform();
40 void Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
42 private:
44 BitmapEx maBmpEx;
45 BitmapEx maDisabledBmpEx;
46 BitmapEx* mpDisplayBmp;
47 Size maSize;
48 sal_uInt8* mpInfoAry;
49 sal_uInt16 mnSize;
51 void ImplUpdateDisplayBmp( OutputDevice* pOutDev );
52 void ImplUpdateDisabledBmpEx( int nPos );
54 private: // prevent assignment and copy construction
55 ImplImageBmp( const ImplImageBmp& );
56 void operator=( const ImplImageBmp& );
59 // --------------
60 // - ImageTypes -
61 // --------------
63 enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE };
65 // -----------------
66 // - ImplImageList -
67 // -----------------
69 struct ImageAryData
71 ::rtl::OUString maName;
72 // Images identified by either name, or by id
73 sal_uInt16 mnId;
74 BitmapEx maBitmapEx;
76 ImageAryData( const rtl::OUString &aName,
77 sal_uInt16 nId, const BitmapEx &aBitmap );
78 ImageAryData( const ImageAryData& rData );
79 ~ImageAryData();
81 bool IsLoadable() { return maBitmapEx.IsEmpty() && !maName.isEmpty(); }
82 void Load(const rtl::OUString &rPrefix);
84 ImageAryData& operator=( const ImageAryData& rData );
87 // ------------------------------------------------------------------------------
89 struct ImplImageList
91 typedef std::vector<ImageAryData *> ImageAryDataVec;
92 typedef boost::unordered_map< rtl::OUString, ImageAryData *, rtl::OUStringHash >
93 ImageAryDataNameHash;
95 ImageAryDataVec maImages;
96 ImageAryDataNameHash maNameHash;
97 rtl::OUString maPrefix;
98 Size maImageSize;
99 sal_uIntPtr mnRefCount;
101 ImplImageList();
102 ImplImageList( const ImplImageList &aSrc );
103 ~ImplImageList();
105 void AddImage( const ::rtl::OUString &aName,
106 sal_uInt16 nId, const BitmapEx &aBitmapEx );
107 void RemoveImage( sal_uInt16 nPos );
110 // --------------------
111 // - ImplImageRefData -
112 // --------------------
114 struct ImplImageRefData
116 ImplImageList* mpImplData;
117 sal_uInt16 mnIndex;
119 ImplImageRefData() {} // Um Warning zu umgehen
120 ~ImplImageRefData();
122 sal_Bool IsEqual( const ImplImageRefData& rData );
125 // ----------------
126 // - ImpImageData -
127 // ----------------
129 struct ImplImageData
131 ImplImageBmp* mpImageBitmap;
132 BitmapEx maBmpEx;
134 ImplImageData( const BitmapEx& rBmpEx );
135 ~ImplImageData();
137 sal_Bool IsEqual( const ImplImageData& rData );
140 // -------------
141 // - ImplImage -
142 // -------------
144 struct ImplImage
146 sal_uIntPtr mnRefCount;
147 // TODO: use inheritance to get rid of meType+mpData
148 void* mpData;
149 ImageType meType;
151 ImplImage();
152 ~ImplImage();
154 private: // prevent assignment and copy construction
155 ImplImage( const ImplImage&);
156 void operator=( const ImplImage&);
159 #endif // _SV_IMAGE_H
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */