update dev300-m57
[ooovba.git] / svtools / inc / fltdefs.hxx
blobefa2968d5f13e698f6fba93635940a8473251d3b
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.4 $
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 #include <tools/solar.h>
32 #include <vcl/bitmap.hxx>
34 #include <string.h>
36 #ifndef _FLTDEFS_HXX
37 #define _FLTDEFS_HXX
40 #if defined ( WIN ) || defined ( WNT )
42 #define RGBQUAD RGBQUADWIN
44 typedef struct RGBQUAD
46 BYTE rgbBlue;
47 BYTE rgbGreen;
48 BYTE rgbRed;
49 BYTE rgbReserved;
51 RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
52 rgbBlue ( cBlue ),
53 rgbGreen ( cGreen ),
54 rgbRed ( cRed ),
55 rgbReserved ( 0 ) {};
56 } RGBQUAD;
59 #ifdef WIN
60 typedef BYTE huge* PDIBBYTE;
61 #define MEMCPY hmemcpy
62 #define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalLock(GlobalAlloc(GHND,(nSize))))
63 #define GLOBALHANDLE(pPointer) ((HGLOBAL)GlobalHandle((*((size_t*)&(pPointer)+1))))
64 #define GLOBALFREE(pPointer) (GlobalUnlock(GLOBALHANDLE((pPointer))))
65 #define MEMSET( pDst, cByte, nCount ) \
66 { \
67 PDIBBYTE pTmp = (PDIBBYTE) pDst; \
68 for ( ULONG i = 0; i < nCount; i++ )\
69 *pTmp++ = cByte; \
72 #else
74 typedef BYTE* PDIBBYTE;
75 #define MEMCPY memcpy
76 #define MEMSET memset
77 #define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalAlloc(GMEM_FIXED,(nSize)))
78 #define GLOBALFREE(pPointer) (GlobalFree((HGLOBAL)pPointer))
79 #define GLOBALHANDLE(pPointer) ((HGLOBAL)(pPointer))
81 #endif
82 #else
84 typedef BYTE* PDIBBYTE;
85 #define MEMCPY memcpy
86 #define MEMSET memset
87 #define GLOBALALLOC(nSize) ((PDIBBYTE)new BYTE[(nSize)])
88 #define GLOBALFREE(pPointer) (delete[] (pPointer))
90 #endif
93 #if defined ( OS2 ) || defined ( UNX )
94 void ReadBitmap( SvStream& rIStream, Bitmap& rBmp, USHORT nDefaultHeight = 0, ULONG nOffBits = 0 );
95 void ReplaceInfoHeader( SvStream& rStm, BYTE* pBuffer );
97 #ifdef OS2
98 #define RGBQUAD RGBQUADOS2
99 #define BITMAPFILEHEADER BITMAPFILEHEADEROS2
100 #define PBITMAPFILEHEADER PBITMAPFILEHEADEROS2
101 #define BITMAPINFOHEADER BITMAPINFOHEADEROS2
102 #define PBITMAPINFOHEADER PBITMAPINFOHEADEROS2
103 #define BITMAPINFO BITMAPINFOOS2
104 #define PBITMAPINFO PBITMAPINFOOS2
105 #endif
107 typedef struct RGBQUAD
109 BYTE rgbBlue;
110 BYTE rgbGreen;
111 BYTE rgbRed;
112 BYTE rgbReserved;
114 RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
115 rgbBlue ( cBlue ),
116 rgbGreen ( cGreen ),
117 rgbRed ( cRed ),
118 rgbReserved ( 0 ) {};
119 } RGBQUAD;
121 typedef struct BITMAPFILEHEADER
123 UINT16 bfType;
124 UINT32 bfSize;
125 UINT16 bfReserved1;
126 UINT16 bfReserved2;
127 UINT32 bfOffBits;
128 } BITMAPFILEHEADER;
129 typedef BITMAPFILEHEADER* PBITMAPFILEHEADER;
131 typedef struct BITMAPINFOHEADER
133 UINT32 biSize;
134 UINT32 biWidth;
135 UINT32 biHeight;
136 UINT16 biPlanes;
137 UINT16 biBitCount;
138 UINT32 biCompression;
139 UINT32 biSizeImage;
140 UINT32 biXPelsPerMeter;
141 UINT32 biYPelsPerMeter;
142 UINT32 biClrUsed;
143 UINT32 biClrImportant;
144 } BITMAPINFOHEADER;
145 typedef BITMAPINFOHEADER* PBITMAPINFOHEADER;
147 typedef struct BITMAPINFO
149 BITMAPINFOHEADER bmiHeader;
150 RGBQUAD bmiColors[1];
151 } BITMAPINFO;
152 typedef BITMAPINFO* PBITMAPINFO;
154 #endif
155 #endif