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 <stdint.h>
14 
15 #include <vector>
16 #include <string>
17 
18 #include <boost/optional.hpp>
19 #include <boost/shared_ptr.hpp>
20 
21 
22 #include "geometry.h"
23 #include "PMDPage.h"
24 #include "PMDExceptions.h"
25 #include "Units.h"
26 #include "OutputShape.h"
27 #include "PMDTypes.h"
28 
29 namespace libpagemaker
30 {
31 
32 
41 {
42  typedef std::vector<boost::shared_ptr<const OutputShape> > PageShapes_t;
43  typedef std::vector<PageShapes_t> PageShapesList_t;
44 
45  /*
46  * Height and width in PMD page units.
47  * One PMD page unit is 1/20 of a point (1/720 inch)
48  */
49  boost::optional<PMDPageUnit> m_pageWidth;
50  boost::optional<PMDPageUnit> m_pageHeight;
51 
52  std::vector<PMDPage> m_pages;
53  std::vector<PMDColor> m_color;
54  std::vector<PMDFont> m_font;
56 
57  void writePage(const PMDPage &,
58  librevenge::RVNGDrawingInterface *,
59  const std::vector<boost::shared_ptr<const OutputShape> > &) const;
60 
61  void paintShape(const OutputShape &shape,
62  librevenge::RVNGDrawingInterface *) const;
63 
64  void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const;
65  void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const;
66  void fillOutputShapesByPage(PageShapesList_t &pageShapes) const;
67 public:
68  PMDCollector();
69 
70  /* State-mutating functions */
73  void setDoubleSided(bool);
74  void addShapeToPage(unsigned pageID, const boost::shared_ptr<PMDLineSet> &shape);
75  void addColor(const PMDColor &color);
76  void addFont(const PMDFont &font);
77 
78  unsigned addPage();
79 
80  /* Output functions */
81  void draw(librevenge::RVNGDrawingInterface *) const;
82 };
83 
84 }
85 
86 #endif /* __PMDCOLLECTOR_H__ */
87 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void fillOutputShapesByPage(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:759
void setDoubleSided(bool)
Definition: PMDCollector.cpp:100
std::vector< PMDColor > m_color
Definition: PMDCollector.h:53
void draw(librevenge::RVNGDrawingInterface *) const
Definition: PMDCollector.cpp:768
PMDCollector()
Definition: PMDCollector.cpp:95
bool m_doubleSided
Definition: PMDCollector.h:55
void setPageWidth(PMDPageUnit)
Definition: PMDCollector.cpp:106
Definition: PMDTypes.h:17
void paintShape(const OutputShape &shape, librevenge::RVNGDrawingInterface *) const
Definition: PMDCollector.cpp:137
void writePage(const PMDPage &, librevenge::RVNGDrawingInterface *, const std::vector< boost::shared_ptr< const OutputShape > > &) const
Definition: PMDCollector.cpp:680
Definition: PMDPage.h:22
void addFont(const PMDFont &font)
Definition: PMDCollector.cpp:127
std::vector< PMDPage > m_pages
Definition: PMDCollector.h:52
void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:703
boost::optional< PMDPageUnit > m_pageWidth
Definition: PMDCollector.h:49
void addColor(const PMDColor &color)
Definition: PMDCollector.cpp:122
Definition: Units.h:20
void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const
Definition: PMDCollector.cpp:740
boost::optional< PMDPageUnit > m_pageHeight
Definition: PMDCollector.h:50
Definition: OutputShape.h:21
std::vector< PageShapes_t > PageShapesList_t
Definition: PMDCollector.h:43
Definition: geometry.h:20
Definition: PMDTypes.h:29
Builder class for PMD Documents.
Definition: PMDCollector.h:40
std::vector< boost::shared_ptr< const OutputShape > > PageShapes_t
Definition: PMDCollector.h:42
std::vector< PMDFont > m_font
Definition: PMDCollector.h:54
unsigned addPage()
Definition: PMDCollector.cpp:116
void addShapeToPage(unsigned pageID, const boost::shared_ptr< PMDLineSet > &shape)
Definition: PMDCollector.cpp:132
void setPageHeight(PMDPageUnit)
Definition: PMDCollector.cpp:111

Generated for libpagemaker by doxygen 1.8.10