|
rpm-build |
324937 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
rpm-build |
324937 |
/*
|
|
rpm-build |
324937 |
* This file is part of the libpagemaker project.
|
|
rpm-build |
324937 |
*
|
|
rpm-build |
324937 |
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
rpm-build |
324937 |
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
rpm-build |
324937 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
rpm-build |
324937 |
*/
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
#ifndef __PMDCOLLECTOR_H__
|
|
rpm-build |
324937 |
#define __PMDCOLLECTOR_H__
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
#include <memory>
|
|
rpm-build |
324937 |
#include <stdint.h>
|
|
rpm-build |
324937 |
#include <string>
|
|
rpm-build |
324937 |
#include <vector>
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
#include <boost/optional.hpp>
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
#include "OutputShape.h"
|
|
rpm-build |
324937 |
#include "PMDExceptions.h"
|
|
rpm-build |
324937 |
#include "PMDPage.h"
|
|
rpm-build |
324937 |
#include "PMDTypes.h"
|
|
rpm-build |
324937 |
#include "Units.h"
|
|
rpm-build |
324937 |
#include "geometry.h"
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
namespace libpagemaker
|
|
rpm-build |
324937 |
{
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
/**
|
|
rpm-build |
324937 |
* Builder class for PMD Documents.
|
|
rpm-build |
324937 |
*
|
|
rpm-build |
324937 |
* Methods are called by the PMD parser to build the document. This done,
|
|
rpm-build |
324937 |
* the draw() method may be called to output the document to the
|
|
rpm-build |
324937 |
* supplied drawing interface.
|
|
rpm-build |
324937 |
*/
|
|
rpm-build |
324937 |
class PMDCollector
|
|
rpm-build |
324937 |
{
|
|
rpm-build |
324937 |
typedef std::vector<std::shared_ptr<const OutputShape> > PageShapes_t;
|
|
rpm-build |
324937 |
typedef std::vector<PageShapes_t> PageShapesList_t;
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
/*
|
|
rpm-build |
324937 |
* Height and width in PMD page units.
|
|
rpm-build |
324937 |
* One PMD page unit is 1/20 of a point (1/720 inch)
|
|
rpm-build |
324937 |
*/
|
|
rpm-build |
324937 |
boost::optional<PMDShapeUnit> m_pageWidth;
|
|
rpm-build |
324937 |
boost::optional<PMDShapeUnit> m_pageHeight;
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
std::vector<PMDPage> m_pages;
|
|
rpm-build |
324937 |
std::vector<PMDColor> m_color;
|
|
rpm-build |
324937 |
std::vector<PMDFont> m_font;
|
|
rpm-build |
324937 |
bool m_doubleSided;
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
void writePage(const PMDPage &,
|
|
rpm-build |
324937 |
librevenge::RVNGDrawingInterface *,
|
|
rpm-build |
324937 |
const std::vector<std::shared_ptr<const OutputShape> > &) const;
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
void paintShape(const OutputShape &shape,
|
|
rpm-build |
324937 |
librevenge::RVNGDrawingInterface *) const;
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
void fillOutputShapesByPage_OneSided(PageShapesList_t &pageShapes) const;
|
|
rpm-build |
324937 |
void fillOutputShapesByPage_TwoSided(PageShapesList_t &pageShapes) const;
|
|
rpm-build |
324937 |
void fillOutputShapesByPage(PageShapesList_t &pageShapes) const;
|
|
rpm-build |
324937 |
public:
|
|
rpm-build |
324937 |
PMDCollector();
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
/* State-mutating functions */
|
|
rpm-build |
324937 |
void setPageWidth(PMDShapeUnit);
|
|
rpm-build |
324937 |
void setPageHeight(PMDShapeUnit);
|
|
rpm-build |
324937 |
void setDoubleSided(bool);
|
|
rpm-build |
324937 |
void addShapeToPage(unsigned pageID, const std::shared_ptr<PMDLineSet> &shape);
|
|
rpm-build |
324937 |
void addColor(const PMDColor &color;;
|
|
rpm-build |
324937 |
void addFont(const PMDFont &font);
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
unsigned addPage();
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
/* Output functions */
|
|
rpm-build |
324937 |
void draw(librevenge::RVNGDrawingInterface *) const;
|
|
rpm-build |
324937 |
};
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
}
|
|
rpm-build |
324937 |
|
|
rpm-build |
324937 |
#endif /* __PMDCOLLECTOR_H__ */
|
|
rpm-build |
324937 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|