/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * This file is part of the libpagemaker 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 __PMDCOLLECTOR_H__ #define __PMDCOLLECTOR_H__ #include #include #include #include #include #include "OutputShape.h" #include "PMDExceptions.h" #include "PMDPage.h" #include "PMDTypes.h" #include "Units.h" #include "geometry.h" namespace libpagemaker { /** * Builder class for PMD Documents. * * Methods are called by the PMD parser to build the document. This done, * the draw() method may be called to output the document to the * supplied drawing interface. */ class PMDCollector { typedef std::vector > PageShapes_t; typedef std::vector PageShapesList_t; /* * Height and width in PMD page units. * One PMD page unit is 1/20 of a point (1/720 inch) */ boost::optional m_pageWidth; boost::optional m_pageHeight; std::vector m_pages; std::vector m_color; std::vector m_font; bool m_doubleSided; void writePage(const PMDPage &, librevenge::RVNGDrawingInterface *, const std::vector > &) const; void paintShape(const OutputShape &shape, librevenge::RVNGDrawingInterface *) const; void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const; void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const; void fillOutputShapesByPage(PageShapesList_t &pageShapes) const; public: PMDCollector(); /* State-mutating functions */ void setPageWidth(PMDShapeUnit); void setPageHeight(PMDShapeUnit); void setDoubleSided(bool); void addShapeToPage(unsigned pageID, const std::shared_ptr &shape); void addColor(const PMDColor &color); void addFont(const PMDFont &font); unsigned addPage(); /* Output functions */ void draw(librevenge::RVNGDrawingInterface *) const; }; } #endif /* __PMDCOLLECTOR_H__ */ /* vim:set shiftwidth=2 softtabstop=2 expandtab: */