CDRContentCollector.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libcdr project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef __CDRCONTENTCOLLECTOR_H__
#define __CDRCONTENTCOLLECTOR_H__
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <librevenge/librevenge.h>
#include "CDROutputElementList.h"
#include "CDRTransforms.h"
#include "CDRTypes.h"
#include "CDRPath.h"
#include "CDRCollector.h"
namespace libcdr
{
class CDRContentCollector : public CDRCollector
{
public:
CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface *painter, bool reverseOrder = true);
~CDRContentCollector() override;
// collector functions
void collectPage(unsigned level) override;
void collectObject(unsigned level) override;
void collectGroup(unsigned level) override;
void collectVect(unsigned level) override;
void collectOtherList() override;
void collectPath(const CDRPath &path) override;
void collectLevel(unsigned level) override;
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) override;
void collectFillStyle(unsigned,const CDRFillStyle &) override {}
void collectFillStyleId(unsigned id) override;
void collectLineStyle(unsigned,const CDRLineStyle &) override {}
void collectLineStyleId(unsigned id) override;
void collectRotate(double angle, double cx, double cy) override;
void collectFlags(unsigned flags, bool considerFlags) override;
void collectPageSize(double, double, double, double) override {}
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) override;
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) override;
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned> &, const std::vector<unsigned char> &) override {}
void collectBmp(unsigned, const std::vector<unsigned char> &) override {}
void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) override {}
void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) override;
void collectFillTransform(const CDRTransforms &fillTrafo) override;
void collectFillOpacity(double opacity) override;
void collectPolygon() override;
void collectSpline() override;
void collectColorProfile(const std::vector<unsigned char> &) override {}
void collectBBox(double x0, double y0, double x1, double y1) override;
void collectSpnd(unsigned spnd) override;
void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) override;
void collectPaletteEntry(unsigned, unsigned, const CDRColor &) override {}
void collectText(unsigned, unsigned, const std::vector<unsigned char> &,
const std::vector<unsigned char> &, const std::map<unsigned, CDRStyle> &) override {}
void collectArtisticText(double x, double y) override;
void collectParagraphText(double x, double y, double width, double height) override;
void collectStld(unsigned, const CDRStyle &) override {}
void collectStyleId(unsigned styleId) override;
private:
CDRContentCollector(const CDRContentCollector &);
CDRContentCollector &operator=(const CDRContentCollector &);
// helper functions
void _startDocument();
void _endDocument();
void _startPage(double width, double height);
void _endPage();
void _flushCurrentPath();
void _fillProperties(librevenge::RVNGPropertyList &propList);
void _lineProperties(librevenge::RVNGPropertyList &propList);
void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
librevenge::RVNGDrawingInterface *m_painter;
bool m_isDocumentStarted;
bool m_isPageProperties;
bool m_isPageStarted;
bool m_ignorePage;
CDRPage m_page;
unsigned m_pageIndex;
CDRFillStyle m_currentFillStyle;
CDRLineStyle m_currentLineStyle;
unsigned m_spnd;
unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, m_currentPageLevel, m_currentStyleId;
CDRImage m_currentImage;
const std::vector<CDRTextLine> *m_currentText;
CDRBox m_currentBBox;
CDRBox m_currentTextBox;
CDRPath m_currentPath;
CDRTransforms m_currentTransforms;
CDRTransforms m_fillTransforms;
std::unique_ptr<CDRPolygon> m_polygon;
bool m_isInPolygon;
bool m_isInSpline;
std::stack<CDROutputElementList> *m_outputElementsStack;
std::stack<CDROutputElementList> m_contentOutputElementsStack;
std::stack<CDROutputElementList> m_fillOutputElementsStack;
std::queue<CDROutputElementList> *m_outputElementsQueue;
std::queue<CDROutputElementList> m_contentOutputElementsQueue;
std::queue<CDROutputElementList> m_fillOutputElementsQueue;
std::stack<unsigned> m_groupLevels;
std::stack<CDRTransforms> m_groupTransforms;
CDRSplineData m_splineData;
double m_fillOpacity;
bool m_reverseOrder;
CDRParserState &m_ps;
};
} // namespace libcdr
#endif /* __CDRCOLLECTOR_H__ */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
CDRCollector.h
CDROutputElementList.h
CDRPath.h
CDRTransforms.h
CDRTypes.h
libcdr::CDRCollector::CDRCollector
CDRCollector()
Definition CDRCollector.h:64
libcdr::CDRContentCollector::m_outputElementsStack
std::stack< CDROutputElementList > * m_outputElementsStack
Definition CDRContentCollector.h:114
libcdr::CDRContentCollector::collectBmp
void collectBmp(unsigned, const std::vector< unsigned char > &) override
Definition CDRContentCollector.h:56
libcdr::CDRContentCollector::_lineProperties
void _lineProperties(librevenge::RVNGPropertyList &propList)
Definition CDRContentCollector.cpp:996
libcdr::CDRContentCollector::collectFillStyle
void collectFillStyle(unsigned, const CDRFillStyle &) override
Definition CDRContentCollector.h:46
libcdr::CDRContentCollector::collectLineStyle
void collectLineStyle(unsigned, const CDRLineStyle &) override
Definition CDRContentCollector.h:48
libcdr::CDRContentCollector::m_ignorePage
bool m_ignorePage
Definition CDRContentCollector.h:95
libcdr::CDRContentCollector::m_fillOutputElementsStack
std::stack< CDROutputElementList > m_fillOutputElementsStack
Definition CDRContentCollector.h:116
libcdr::CDRContentCollector::collectLineStyleId
void collectLineStyleId(unsigned id) override
Definition CDRContentCollector.cpp:658
libcdr::CDRContentCollector::collectFillStyleId
void collectFillStyleId(unsigned id) override
Definition CDRContentCollector.cpp:651
libcdr::CDRContentCollector::collectPage
void collectPage(unsigned level) override
Definition CDRContentCollector.cpp:141
libcdr::CDRContentCollector::collectColorProfile
void collectColorProfile(const std::vector< unsigned char > &) override
Definition CDRContentCollector.h:63
libcdr::CDRContentCollector::m_groupTransforms
std::stack< CDRTransforms > m_groupTransforms
Definition CDRContentCollector.h:121
libcdr::CDRContentCollector::_startPage
void _startPage(double width, double height)
Definition CDRContentCollector.cpp:108
libcdr::CDRContentCollector::collectLevel
void collectLevel(unsigned level) override
Definition CDRContentCollector.cpp:566
libcdr::CDRContentCollector::m_currentTransforms
CDRTransforms m_currentTransforms
Definition CDRContentCollector.h:109
libcdr::CDRContentCollector::collectPath
void collectPath(const CDRPath &path) override
Definition CDRContentCollector.cpp:210
libcdr::CDRContentCollector::collectPolygonTransform
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) override
Definition CDRContentCollector.cpp:685
libcdr::CDRContentCollector::collectSpnd
void collectSpnd(unsigned spnd) override
Definition CDRContentCollector.cpp:1251
libcdr::CDRContentCollector::m_polygon
std::unique_ptr< CDRPolygon > m_polygon
Definition CDRContentCollector.h:111
libcdr::CDRContentCollector::m_isDocumentStarted
bool m_isDocumentStarted
Definition CDRContentCollector.h:92
libcdr::CDRContentCollector::m_currentPath
CDRPath m_currentPath
Definition CDRContentCollector.h:108
libcdr::CDRContentCollector::m_isPageStarted
bool m_isPageStarted
Definition CDRContentCollector.h:94
libcdr::CDRContentCollector::m_fillOutputElementsQueue
std::queue< CDROutputElementList > m_fillOutputElementsQueue
Definition CDRContentCollector.h:119
libcdr::CDRContentCollector::m_currentLineStyle
CDRLineStyle m_currentLineStyle
Definition CDRContentCollector.h:100
libcdr::CDRContentCollector::m_currentStyleId
unsigned m_currentStyleId
Definition CDRContentCollector.h:102
libcdr::CDRContentCollector::collectBmpf
void collectBmpf(unsigned, unsigned, unsigned, const std::vector< unsigned char > &) override
Definition CDRContentCollector.h:57
libcdr::CDRContentCollector::collectVect
void collectVect(unsigned level) override
Definition CDRContentCollector.cpp:182
libcdr::CDRContentCollector::m_outputElementsQueue
std::queue< CDROutputElementList > * m_outputElementsQueue
Definition CDRContentCollector.h:117
libcdr::CDRContentCollector::m_currentTextBox
CDRBox m_currentTextBox
Definition CDRContentCollector.h:106
libcdr::CDRContentCollector::_endDocument
void _endDocument()
Definition CDRContentCollector.cpp:97
libcdr::CDRContentCollector::collectObject
void collectObject(unsigned level) override
Definition CDRContentCollector.cpp:150
libcdr::CDRContentCollector::collectParagraphText
void collectParagraphText(double x, double y, double width, double height) override
Definition CDRContentCollector.cpp:1313
libcdr::CDRContentCollector::m_currentGroupLevel
unsigned m_currentGroupLevel
Definition CDRContentCollector.h:102
libcdr::CDRContentCollector::_flushCurrentPath
void _flushCurrentPath()
Definition CDRContentCollector.cpp:216
libcdr::CDRContentCollector::m_isInSpline
bool m_isInSpline
Definition CDRContentCollector.h:113
libcdr::CDRContentCollector::collectBmp
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector< unsigned > &, const std::vector< unsigned char > &) override
Definition CDRContentCollector.h:55
libcdr::CDRContentCollector::collectPpdt
void collectPpdt(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned > &knotVector) override
Definition CDRContentCollector.cpp:1228
libcdr::CDRContentCollector::m_page
CDRPage m_page
Definition CDRContentCollector.h:97
libcdr::CDRContentCollector::m_fillTransforms
CDRTransforms m_fillTransforms
Definition CDRContentCollector.h:110
libcdr::CDRContentCollector::collectRotate
void collectRotate(double angle, double cx, double cy) override
Definition CDRContentCollector.cpp:665
libcdr::CDRContentCollector::m_groupLevels
std::stack< unsigned > m_groupLevels
Definition CDRContentCollector.h:120
libcdr::CDRContentCollector::m_currentVectLevel
unsigned m_currentVectLevel
Definition CDRContentCollector.h:102
libcdr::CDRContentCollector::m_currentPageLevel
unsigned m_currentPageLevel
Definition CDRContentCollector.h:102
libcdr::CDRContentCollector::collectFlags
void collectFlags(unsigned flags, bool considerFlags) override
Definition CDRContentCollector.cpp:193
libcdr::CDRContentCollector::m_splineData
CDRSplineData m_splineData
Definition CDRContentCollector.h:122
libcdr::CDRContentCollector::collectVectorPattern
void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) override
Definition CDRContentCollector.cpp:1259
libcdr::CDRContentCollector::m_currentObjectLevel
unsigned m_currentObjectLevel
Definition CDRContentCollector.h:102
libcdr::CDRContentCollector::~CDRContentCollector
~CDRContentCollector() override
Definition CDRContentCollector.cpp:79
libcdr::CDRContentCollector::m_currentText
const std::vector< CDRTextLine > * m_currentText
Definition CDRContentCollector.h:104
libcdr::CDRContentCollector::m_contentOutputElementsStack
std::stack< CDROutputElementList > m_contentOutputElementsStack
Definition CDRContentCollector.h:115
libcdr::CDRContentCollector::collectFillTransform
void collectFillTransform(const CDRTransforms &fillTrafo) override
Definition CDRContentCollector.cpp:561
libcdr::CDRContentCollector::_endPage
void _endPage()
Definition CDRContentCollector.cpp:122
libcdr::CDRContentCollector::_startDocument
void _startDocument()
Definition CDRContentCollector.cpp:87
libcdr::CDRContentCollector::m_contentOutputElementsQueue
std::queue< CDROutputElementList > m_contentOutputElementsQueue
Definition CDRContentCollector.h:118
libcdr::CDRContentCollector::m_currentFillStyle
CDRFillStyle m_currentFillStyle
Definition CDRContentCollector.h:99
libcdr::CDRContentCollector::collectStyleId
void collectStyleId(unsigned styleId) override
Definition CDRContentCollector.cpp:1324
libcdr::CDRContentCollector::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition CDRContentCollector.h:90
libcdr::CDRContentCollector::collectBitmap
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) override
Definition CDRContentCollector.cpp:1221
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:68
libcdr::CDRContentCollector::collectOtherList
void collectOtherList() override
Definition CDRContentCollector.cpp:205
libcdr::CDRContentCollector::collectGroup
void collectGroup(unsigned level) override
Definition CDRContentCollector.cpp:161
libcdr::CDRContentCollector::m_spnd
unsigned m_spnd
Definition CDRContentCollector.h:101
libcdr::CDRContentCollector::collectArtisticText
void collectArtisticText(double x, double y) override
Definition CDRContentCollector.cpp:1304
libcdr::CDRContentCollector::m_isInPolygon
bool m_isInPolygon
Definition CDRContentCollector.h:112
libcdr::CDRContentCollector::collectPaletteEntry
void collectPaletteEntry(unsigned, unsigned, const CDRColor &) override
Definition CDRContentCollector.h:67
libcdr::CDRContentCollector::_fillProperties
void _fillProperties(librevenge::RVNGPropertyList &propList)
Definition CDRContentCollector.cpp:690
libcdr::CDRContentCollector::m_pageIndex
unsigned m_pageIndex
Definition CDRContentCollector.h:98
libcdr::CDRContentCollector::collectPageSize
void collectPageSize(double, double, double, double) override
Definition CDRContentCollector.h:52
libcdr::CDRContentCollector::CDRContentCollector
CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface *painter, bool reverseOrder=true)
Definition CDRContentCollector.cpp:63
libcdr::CDRContentCollector::m_currentImage
CDRImage m_currentImage
Definition CDRContentCollector.h:103
libcdr::CDRContentCollector::m_reverseOrder
bool m_reverseOrder
Definition CDRContentCollector.h:124
libcdr::CDRContentCollector::m_currentBBox
CDRBox m_currentBBox
Definition CDRContentCollector.h:105
libcdr::CDRContentCollector::collectBBox
void collectBBox(double x0, double y0, double x1, double y1) override
Definition CDRContentCollector.cpp:1238
libcdr::CDRContentCollector::collectStld
void collectStld(unsigned, const CDRStyle &) override
Definition CDRContentCollector.h:72
libcdr::CDRContentCollector::m_fillOpacity
double m_fillOpacity
Definition CDRContentCollector.h:123
libcdr::CDRContentCollector::CDRContentCollector
CDRContentCollector(const CDRContentCollector &)
libcdr::CDRContentCollector::operator=
CDRContentCollector & operator=(const CDRContentCollector &)
libcdr::CDRContentCollector::collectFillOpacity
void collectFillOpacity(double opacity) override
Definition CDRContentCollector.cpp:1233
libcdr::CDRContentCollector::m_ps
CDRParserState & m_ps
Definition CDRContentCollector.h:126
libcdr::CDRContentCollector::m_isPageProperties
bool m_isPageProperties
Definition CDRContentCollector.h:93
libcdr::CDRContentCollector::collectTransform
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) override
Definition CDRContentCollector.cpp:553
libcdr::CDRContentCollector::collectSpline
void collectSpline() override
Definition CDRContentCollector.cpp:680
libcdr::CDRContentCollector::collectPolygon
void collectPolygon() override
Definition CDRContentCollector.cpp:675
libcdr::CDRContentCollector::_generateBitmapFromPattern
void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor)
Definition CDRContentCollector.cpp:1150
libcdr::CDRParserState
Definition CDRCollector.h:31
libcdr::CDRPath
Definition CDRPath.h:37
libcdr::CDRTransforms
Definition CDRTransforms.h:51
libcdr
Definition CDRCollector.h:25
libcdr::CDRBox
Definition CDRTypes.h:25
libcdr::CDRColor
Definition CDRTypes.h:54
libcdr::CDRFillStyle
Definition CDRTypes.h:106
libcdr::CDRImage
Definition CDRTypes.h:197
libcdr::CDRLineStyle
Definition CDRTypes.h:118
libcdr::CDRPage
Definition CDRTypes.h:244
libcdr::CDRPattern
Definition CDRTypes.h:221
libcdr::CDRSplineData
Definition CDRTypes.h:255
libcdr::CDRStyle
Definition CDRTypes.h:142