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 
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 collectGroup(unsigned level);
56  void collectVect(unsigned level);
57  void collectOtherList();
58  void collectPath(const CDRPath &path);
59  void collectLevel(unsigned level);
60  void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform);
61  void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill);
62  void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
63  double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
64  const CDRPath &startMarker, const CDRPath &endMarker);
65  void collectRotate(double angle, double cx, double cy);
66  void collectFlags(unsigned flags, bool considerFlags);
67  void collectPageSize(double, double, double, double) {}
68  void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy);
69  void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2);
70  void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned> &, const std::vector<unsigned char> &) {}
71  void collectBmp(unsigned, const std::vector<unsigned char> &) {}
72  void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) {}
73  void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector);
74  void collectFillTransform(const CDRTransforms &fillTrafo);
75  void collectFillOpacity(double opacity);
76  void collectPolygon();
77  void collectSpline();
78  void collectColorProfile(const std::vector<unsigned char> &) {}
79  void collectBBox(double x0, double y0, double x1, double y1);
80  void collectSpnd(unsigned spnd);
81  void collectVectorPattern(unsigned id, const WPXBinaryData &data);
82  void collectPaletteEntry(unsigned, unsigned, const CDRColor &) {}
83  void collectText(unsigned, unsigned, const std::vector<unsigned char> &,
84  const std::vector<unsigned char> &, const std::map<unsigned, CDRCharacterStyle> &) {}
85  void collectArtisticText(double x, double y);
86  void collectParagraphText(double x, double y, double width, double height);
87  void collectStld(unsigned, const CDRCharacterStyle &) {}
88 
89 private:
92 
93  // helper functions
94  void _startPage(double width, double height);
95  void _endPage();
96  void _flushCurrentPath();
97 
98  void _fillProperties(WPXPropertyList &propList, WPXPropertyListVector &vec);
99  void _lineProperties(WPXPropertyList &propList);
100  void _generateBitmapFromPattern(WPXBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
101 
102  libwpg::WPGPaintInterface *m_painter;
103 
107 
109  unsigned m_pageIndex;
112  unsigned m_spnd;
115  const std::vector<CDRTextLine> *m_currentText;
118 
125  std::stack<CDROutputElementList> *m_outputElements;
126  std::stack<CDROutputElementList> m_contentOutputElements;
127  std::stack<CDROutputElementList> m_fillOutputElements;
128  std::stack<unsigned> m_groupLevels;
129  std::stack<CDRTransforms> m_groupTransforms;
132 
134 };
135 
136 } // namespace libcdr
137 
138 #endif /* __CDRCOLLECTOR_H__ */
139 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
const std::vector< CDRTextLine > * m_currentText
Definition: CDRContentCollector.h:115
unsigned m_pageIndex
Definition: CDRContentCollector.h:109
void _flushCurrentPath()
Definition: CDRContentCollector.cpp:162
void collectOtherList()
Definition: CDRContentCollector.cpp:151
void collectColorProfile(const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:78
CDRFillStyle m_currentFillStyle
Definition: CDRContentCollector.h:110
std::stack< unsigned > m_groupLevels
Definition: CDRContentCollector.h:128
Definition: CDRTypes.h:42
CDRTransforms m_fillTransforms
Definition: CDRContentCollector.h:121
Definition: CDRPath.h:54
CDRPage m_page
Definition: CDRContentCollector.h:108
void collectFillOpacity(double opacity)
Definition: CDRContentCollector.cpp:1153
std::stack< CDRTransforms > m_groupTransforms
Definition: CDRContentCollector.h:129
CDRImage m_currentImage
Definition: CDRContentCollector.h:114
Definition: CDRTypes.h:244
void _fillProperties(WPXPropertyList &propList, WPXPropertyListVector &vec)
Definition: CDRContentCollector.cpp:610
Definition: CDRTypes.h:103
void collectParagraphText(double x, double y, double width, double height)
Definition: CDRContentCollector.cpp:1220
unsigned m_currentPageLevel
Definition: CDRContentCollector.h:113
void _generateBitmapFromPattern(WPXBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor)
Definition: CDRContentCollector.cpp:1073
unsigned m_currentObjectLevel
Definition: CDRContentCollector.h:113
bool m_isInPolygon
Definition: CDRContentCollector.h:123
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector< unsigned > &, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:70
void collectPpdt(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned > &knotVector)
Definition: CDRContentCollector.cpp:1148
unsigned m_spnd
Definition: CDRContentCollector.h:112
Definition: CDRTypes.h:255
Definition: CDRTypes.h:155
libwpg::WPGPaintInterface * m_painter
Definition: CDRContentCollector.h:102
unsigned m_currentVectLevel
Definition: CDRContentCollector.h:113
Definition: CDRTypes.h:119
void collectPath(const CDRPath &path)
Definition: CDRContentCollector.cpp:156
void collectPage(unsigned level)
Definition: CDRContentCollector.cpp:97
void collectVect(unsigned level)
Definition: CDRContentCollector.cpp:129
void collectGroup(unsigned level)
Definition: CDRContentCollector.cpp:116
Definition: CDRTypes.h:196
void _lineProperties(WPXPropertyList &propList)
Definition: CDRContentCollector.cpp:924
CDRContentCollector(CDRParserState &ps,::libwpg::WPGPaintInterface *painter)
void collectSpline()
Definition: CDRContentCollector.cpp:598
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform)
Definition: CDRContentCollector.cpp:488
bool m_ignorePage
Definition: CDRContentCollector.h:106
void collectPaletteEntry(unsigned, unsigned, const CDRColor &)
Definition: CDRContentCollector.h:82
void collectRotate(double angle, double cx, double cy)
Definition: CDRContentCollector.cpp:583
bool m_isInSpline
Definition: CDRContentCollector.h:124
std::stack< CDROutputElementList > m_fillOutputElements
Definition: CDRContentCollector.h:127
CDRParserState & m_ps
Definition: CDRContentCollector.h:133
std::stack< CDROutputElementList > m_contentOutputElements
Definition: CDRContentCollector.h:126
void collectPolygon()
Definition: CDRContentCollector.cpp:593
void collectFlags(unsigned flags, bool considerFlags)
Definition: CDRContentCollector.cpp:139
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2)
Definition: CDRContentCollector.cpp:1141
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy)
Definition: CDRContentCollector.cpp:603
CDRLineStyle m_currentLineStyle
Definition: CDRContentCollector.h:111
void collectSpnd(unsigned spnd)
Definition: CDRContentCollector.cpp:1171
CDRBox m_currentTextBox
Definition: CDRContentCollector.h:117
void collectBBox(double x0, double y0, double x1, double y1)
Definition: CDRContentCollector.cpp:1158
CDRPolygon * m_polygon
Definition: CDRContentCollector.h:122
double m_fillOpacity
Definition: CDRContentCollector.h:131
CDRContentCollector & operator=(const CDRContentCollector &)
unsigned m_currentGroupLevel
Definition: CDRContentCollector.h:113
void collectArtisticText(double x, double y)
Definition: CDRContentCollector.cpp:1211
bool m_isPageProperties
Definition: CDRContentCollector.h:104
void _startPage(double width, double height)
Definition: CDRContentCollector.cpp:69
Definition: CDRContentCollector.h:46
std::stack< CDROutputElementList > * m_outputElements
Definition: CDRContentCollector.h:125
Definition: CDRTypes.h:131
void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill)
Definition: CDRContentCollector.cpp:571
void collectLevel(unsigned level)
Definition: CDRContentCollector.cpp:501
void _endPage()
Definition: CDRContentCollector.cpp:83
bool m_isPageStarted
Definition: CDRContentCollector.h:105
void collectFillTransform(const CDRTransforms &fillTrafo)
Definition: CDRContentCollector.cpp:496
void collectObject(unsigned level)
Definition: CDRContentCollector.cpp:106
Definition: CDRCollector.h:52
void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth, double stretch, double angle, const CDRColor &color, const std::vector< unsigned > &dashArray, const CDRPath &startMarker, const CDRPath &endMarker)
Definition: CDRContentCollector.cpp:576
void collectText(unsigned, unsigned, const std::vector< unsigned char > &, const std::vector< unsigned char > &, const std::map< unsigned, CDRCharacterStyle > &)
Definition: CDRContentCollector.h:83
Definition: CDRTypes.h:71
CDRTransforms m_currentTransforms
Definition: CDRContentCollector.h:120
Definition: CDRTypes.h:234
CDRBox m_currentBBox
Definition: CDRContentCollector.h:116
Definition: CDRTypes.h:89
void collectVectorPattern(unsigned id, const WPXBinaryData &data)
Definition: CDRContentCollector.cpp:1179
CDRPath m_currentPath
Definition: CDRContentCollector.h:119
CDRSplineData m_splineData
Definition: CDRContentCollector.h:130
Definition: CDRTypes.h:210
virtual ~CDRContentCollector()
Definition: CDRContentCollector.cpp:63
void collectBmpf(unsigned, unsigned, unsigned, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:72
void collectBmp(unsigned, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:71
void collectPageSize(double, double, double, double)
Definition: CDRContentCollector.h:67
void collectStld(unsigned, const CDRCharacterStyle &)
Definition: CDRContentCollector.h:87
Definition: CDRTransforms.h:66
Definition: CDRCollector.h:79

Generated for libcdr by doxygen 1.8.6