1*01aa44aaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*01aa44aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*01aa44aaSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*01aa44aaSAndrew Rist * distributed with this work for additional information 6*01aa44aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*01aa44aaSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*01aa44aaSAndrew Rist * "License"); you may not use this file except in compliance 9*01aa44aaSAndrew Rist * with the License. You may obtain a copy of the License at 10*01aa44aaSAndrew Rist * 11*01aa44aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*01aa44aaSAndrew Rist * 13*01aa44aaSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*01aa44aaSAndrew Rist * software distributed under the License is distributed on an 15*01aa44aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*01aa44aaSAndrew Rist * KIND, either express or implied. See the License for the 17*01aa44aaSAndrew Rist * specific language governing permissions and limitations 18*01aa44aaSAndrew Rist * under the License. 19*01aa44aaSAndrew Rist * 20*01aa44aaSAndrew Rist *************************************************************/ 21*01aa44aaSAndrew Rist 22*01aa44aaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _XPMREAD_HXX 25cdf0e10cSrcweir #define _XPMREAD_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _BITMAP_HXX 28cdf0e10cSrcweir #include <vcl/bitmap.hxx> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifdef _XPMPRIVATE 32cdf0e10cSrcweir 33cdf0e10cSrcweir #define XPMTEMPBUFSIZE 0x00008000 34cdf0e10cSrcweir #define XPMSTRINGBUF 0x00008000 35cdf0e10cSrcweir 36cdf0e10cSrcweir #define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases 37cdf0e10cSrcweir #define XPMDEFINITION 0x00000002 // the XPM format consists of 38cdf0e10cSrcweir #define XPMVALUES 0x00000003 39cdf0e10cSrcweir #define XPMCOLORS 0x00000004 40cdf0e10cSrcweir #define XPMPIXELS 0x00000005 41cdf0e10cSrcweir #define XPMEXTENSIONS 0x00000006 42cdf0e10cSrcweir #define XPMENDEXT 0x00000007 43cdf0e10cSrcweir 44cdf0e10cSrcweir 45cdf0e10cSrcweir #define XPMREMARK 0x00000001 // defines used by mnStatus 46cdf0e10cSrcweir #define XPMDOUBLE 0x00000002 47cdf0e10cSrcweir #define XPMSTRING 0x00000004 48cdf0e10cSrcweir #define XPMFINISHED 0x00000008 49cdf0e10cSrcweir 50cdf0e10cSrcweir #define XPMCASESENSITIVE 0x00000001 51cdf0e10cSrcweir #define XPMCASENONSENSITIVE 0x00000002 52cdf0e10cSrcweir 53cdf0e10cSrcweir // --------- 54cdf0e10cSrcweir // - Enums - 55cdf0e10cSrcweir // --------- 56cdf0e10cSrcweir 57cdf0e10cSrcweir enum ReadState 58cdf0e10cSrcweir { 59cdf0e10cSrcweir XPMREAD_OK, 60cdf0e10cSrcweir XPMREAD_ERROR, 61cdf0e10cSrcweir XPMREAD_NEED_MORE 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // ------------- 65cdf0e10cSrcweir // - XPMReader - 66cdf0e10cSrcweir // ------------- 67cdf0e10cSrcweir 68cdf0e10cSrcweir class BitmapWriteAccess; 69cdf0e10cSrcweir class Graphic; 70cdf0e10cSrcweir 71cdf0e10cSrcweir class XPMReader : public GraphicReader 72cdf0e10cSrcweir { 73cdf0e10cSrcweir private: 74cdf0e10cSrcweir 75cdf0e10cSrcweir SvStream& mrIStm; 76cdf0e10cSrcweir Bitmap maBmp; 77cdf0e10cSrcweir BitmapWriteAccess* mpAcc; 78cdf0e10cSrcweir Bitmap maMaskBmp; 79cdf0e10cSrcweir BitmapWriteAccess* mpMaskAcc; 80cdf0e10cSrcweir long mnLastPos; 81cdf0e10cSrcweir 82cdf0e10cSrcweir sal_uLong mnWidth; 83cdf0e10cSrcweir sal_uLong mnHeight; 84cdf0e10cSrcweir sal_uLong mnColors; 85cdf0e10cSrcweir sal_uLong mnCpp; // characters per pix 86cdf0e10cSrcweir sal_Bool mbTransparent; 87cdf0e10cSrcweir sal_Bool mbStatus; 88cdf0e10cSrcweir sal_uLong mnStatus; 89cdf0e10cSrcweir sal_uLong mnIdentifier; 90cdf0e10cSrcweir sal_uInt8 mcThisByte; 91cdf0e10cSrcweir sal_uInt8 mcLastByte; 92cdf0e10cSrcweir sal_uLong mnTempAvail; 93cdf0e10cSrcweir sal_uInt8* mpTempBuf; 94cdf0e10cSrcweir sal_uInt8* mpTempPtr; 95cdf0e10cSrcweir sal_uInt8* mpFastColorTable; 96cdf0e10cSrcweir sal_uInt8* mpColMap; 97cdf0e10cSrcweir sal_uLong mnStringSize; 98cdf0e10cSrcweir sal_uInt8* mpStringBuf; 99cdf0e10cSrcweir sal_uLong mnParaSize; 100cdf0e10cSrcweir sal_uInt8* mpPara; 101cdf0e10cSrcweir 102cdf0e10cSrcweir sal_Bool ImplGetString( void ); 103cdf0e10cSrcweir sal_Bool ImplGetColor( sal_uLong ); 104cdf0e10cSrcweir sal_Bool ImplGetScanLine( sal_uLong ); 105cdf0e10cSrcweir sal_Bool ImplGetColSub( sal_uInt8* ); 106cdf0e10cSrcweir sal_Bool ImplGetColKey( sal_uInt8 ); 107cdf0e10cSrcweir void ImplGetRGBHex( sal_uInt8*, sal_uLong ); 108cdf0e10cSrcweir sal_Bool ImplGetPara( sal_uLong numb ); 109cdf0e10cSrcweir sal_Bool ImplCompare( sal_uInt8*, sal_uInt8*, sal_uLong, sal_uLong nmode = XPMCASENONSENSITIVE ); 110cdf0e10cSrcweir sal_uLong ImplGetULONG( sal_uLong nPara ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir public: 113cdf0e10cSrcweir XPMReader( SvStream& rStm ); 114cdf0e10cSrcweir virtual ~XPMReader(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir ReadState ReadXPM( Graphic& rGraphic ); 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir 119cdf0e10cSrcweir #endif // _XPMPRIVATE 120cdf0e10cSrcweir 121cdf0e10cSrcweir // ------------- 122cdf0e10cSrcweir // - ImportXPM - 123cdf0e10cSrcweir // ------------- 124cdf0e10cSrcweir 125cdf0e10cSrcweir sal_Bool ImportXPM( SvStream& rStream, Graphic& rGraphic ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir #endif // _XPMREAD_HXX 128