00001 /* libwpg 00002 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 00003 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) 00004 * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the 00018 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02111-1301 USA 00020 * 00021 * For further information visit http://libwpg.sourceforge.net 00022 */ 00023 00024 /* "This product is not manufactured, approved, or supported by 00025 * Corel Corporation or Corel Corporation Limited." 00026 */ 00027 00028 #ifndef __WPG1PARSER_H__ 00029 #define __WPG1PARSER_H__ 00030 00031 #include "WPGXParser.h" 00032 #include "WPGDashArray.h" 00033 #include "WPGBitmap.h" 00034 #include <libwpd/libwpd.h> 00035 #include <vector> 00036 00037 class WPG1Parser : public WPGXParser 00038 { 00039 public: 00040 WPG1Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter); 00041 bool parse(); 00042 00043 private: 00044 void handleStartWPG(); 00045 void handleEndWPG(); 00046 00047 void handleFillAttributes(); 00048 void handleLineAttributes(); 00049 void handleColormap(); 00050 00051 void handleLine(); 00052 void handlePolyline(); 00053 void handleRectangle(); 00054 void handlePolygon(); 00055 void handleEllipse(); 00056 00057 void handleCurvedPolyline(); 00058 00059 void decodeRLE(std::vector<unsigned char>& buffer, unsigned width, unsigned height, unsigned depth); 00060 void fillPixels(libwpg::WPGBitmap& bitmap, const unsigned char* buffer, unsigned width, unsigned height, unsigned depth); 00061 void handleBitmapTypeOne(); 00062 void handleBitmapTypeTwo(); 00063 void handlePostscriptTypeOne(); 00064 void handlePostscriptTypeTwo(); 00065 00066 void handleGraphicsTextAttributes(); 00067 void handleGraphicsTextTypeOne(); 00068 void handleGraphicsTextTypeTwo(); 00069 void handleGraphicsTextTypeThree(); 00070 00071 void resetPalette(); 00072 00073 // parsing context 00074 int m_recordLength; 00075 long m_recordEnd; 00076 bool m_success; 00077 bool m_exit; 00078 bool m_graphicsStarted; 00079 int m_width; 00080 int m_height; 00081 ::WPXPropertyList m_style; 00082 libwpg::WPGColor m_penForeColor; 00083 libwpg::WPGColor m_penBackColor; 00084 libwpg::WPGColor m_brushForeColor; 00085 libwpg::WPGColor m_brushBackColor; 00086 libwpg::WPGDashArray m_dashArray; 00087 ::WPXPropertyListVector m_gradient; 00088 }; 00089 00090 #endif // __WPG1PARSER_H__