WPG1Parser.h Source File documentation

WPG1Parser.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* libwpg
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
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/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
11 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
12 * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 *
21 * For further information visit http://libwpg.sourceforge.net
22 */
23
24/* "This product is not manufactured, approved, or supported by
25 * Corel Corporation or Corel Corporation Limited."
26 */
27
28#ifndef __WPG1PARSER_H__
29#define __WPG1PARSER_H__
30
31#include <vector>
32
33#include <boost/optional.hpp>
34
35#include <librevenge/librevenge.h>
36
37#include "WPGBitmap.h"
38#include "WPGDashArray.h"
39#include "WPGXParser.h"
40
41 class WPG1Parser : public WPGXParser
42{
43public:
44 WPG1Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
45 bool parse() override;
46
47private:
48 void handleStartWPG();
49 void handleEndWPG();
50 void handlePageFormat();
51
52 void handleFillAttributes();
53 void handleLineAttributes();
54 void handleColormap();
55
56 void handleLine();
57 void handlePolyline();
58 void handleRectangle();
59 void handlePolygon();
60 void handleEllipse();
61
62 void handleCurvedPolyline();
63
64 void handleGroup();
65 void closeGroup(bool force = false);
66
67 bool decodeRLE(std::vector<unsigned char> &buffer, unsigned width, unsigned height, unsigned depth);
68 void fillPixels(libwpg::WPGBitmap &bitmap, const unsigned char *buffer, unsigned width, unsigned height, unsigned depth);
69 void handleBitmapTypeOne();
70 void handleBitmapTypeTwo();
71 void handlePostscriptTypeOne();
72 void handlePostscriptTypeTwo();
73
74 void handleGraphicsTextAttributes();
75 void handleGraphicsTextTypeOne();
76 void handleGraphicsTextTypeTwo();
77 void handleGraphicsTextTypeThree();
78
79 void resetPalette();
80
81 // parsing context
82 int m_recordLength;
83 long m_recordEnd;
84 boost::optional<long> m_groupEnd;
85 bool m_success;
86 bool m_exit;
87 bool m_graphicsStarted;
88 int m_width;
89 int m_height;
90 librevenge::RVNGPropertyList m_style;
91 libwpg::WPGColor m_penForeColor;
92 libwpg::WPGColor m_penBackColor;
93 libwpg::WPGColor m_brushForeColor;
94 libwpg::WPGColor m_brushBackColor;
95 libwpg::WPGDashArray m_dashArray;
96 librevenge::RVNGPropertyListVector m_gradient;
97 libwpg::WPGColor m_fontColor;
98 unsigned m_fontSize;
99 unsigned m_avgCharWidth;
100 unsigned char m_textAlign;
101};
102
103#endif // __WPG1PARSER_H__
104/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPGBitmap.h
WPGDashArray.h
WPGXParser.h
WPG1Parser::handleStartWPG
void handleStartWPG()
Definition WPG1Parser.cpp:301
WPG1Parser::m_dashArray
libwpg::WPGDashArray m_dashArray
Definition WPG1Parser.h:95
WPG1Parser::handleEllipse
void handleEllipse()
Definition WPG1Parser.cpp:644
WPG1Parser::m_avgCharWidth
unsigned m_avgCharWidth
Definition WPG1Parser.h:99
WPG1Parser::handleLine
void handleLine()
Definition WPG1Parser.cpp:521
WPG1Parser::WPG1Parser
WPG1Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
Definition WPG1Parser.cpp:152
WPG1Parser::handlePostscriptTypeOne
void handlePostscriptTypeOne()
Definition WPG1Parser.cpp:1020
WPG1Parser::handleEndWPG
void handleEndWPG()
Definition WPG1Parser.cpp:322
WPG1Parser::resetPalette
void resetPalette()
Definition WPG1Parser.cpp:1251
WPG1Parser::handleRectangle
void handleRectangle()
Definition WPG1Parser.cpp:583
WPG1Parser::m_width
int m_width
Definition WPG1Parser.h:88
WPG1Parser::m_penBackColor
libwpg::WPGColor m_penBackColor
Definition WPG1Parser.h:92
WPG1Parser::m_style
librevenge::RVNGPropertyList m_style
Definition WPG1Parser.h:90
WPG1Parser::handleCurvedPolyline
void handleCurvedPolyline()
Definition WPG1Parser.cpp:674
WPG1Parser::fillPixels
void fillPixels(libwpg::WPGBitmap &bitmap, const unsigned char *buffer, unsigned width, unsigned height, unsigned depth)
Definition WPG1Parser.cpp:831
WPG1Parser::m_fontSize
unsigned m_fontSize
Definition WPG1Parser.h:98
WPG1Parser::m_success
bool m_success
Definition WPG1Parser.h:85
WPG1Parser::m_gradient
librevenge::RVNGPropertyListVector m_gradient
Definition WPG1Parser.h:96
WPG1Parser::handleGraphicsTextTypeTwo
void handleGraphicsTextTypeTwo()
Definition WPG1Parser.cpp:1200
WPG1Parser::handlePostscriptTypeTwo
void handlePostscriptTypeTwo()
Definition WPG1Parser.cpp:1048
WPG1Parser::m_textAlign
unsigned char m_textAlign
Definition WPG1Parser.h:100
WPG1Parser::m_groupEnd
boost::optional< long > m_groupEnd
Definition WPG1Parser.h:84
WPG1Parser::m_exit
bool m_exit
Definition WPG1Parser.h:86
WPG1Parser::m_brushForeColor
libwpg::WPGColor m_brushForeColor
Definition WPG1Parser.h:93
WPG1Parser::handleGraphicsTextAttributes
void handleGraphicsTextAttributes()
Definition WPG1Parser.cpp:1102
WPG1Parser::m_fontColor
libwpg::WPGColor m_fontColor
Definition WPG1Parser.h:97
WPG1Parser::handleFillAttributes
void handleFillAttributes()
Definition WPG1Parser.cpp:412
WPG1Parser::parse
bool parse() override
Definition WPG1Parser.cpp:175
WPG1Parser::handlePolygon
void handlePolygon()
Definition WPG1Parser.cpp:612
WPG1Parser::handlePolyline
void handlePolyline()
Definition WPG1Parser.cpp:554
WPG1Parser::handleGraphicsTextTypeOne
void handleGraphicsTextTypeOne()
Definition WPG1Parser.cpp:1133
WPG1Parser::handleBitmapTypeTwo
void handleBitmapTypeTwo()
Definition WPG1Parser.cpp:953
WPG1Parser::m_recordEnd
long m_recordEnd
Definition WPG1Parser.h:83
WPG1Parser::m_penForeColor
libwpg::WPGColor m_penForeColor
Definition WPG1Parser.h:91
WPG1Parser::handleBitmapTypeOne
void handleBitmapTypeOne()
Definition WPG1Parser.cpp:902
WPG1Parser::closeGroup
void closeGroup(bool force=false)
Definition WPG1Parser.cpp:742
WPG1Parser::handleLineAttributes
void handleLineAttributes()
Definition WPG1Parser.cpp:476
WPG1Parser::handleColormap
void handleColormap()
Definition WPG1Parser.cpp:391
WPG1Parser::handleGroup
void handleGroup()
Definition WPG1Parser.cpp:725
WPG1Parser::handleGraphicsTextTypeThree
void handleGraphicsTextTypeThree()
WPG1Parser::handlePageFormat
void handlePageFormat()
Definition WPG1Parser.cpp:335
WPG1Parser::decodeRLE
bool decodeRLE(std::vector< unsigned char > &buffer, unsigned width, unsigned height, unsigned depth)
Definition WPG1Parser.cpp:756
WPG1Parser::m_recordLength
int m_recordLength
Definition WPG1Parser.h:82
WPG1Parser::m_brushBackColor
libwpg::WPGColor m_brushBackColor
Definition WPG1Parser.h:94
WPG1Parser::m_graphicsStarted
bool m_graphicsStarted
Definition WPG1Parser.h:87
WPG1Parser::m_height
int m_height
Definition WPG1Parser.h:89
WPGXParser::WPGXParser
WPGXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
Definition WPGXParser.cpp:30
libwpg::WPGBitmap
Definition WPGBitmap.h:40
libwpg::WPGColor
Definition WPGColor.h:35
libwpg::WPGDashArray
Definition WPGDashArray.h:37