Shapes.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 libmspub 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 INCLUDED_SHAPES_H
11 #define INCLUDED_SHAPES_H
12 
13 #include <map>
14 #include <vector>
15 
16 #include "Coordinate.h"
17 #include "MSPUBConstants.h"
18 #include "ShapeType.h"
19 #include "VectorTransformation2D.h"
20 
21 namespace libmspub
22 {
23 class MSPUBCollector;
24 struct CustomShape;
25 struct Shape
26 {
28  virtual void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
29  virtual ~Shape()
30  {
31  }
32  librevenge::RVNGPropertyList props;
33  librevenge::RVNGPropertyList graphicsProps;
34 protected:
35  virtual void setCoordProps(Coordinate coord);
36  virtual void write(librevenge::RVNGDrawingInterface *painter) = 0;
38 
39  virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
40 
41  Shape();
42 private:
43  Shape(const Shape &);
44  Shape &operator=(const Shape &);
45 };
46 struct FillableShape : public Shape
47 {
50  void setFill(Fill *fill);
51 protected:
52  virtual librevenge::RVNGPropertyListVector updateGraphicsProps();
53 private:
56 };
58 {
59  void addLine(ColorReference color, unsigned widthInEmu, bool lineExists);
61  void setAdjustValue(unsigned index, int adjustValue);
62  void setText(std::vector<TextParagraph> str);
63  double getCalculationValue(unsigned index, bool recursiveEntry = false) const;
64  double getSpecialValue(const CustomShape &shape, int arg) const;
65  void writeText(librevenge::RVNGDrawingInterface *painter);
67 
68  std::vector<TextParagraph> m_str;
69  bool m_hasText;
70  unsigned m_pageSeqNum;
71  unsigned m_imgIndex;
73  double m_x, m_y, m_width, m_height;
75  std::vector<int> m_adjustValues;
76  unsigned m_left, m_top, m_right, m_bottom; //emu
83  m_lines(), m_drawStroke(false),
86  GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
87  : FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(pageSeqNum), m_imgIndex(0), m_type(RECTANGLE),
91  m_lines(), m_drawStroke(false),
94  std::vector<Color> getPaletteColors() const;
95  void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord);
96 protected:
97  virtual bool hasFill();
99  virtual void write(librevenge::RVNGDrawingInterface *painter);
100  librevenge::RVNGPropertyListVector updateGraphicsProps();
102 private:
105  mutable std::vector<bool> m_valuesSeen;
109 public:
110  std::vector<Line> m_lines;
115 };
116 } // namespace libmspub
117 #endif // INCLUDED_SHAPES_H
118 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
#define DEFAULT_MARGIN
Definition: MSPUBConstants.h:15
Definition: ColorReference.h:20
Definition: Fill.h:23
Definition: MSPUBCollector.h:45
Definition: VectorTransformation2D.h:26
Definition: Arrow.h:14
ShapeType
Definition: ShapeType.h:16
@ RECTANGLE
Definition: ShapeType.h:19
BorderPosition
Definition: MSPUBTypes.h:27
@ HALF_INSIDE_SHAPE
Definition: MSPUBTypes.h:29
Definition: Coordinate.h:18
Definition: PolygonUtils.h:60
Definition: Shapes.h:47
FillableShape & operator=(const FillableShape &)
Fill * m_fill
Definition: Shapes.h:49
FillableShape(const FillableShape &)
void setFill(Fill *fill)
virtual librevenge::RVNGPropertyListVector updateGraphicsProps()
FillableShape(MSPUBCollector *o)
Definition: Shapes.h:48
Definition: Shapes.h:58
GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
Definition: Shapes.h:86
VectorTransformation2D m_transform
Definition: Shapes.h:74
void setCoordProps(Coordinate coord)
double m_height
Definition: Shapes.h:73
void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord)
double m_width
Definition: Shapes.h:73
void setText(std::vector< TextParagraph > str)
VectorTransformation2D m_foldedTransform
Definition: Shapes.h:114
void setTransformation(VectorTransformation2D transform)
std::vector< Color > getPaletteColors() const
librevenge::RVNGPropertyListVector updateGraphicsProps()
void setAdjustValue(unsigned index, int adjustValue)
bool m_coordinatesRotated90
Definition: Shapes.h:113
std::vector< bool > m_valuesSeen
Definition: Shapes.h:105
double m_x
Definition: Shapes.h:73
unsigned m_left
Definition: Shapes.h:76
unsigned m_pageSeqNum
Definition: Shapes.h:70
unsigned m_right
Definition: Shapes.h:76
virtual bool hasFill()
bool m_hasText
Definition: Shapes.h:69
bool m_drawStroke
Definition: Shapes.h:111
double getCalculationValue(unsigned index, bool recursiveEntry=false) const
std::vector< Line > m_lines
Definition: Shapes.h:110
unsigned m_imgIndex
Definition: Shapes.h:71
void addLine(ColorReference color, unsigned widthInEmu, bool lineExists)
ShapeType m_type
Definition: Shapes.h:72
double m_y
Definition: Shapes.h:73
Coordinate m_textCoord
Definition: Shapes.h:107
bool m_filledDefaultAdjustValues
Definition: Shapes.h:106
std::vector< int > m_adjustValues
Definition: Shapes.h:75
BorderPosition m_borderPosition
Definition: Shapes.h:112
virtual void write(librevenge::RVNGDrawingInterface *painter)
GeometricShape(const GeometricShape &)
double getSpecialValue(const CustomShape &shape, int arg) const
unsigned m_top
Definition: Shapes.h:76
unsigned m_bottom
Definition: Shapes.h:76
GeometricShape & operator=(const GeometricShape &)
bool m_closeEverything
Definition: Shapes.h:108
GeometricShape(MSPUBCollector *o)
Definition: Shapes.h:77
std::vector< TextParagraph > m_str
Definition: Shapes.h:68
void writeText(librevenge::RVNGDrawingInterface *painter)
Definition: Shapes.h:26
librevenge::RVNGPropertyList graphicsProps
Definition: Shapes.h:33
virtual librevenge::RVNGPropertyListVector updateGraphicsProps()
virtual void write(librevenge::RVNGDrawingInterface *painter)=0
Shape(MSPUBCollector *o)
Definition: Shapes.h:27
virtual void setCoordProps(Coordinate coord)
librevenge::RVNGPropertyList props
Definition: Shapes.h:32
Shape(const Shape &)
Shape & operator=(const Shape &)
virtual void output(librevenge::RVNGDrawingInterface *painter, Coordinate coord)
virtual ~Shape()
Definition: Shapes.h:29
MSPUBCollector * owner
Definition: Shapes.h:37

Generated for libmspub by doxygen 1.9.1