Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_IMAGE_HXX
30 : : #define _SV_IMAGE_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : : #include <tools/gen.hxx>
34 : : #include <tools/resid.hxx>
35 : : #include <tools/solar.h>
36 : : #include <vcl/bitmapex.hxx>
37 : : #include <com/sun/star/uno/Reference.hxx>
38 : :
39 : : #include <vector>
40 : :
41 : : struct ImplImage;
42 : : struct ImplImageList;
43 : : namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } }
44 : :
45 : : // -----------
46 : : // - Defines -
47 : : // -----------
48 : :
49 : : #define IMAGE_STDBTN_COLOR Color( 0xC0, 0xC0, 0xC0 )
50 : : #define IMAGELIST_IMAGE_NOTFOUND ((sal_uInt16)0xFFFF)
51 : :
52 : : // -----------------------
53 : : // - ImageColorTransform -
54 : : // -----------------------
55 : :
56 : : enum ImageColorTransform
57 : : {
58 : : IMAGECOLORTRANSFORM_NONE = 0,
59 : : IMAGECOLORTRANSFORM_HIGHCONTRAST = 1,
60 : : IMAGECOLORTRANSFORM_MONOCHROME_BLACK = 2,
61 : : IMAGECOLORTRANSFORM_MONOCHROME_WHITE = 3
62 : : };
63 : :
64 : : // ---------
65 : : // - Image -
66 : : // ---------
67 : :
68 : : class VCL_DLLPUBLIC Image
69 : : {
70 : : friend class ImageList;
71 : : friend class OutputDevice;
72 : :
73 : : public:
74 : : Image();
75 : : Image( const ResId& rResId );
76 : : Image( const Image& rImage );
77 : : Image( const BitmapEx& rBitmapEx );
78 : : Image( const Bitmap& rBitmap );
79 : : Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap );
80 : : Image( const Bitmap& rBitmap, const Color& rColor );
81 : : Image( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic );
82 : : ~Image();
83 : :
84 : : Size GetSizePixel() const;
85 : :
86 : : BitmapEx GetBitmapEx() const;
87 : : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const;
88 : :
89 : : Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const;
90 : :
91 : 1037525 : sal_Bool operator!() const { return( !mpImplData ? true : false ); }
92 : : Image& operator=( const Image& rImage );
93 : : sal_Bool operator==( const Image& rImage ) const;
94 : 1533 : sal_Bool operator!=( const Image& rImage ) const { return !(Image::operator==( rImage )); }
95 : :
96 : : private:
97 : :
98 : : ImplImage* mpImplData;
99 : :
100 : : SAL_DLLPRIVATE void ImplInit( const BitmapEx& rBmpEx );
101 : : };
102 : :
103 : : // -------------
104 : : // - ImageList -
105 : : // -------------
106 : :
107 : : class VCL_DLLPUBLIC ImageList
108 : : {
109 : : public:
110 : : ImageList( sal_uInt16 nInit = 8, sal_uInt16 nGrow = 4 );
111 : : ImageList( const ResId& rResId );
112 : : ImageList( const ::std::vector< ::rtl::OUString >& rNameVector,
113 : : const ::rtl::OUString& rPrefix,
114 : : const Color* pMaskColor = NULL );
115 : : ImageList( const ImageList& rImageList );
116 : : ~ImageList();
117 : :
118 : : void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
119 : : const std::vector< rtl::OUString > &rNameVector );
120 : : void InsertFromHorizontalBitmap( const ResId& rResId,
121 : : sal_uInt16 nCount,
122 : : const Color *pNonAlphaMaskColor,
123 : : const Color *pSearchColors = NULL,
124 : : const Color *pReplaceColors = NULL,
125 : : sal_uLong nColorCount = 0);
126 : : BitmapEx GetAsHorizontalStrip() const;
127 : : sal_uInt16 GetImageCount() const;
128 : : Size GetImageSize() const;
129 : :
130 : : void AddImage( const ::rtl::OUString& rImageName, const Image& rImage );
131 : :
132 : : void ReplaceImage( const ::rtl::OUString& rImageName, const Image& rImage );
133 : :
134 : : void RemoveImage( sal_uInt16 nId );
135 : :
136 : : Image GetImage( sal_uInt16 nId ) const;
137 : : Image GetImage( const ::rtl::OUString& rImageName ) const;
138 : :
139 : : sal_uInt16 GetImagePos( sal_uInt16 nId ) const;
140 : : bool HasImageAtPos( sal_uInt16 nId ) const;
141 : : sal_uInt16 GetImagePos( const ::rtl::OUString& rImageName ) const;
142 : :
143 : : sal_uInt16 GetImageId( sal_uInt16 nPos ) const;
144 : :
145 : : ::rtl::OUString GetImageName( sal_uInt16 nPos ) const;
146 : : void GetImageNames( ::std::vector< ::rtl::OUString >& rNames ) const;
147 : :
148 : : ImageList& operator=( const ImageList& rImageList );
149 : : sal_Bool operator==( const ImageList& rImageList ) const;
150 : : sal_Bool operator!=( const ImageList& rImageList ) const { return !(ImageList::operator==( rImageList )); }
151 : :
152 : : private:
153 : :
154 : : ImplImageList* mpImplData;
155 : : sal_uInt16 mnInitSize;
156 : : sal_uInt16 mnGrowSize;
157 : :
158 : : SAL_DLLPRIVATE void ImplInitBitmapEx( const ::rtl::OUString& rUserImageName,
159 : : const ::std::vector< ::rtl::OUString >& rImageNames,
160 : : const ::rtl::OUString& rSymbolsStyle,
161 : : BitmapEx& rBmpEx,
162 : : const Color* pMaskColor ) const;
163 : : SAL_DLLPRIVATE void ImplInit( sal_uInt16 nItems, const Size &rSize );
164 : : SAL_DLLPRIVATE sal_uInt16 ImplGetImageId( const ::rtl::OUString& rImageName ) const;
165 : : };
166 : :
167 : : #endif // _SV_IMAGE_HXX
168 : :
169 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|