|
rpm-build |
9243a4 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
rpm-build |
9243a4 |
/*
|
|
rpm-build |
9243a4 |
* This file is part of the libmspub project.
|
|
rpm-build |
9243a4 |
*
|
|
rpm-build |
9243a4 |
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
rpm-build |
9243a4 |
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
rpm-build |
9243a4 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
rpm-build |
9243a4 |
*/
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
#ifndef INCLUDED_SHAPES_H
|
|
rpm-build |
9243a4 |
#define INCLUDED_SHAPES_H
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
#include <map>
|
|
rpm-build |
9243a4 |
#include <vector>
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
#include "Coordinate.h"
|
|
rpm-build |
9243a4 |
#include "MSPUBConstants.h"
|
|
rpm-build |
9243a4 |
#include "ShapeType.h"
|
|
rpm-build |
9243a4 |
#include "VectorTransformation2D.h"
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
namespace libmspub
|
|
rpm-build |
9243a4 |
{
|
|
rpm-build |
9243a4 |
class MSPUBCollector;
|
|
rpm-build |
9243a4 |
struct CustomShape;
|
|
rpm-build |
9243a4 |
struct Shape
|
|
rpm-build |
9243a4 |
{
|
|
rpm-build |
9243a4 |
Shape(MSPUBCollector *o) : props(), graphicsProps(), owner(o) { }
|
|
rpm-build |
9243a4 |
virtual void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
|
|
rpm-build |
9243a4 |
virtual ~Shape()
|
|
rpm-build |
9243a4 |
{
|
|
rpm-build |
9243a4 |
}
|
|
rpm-build |
9243a4 |
librevenge::RVNGPropertyList props;
|
|
rpm-build |
9243a4 |
librevenge::RVNGPropertyList graphicsProps;
|
|
rpm-build |
9243a4 |
protected:
|
|
rpm-build |
9243a4 |
virtual void setCoordProps(Coordinate coord);
|
|
rpm-build |
9243a4 |
virtual void write(librevenge::RVNGDrawingInterface *painter) = 0;
|
|
rpm-build |
9243a4 |
MSPUBCollector *owner;
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
Shape();
|
|
rpm-build |
9243a4 |
private:
|
|
rpm-build |
9243a4 |
Shape(const Shape &);
|
|
rpm-build |
9243a4 |
Shape &operator=(const Shape &);
|
|
rpm-build |
9243a4 |
};
|
|
rpm-build |
9243a4 |
struct FillableShape : public Shape
|
|
rpm-build |
9243a4 |
{
|
|
rpm-build |
9243a4 |
FillableShape(MSPUBCollector *o) : Shape(o), m_fill(NULL) { }
|
|
rpm-build |
9243a4 |
Fill *m_fill;
|
|
rpm-build |
9243a4 |
void setFill(Fill *fill);
|
|
rpm-build |
9243a4 |
protected:
|
|
rpm-build |
9243a4 |
virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
|
|
rpm-build |
9243a4 |
private:
|
|
rpm-build |
9243a4 |
FillableShape(const FillableShape &);
|
|
rpm-build |
9243a4 |
FillableShape &operator=(const FillableShape &);
|
|
rpm-build |
9243a4 |
};
|
|
rpm-build |
9243a4 |
struct GeometricShape : public FillableShape
|
|
rpm-build |
9243a4 |
{
|
|
rpm-build |
9243a4 |
void addLine(ColorReference color, unsigned widthInEmu, bool lineExists);
|
|
rpm-build |
9243a4 |
void fillDefaultAdjustValues();
|
|
rpm-build |
9243a4 |
void setAdjustValue(unsigned index, int adjustValue);
|
|
rpm-build |
9243a4 |
void setText(std::vector<TextParagraph> str);
|
|
rpm-build |
9243a4 |
double getCalculationValue(unsigned index, bool recursiveEntry = false) const;
|
|
rpm-build |
9243a4 |
double getSpecialValue(const CustomShape &shape, int arg) const;
|
|
rpm-build |
9243a4 |
void writeText(librevenge::RVNGDrawingInterface *painter);
|
|
rpm-build |
9243a4 |
void setTransformation(VectorTransformation2D transform);
|
|
rpm-build |
9243a4 |
|
|
rpm-build |
9243a4 |
std::vector<TextParagraph> m_str;
|
|
rpm-build |
9243a4 |
bool m_hasText;
|
|
rpm-build |
9243a4 |
unsigned m_pageSeqNum;
|
|
rpm-build |
9243a4 |
unsigned m_imgIndex;
|
|
rpm-build |
9243a4 |
ShapeType m_type;
|
|
rpm-build |
9243a4 |
double m_x, m_y, m_width, m_height;
|
|
rpm-build |
9243a4 |
VectorTransformation2D m_transform;
|
|
rpm-build |
9243a4 |
std::vector<int> m_adjustValues;
|
|
rpm-build |
9243a4 |
unsigned m_left, m_top, m_right, m_bottom; //emu
|
|
rpm-build |
9243a4 |
GeometricShape(MSPUBCollector *o)
|
|
rpm-build |
9243a4 |
: FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(0), m_imgIndex(0), m_type(RECTANGLE),
|
|
rpm-build |
9243a4 |
m_x(0), m_y(0), m_width(0), m_height(0), m_transform(VectorTransformation2D()),
|
|
rpm-build |
9243a4 |
m_adjustValues(),
|
|
rpm-build |
9243a4 |
m_left(DEFAULT_MARGIN), m_top(DEFAULT_MARGIN), m_right(DEFAULT_MARGIN), m_bottom(DEFAULT_MARGIN),
|
|
rpm-build |
9243a4 |
m_valuesSeen(), m_filledDefaultAdjustValues(false), m_textCoord(), m_closeEverything(false),
|
|
rpm-build |
9243a4 |
m_lines(), m_drawStroke(false),
|
|
rpm-build |
9243a4 |
m_borderPosition(HALF_INSIDE_SHAPE),
|
|
rpm-build |
9243a4 |
m_coordinatesRotated90(false), m_foldedTransform(VectorTransformation2D()) { }
|
|
rpm-build |
9243a4 |
GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
|
|
rpm-build |
9243a4 |
: FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(pageSeqNum), m_imgIndex(0), m_type(RECTANGLE),
|
|
rpm-build |
9243a4 |
m_x(0), m_y(0), m_width(0), m_height(0), m_transform(VectorTransformation2D()), m_adjustValues(),
|
|
rpm-build |
9243a4 |
m_left(DEFAULT_MARGIN), m_top(DEFAULT_MARGIN), m_right(DEFAULT_MARGIN), m_bottom(DEFAULT_MARGIN),
|
|
rpm-build |
9243a4 |
m_valuesSeen(), m_filledDefaultAdjustValues(false), m_textCoord(), m_closeEverything(false),
|
|
rpm-build |
9243a4 |
m_lines(), m_drawStroke(false),
|
|
rpm-build |
9243a4 |
m_borderPosition(HALF_INSIDE_SHAPE),
|
|
rpm-build |
9243a4 |
m_coordinatesRotated90(false), m_foldedTransform(VectorTransformation2D()) { }
|
|
rpm-build |
9243a4 |
std::vector<Color> getPaletteColors() const;
|
|
rpm-build |
9243a4 |
void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
|
|
rpm-build |
9243a4 |
protected:
|
|
rpm-build |
9243a4 |
virtual bool hasFill();
|
|
rpm-build |
9243a4 |
void setCoordProps(Coordinate coord);
|
|
rpm-build |
9243a4 |
virtual void write(librevenge::RVNGDrawingInterface *painter);
|
|
rpm-build |
9243a4 |
librevenge::RVNGPropertyListVector updateGraphicsProps();
|
|
rpm-build |
9243a4 |
GeometricShape();
|
|
rpm-build |
9243a4 |
private:
|
|
rpm-build |
9243a4 |
GeometricShape(const GeometricShape &);
|
|
rpm-build |
9243a4 |
GeometricShape &operator=(const GeometricShape &);
|
|
rpm-build |
9243a4 |
mutable std::vector<bool> m_valuesSeen;
|
|
rpm-build |
9243a4 |
bool m_filledDefaultAdjustValues;
|
|
rpm-build |
9243a4 |
Coordinate m_textCoord;
|
|
rpm-build |
9243a4 |
bool m_closeEverything;
|
|
rpm-build |
9243a4 |
public:
|
|
rpm-build |
9243a4 |
std::vector<Line> m_lines;
|
|
rpm-build |
9243a4 |
bool m_drawStroke;
|
|
rpm-build |
9243a4 |
BorderPosition m_borderPosition;
|
|
rpm-build |
9243a4 |
bool m_coordinatesRotated90;
|
|
rpm-build |
9243a4 |
VectorTransformation2D m_foldedTransform;
|
|
rpm-build |
9243a4 |
};
|
|
rpm-build |
9243a4 |
} // namespace libmspub
|
|
rpm-build |
9243a4 |
#endif // INCLUDED_SHAPES_H
|
|
rpm-build |
9243a4 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|