Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / source / filter / ixpm / xpmread.hxx
blob0c9b9d3144461c20534c007584c225d5f306b863
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_SOURCE_FILTER_IXPM_XPMREAD_HXX
21 #define INCLUDED_VCL_SOURCE_FILTER_IXPM_XPMREAD_HXX
23 #include <vcl/bitmap.hxx>
25 #ifdef _XPMPRIVATE
27 #define XPMTEMPBUFSIZE 0x00008000
28 #define XPMSTRINGBUF 0x00008000
30 #define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases
31 #define XPMDEFINITION 0x00000002 // the XPM format consists of
32 #define XPMVALUES 0x00000003
33 #define XPMCOLORS 0x00000004
34 #define XPMPIXELS 0x00000005
35 #define XPMEXTENSIONS 0x00000006
36 #define XPMENDEXT 0x00000007
38 #define XPMREMARK 0x00000001 // defines used by mnStatus
39 #define XPMDOUBLE 0x00000002
40 #define XPMSTRING 0x00000004
41 #define XPMFINISHED 0x00000008
43 #define XPMCASESENSITIVE 0x00000001
44 #define XPMCASENONSENSITIVE 0x00000002
46 enum ReadState
48 XPMREAD_OK,
49 XPMREAD_ERROR,
50 XPMREAD_NEED_MORE
53 class BitmapWriteAccess;
54 class Graphic;
56 class XPMReader : public GraphicReader
58 private:
60 SvStream& mrIStm;
61 Bitmap maBmp;
62 BitmapWriteAccess* mpAcc;
63 Bitmap maMaskBmp;
64 BitmapWriteAccess* mpMaskAcc;
65 long mnLastPos;
67 sal_uLong mnWidth;
68 sal_uLong mnHeight;
69 sal_uLong mnColors;
70 sal_uLong mnCpp; // characters per pix
71 bool mbTransparent;
72 bool mbStatus;
73 sal_uLong mnStatus;
74 sal_uLong mnIdentifier;
75 sal_uInt8 mcThisByte;
76 sal_uInt8 mcLastByte;
77 sal_uLong mnTempAvail;
78 sal_uInt8* mpTempBuf;
79 sal_uInt8* mpTempPtr;
80 sal_uInt8* mpFastColorTable;
81 sal_uInt8* mpColMap;
82 sal_uLong mnStringSize;
83 sal_uInt8* mpStringBuf;
84 sal_uLong mnParaSize;
85 sal_uInt8* mpPara;
87 bool ImplGetString();
88 bool ImplGetColor( sal_uLong );
89 bool ImplGetScanLine( sal_uLong );
90 bool ImplGetColSub( sal_uInt8* );
91 bool ImplGetColKey( sal_uInt8 );
92 void ImplGetRGBHex( sal_uInt8*, sal_uLong );
93 bool ImplGetPara( sal_uLong numb );
94 static bool ImplCompare( sal_uInt8 const *, sal_uInt8 const *, sal_uLong, sal_uLong nmode = XPMCASENONSENSITIVE );
95 sal_uLong ImplGetULONG( sal_uLong nPara );
97 public:
98 XPMReader( SvStream& rStm );
99 virtual ~XPMReader();
101 ReadState ReadXPM( Graphic& rGraphic );
104 #endif // _XPMPRIVATE
106 bool ImportXPM( SvStream& rStream, Graphic& rGraphic );
108 #endif // INCLUDED_VCL_SOURCE_FILTER_IXPM_XPMREAD_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */