ZMFCollector.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 a part of the libzmf 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 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 // disable copying
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 // ZMFCOLLECTOR_H_INCLUDED
88
89/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ZMFTypes.h
libzmf::ZMFCollector
Definition: ZMFCollector.h:22
libzmf::ZMFCollector::collectEllipse
void collectEllipse(const Point &c, double rx, double ry, double rotation)
Definition: ZMFCollector.cpp:448
libzmf::ZMFCollector::endLayer
void endLayer()
Definition: ZMFCollector.cpp:397
libzmf::ZMFCollector::startLayer
void startLayer()
Definition: ZMFCollector.cpp:385
libzmf::ZMFCollector::m_pageSettings
ZMFPageSettings m_pageSettings
Definition: ZMFCollector.h:76
libzmf::ZMFCollector::endGroup
void endGroup()
Definition: ZMFCollector.cpp:414
libzmf::ZMFCollector::collectTextObject
void collectTextObject(const Text &text, const Point &topLeft, double width, double height, VerticalAlignment align, double rotation)
Definition: ZMFCollector.cpp:599
libzmf::ZMFCollector::m_isDocumentStarted
bool m_isDocumentStarted
Definition: ZMFCollector.h:78
libzmf::ZMFCollector::startDocument
void startDocument()
Definition: ZMFCollector.cpp:327
libzmf::ZMFCollector::startGroup
void startGroup()
Definition: ZMFCollector.cpp:407
libzmf::ZMFCollector::pageY
double pageY(double canvasY)
Definition: ZMFCollector.cpp:836
libzmf::ZMFCollector::collectText
void collectText(const Text &text)
Definition: ZMFCollector.cpp:633
libzmf::ZMFCollector::m_isLayerStarted
bool m_isLayerStarted
Definition: ZMFCollector.h:80
libzmf::ZMFCollector::writePen
void writePen(librevenge::RVNGPropertyList &propList, const Pen &pen)
Definition: ZMFCollector.cpp:864
libzmf::ZMFCollector::m_style
Style m_style
Definition: ZMFCollector.h:82
libzmf::ZMFCollector::writeShadow
void writeShadow(librevenge::RVNGPropertyList &propList, const Shadow &shadow)
Definition: ZMFCollector.cpp:944
libzmf::ZMFCollector::startPage
void startPage(const ZMFPageSettings &pageSettings)
Definition: ZMFCollector.cpp:352
libzmf::ZMFCollector::writeFill
void writeFill(librevenge::RVNGPropertyList &propList, const Fill &fill)
Definition: ZMFCollector.cpp:936
libzmf::ZMFCollector::collectPolygon
void collectPolygon(const Point &c, double rx, double ry, uint32_t peaksCount, const Curve &peak, double rotation, bool mirrorHorizontal, bool mirrorVertical)
Definition: ZMFCollector.cpp:535
libzmf::ZMFCollector::collectImage
void collectImage(const librevenge::RVNGBinaryData &image, const Point &topLeft, double width, double height, double rotation, bool mirrorHorizontal, bool mirrorVertical)
Definition: ZMFCollector.cpp:800
libzmf::ZMFCollector::flushText
void flushText(std::string &text)
Definition: ZMFCollector.cpp:721
libzmf::ZMFCollector::collectPath
void collectPath(const std::vector< Curve > &curves)
Definition: ZMFCollector.cpp:424
libzmf::ZMFCollector::writeStyle
void writeStyle(librevenge::RVNGPropertyList &propList, const Style &style, bool noFill=false)
Definition: ZMFCollector.cpp:843
libzmf::ZMFCollector::operator=
ZMFCollector & operator=(const ZMFCollector &other)=delete
libzmf::ZMFCollector::pageX
double pageX(double canvasX)
Definition: ZMFCollector.cpp:831
libzmf::ZMFCollector::~ZMFCollector
~ZMFCollector()
Definition: ZMFCollector.cpp:319
libzmf::ZMFCollector::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: ZMFCollector.h:74
libzmf::ZMFCollector::collectTable
void collectTable(const Table &table)
Definition: ZMFCollector.cpp:730
libzmf::ZMFCollector::ZMFCollector
ZMFCollector(const ZMFCollector &other)=delete
libzmf::ZMFCollector::endDocument
void endDocument()
Definition: ZMFCollector.cpp:339
libzmf::ZMFCollector::endPage
void endPage()
Definition: ZMFCollector.cpp:375
libzmf::ZMFCollector::m_isPageStarted
bool m_isPageStarted
Definition: ZMFCollector.h:79
libzmf::ZMFCollector::collectArc
void collectArc(const Point &c, double rx, double ry, double beginAngle, double endAngle, bool closed, double rotation)
Definition: ZMFCollector.cpp:468
libzmf::ZMFCollector::setStyle
void setStyle(const Style &style)
Definition: ZMFCollector.cpp:419
libzmf_utils.h
libzmf
Definition: BMIHeader.cpp:14
libzmf::Fill
boost::variant< Color, Gradient, ImageFill > Fill
Definition: ZMFTypes.h:230
libzmf::VerticalAlignment
VerticalAlignment
Definition: ZMFTypes.h:306
libzmf::Curve
Definition: ZMFTypes.h:87
libzmf::Pen
Definition: ZMFTypes.h:142
libzmf::Point
Definition: ZMFTypes.h:25
libzmf::Shadow
Definition: ZMFTypes.h:247
libzmf::Style
Definition: ZMFTypes.h:259
libzmf::Table
Definition: ZMFTypes.h:377
libzmf::Text
Definition: ZMFTypes.h:334
libzmf::ZMFPageSettings
Definition: ZMFTypes.h:390