update dev300-m57
[ooovba.git] / svtools / inc / xpmread.hxx
blob3d54b41fb3d73bde5d49f458598760b1fdaef91c
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.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 #ifndef _XPMREAD_HXX
32 #define _XPMREAD_HXX
34 #ifndef _BITMAP_HXX
35 #include <vcl/bitmap.hxx>
36 #endif
38 #ifdef _XPMPRIVATE
40 #define XPMTEMPBUFSIZE 0x00008000
41 #define XPMSTRINGBUF 0x00008000
43 #define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases
44 #define XPMDEFINITION 0x00000002 // the XPM format consists of
45 #define XPMVALUES 0x00000003
46 #define XPMCOLORS 0x00000004
47 #define XPMPIXELS 0x00000005
48 #define XPMEXTENSIONS 0x00000006
49 #define XPMENDEXT 0x00000007
52 #define XPMREMARK 0x00000001 // defines used by mnStatus
53 #define XPMDOUBLE 0x00000002
54 #define XPMSTRING 0x00000004
55 #define XPMFINISHED 0x00000008
57 #define XPMCASESENSITIVE 0x00000001
58 #define XPMCASENONSENSITIVE 0x00000002
60 // ---------
61 // - Enums -
62 // ---------
64 enum ReadState
66 XPMREAD_OK,
67 XPMREAD_ERROR,
68 XPMREAD_NEED_MORE
71 // -------------
72 // - XPMReader -
73 // -------------
75 class BitmapWriteAccess;
76 class Graphic;
78 class XPMReader : public GraphicReader
80 private:
82 SvStream& mrIStm;
83 Bitmap maBmp;
84 BitmapWriteAccess* mpAcc;
85 Bitmap maMaskBmp;
86 BitmapWriteAccess* mpMaskAcc;
87 long mnLastPos;
89 ULONG mnWidth;
90 ULONG mnHeight;
91 ULONG mnColors;
92 ULONG mnCpp; // characters per pix
93 BOOL mbTransparent;
94 BOOL mbStatus;
95 ULONG mnStatus;
96 ULONG mnIdentifier;
97 BYTE mcThisByte;
98 BYTE mcLastByte;
99 ULONG mnTempAvail;
100 BYTE* mpTempBuf;
101 BYTE* mpTempPtr;
102 BYTE* mpFastColorTable;
103 BYTE* mpColMap;
104 ULONG mnStringSize;
105 BYTE* mpStringBuf;
106 ULONG mnParaSize;
107 BYTE* mpPara;
109 BOOL ImplGetString( void );
110 BOOL ImplGetColor( ULONG );
111 BOOL ImplGetScanLine( ULONG );
112 BOOL ImplGetColSub( BYTE* );
113 BOOL ImplGetColKey( BYTE );
114 void ImplGetRGBHex( BYTE*, ULONG );
115 BOOL ImplGetPara( ULONG numb );
116 BOOL ImplCompare( BYTE*, BYTE*, ULONG, ULONG nmode = XPMCASENONSENSITIVE );
117 ULONG ImplGetULONG( ULONG nPara );
119 public:
120 XPMReader( SvStream& rStm );
121 virtual ~XPMReader();
123 ReadState ReadXPM( Graphic& rGraphic );
126 #endif // _XPMPRIVATE
128 // -------------
129 // - ImportXPM -
130 // -------------
132 BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic );
134 #endif // _XPMREAD_HXX