PMDCollector.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 part of the libpagemaker 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 __PMDCOLLECTOR_H__
11 #define __PMDCOLLECTOR_H__
12 
13 #include <memory>
14 #include <stdint.h>
15 #include <string>
16 #include <vector>
17 
18 #include <boost/optional.hpp>
19 
20 #include "OutputShape.h"
21 #include "PMDExceptions.h"
22 #include "PMDPage.h"
23 #include "PMDTypes.h"
24 #include "Units.h"
25 #include "geometry.h"
26 
27 namespace libpagemaker
28 {
29 
30 
39 {
40  typedef std::vector<std::shared_ptr<const OutputShape> > PageShapes_t;
41  typedef std::vector<PageShapes_t> PageShapesList_t;
42 
43  /*
44  * Height and width in PMD page units.
45  * One PMD page unit is 1/20 of a point (1/720 inch)
46  */
47  boost::optional<PMDShapeUnit> m_pageWidth;
48  boost::optional<PMDShapeUnit> m_pageHeight;
49 
50  std::vector<PMDPage> m_pages;
51  std::vector<PMDColor> m_color;
52  std::vector<PMDFont> m_font;
54 
55  void writePage(const PMDPage &,
56  librevenge::RVNGDrawingInterface *,
57  const std::vector<std::shared_ptr<const OutputShape> > &) const;
58 
59  void paintShape(const OutputShape &shape,
60  librevenge::RVNGDrawingInterface *) const;
61 
62  void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const;
63  void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const;
64  void fillOutputShapesByPage(PageShapesList_t &pageShapes) const;
65 public:
66  PMDCollector();
67 
68  /* State-mutating functions */
71  void setDoubleSided(bool);
72  void addShapeToPage(unsigned pageID, const std::shared_ptr<PMDLineSet> &shape);
73  void addColor(const PMDColor &color);
74  void addFont(const PMDFont &font);
75 
76  unsigned addPage();
77 
78  /* Output functions */
79  void draw(librevenge::RVNGDrawingInterface *) const;
80 };
81 
82 }
83 
84 #endif /* __PMDCOLLECTOR_H__ */
85 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
SHAPE_TYPE_BITMAP
const uint8_t SHAPE_TYPE_BITMAP
Definition: constants.h:57
libpagemaker::PMDColor::m_blue
uint16_t m_blue
Definition: PMDTypes.h:25
libpagemaker::OutputShape::numPoints
unsigned numPoints() const
Definition: OutputShape.h:61
libpagemaker::PMDCollector::setDoubleSided
void setDoubleSided(bool)
Definition: PMDCollector.cpp:141
libpagemaker::Point::m_y
Unit m_y
Definition: geometry.h:27
libpagemaker::EM2PT
static const double EM2PT
Definition: PMDCollector.cpp:23
libpagemaker::PMDFillProperties::m_fillTint
uint8_t m_fillTint
Definition: PMDTypes.h:48
libpagemaker::OutputShape::getStrokeProperties
const PMDStrokeProperties & getStrokeProperties() const
Definition: OutputShape.h:86
geometry.h
libpagemaker::PMDCollector::m_color
std::vector< PMDColor > m_color
Definition: PMDCollector.h:51
libpagemaker::PMDCollector::m_pageWidth
boost::optional< PMDShapeUnit > m_pageWidth
Definition: PMDCollector.h:47
libpagemaker::LengthUnit
Definition: Units.h:21
STROKE_LIGHT_DARK
const uint8_t STROKE_LIGHT_DARK
Definition: constants.h:76
libpagemaker::OutputShape::getText
std::string getText() const
Definition: OutputShape.h:101
libpagemaker::PMDFont
Definition: PMDTypes.h:32
libpagemaker::PMDCollector::fillOutputShapesByPage
void fillOutputShapesByPage(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:701
libpagemaker::PMDCollector::setPageWidth
void setPageWidth(PMDShapeUnit)
Definition: PMDCollector.cpp:147
libpagemaker::PMDCollector::m_doubleSided
bool m_doubleSided
Definition: PMDCollector.h:53
libpagemaker::PMDColor::m_red
uint16_t m_red
Definition: PMDTypes.h:23
libpagemaker::PMDCollector::writePage
void writePage(const PMDPage &, librevenge::RVNGDrawingInterface *, const std::vector< std::shared_ptr< const OutputShape > > &) const
Definition: PMDCollector.cpp:622
libpagemaker::PMDStrokeProperties::m_strokeWidth
uint16_t m_strokeWidth
Definition: PMDTypes.h:56
libpagemaker::OutputShape::getParaProperties
std::vector< PMDParaProperties > getParaProperties() const
Definition: OutputShape.h:111
libpagemaker::OutputShape::getFillProperties
const PMDFillProperties & getFillProperties() const
Definition: OutputShape.h:81
STROKE_NORMAL
const uint8_t STROKE_NORMAL
Definition: constants.h:73
libpagemaker::OutputShape::getHeight
double getHeight() const
Definition: OutputShape.h:154
STROKE_SQUARE_DOTS
const uint8_t STROKE_SQUARE_DOTS
Definition: constants.h:79
libpagemaker::PMDFillProperties::m_fillType
uint8_t m_fillType
Definition: PMDTypes.h:45
libpagemaker::OutputShape::getBitmap
librevenge::RVNGBinaryData getBitmap() const
Definition: OutputShape.h:116
FILL_SOLID
const uint8_t FILL_SOLID
Definition: constants.h:62
STROKE_DARK_LIGHT
const uint8_t STROKE_DARK_LIGHT
Definition: constants.h:75
libpagemaker::PMDFillProperties::m_fillColor
uint8_t m_fillColor
Definition: PMDTypes.h:46
libpagemaker::PMDPage::numShapes
unsigned numShapes() const
Definition: PMDPage.h:35
libpagemaker::OutputShape::getSkew
double getSkew() const
Definition: OutputShape.h:96
libpagemaker::newOutputShape
std::shared_ptr< OutputShape > newOutputShape(const std::shared_ptr< const PMDLineSet > &lineSet, const InchPoint &translate)
Definition: OutputShape.cpp:17
libpagemaker::PMDStrokeProperties
Definition: PMDTypes.h:53
libpagemaker::PMDCollector::addShapeToPage
void addShapeToPage(unsigned pageID, const std::shared_ptr< PMDLineSet > &shape)
Definition: PMDCollector.cpp:173
libpagemaker_utils.h
libpagemaker::PMDColor
Definition: PMDTypes.h:20
OutputShape.h
libpagemaker::PMDCollector::PageShapesList_t
std::vector< PageShapes_t > PageShapesList_t
Definition: PMDCollector.h:41
libpagemaker::PMDCollector::addFont
void addFont(const PMDFont &font)
Definition: PMDCollector.cpp:168
PMDCollector.h
M_PI
#define M_PI
Definition: libpagemaker_utils.h:28
libpagemaker::OutputShape::getIsClosed
bool getIsClosed() const
Definition: OutputShape.h:71
libpagemaker::PMDCollector
Builder class for PMD Documents.
Definition: PMDCollector.h:38
libpagemaker::PMDCollector::draw
void draw(librevenge::RVNGDrawingInterface *) const
Definition: PMDCollector.cpp:710
libpagemaker::PMDStrokeProperties::m_strokeColor
uint8_t m_strokeColor
Definition: PMDTypes.h:57
libpagemaker::PMDCollector::PageShapes_t
std::vector< std::shared_ptr< const OutputShape > > PageShapes_t
Definition: PMDCollector.h:40
SHAPE_TYPE_RECT
const uint8_t SHAPE_TYPE_RECT
Definition: constants.h:54
PMD_FALLTHROUGH
#define PMD_FALLTHROUGH
Definition: libpagemaker_utils.h:42
libpagemaker::PMDCollector::m_pages
std::vector< PMDPage > m_pages
Definition: PMDCollector.h:50
libpagemaker::OutputShape::getWidth
double getWidth() const
Definition: OutputShape.h:149
libpagemaker::PMDStrokeProperties::m_strokeType
uint8_t m_strokeType
Definition: PMDTypes.h:55
libpagemaker::SHAPE_UNITS_PER_INCH
const unsigned SHAPE_UNITS_PER_INCH
Definition: Units.h:19
libpagemaker::PMDPage::getShape
std::shared_ptr< const PMDLineSet > getShape(unsigned i) const
Definition: PMDPage.h:40
libpagemaker::Point
Definition: geometry.h:24
Units.h
SHAPE_TYPE_POLY
const uint8_t SHAPE_TYPE_POLY
Definition: constants.h:53
libpagemaker::PMDFont::m_fontName
std::string m_fontName
Definition: PMDTypes.h:36
libpagemaker
Definition: geometry.h:22
libpagemaker::OutputShape::shapeType
uint8_t shapeType() const
Definition: OutputShape.h:76
libpagemaker::Point::m_x
Unit m_x
Definition: geometry.h:26
constants.h
PMDExceptions.h
PMDTypes.h
libpagemaker::OutputShape::getRotation
double getRotation() const
Definition: OutputShape.h:91
libpagemaker::PMDCollector::fillOutputShapesByPage_TwoSided
void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:645
STROKE_LIGHT_DARK_LIGHT
const uint8_t STROKE_LIGHT_DARK_LIGHT
Definition: constants.h:77
libpagemaker::OutputShape::getCharProperties
std::vector< PMDCharProperties > getCharProperties() const
Definition: OutputShape.h:106
libpagemaker::OutputShape
Definition: OutputShape.h:23
STROKE_LIGHT_LIGHT
const uint8_t STROKE_LIGHT_LIGHT
Definition: constants.h:74
libpagemaker::PMDFillProperties
Definition: PMDTypes.h:43
SHAPE_TYPE_TEXTBOX
const uint8_t SHAPE_TYPE_TEXTBOX
Definition: constants.h:56
libpagemaker::PMDStrokeProperties::m_strokeTint
uint8_t m_strokeTint
Definition: PMDTypes.h:59
libpagemaker::PMDPage
Definition: PMDPage.h:23
libpagemaker::PMDCollector::paintShape
void paintShape(const OutputShape &shape, librevenge::RVNGDrawingInterface *) const
Definition: PMDCollector.cpp:178
libpagemaker::PMDCollector::m_pageHeight
boost::optional< PMDShapeUnit > m_pageHeight
Definition: PMDCollector.h:48
libpagemaker::PMDColor::m_green
uint16_t m_green
Definition: PMDTypes.h:24
STROKE_CIRCULAR_DOTS
const uint8_t STROKE_CIRCULAR_DOTS
Definition: constants.h:80
libpagemaker::PMDCollector::setPageHeight
void setPageHeight(PMDShapeUnit)
Definition: PMDCollector.cpp:152
libpagemaker::PMDCollector::m_font
std::vector< PMDFont > m_font
Definition: PMDCollector.h:52
SHAPE_TYPE_LINE
const uint8_t SHAPE_TYPE_LINE
Definition: constants.h:52
libpagemaker::OutputShape::getPoint
InchPoint getPoint(unsigned i) const
Definition: OutputShape.h:66
STROKE_DASHED
const uint8_t STROKE_DASHED
Definition: constants.h:78
libpagemaker::PMDCollector::addPage
unsigned addPage()
Definition: PMDCollector.cpp:157
FILL_NONE
const uint8_t FILL_NONE
Definition: constants.h:60
PMD_DEBUG_MSG
#define PMD_DEBUG_MSG(M)
Definition: libpagemaker_utils.h:56
libpagemaker::PMDCollector::PMDCollector
PMDCollector()
Definition: PMDCollector.cpp:136
PMDPage.h
libpagemaker::PMDCollector::fillOutputShapesByPage_OneSided
void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:682
libpagemaker::PMDCollector::addColor
void addColor(const PMDColor &color)
Definition: PMDCollector.cpp:163

Generated for libpagemaker by doxygen 1.8.16