| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef __CDRCONTENTCOLLECTOR_H__ |
| 11 |
#define __CDRCONTENTCOLLECTOR_H__ |
| 12 |
|
| 13 |
#include <map> |
| 14 |
#include <memory> |
| 15 |
#include <utility> |
| 16 |
#include <vector> |
| 17 |
#include <stack> |
| 18 |
#include <queue> |
| 19 |
|
| 20 |
#include <librevenge/librevenge.h> |
| 21 |
|
| 22 |
#include "CDROutputElementList.h" |
| 23 |
#include "CDRTransforms.h" |
| 24 |
#include "CDRTypes.h" |
| 25 |
#include "CDRPath.h" |
| 26 |
#include "CDRCollector.h" |
| 27 |
|
| 28 |
namespace libcdr |
| 29 |
{ |
| 30 |
|
| 31 |
class CDRContentCollector : public CDRCollector |
| 32 |
{ |
| 33 |
public: |
| 34 |
CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface *painter, bool reverseOrder = true); |
| 35 |
~CDRContentCollector() override; |
| 36 |
|
| 37 |
|
| 38 |
void collectPage(unsigned level) override; |
| 39 |
void collectObject(unsigned level) override; |
| 40 |
void collectGroup(unsigned level) override; |
| 41 |
void collectVect(unsigned level) override; |
| 42 |
void collectOtherList() override; |
| 43 |
void collectPath(const CDRPath &path) override; |
| 44 |
void collectLevel(unsigned level) override; |
| 45 |
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) override; |
| 46 |
void collectFillStyle(unsigned,const CDRFillStyle &) override {} |
| 47 |
void collectFillStyleId(unsigned id) override; |
| 48 |
void collectLineStyle(unsigned,const CDRLineStyle &) override {} |
| 49 |
void collectLineStyleId(unsigned id) override; |
| 50 |
void collectRotate(double angle, double cx, double cy) override; |
| 51 |
void collectFlags(unsigned flags, bool considerFlags) override; |
| 52 |
void collectPageSize(double, double, double, double) override {} |
| 53 |
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) override; |
| 54 |
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) override; |
| 55 |
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned> &, const std::vector<unsigned char> &) override {} |
| 56 |
void collectBmp(unsigned, const std::vector<unsigned char> &) override {} |
| 57 |
void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) override {} |
| 58 |
void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) override; |
| 59 |
void collectFillTransform(const CDRTransforms &fillTrafo) override; |
| 60 |
void collectFillOpacity(double opacity) override; |
| 61 |
void collectPolygon() override; |
| 62 |
void collectSpline() override; |
| 63 |
void collectColorProfile(const std::vector<unsigned char> &) override {} |
| 64 |
void collectBBox(double x0, double y0, double x1, double y1) override; |
| 65 |
void collectSpnd(unsigned spnd) override; |
| 66 |
void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) override; |
| 67 |
void collectPaletteEntry(unsigned, unsigned, const CDRColor &) override {} |
| 68 |
void collectText(unsigned, unsigned, const std::vector<unsigned char> &, |
| 69 |
const std::vector<unsigned char> &, const std::map<unsigned, CDRStyle> &) override {} |
| 70 |
void collectArtisticText(double x, double y) override; |
| 71 |
void collectParagraphText(double x, double y, double width, double height) override; |
| 72 |
void collectStld(unsigned, const CDRStyle &) override {} |
| 73 |
void collectStyleId(unsigned styleId) override; |
| 74 |
|
| 75 |
private: |
| 76 |
CDRContentCollector(const CDRContentCollector &); |
| 77 |
CDRContentCollector &operator=(const CDRContentCollector &); |
| 78 |
|
| 79 |
|
| 80 |
void _startDocument(); |
| 81 |
void _endDocument(); |
| 82 |
void _startPage(double width, double height); |
| 83 |
void _endPage(); |
| 84 |
void _flushCurrentPath(); |
| 85 |
|
| 86 |
void _fillProperties(librevenge::RVNGPropertyList &propList); |
| 87 |
void _lineProperties(librevenge::RVNGPropertyList &propList); |
| 88 |
void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor); |
| 89 |
|
| 90 |
librevenge::RVNGDrawingInterface *m_painter; |
| 91 |
|
| 92 |
bool m_isDocumentStarted; |
| 93 |
bool m_isPageProperties; |
| 94 |
bool m_isPageStarted; |
| 95 |
bool m_ignorePage; |
| 96 |
|
| 97 |
CDRPage m_page; |
| 98 |
unsigned m_pageIndex; |
| 99 |
CDRFillStyle m_currentFillStyle; |
| 100 |
CDRLineStyle m_currentLineStyle; |
| 101 |
unsigned m_spnd; |
| 102 |
unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, m_currentPageLevel, m_currentStyleId; |
| 103 |
CDRImage m_currentImage; |
| 104 |
const std::vector<CDRTextLine> *m_currentText; |
| 105 |
CDRBox m_currentBBox; |
| 106 |
CDRBox m_currentTextBox; |
| 107 |
|
| 108 |
CDRPath m_currentPath; |
| 109 |
CDRTransforms m_currentTransforms; |
| 110 |
CDRTransforms m_fillTransforms; |
| 111 |
std::unique_ptr<CDRPolygon> m_polygon; |
| 112 |
bool m_isInPolygon; |
| 113 |
bool m_isInSpline; |
| 114 |
std::stack<CDROutputElementList> *m_outputElementsStack; |
| 115 |
std::stack<CDROutputElementList> m_contentOutputElementsStack; |
| 116 |
std::stack<CDROutputElementList> m_fillOutputElementsStack; |
| 117 |
std::queue<CDROutputElementList> *m_outputElementsQueue; |
| 118 |
std::queue<CDROutputElementList> m_contentOutputElementsQueue; |
| 119 |
std::queue<CDROutputElementList> m_fillOutputElementsQueue; |
| 120 |
std::stack<unsigned> m_groupLevels; |
| 121 |
std::stack<CDRTransforms> m_groupTransforms; |
| 122 |
CDRSplineData m_splineData; |
| 123 |
double m_fillOpacity; |
| 124 |
bool m_reverseOrder; |
| 125 |
|
| 126 |
CDRParserState &m_ps; |
| 127 |
}; |
| 128 |
|
| 129 |
} |
| 130 |
|
| 131 |
#endif |
| 132 |
|