xref: /aoo41x/main/svtools/source/inc/xbmread.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XBMREAD_HXX
29 #define _XBMREAD_HXX
30 
31 #ifndef _GRAPH_HXX
32 #include <vcl/graph.hxx>
33 #endif
34 #ifndef _BMPACC_HXX
35 #include <vcl/bmpacc.hxx>
36 #endif
37 
38 #ifdef _XBMPRIVATE
39 
40 // ---------
41 // - Enums -
42 // ---------
43 
44 enum XBMFormat
45 {
46 	XBM10,
47 	XBM11
48 };
49 
50 enum ReadState
51 {
52 	XBMREAD_OK,
53 	XBMREAD_ERROR,
54 	XBMREAD_NEED_MORE
55 };
56 
57 // -------------
58 // - XBMReader -
59 // -------------
60 
61 class XBMReader : public GraphicReader
62 {
63 	SvStream&			rIStm;
64 	Bitmap				aBmp1;
65 	BitmapWriteAccess*	pAcc1;
66 	short*				pHexTable;
67 	BitmapColor			aWhite;
68 	BitmapColor			aBlack;
69 	long				nLastPos;
70 	long				nWidth;
71 	long				nHeight;
72 	sal_Bool				bStatus;
73 
74 	void				InitTable();
75 	ByteString			FindTokenLine( SvStream* pInStm, const char* pTok1,
76 									   const char* pTok2 = NULL, const char* pTok3 = NULL );
77 	long				ParseDefine( const sal_Char* pDefine );
78 	sal_Bool				ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat );
79 
80 
81 public:
82 
83 						XBMReader( SvStream& rStm );
84 	virtual				~XBMReader();
85 
86 	ReadState			ReadXBM( Graphic& rGraphic );
87 };
88 
89 #endif // _XBMPRIVATE
90 
91 // -------------
92 // - ImportXBM -
93 // -------------
94 
95 sal_Bool ImportXBM( SvStream& rStream, Graphic& rGraphic );
96 
97 #endif // _XBMREAD_HXX
98