- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

CDRContentCollector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libcdr
3 * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License or as specified alternatively below. You may obtain a copy of
8 * the License at http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * Major Contributor(s):
16 * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
17 *
18 *
19 * All Rights Reserved.
20 *
21 * For minor contributions see the git repository.
22 *
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26 * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27 * instead of those above.
28 */
29
30 #ifndef __CDRCONTENTCOLLECTOR_H__
31 #define __CDRCONTENTCOLLECTOR_H__
32
33 #include <map>
34 #include <vector>
35 #include <stack>
36 #include <libwpg/libwpg.h>
37 #include <lcms2.h>
38 #include "CDRTypes.h"
39 #include "CDRPath.h"
40 #include "CDROutputElementList.h"
41 #include "CDRCollector.h"
42
43 namespace libcdr
44 {
45
46 class CDRContentCollector : public CDRCollector
47 {
48 public:
49 CDRContentCollector(CDRParserState &ps, ::libwpg::WPGPaintInterface *painter);
50 virtual ~CDRContentCollector();
51
52 // collector functions
53 void collectPage(unsigned level);
54 void collectObject(unsigned level);
55 void collectOtherList();
56 void collectCubicBezier(double x1, double y1, double x2, double y2, double x, double y);
57 void collectQuadraticBezier(double x1, double y1, double x, double y);
58 void collectMoveTo(double x, double y);
59 void collectLineTo(double x, double y);
60 void collectArcTo(double rx, double ry, bool largeArc, bool sweep, double x, double y);
61 void collectClosePath();
62 void collectLevel(unsigned level);
63 void collectTransform(double v0, double v1, double x, double v3, double v4, double y);
64 void collectFildId(unsigned id);
65 void collectOutlId(unsigned id);
66 void collectFild(unsigned, unsigned short, const CDRColor &, const CDRColor &, const CDRGradient &, const CDRImageFill &) {}
67 void collectOutl(unsigned, unsigned short, unsigned short, unsigned short, double, double, double, const CDRColor &,
68 const std::vector<unsigned short> &, unsigned, unsigned) {}
69 void collectRotate(double angle);
70 void collectFlags(unsigned flags);
71 void collectPageSize(double width, double height);
72 void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy);
73 void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2);
74 void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned>&, const std::vector<unsigned char>&) {}
75 void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) {}
76 void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector);
77 void collectFillTransform(double v0, double v1, double x, double v3, double v4, double y);
78 void collectFillOpacity(double opacity);
79 void collectPolygon();
80 void collectSpline();
81
82 private:
83 CDRContentCollector(const CDRContentCollector &);
84 CDRContentCollector &operator=(const CDRContentCollector &);
85
86 // helper functions
87 void _startPage(double width, double height);
88 void _endPage();
89 void _flushCurrentPath();
90
91 void _fillProperties(WPXPropertyList &propList, WPXPropertyListVector &vec);
92 void _lineProperties(WPXPropertyList &propList);
93 void _generateBitmapFromPattern(WPXBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
94
95 libwpg::WPGPaintInterface *m_painter;
96
97 bool m_isPageProperties;
98 bool m_isPageStarted;
99
100 double m_pageOffsetX, m_pageOffsetY;
101 double m_pageWidth, m_pageHeight;
102 unsigned m_currentFildId, m_currentOutlId;
103 unsigned m_currentObjectLevel, m_currentPageLevel;
104 CDRImage m_currentImage;
105
106 CDRPath m_currentPath;
107 CDRTransform m_currentTransform, m_fillTransform;
108 CDRPolygon *m_polygon;
109 bool m_isInPolygon;
110 bool m_isInSpline;
111 std::stack<CDROutputElementList> m_outputElements;
112 CDRSplineData m_splineData;
113 double m_fillOpacity;
114
115 CDRParserState &m_ps;
116 };
117
118 } // namespace libcdr
119
120 #endif /* __CDRCOLLECTOR_H__ */
121 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRContentCollector::_flushCurrentPath
void _flushCurrentPath()
Definition: CDRContentCollector.cpp:169
libcdr::CDRContentCollector::collectOtherList
void collectOtherList()
Definition: CDRContentCollector.cpp:120
libcdr::CDRContentCollector::collectFillTransform
void collectFillTransform(double v0, double v1, double x, double v3, double v4, double y)
Definition: CDRContentCollector.cpp:316
libcdr::CDRContentCollector::m_pageOffsetX
double m_pageOffsetX
Definition: CDRContentCollector.h:100
libcdr::CDRPath
Definition: CDRPath.h:52
libcdr::CDRContentCollector::collectFillOpacity
void collectFillOpacity(double opacity)
Definition: CDRContentCollector.cpp:828
libcdr::CDRContentCollector::m_currentImage
CDRImage m_currentImage
Definition: CDRContentCollector.h:104
libcdr::CDRContentCollector::collectCubicBezier
void collectCubicBezier(double x1, double y1, double x2, double y2, double x, double y)
Definition: CDRContentCollector.cpp:133
libcdr::CDRContentCollector::_fillProperties
void _fillProperties(WPXPropertyList &propList, WPXPropertyListVector &vec)
Definition: CDRContentCollector.cpp:366
libcdr::CDRImageFill
Definition: CDRTypes.h:98
libcdr::CDRContentCollector::m_currentPageLevel
unsigned m_currentPageLevel
Definition: CDRContentCollector.h:103
libcdr::CDRContentCollector::_generateBitmapFromPattern
void _generateBitmapFromPattern(WPXBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor)
Definition: CDRContentCollector.cpp:748
libcdr::CDRContentCollector::m_currentObjectLevel
unsigned m_currentObjectLevel
Definition: CDRContentCollector.h:103
libcdr::CDRContentCollector::m_isInPolygon
bool m_isInPolygon
Definition: CDRContentCollector.h:109
libcdr::CDRContentCollector::collectBmp
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector< unsigned > &, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:74
libcdr::CDRContentCollector::collectFild
void collectFild(unsigned, unsigned short, const CDRColor &, const CDRColor &, const CDRGradient &, const CDRImageFill &)
Definition: CDRContentCollector.h:66
libcdr::CDRContentCollector::collectPpdt
void collectPpdt(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned > &knotVector)
Definition: CDRContentCollector.cpp:823
libcdr::CDRSplineData
Definition: CDRTypes.h:208
libcdr::CDRContentCollector::m_outputElements
std::stack< CDROutputElementList > m_outputElements
Definition: CDRContentCollector.h:111
libcdr::CDRContentCollector::collectPageSize
void collectPageSize(double width, double height)
Definition: CDRContentCollector.cpp:125
libcdr::CDRContentCollector::m_painter
libwpg::WPGPaintInterface * m_painter
Definition: CDRContentCollector.h:95
libcdr::CDRContentCollector::collectPage
void collectPage(unsigned level)
Definition: CDRContentCollector.cpp:93
libcdr::CDRPolygon
Definition: CDRTypes.h:152
libcdr::CDRContentCollector::_lineProperties
void _lineProperties(WPXPropertyList &propList)
Definition: CDRContentCollector.cpp:626
libcdr::CDRContentCollector::CDRContentCollector
CDRContentCollector(CDRParserState &ps,::libwpg::WPGPaintInterface *painter)
libcdr::CDRContentCollector::collectOutl
void collectOutl(unsigned, unsigned short, unsigned short, unsigned short, double, double, double, const CDRColor &, const std::vector< unsigned short > &, unsigned, unsigned)
Definition: CDRContentCollector.h:67
libcdr::CDRContentCollector::m_fillTransform
CDRTransform m_fillTransform
Definition: CDRContentCollector.h:107
libcdr::CDRContentCollector::collectSpline
void collectSpline()
Definition: CDRContentCollector.cpp:354
libcdr::CDRContentCollector::m_isInSpline
bool m_isInSpline
Definition: CDRContentCollector.h:110
libcdr::CDRContentCollector::m_ps
CDRParserState & m_ps
Definition: CDRContentCollector.h:115
libcdr::CDRContentCollector::collectTransform
void collectTransform(double v0, double v1, double x, double v3, double v4, double y)
Definition: CDRContentCollector.cpp:311
libcdr::CDRContentCollector::collectPolygon
void collectPolygon()
Definition: CDRContentCollector.cpp:349
libcdr::CDRContentCollector::collectBitmap
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2)
Definition: CDRContentCollector.cpp:816
libcdr::CDRContentCollector::collectPolygonTransform
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy)
Definition: CDRContentCollector.cpp:359
libcdr::CDRContentCollector::m_pageWidth
double m_pageWidth
Definition: CDRContentCollector.h:101
libcdr::CDRContentCollector::collectRotate
void collectRotate(double angle)
Definition: CDRContentCollector.cpp:345
CDROutputElementList.h
libcdr::CDRContentCollector::m_polygon
CDRPolygon * m_polygon
Definition: CDRContentCollector.h:108
libcdr::CDRContentCollector::m_fillOpacity
double m_fillOpacity
Definition: CDRContentCollector.h:113
libcdr::CDRContentCollector::operator=
CDRContentCollector & operator=(const CDRContentCollector &)
libcdr::CDRContentCollector::m_currentTransform
CDRTransform m_currentTransform
Definition: CDRContentCollector.h:107
libcdr::CDRContentCollector::collectQuadraticBezier
void collectQuadraticBezier(double x1, double y1, double x, double y)
Definition: CDRContentCollector.cpp:139
libcdr::CDRContentCollector::collectMoveTo
void collectMoveTo(double x, double y)
Definition: CDRContentCollector.cpp:145
libcdr::CDRContentCollector::m_currentOutlId
unsigned m_currentOutlId
Definition: CDRContentCollector.h:102
libcdr::CDRContentCollector::m_isPageProperties
bool m_isPageProperties
Definition: CDRContentCollector.h:97
libcdr::CDRContentCollector::_startPage
void _startPage(double width, double height)
Definition: CDRContentCollector.cpp:67
libcdr::CDRContentCollector::m_currentFildId
unsigned m_currentFildId
Definition: CDRContentCollector.h:102
libcdr::CDRContentCollector
Definition: CDRContentCollector.h:46
libcdr::CDRContentCollector::collectFlags
void collectFlags(unsigned flags)
Definition: CDRContentCollector.cpp:106
CDRCollector.h
CDRTypes.h
libcdr::CDRContentCollector::collectLevel
void collectLevel(unsigned level)
Definition: CDRContentCollector.cpp:321
libcdr::CDRContentCollector::collectArcTo
void collectArcTo(double rx, double ry, bool largeArc, bool sweep, double x, double y)
Definition: CDRContentCollector.cpp:157
libcdr::CDRContentCollector::_endPage
void _endPage()
Definition: CDRContentCollector.cpp:79
libcdr::CDRContentCollector::collectLineTo
void collectLineTo(double x, double y)
Definition: CDRContentCollector.cpp:151
libcdr::CDRContentCollector::m_isPageStarted
bool m_isPageStarted
Definition: CDRContentCollector.h:98
libcdr::CDRContentCollector::collectObject
void collectObject(unsigned level)
Definition: CDRContentCollector.cpp:99
libcdr::CDRParserState
Definition: CDRCollector.h:75
libcdr::CDRColor
Definition: CDRTypes.h:58
libcdr::CDRContentCollector::m_pageOffsetY
double m_pageOffsetY
Definition: CDRContentCollector.h:100
libcdr::CDRPattern
Definition: CDRTypes.h:198
libcdr::CDRGradient
Definition: CDRTypes.h:80
libcdr::CDRContentCollector::m_currentPath
CDRPath m_currentPath
Definition: CDRContentCollector.h:106
libcdr::CDRContentCollector::m_splineData
CDRSplineData m_splineData
Definition: CDRContentCollector.h:112
libcdr::CDRImage
Definition: CDRTypes.h:166
libcdr::CDRTransform
Definition: CDRTypes.h:40
libcdr::CDRContentCollector::collectOutlId
void collectOutlId(unsigned id)
Definition: CDRContentCollector.cpp:340
libcdr::CDRContentCollector::~CDRContentCollector
virtual ~CDRContentCollector()
Definition: CDRContentCollector.cpp:61
libcdr::CDRContentCollector::collectBmpf
void collectBmpf(unsigned, unsigned, unsigned, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:75
CDRPath.h
libcdr::CDRContentCollector::m_pageHeight
double m_pageHeight
Definition: CDRContentCollector.h:101
libcdr::CDRContentCollector::collectFildId
void collectFildId(unsigned id)
Definition: CDRContentCollector.cpp:335
libcdr::CDRCollector
Definition: CDRCollector.h:96
libcdr::CDRContentCollector::collectClosePath
void collectClosePath()
Definition: CDRContentCollector.cpp:163