merge the formfield patch from ooo-build
[ooovba.git] / binfilter / inc / bf_svtools / xpmread.hxx
blobe8db1132531cf6ad31089a22438588066154b80b
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: xpmread.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 _XPMREAD_HXX
32 #define _XPMREAD_HXX
34 #ifndef _BITMAP_HXX
35 #include <vcl/bitmap.hxx>
36 #endif
38 class BitmapWriteAccess;
39 class Graphic;
41 namespace binfilter
44 #ifdef _XPMPRIVATE
46 #define XPMTEMPBUFSIZE 0x00008000
47 #define XPMSTRINGBUF 0x00008000
49 #define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases
50 #define XPMDEFINITION 0x00000002 // the XPM format consists of
51 #define XPMVALUES 0x00000003
52 #define XPMCOLORS 0x00000004
53 #define XPMPIXELS 0x00000005
54 #define XPMEXTENSIONS 0x00000006
55 #define XPMENDEXT 0x00000007
58 #define XPMREMARK 0x00000001 // defines used by mnStatus
59 #define XPMDOUBLE 0x00000002
60 #define XPMSTRING 0x00000004
61 #define XPMFINISHED 0x00000008
63 #define XPMCASESENSITIVE 0x00000001
64 #define XPMCASENONSENSITIVE 0x00000002
66 // ---------
67 // - Enums -
68 // ---------
70 enum ReadState
72 XPMREAD_OK,
73 XPMREAD_ERROR,
74 XPMREAD_NEED_MORE
77 // -------------
78 // - XPMReader -
79 // -------------
81 class XPMReader : public GraphicReader
83 private:
85 SvStream& mrIStm;
86 Bitmap maBmp;
87 BitmapWriteAccess* mpAcc;
88 Bitmap maMaskBmp;
89 BitmapWriteAccess* mpMaskAcc;
90 long mnLastPos;
92 ULONG mnWidth;
93 ULONG mnHeight;
94 ULONG mnColors;
95 ULONG mnCpp; // characters per pix
96 BOOL mbTransparent;
97 BOOL mbStatus;
98 ULONG mnStatus;
99 ULONG mnIdentifier;
100 BYTE mcThisByte;
101 BYTE mcLastByte;
102 ULONG mnTempAvail;
103 BYTE* mpTempBuf;
104 BYTE* mpTempPtr;
105 BYTE* mpFastColorTable;
106 BYTE* mpColMap;
107 ULONG mnStringSize;
108 BYTE* mpStringBuf;
109 ULONG mnParaSize;
110 BYTE* mpPara;
112 BOOL ImplGetString( void );
113 BOOL ImplGetColor( ULONG );
114 BOOL ImplGetScanLine( ULONG );
115 BOOL ImplGetColSub( BYTE* );
116 BOOL ImplGetColKey( BYTE );
117 void ImplGetRGBHex( BYTE*, ULONG );
118 BOOL ImplGetPara( ULONG numb );
119 BOOL ImplCompare( BYTE*, BYTE*, ULONG, ULONG nmode = XPMCASENONSENSITIVE );
120 ULONG ImplGetULONG( ULONG nPara );
122 public:
123 XPMReader( SvStream& rStm );
124 virtual ~XPMReader();
126 ReadState ReadXPM( Graphic& rGraphic );
129 #endif // _XPMPRIVATE
131 // -------------
132 // - ImportXPM -
133 // -------------
135 BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic );
139 #endif // _XPMREAD_HXX