CDRContentCollector.h Source File documentation

CDRContentCollector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libcdr project.
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
10 #ifndef __CDRCONTENTCOLLECTOR_H__
11 #define __CDRCONTENTCOLLECTOR_H__
12
13 #include <map>
14 #include <vector>
15 #include <stack>
16 #include <queue>
17 #include <librevenge/librevenge.h>
18 #include <lcms2.h>
19 #include "CDRTypes.h"
20 #include "CDRPath.h"
21 #include "CDROutputElementList.h"
22 #include "CDRCollector.h"
23
24 namespace libcdr
25 {
26
27 class CDRContentCollector : public CDRCollector
28 {
29 public:
30 CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface *painter, bool reverseOrder = true);
31 ~CDRContentCollector() override;
32
33 // collector functions
34 void collectPage(unsigned level) override;
35 void collectObject(unsigned level) override;
36 void collectGroup(unsigned level) override;
37 void collectVect(unsigned level) override;
38 void collectOtherList() override;
39 void collectPath(const CDRPath &path) override;
40 void collectLevel(unsigned level) override;
41 void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) override;
42 void collectFillStyle(unsigned,const CDRFillStyle &) override {}
43 void collectFillStyleId(unsigned id) override;
44 void collectLineStyle(unsigned,const CDRLineStyle &) override {}
45 void collectLineStyleId(unsigned id) override;
46 void collectRotate(double angle, double cx, double cy) override;
47 void collectFlags(unsigned flags, bool considerFlags) override;
48 void collectPageSize(double, double, double, double) override {}
49 void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) override;
50 void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) override;
51 void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned> &, const std::vector<unsigned char> &) override {}
52 void collectBmp(unsigned, const std::vector<unsigned char> &) override {}
53 void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) override {}
54 void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) override;
55 void collectFillTransform(const CDRTransforms &fillTrafo) override;
56 void collectFillOpacity(double opacity) override;
57 void collectPolygon() override;
58 void collectSpline() override;
59 void collectColorProfile(const std::vector<unsigned char> &) override {}
60 void collectBBox(double x0, double y0, double x1, double y1) override;
61 void collectSpnd(unsigned spnd) override;
62 void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) override;
63 void collectPaletteEntry(unsigned, unsigned, const CDRColor &) override {}
64 void collectText(unsigned, unsigned, const std::vector<unsigned char> &,
65 const std::vector<unsigned char> &, const std::map<unsigned, CDRStyle> &) override {}
66 void collectArtisticText(double x, double y) override;
67 void collectParagraphText(double x, double y, double width, double height) override;
68 void collectStld(unsigned, const CDRStyle &) override {}
69 void collectStyleId(unsigned styleId) override;
70
71 private:
72 CDRContentCollector(const CDRContentCollector &);
73 CDRContentCollector &operator=(const CDRContentCollector &);
74
75 // helper functions
76 void _startDocument();
77 void _endDocument();
78 void _startPage(double width, double height);
79 void _endPage();
80 void _flushCurrentPath();
81
82 void _fillProperties(librevenge::RVNGPropertyList &propList);
83 void _lineProperties(librevenge::RVNGPropertyList &propList);
84 void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
85
86 librevenge::RVNGDrawingInterface *m_painter;
87
88 bool m_isDocumentStarted;
89 bool m_isPageProperties;
90 bool m_isPageStarted;
91 bool m_ignorePage;
92
93 CDRPage m_page;
94 unsigned m_pageIndex;
95 CDRFillStyle m_currentFillStyle;
96 CDRLineStyle m_currentLineStyle;
97 unsigned m_spnd;
98 unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, m_currentPageLevel, m_currentStyleId;
99 CDRImage m_currentImage;
100 const std::vector<CDRTextLine> *m_currentText;
101 CDRBox m_currentBBox;
102 CDRBox m_currentTextBox;
103
104 CDRPath m_currentPath;
105 CDRTransforms m_currentTransforms;
106 CDRTransforms m_fillTransforms;
107 CDRPolygon *m_polygon;
108 bool m_isInPolygon;
109 bool m_isInSpline;
110 std::stack<CDROutputElementList> *m_outputElementsStack;
111 std::stack<CDROutputElementList> m_contentOutputElementsStack;
112 std::stack<CDROutputElementList> m_fillOutputElementsStack;
113 std::queue<CDROutputElementList> *m_outputElementsQueue;
114 std::queue<CDROutputElementList> m_contentOutputElementsQueue;
115 std::queue<CDROutputElementList> m_fillOutputElementsQueue;
116 std::stack<unsigned> m_groupLevels;
117 std::stack<CDRTransforms> m_groupTransforms;
118 CDRSplineData m_splineData;
119 double m_fillOpacity;
120 bool m_reverseOrder;
121
122 CDRParserState &m_ps;
123 };
124
125 } // namespace libcdr
126
127 #endif /* __CDRCOLLECTOR_H__ */
128 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRContentCollector::collectLineStyleId
void collectLineStyleId(unsigned id) override
Definition: CDRContentCollector.cpp:648
libcdr::CDRContentCollector::collectOtherList
void collectOtherList() override
Definition: CDRContentCollector.cpp:198
libcdr::CDRContentCollector::m_currentText
const std::vector< CDRTextLine > * m_currentText
Definition: CDRContentCollector.h:100
libcdr::CDRContentCollector::m_pageIndex
unsigned m_pageIndex
Definition: CDRContentCollector.h:94
libcdr::CDRContentCollector::_flushCurrentPath
void _flushCurrentPath()
Definition: CDRContentCollector.cpp:209
libcdr::CDRContentCollector::m_currentFillStyle
CDRFillStyle m_currentFillStyle
Definition: CDRContentCollector.h:95
libcdr::CDRContentCollector::collectVect
void collectVect(unsigned level) override
Definition: CDRContentCollector.cpp:175
libcdr::CDRContentCollector::~CDRContentCollector
~CDRContentCollector() override
Definition: CDRContentCollector.cpp:71
libcdr::CDRContentCollector::m_groupLevels
std::stack< unsigned > m_groupLevels
Definition: CDRContentCollector.h:116
libcdr::CDRBox
Definition: CDRTypes.h:23
libcdr::CDRContentCollector::m_fillTransforms
CDRTransforms m_fillTransforms
Definition: CDRContentCollector.h:106
libcdr::CDRContentCollector::collectBmp
void collectBmp(unsigned, const std::vector< unsigned char > &) override
Definition: CDRContentCollector.h:52
libcdr::CDRPath
Definition: CDRPath.h:34
libcdr::CDRContentCollector::m_page
CDRPage m_page
Definition: CDRContentCollector.h:93
libcdr::CDRContentCollector::m_groupTransforms
std::stack< CDRTransforms > m_groupTransforms
Definition: CDRContentCollector.h:117
libcdr::CDRContentCollector::m_outputElementsStack
std::stack< CDROutputElementList > * m_outputElementsStack
Definition: CDRContentCollector.h:110
libcdr::CDRContentCollector::m_currentImage
CDRImage m_currentImage
Definition: CDRContentCollector.h:99
libcdr::CDRContentCollector::collectPpdt
void collectPpdt(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned > &knotVector) override
Definition: CDRContentCollector.cpp:1232
libcdr::CDRPage
Definition: CDRTypes.h:238
libcdr::CDRContentCollector::collectFlags
void collectFlags(unsigned flags, bool considerFlags) override
Definition: CDRContentCollector.cpp:186
libcdr::CDRContentCollector::_generateBitmapFromPattern
void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor)
Definition: CDRContentCollector.cpp:1154
libcdr::CDRContentCollector::collectStld
void collectStld(unsigned, const CDRStyle &) override
Definition: CDRContentCollector.h:68
libcdr::CDRContentCollector::m_contentOutputElementsQueue
std::queue< CDROutputElementList > m_contentOutputElementsQueue
Definition: CDRContentCollector.h:114
libcdr::CDRContentCollector::m_currentPageLevel
unsigned m_currentPageLevel
Definition: CDRContentCollector.h:98
libcdr::CDRContentCollector::m_contentOutputElementsStack
std::stack< CDROutputElementList > m_contentOutputElementsStack
Definition: CDRContentCollector.h:111
libcdr::CDRContentCollector::collectBmpf
void collectBmpf(unsigned, unsigned, unsigned, const std::vector< unsigned char > &) override
Definition: CDRContentCollector.h:53
libcdr::CDRContentCollector::m_currentObjectLevel
unsigned m_currentObjectLevel
Definition: CDRContentCollector.h:98
libcdr::CDRContentCollector::m_isInPolygon
bool m_isInPolygon
Definition: CDRContentCollector.h:108
libcdr::CDRContentCollector::m_spnd
unsigned m_spnd
Definition: CDRContentCollector.h:97
libcdr::CDRSplineData
Definition: CDRTypes.h:249
libcdr::CDRContentCollector::m_reverseOrder
bool m_reverseOrder
Definition: CDRContentCollector.h:120
libcdr::CDRContentCollector::m_currentVectLevel
unsigned m_currentVectLevel
Definition: CDRContentCollector.h:98
libcdr::CDRFillStyle
Definition: CDRTypes.h:100
libcdr::CDRPolygon
Definition: CDRTypes.h:177
libcdr::CDRContentCollector::collectBBox
void collectBBox(double x0, double y0, double x1, double y1) override
Definition: CDRContentCollector.cpp:1242
libcdr::CDRContentCollector::collectPolygonTransform
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) override
Definition: CDRContentCollector.cpp:675
libcdr::CDRContentCollector::m_ignorePage
bool m_ignorePage
Definition: CDRContentCollector.h:91
libcdr::CDRContentCollector::m_isInSpline
bool m_isInSpline
Definition: CDRContentCollector.h:109
libcdr::CDRContentCollector::_endDocument
void _endDocument()
Definition: CDRContentCollector.cpp:90
libcdr::CDRContentCollector::m_ps
CDRParserState & m_ps
Definition: CDRContentCollector.h:122
libcdr::CDRContentCollector::collectArtisticText
void collectArtisticText(double x, double y) override
Definition: CDRContentCollector.cpp:1308
libcdr
Definition: CDRCollector.h:29
libcdr::CDRContentCollector::m_fillOutputElementsQueue
std::queue< CDROutputElementList > m_fillOutputElementsQueue
Definition: CDRContentCollector.h:115
libcdr::CDRContentCollector::collectFillOpacity
void collectFillOpacity(double opacity) override
Definition: CDRContentCollector.cpp:1237
libcdr::CDRContentCollector::_fillProperties
void _fillProperties(librevenge::RVNGPropertyList &propList)
Definition: CDRContentCollector.cpp:682
libcdr::CDRContentCollector::m_currentLineStyle
CDRLineStyle m_currentLineStyle
Definition: CDRContentCollector.h:96
libcdr::CDRContentCollector::m_currentStyleId
unsigned m_currentStyleId
Definition: CDRContentCollector.h:98
libcdr::CDRContentCollector::collectTransform
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) override
Definition: CDRContentCollector.cpp:543
CDROutputElementList.h
libcdr::CDRContentCollector::collectSpnd
void collectSpnd(unsigned spnd) override
Definition: CDRContentCollector.cpp:1255
libcdr::CDRContentCollector::m_currentTextBox
CDRBox m_currentTextBox
Definition: CDRContentCollector.h:102
libcdr::CDRContentCollector::collectFillStyle
void collectFillStyle(unsigned, const CDRFillStyle &) override
Definition: CDRContentCollector.h:42
libcdr::CDRContentCollector::m_polygon
CDRPolygon * m_polygon
Definition: CDRContentCollector.h:107
libcdr::CDRContentCollector::m_fillOpacity
double m_fillOpacity
Definition: CDRContentCollector.h:119
libcdr::CDRContentCollector::operator=
CDRContentCollector & operator=(const CDRContentCollector &)
libcdr::CDRContentCollector::m_currentGroupLevel
unsigned m_currentGroupLevel
Definition: CDRContentCollector.h:98
libcdr::CDRContentCollector::collectVectorPattern
void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) override
Definition: CDRContentCollector.cpp:1263
libcdr::CDRContentCollector::collectPaletteEntry
void collectPaletteEntry(unsigned, unsigned, const CDRColor &) override
Definition: CDRContentCollector.h:63
libcdr::CDRContentCollector::collectBmp
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector< unsigned > &, const std::vector< unsigned char > &) override
Definition: CDRContentCollector.h:51
libcdr::CDRContentCollector::collectRotate
void collectRotate(double angle, double cx, double cy) override
Definition: CDRContentCollector.cpp:655
libcdr::CDRContentCollector::collectLevel
void collectLevel(unsigned level) override
Definition: CDRContentCollector.cpp:556
libcdr::CDRContentCollector::collectGroup
void collectGroup(unsigned level) override
Definition: CDRContentCollector.cpp:154
libcdr::CDRContentCollector::collectParagraphText
void collectParagraphText(double x, double y, double width, double height) override
Definition: CDRContentCollector.cpp:1317
libcdr::CDRContentCollector::m_isPageProperties
bool m_isPageProperties
Definition: CDRContentCollector.h:89
libcdr::CDRContentCollector::collectFillTransform
void collectFillTransform(const CDRTransforms &fillTrafo) override
Definition: CDRContentCollector.cpp:551
libcdr::CDRContentCollector::m_outputElementsQueue
std::queue< CDROutputElementList > * m_outputElementsQueue
Definition: CDRContentCollector.h:113
libcdr::CDRContentCollector::collectBitmap
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) override
Definition: CDRContentCollector.cpp:1225
libcdr::CDRContentCollector::CDRContentCollector
CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface *painter, bool reverseOrder=true)
Definition: CDRContentCollector.cpp:55
libcdr::CDRContentCollector::_startPage
void _startPage(double width, double height)
Definition: CDRContentCollector.cpp:101
libcdr::CDRContentCollector::collectSpline
void collectSpline() override
Definition: CDRContentCollector.cpp:670
libcdr::CDRContentCollector::_lineProperties
void _lineProperties(librevenge::RVNGPropertyList &propList)
Definition: CDRContentCollector.cpp:1000
libcdr::CDRContentCollector
Definition: CDRContentCollector.h:27
libcdr::CDRContentCollector::collectPage
void collectPage(unsigned level) override
Definition: CDRContentCollector.cpp:134
libcdr::CDRContentCollector::collectColorProfile
void collectColorProfile(const std::vector< unsigned char > &) override
Definition: CDRContentCollector.h:59
CDRCollector.h
CDRTypes.h
libcdr::CDRContentCollector::_startDocument
void _startDocument()
Definition: CDRContentCollector.cpp:80
libcdr::CDRLineStyle
Definition: CDRTypes.h:112
libcdr::CDRContentCollector::collectPolygon
void collectPolygon() override
Definition: CDRContentCollector.cpp:665
libcdr::CDRContentCollector::_endPage
void _endPage()
Definition: CDRContentCollector.cpp:115
libcdr::CDRContentCollector::m_isPageStarted
bool m_isPageStarted
Definition: CDRContentCollector.h:90
libcdr::CDRParserState
Definition: CDRCollector.h:32
libcdr::CDRContentCollector::m_fillOutputElementsStack
std::stack< CDROutputElementList > m_fillOutputElementsStack
Definition: CDRContentCollector.h:112
libcdr::CDRColor
Definition: CDRTypes.h:52
libcdr::CDRContentCollector::collectPageSize
void collectPageSize(double, double, double, double) override
Definition: CDRContentCollector.h:48
libcdr::CDRContentCollector::m_currentTransforms
CDRTransforms m_currentTransforms
Definition: CDRContentCollector.h:105
libcdr::CDRContentCollector::collectLineStyle
void collectLineStyle(unsigned, const CDRLineStyle &) override
Definition: CDRContentCollector.h:44
libcdr::CDRPattern
Definition: CDRTypes.h:215
libcdr::CDRContentCollector::m_currentBBox
CDRBox m_currentBBox
Definition: CDRContentCollector.h:101
libcdr::CDRContentCollector::collectObject
void collectObject(unsigned level) override
Definition: CDRContentCollector.cpp:143
libcdr::CDRContentCollector::m_currentPath
CDRPath m_currentPath
Definition: CDRContentCollector.h:104
libcdr::CDRContentCollector::m_splineData
CDRSplineData m_splineData
Definition: CDRContentCollector.h:118
libcdr::CDRImage
Definition: CDRTypes.h:191
libcdr::CDRContentCollector::collectFillStyleId
void collectFillStyleId(unsigned id) override
Definition: CDRContentCollector.cpp:641
libcdr::CDRContentCollector::collectText
void collectText(unsigned, unsigned, const std::vector< unsigned char > &, const std::vector< unsigned char > &, const std::map< unsigned, CDRStyle > &) override
Definition: CDRContentCollector.h:64
CDRPath.h
libcdr::CDRContentCollector::collectPath
void collectPath(const CDRPath &path) override
Definition: CDRContentCollector.cpp:203
libcdr::CDRContentCollector::collectStyleId
void collectStyleId(unsigned styleId) override
Definition: CDRContentCollector.cpp:1328
libcdr::CDRStyle
Definition: CDRTypes.h:136
libcdr::CDRTransforms
Definition: CDRTransforms.h:50
libcdr::CDRContentCollector::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: CDRContentCollector.h:86
libcdr::CDRCollector
Definition: CDRCollector.h:63
libcdr::CDRContentCollector::m_isDocumentStarted
bool m_isDocumentStarted
Definition: CDRContentCollector.h:88