| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef ZMFCOLLECTOR_H_INCLUDED |
| 11 |
#define ZMFCOLLECTOR_H_INCLUDED |
| 12 |
|
| 13 |
#include <librevenge/librevenge.h> |
| 14 |
#include "libzmf_utils.h" |
| 15 |
#include "ZMFTypes.h" |
| 16 |
#include <vector> |
| 17 |
|
| 18 |
namespace libzmf |
| 19 |
{ |
| 20 |
|
| 21 |
class ZMFCollector |
| 22 |
{ |
| 23 |
|
| 24 |
ZMFCollector(const ZMFCollector &other) = delete; |
| 25 |
ZMFCollector &operator=(const ZMFCollector &other) = delete; |
| 26 |
|
| 27 |
public: |
| 28 |
ZMFCollector(librevenge::RVNGDrawingInterface *painter); |
| 29 |
~ZMFCollector(); |
| 30 |
|
| 31 |
void startDocument(); |
| 32 |
void endDocument(); |
| 33 |
|
| 34 |
void startPage(const ZMFPageSettings &pageSettings); |
| 35 |
void endPage(); |
| 36 |
|
| 37 |
void startLayer(); |
| 38 |
void endLayer(); |
| 39 |
|
| 40 |
void startGroup(); |
| 41 |
void endGroup(); |
| 42 |
|
| 43 |
void setStyle(const Style &style); |
| 44 |
|
| 45 |
void collectPath(const std::vector<Curve> &curves); |
| 46 |
void collectPath(const Curve &curve); |
| 47 |
|
| 48 |
void collectEllipse(const Point &c, double rx, double ry, double rotation); |
| 49 |
void collectArc(const Point &c, double rx, double ry, double beginAngle, double endAngle, bool closed, double rotation); |
| 50 |
|
| 51 |
void collectPolygon(const Point &c, double rx, double ry, uint32_t peaksCount, const Curve &peak, |
| 52 |
double rotation, bool mirrorHorizontal, bool mirrorVertical); |
| 53 |
|
| 54 |
void collectTextObject(const Text &text, const Point &topLeft, double width, double height, |
| 55 |
VerticalAlignment align, double rotation); |
| 56 |
|
| 57 |
void collectTable(const Table &table); |
| 58 |
|
| 59 |
void collectImage(const librevenge::RVNGBinaryData &image, const Point &topLeft, double width, double height, |
| 60 |
double rotation, bool mirrorHorizontal, bool mirrorVertical); |
| 61 |
|
| 62 |
private: |
| 63 |
double pageX(double canvasX); |
| 64 |
double pageY(double canvasY); |
| 65 |
|
| 66 |
void writeStyle(librevenge::RVNGPropertyList &propList, const Style &style, bool noFill = false); |
| 67 |
void writePen(librevenge::RVNGPropertyList &propList, const Pen &pen); |
| 68 |
void writeFill(librevenge::RVNGPropertyList &propList, const Fill &fill); |
| 69 |
void writeShadow(librevenge::RVNGPropertyList &propList, const Shadow &shadow); |
| 70 |
|
| 71 |
void collectText(const Text &text); |
| 72 |
void flushText(std::string &text); |
| 73 |
|
| 74 |
librevenge::RVNGDrawingInterface *m_painter; |
| 75 |
|
| 76 |
ZMFPageSettings m_pageSettings; |
| 77 |
|
| 78 |
bool m_isDocumentStarted; |
| 79 |
bool m_isPageStarted; |
| 80 |
bool m_isLayerStarted; |
| 81 |
|
| 82 |
Style m_style; |
| 83 |
}; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
#endif |
| 88 |
|
| 89 |
|