sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / fltdefs.hxx
blob0ef98820d0b5c1a59c91636b60b5f61403239f85
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fltdefs.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SOLAR_H
32 #include <tools/solar.h>
33 #endif
34 #include <vcl/bitmap.hxx>
36 #include <string.h>
38 namespace binfilter
41 #ifndef _FLTDEFS_HXX
42 #define _FLTDEFS_HXX
45 #if defined ( WIN ) || defined ( WNT )
47 #define RGBQUAD RGBQUADWIN
49 typedef struct RGBQUAD
51 BYTE rgbBlue;
52 BYTE rgbGreen;
53 BYTE rgbRed;
54 BYTE rgbReserved;
56 RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
57 rgbBlue ( cBlue ),
58 rgbGreen ( cGreen ),
59 rgbRed ( cRed ),
60 rgbReserved ( 0 ) {};
61 } RGBQUAD;
64 #ifdef WIN
65 typedef BYTE huge* PDIBBYTE;
66 #define MEMCPY hmemcpy
67 #define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalLock(GlobalAlloc(GHND,(nSize))))
68 #define GLOBALHANDLE(pPointer) ((HGLOBAL)GlobalHandle((*((size_t*)&(pPointer)+1))))
69 #define GLOBALFREE(pPointer) (GlobalUnlock(GLOBALHANDLE((pPointer))))
70 #define MEMSET( pDst, cByte, nCount ) \
71 { \
72 PDIBBYTE pTmp = (PDIBBYTE) pDst; \
73 for ( ULONG i = 0; i < nCount; i++ )\
74 *pTmp++ = cByte; \
77 #else
79 typedef BYTE* PDIBBYTE;
80 #define MEMCPY memcpy
81 #define MEMSET memset
82 #define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalAlloc(GMEM_FIXED,(nSize)))
83 #define GLOBALFREE(pPointer) (GlobalFree((HGLOBAL)pPointer))
84 #define GLOBALHANDLE(pPointer) ((HGLOBAL)(pPointer))
86 #endif
87 #else
89 typedef BYTE* PDIBBYTE;
90 #define MEMCPY memcpy
91 #define MEMSET memset
92 #define GLOBALALLOC(nSize) ((PDIBBYTE)new BYTE[(nSize)])
93 #define GLOBALFREE(pPointer) (delete[] (pPointer))
95 #endif
98 #if defined ( OS2 ) || defined ( UNX )
99 void ReadBitmap( SvStream& rIStream, Bitmap& rBmp, USHORT nDefaultHeight = 0, ULONG nOffBits = 0 );
100 void ReplaceInfoHeader( SvStream& rStm, BYTE* pBuffer );
102 #ifdef OS2
103 #define RGBQUAD RGBQUADOS2
104 #define BITMAPFILEHEADER BITMAPFILEHEADEROS2
105 #define PBITMAPFILEHEADER PBITMAPFILEHEADEROS2
106 #define BITMAPINFOHEADER BITMAPINFOHEADEROS2
107 #define PBITMAPINFOHEADER PBITMAPINFOHEADEROS2
108 #define BITMAPINFO BITMAPINFOOS2
109 #define PBITMAPINFO PBITMAPINFOOS2
110 #endif
112 typedef struct RGBQUAD
114 BYTE rgbBlue;
115 BYTE rgbGreen;
116 BYTE rgbRed;
117 BYTE rgbReserved;
119 RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
120 rgbBlue ( cBlue ),
121 rgbGreen ( cGreen ),
122 rgbRed ( cRed ),
123 rgbReserved ( 0 ) {};
124 } RGBQUAD;
126 typedef struct BITMAPFILEHEADER
128 UINT16 bfType;
129 UINT32 bfSize;
130 UINT16 bfReserved1;
131 UINT16 bfReserved2;
132 UINT32 bfOffBits;
133 } BITMAPFILEHEADER;
134 typedef BITMAPFILEHEADER* PBITMAPFILEHEADER;
136 typedef struct BITMAPINFOHEADER
138 UINT32 biSize;
139 UINT32 biWidth;
140 UINT32 biHeight;
141 UINT16 biPlanes;
142 UINT16 biBitCount;
143 UINT32 biCompression;
144 UINT32 biSizeImage;
145 UINT32 biXPelsPerMeter;
146 UINT32 biYPelsPerMeter;
147 UINT32 biClrUsed;
148 UINT32 biClrImportant;
149 } BITMAPINFOHEADER;
150 typedef BITMAPINFOHEADER* PBITMAPINFOHEADER;
152 typedef struct BITMAPINFO
154 BITMAPINFOHEADER bmiHeader;
155 RGBQUAD bmiColors[1];
156 } BITMAPINFO;
157 typedef BITMAPINFO* PBITMAPINFO;
159 #endif
162 #endif