xref: /trunk/main/svtools/source/inc/xbmread.hxx (revision 01aa44aa)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XBMREAD_HXX
25 #define _XBMREAD_HXX
26 
27 #ifndef _GRAPH_HXX
28 #include <vcl/graph.hxx>
29 #endif
30 #ifndef _BMPACC_HXX
31 #include <vcl/bmpacc.hxx>
32 #endif
33 
34 #ifdef _XBMPRIVATE
35 
36 // ---------
37 // - Enums -
38 // ---------
39 
40 enum XBMFormat
41 {
42 	XBM10,
43 	XBM11
44 };
45 
46 enum ReadState
47 {
48 	XBMREAD_OK,
49 	XBMREAD_ERROR,
50 	XBMREAD_NEED_MORE
51 };
52 
53 // -------------
54 // - XBMReader -
55 // -------------
56 
57 class XBMReader : public GraphicReader
58 {
59 	SvStream&			rIStm;
60 	Bitmap				aBmp1;
61 	BitmapWriteAccess*	pAcc1;
62 	short*				pHexTable;
63 	BitmapColor			aWhite;
64 	BitmapColor			aBlack;
65 	long				nLastPos;
66 	long				nWidth;
67 	long				nHeight;
68 	sal_Bool				bStatus;
69 
70 	void				InitTable();
71 	ByteString			FindTokenLine( SvStream* pInStm, const char* pTok1,
72 									   const char* pTok2 = NULL, const char* pTok3 = NULL );
73 	long				ParseDefine( const sal_Char* pDefine );
74 	sal_Bool				ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat );
75 
76 
77 public:
78 
79 						XBMReader( SvStream& rStm );
80 	virtual				~XBMReader();
81 
82 	ReadState			ReadXBM( Graphic& rGraphic );
83 };
84 
85 #endif // _XBMPRIVATE
86 
87 // -------------
88 // - ImportXBM -
89 // -------------
90 
91 sal_Bool ImportXBM( SvStream& rStream, Graphic& rGraphic );
92 
93 #endif // _XBMREAD_HXX
94