Shapes.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libmspub 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 INCLUDED_SHAPES_H
#define INCLUDED_SHAPES_H
#include <map>
#include <vector>
#include "Coordinate.h"
#include "MSPUBConstants.h"
#include "ShapeType.h"
#include "VectorTransformation2D.h"
namespace libmspub
{
class MSPUBCollector;
struct CustomShape;
struct Shape
{
Shape(MSPUBCollector *o) : props(), graphicsProps(), owner(o) { }
virtual void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
virtual ~Shape()
{
}
librevenge::RVNGPropertyList props;
librevenge::RVNGPropertyList graphicsProps;
protected:
virtual void setCoordProps(Coordinate coord);
virtual void write(librevenge::RVNGDrawingInterface *painter) = 0;
MSPUBCollector *owner;
virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
Shape();
private:
Shape(const Shape &);
Shape &operator=(const Shape &);
};
struct FillableShape : public Shape
{
FillableShape(MSPUBCollector *o) : Shape(o), m_fill(NULL) { }
Fill *m_fill;
void setFill(Fill *fill);
protected:
virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
private:
FillableShape(const FillableShape &);
FillableShape &operator=(const FillableShape &);
};
struct GeometricShape : public FillableShape
{
void addLine(ColorReference color, unsigned widthInEmu, bool lineExists);
void fillDefaultAdjustValues();
void setAdjustValue(unsigned index, int adjustValue);
void setText(std::vector<TextParagraph> str);
double getCalculationValue(unsigned index, bool recursiveEntry = false) const;
double getSpecialValue(const CustomShape &shape, int arg) const;
void writeText(librevenge::RVNGDrawingInterface *painter);
void setTransformation(VectorTransformation2D transform);
std::vector<TextParagraph> m_str;
bool m_hasText;
unsigned m_pageSeqNum;
unsigned m_imgIndex;
ShapeType m_type;
double m_x, m_y, m_width, m_height;
VectorTransformation2D m_transform;
std::vector<int> m_adjustValues;
unsigned m_left, m_top, m_right, m_bottom; //emu
GeometricShape(MSPUBCollector *o)
: FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(0), m_imgIndex(0), m_type(RECTANGLE),
m_x(0), m_y(0), m_width(0), m_height(0), m_transform(VectorTransformation2D()),
m_adjustValues(),
m_left(DEFAULT_MARGIN), m_top(DEFAULT_MARGIN), m_right(DEFAULT_MARGIN), m_bottom(DEFAULT_MARGIN),
m_valuesSeen(), m_filledDefaultAdjustValues(false), m_textCoord(), m_closeEverything(false),
m_lines(), m_drawStroke(false),
m_borderPosition(HALF_INSIDE_SHAPE),
m_coordinatesRotated90(false), m_foldedTransform(VectorTransformation2D()) { }
GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
: FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(pageSeqNum), m_imgIndex(0), m_type(RECTANGLE),
m_x(0), m_y(0), m_width(0), m_height(0), m_transform(VectorTransformation2D()), m_adjustValues(),
m_left(DEFAULT_MARGIN), m_top(DEFAULT_MARGIN), m_right(DEFAULT_MARGIN), m_bottom(DEFAULT_MARGIN),
m_valuesSeen(), m_filledDefaultAdjustValues(false), m_textCoord(), m_closeEverything(false),
m_lines(), m_drawStroke(false),
m_borderPosition(HALF_INSIDE_SHAPE),
m_coordinatesRotated90(false), m_foldedTransform(VectorTransformation2D()) { }
std::vector<Color> getPaletteColors() const;
void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
protected:
virtual bool hasFill();
void setCoordProps(Coordinate coord);
virtual void write(librevenge::RVNGDrawingInterface *painter);
librevenge::RVNGPropertyListVector updateGraphicsProps();
GeometricShape();
private:
GeometricShape(const GeometricShape &);
GeometricShape &operator=(const GeometricShape &);
mutable std::vector<bool> m_valuesSeen;
bool m_filledDefaultAdjustValues;
Coordinate m_textCoord;
bool m_closeEverything;
public:
std::vector<Line> m_lines;
bool m_drawStroke;
BorderPosition m_borderPosition;
bool m_coordinatesRotated90;
VectorTransformation2D m_foldedTransform;
};
} // namespace libmspub
#endif // INCLUDED_SHAPES_H
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Coordinate.h
MSPUBConstants.h
DEFAULT_MARGIN
#define DEFAULT_MARGIN
Definition MSPUBConstants.h:15
ShapeType.h
VectorTransformation2D.h
libmspub::ColorReference
Definition ColorReference.h:20
libmspub::Fill
Definition Fill.h:23
libmspub::MSPUBCollector
Definition MSPUBCollector.h:45
libmspub::VectorTransformation2D
Definition VectorTransformation2D.h:26
libmspub
Definition Arrow.h:14
libmspub::ShapeType
ShapeType
Definition ShapeType.h:16
libmspub::RECTANGLE
@ RECTANGLE
Definition ShapeType.h:19
libmspub::BorderPosition
BorderPosition
Definition MSPUBTypes.h:27
libmspub::HALF_INSIDE_SHAPE
@ HALF_INSIDE_SHAPE
Definition MSPUBTypes.h:29
libmspub::Coordinate
Definition Coordinate.h:22
libmspub::CustomShape
Definition PolygonUtils.h:60
libmspub::FillableShape::m_fill
Fill * m_fill
Definition Shapes.h:49
libmspub::FillableShape::FillableShape
FillableShape(const FillableShape &)
libmspub::FillableShape::setFill
void setFill(Fill *fill)
libmspub::FillableShape::operator=
FillableShape & operator=(const FillableShape &)
libmspub::FillableShape::updateGraphicsProps
virtual librevenge::RVNGPropertyListVector updateGraphicsProps()
libmspub::FillableShape::FillableShape
FillableShape(MSPUBCollector *o)
Definition Shapes.h:48
libmspub::GeometricShape::GeometricShape
GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
Definition Shapes.h:86
libmspub::GeometricShape::m_transform
VectorTransformation2D m_transform
Definition Shapes.h:74
libmspub::GeometricShape::getPaletteColors
std::vector< Color > getPaletteColors() const
libmspub::GeometricShape::setCoordProps
void setCoordProps(Coordinate coord)
libmspub::GeometricShape::m_height
double m_height
Definition Shapes.h:73
libmspub::GeometricShape::output
void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord)
libmspub::GeometricShape::m_width
double m_width
Definition Shapes.h:73
libmspub::GeometricShape::setText
void setText(std::vector< TextParagraph > str)
libmspub::GeometricShape::GeometricShape
GeometricShape()
libmspub::GeometricShape::m_foldedTransform
VectorTransformation2D m_foldedTransform
Definition Shapes.h:114
libmspub::GeometricShape::setTransformation
void setTransformation(VectorTransformation2D transform)
libmspub::GeometricShape::updateGraphicsProps
librevenge::RVNGPropertyListVector updateGraphicsProps()
libmspub::GeometricShape::setAdjustValue
void setAdjustValue(unsigned index, int adjustValue)
libmspub::GeometricShape::m_coordinatesRotated90
bool m_coordinatesRotated90
Definition Shapes.h:113
libmspub::GeometricShape::m_valuesSeen
std::vector< bool > m_valuesSeen
Definition Shapes.h:105
libmspub::GeometricShape::m_x
double m_x
Definition Shapes.h:73
libmspub::GeometricShape::m_left
unsigned m_left
Definition Shapes.h:76
libmspub::GeometricShape::m_pageSeqNum
unsigned m_pageSeqNum
Definition Shapes.h:70
libmspub::GeometricShape::m_right
unsigned m_right
Definition Shapes.h:76
libmspub::GeometricShape::hasFill
virtual bool hasFill()
libmspub::GeometricShape::m_hasText
bool m_hasText
Definition Shapes.h:69
libmspub::GeometricShape::m_drawStroke
bool m_drawStroke
Definition Shapes.h:111
libmspub::GeometricShape::getCalculationValue
double getCalculationValue(unsigned index, bool recursiveEntry=false) const
libmspub::GeometricShape::m_lines
std::vector< Line > m_lines
Definition Shapes.h:110
libmspub::GeometricShape::m_imgIndex
unsigned m_imgIndex
Definition Shapes.h:71
libmspub::GeometricShape::addLine
void addLine(ColorReference color, unsigned widthInEmu, bool lineExists)
libmspub::GeometricShape::m_type
ShapeType m_type
Definition Shapes.h:72
libmspub::GeometricShape::m_y
double m_y
Definition Shapes.h:73
libmspub::GeometricShape::m_textCoord
Coordinate m_textCoord
Definition Shapes.h:107
libmspub::GeometricShape::m_filledDefaultAdjustValues
bool m_filledDefaultAdjustValues
Definition Shapes.h:106
libmspub::GeometricShape::m_adjustValues
std::vector< int > m_adjustValues
Definition Shapes.h:75
libmspub::GeometricShape::m_borderPosition
BorderPosition m_borderPosition
Definition Shapes.h:112
libmspub::GeometricShape::write
virtual void write(librevenge::RVNGDrawingInterface *painter)
libmspub::GeometricShape::GeometricShape
GeometricShape(const GeometricShape &)
libmspub::GeometricShape::getSpecialValue
double getSpecialValue(const CustomShape &shape, int arg) const
libmspub::GeometricShape::m_top
unsigned m_top
Definition Shapes.h:76
libmspub::GeometricShape::m_bottom
unsigned m_bottom
Definition Shapes.h:76
libmspub::GeometricShape::m_closeEverything
bool m_closeEverything
Definition Shapes.h:108
libmspub::GeometricShape::operator=
GeometricShape & operator=(const GeometricShape &)
libmspub::GeometricShape::GeometricShape
GeometricShape(MSPUBCollector *o)
Definition Shapes.h:77
libmspub::GeometricShape::m_str
std::vector< TextParagraph > m_str
Definition Shapes.h:68
libmspub::GeometricShape::fillDefaultAdjustValues
void fillDefaultAdjustValues()
libmspub::GeometricShape::writeText
void writeText(librevenge::RVNGDrawingInterface *painter)
libmspub::Shape::graphicsProps
librevenge::RVNGPropertyList graphicsProps
Definition Shapes.h:33
libmspub::Shape::updateGraphicsProps
virtual librevenge::RVNGPropertyListVector updateGraphicsProps()
libmspub::Shape::operator=
Shape & operator=(const Shape &)
libmspub::Shape::Shape
Shape()
libmspub::Shape::write
virtual void write(librevenge::RVNGDrawingInterface *painter)=0
libmspub::Shape::Shape
Shape(MSPUBCollector *o)
Definition Shapes.h:27
libmspub::Shape::setCoordProps
virtual void setCoordProps(Coordinate coord)
libmspub::Shape::props
librevenge::RVNGPropertyList props
Definition Shapes.h:32
libmspub::Shape::Shape
Shape(const Shape &)
libmspub::Shape::output
virtual void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord)
libmspub::Shape::~Shape
virtual ~Shape()
Definition Shapes.h:29
libmspub::Shape::owner
MSPUBCollector * owner
Definition Shapes.h:37