WPG1Parser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwpg
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
00011  * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
00012  * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
00013  *
00014  * For minor contributions see the git repository.
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the GNU Lesser General Public License Version 2.1 or later
00018  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00019  * applicable instead of those above.
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__
00091 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */