1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_VCL_IMAGE_HXX
21 #define INCLUDED_VCL_IMAGE_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/gen.hxx>
25 #include <tools/resid.hxx>
26 #include <tools/solar.h>
27 #include <vcl/bitmapex.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
34 namespace com
{ namespace sun
{ namespace star
{ namespace graphic
{ class XGraphic
;} } } }
36 #define IMAGE_STDBTN_COLOR Color( 0xC0, 0xC0, 0xC0 )
37 #define IMAGELIST_IMAGE_NOTFOUND ((sal_uInt16)0xFFFF)
39 enum ImageColorTransform
41 IMAGECOLORTRANSFORM_NONE
= 0,
42 IMAGECOLORTRANSFORM_HIGHCONTRAST
= 1,
43 IMAGECOLORTRANSFORM_MONOCHROME_BLACK
= 2,
44 IMAGECOLORTRANSFORM_MONOCHROME_WHITE
= 3
47 class VCL_DLLPUBLIC Image
49 friend class ImageList
;
50 friend class ::OutputDevice
;
54 explicit Image( const ResId
& rResId
);
55 Image( const Image
& rImage
);
56 explicit Image( const BitmapEx
& rBitmapEx
);
57 explicit Image( const Bitmap
& rBitmap
);
58 Image( const Bitmap
& rBitmap
, const Bitmap
& rMaskBitmap
);
59 Image( const Bitmap
& rBitmap
, const Color
& rColor
);
60 explicit Image( const css::uno::Reference
< css::graphic::XGraphic
>& rxGraphic
);
61 explicit Image( const OUString
&rPNGFileUrl
);
64 Size
GetSizePixel() const;
66 BitmapEx
GetBitmapEx() const;
67 css::uno::Reference
< css::graphic::XGraphic
> GetXGraphic() const;
69 Image
GetColorTransformedImage( ImageColorTransform eColorTransform
) const;
71 bool operator!() const { return !mpImplData
; }
72 Image
& operator=( const Image
& rImage
);
73 bool operator==( const Image
& rImage
) const;
74 bool operator!=( const Image
& rImage
) const { return !(Image::operator==( rImage
)); }
78 ImplImage
* mpImplData
;
80 SAL_DLLPRIVATE
void ImplInit( const BitmapEx
& rBmpEx
);
83 class VCL_DLLPUBLIC ImageList
86 explicit ImageList( sal_uInt16 nInit
= 8, sal_uInt16 nGrow
= 4 );
87 explicit ImageList( const ResId
& rResId
);
88 ImageList( const ::std::vector
< OUString
>& rNameVector
,
89 const OUString
& rPrefix
,
90 const Color
* pMaskColor
= NULL
);
91 ImageList( const ImageList
& rImageList
);
94 void InsertFromHorizontalStrip( const BitmapEx
&rBitmapEx
,
95 const std::vector
< OUString
> &rNameVector
);
96 void InsertFromHorizontalBitmap( const ResId
& rResId
,
98 const Color
*pNonAlphaMaskColor
,
99 const Color
*pSearchColors
= NULL
,
100 const Color
*pReplaceColors
= NULL
,
101 sal_uLong nColorCount
= 0);
102 BitmapEx
GetAsHorizontalStrip() const;
103 sal_uInt16
GetImageCount() const;
104 Size
GetImageSize() const;
106 void AddImage( const OUString
& rImageName
, const Image
& rImage
);
108 void ReplaceImage( const OUString
& rImageName
, const Image
& rImage
);
110 void RemoveImage( sal_uInt16 nId
);
112 Image
GetImage( sal_uInt16 nId
) const;
113 Image
GetImage( const OUString
& rImageName
) const;
115 sal_uInt16
GetImagePos( sal_uInt16 nId
) const;
116 bool HasImageAtPos( sal_uInt16 nId
) const;
117 sal_uInt16
GetImagePos( const OUString
& rImageName
) const;
119 sal_uInt16
GetImageId( sal_uInt16 nPos
) const;
121 OUString
GetImageName( sal_uInt16 nPos
) const;
122 void GetImageNames( ::std::vector
< OUString
>& rNames
) const;
124 ImageList
& operator=( const ImageList
& rImageList
);
125 bool operator==( const ImageList
& rImageList
) const;
126 bool operator!=( const ImageList
& rImageList
) const { return !(ImageList::operator==( rImageList
)); }
130 ImplImageList
* mpImplData
;
131 sal_uInt16 mnInitSize
;
132 sal_uInt16 mnGrowSize
;
134 SAL_DLLPRIVATE
void ImplInitBitmapEx( const OUString
& rUserImageName
,
135 const ::std::vector
< OUString
>& rImageNames
,
136 const OUString
& rSymbolsStyle
,
138 const Color
* pMaskColor
) const;
139 SAL_DLLPRIVATE
void ImplInit( sal_uInt16 nItems
, const Size
&rSize
);
140 SAL_DLLPRIVATE sal_uInt16
ImplGetImageId( const OUString
& rImageName
) const;
143 #endif // INCLUDED_VCL_IMAGE_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */