Shapes.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libmspub
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
17  *
18  * All Rights Reserved.
19  *
20  * For minor contributions see the git repository.
21  *
22  * Alternatively, the contents of this file may be used under the terms of
23  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26  * instead of those above.
27  */
28 #ifndef __SHAPES_H__
29 #define __SHAPES_H__
30 
31 #include <vector>
32 #include <map>
33 
34 #include "Coordinate.h"
35 #include "MSPUBConstants.h"
36 #include "ShapeType.h"
37 #include "VectorTransformation2D.h"
38 
39 namespace libmspub
40 {
41 class MSPUBCollector;
42 struct CustomShape;
43 struct Shape
44 {
46  virtual void output(libwpg::WPGPaintInterface *painter, Coordinate coord);
47  virtual ~Shape()
48  {
49  }
50  WPXPropertyList props;
51  WPXPropertyList graphicsProps;
52 protected:
53  virtual void setCoordProps(Coordinate coord);
54  virtual void write(libwpg::WPGPaintInterface *painter) = 0;
56 
57  virtual WPXPropertyListVector updateGraphicsProps();
58 
59  Shape();
60 private:
61  Shape(const Shape &);
62  Shape &operator=(const Shape &);
63 };
64 struct FillableShape : public Shape
65 {
68  void setFill(Fill *fill);
69 protected:
70  virtual WPXPropertyListVector updateGraphicsProps();
71 private:
74 };
76 {
77  void addLine(ColorReference color, unsigned widthInEmu, bool lineExists);
79  void setAdjustValue(unsigned index, int adjustValue);
80  void setText(std::vector<TextParagraph> str);
81  double getCalculationValue(unsigned index, bool recursiveEntry = false) const;
82  double getSpecialValue(const CustomShape &shape, int arg) const;
83  void writeText(libwpg::WPGPaintInterface *painter);
85 
86  std::vector<TextParagraph> m_str;
87  bool m_hasText;
88  unsigned m_pageSeqNum;
89  unsigned m_imgIndex;
91  double m_x, m_y, m_width, m_height;
93  std::vector<int> m_adjustValues;
94  unsigned m_left, m_top, m_right, m_bottom; //emu
101  m_lines(), m_drawStroke(false),
104  GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
105  : FillableShape(o), m_str(), m_hasText(false), m_pageSeqNum(pageSeqNum), m_imgIndex(0), m_type(RECTANGLE),
109  m_lines(), m_drawStroke(false),
112  std::vector<Color> getPaletteColors() const;
113  void output(libwpg::WPGPaintInterface *painter, Coordinate coord);
114 protected:
115  virtual bool hasFill();
116  void setCoordProps(Coordinate coord);
117  virtual void write(libwpg::WPGPaintInterface *painter);
118  WPXPropertyListVector updateGraphicsProps();
119  GeometricShape();
120 private:
123  mutable std::vector<bool> m_valuesSeen;
127 public:
128  std::vector<Line> m_lines;
133 };
134 } // namespace libmspub
135 #endif // __SHAPES_H__
136 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
WPXPropertyList props
Definition: Shapes.h:50
Fill * m_fill
Definition: Shapes.h:67
unsigned m_pageSeqNum
Definition: Shapes.h:88
unsigned m_right
Definition: Shapes.h:94
Definition: MSPUBTypes.h:47
void setText(std::vector< TextParagraph > str)
double m_x
Definition: Shapes.h:91
FillableShape(MSPUBCollector *o)
Definition: Shapes.h:66
std::vector< TextParagraph > m_str
Definition: Shapes.h:86
WPXPropertyListVector updateGraphicsProps()
BorderPosition m_borderPosition
Definition: Shapes.h:130
virtual void setCoordProps(Coordinate coord)
Definition: Fill.h:43
void setCoordProps(Coordinate coord)
unsigned m_left
Definition: Shapes.h:94
void setAdjustValue(unsigned index, int adjustValue)
Definition: Shapes.h:43
virtual void output(libwpg::WPGPaintInterface *painter, Coordinate coord)
BorderPosition
Definition: MSPUBTypes.h:44
Definition: ColorReference.h:36
ShapeType m_type
Definition: Shapes.h:90
bool m_closeEverything
Definition: Shapes.h:126
GeometricShape(MSPUBCollector *o)
Definition: Shapes.h:95
bool m_hasText
Definition: Shapes.h:87
std::vector< Line > m_lines
Definition: Shapes.h:128
Definition: Coordinate.h:34
virtual bool hasFill()
WPXPropertyList graphicsProps
Definition: Shapes.h:51
Definition: ShapeType.h:38
FillableShape & operator=(const FillableShape &)
double m_y
Definition: Shapes.h:91
void setFill(Fill *fill)
Coordinate m_textCoord
Definition: Shapes.h:125
VectorTransformation2D m_transform
Definition: Shapes.h:92
double getCalculationValue(unsigned index, bool recursiveEntry=false) const
GeometricShape(unsigned pageSeqNum, MSPUBCollector *o)
Definition: Shapes.h:104
double m_height
Definition: Shapes.h:91
void addLine(ColorReference color, unsigned widthInEmu, bool lineExists)
std::vector< Color > getPaletteColors() const
void output(libwpg::WPGPaintInterface *painter, Coordinate coord)
void writeText(libwpg::WPGPaintInterface *painter)
bool m_drawStroke
Definition: Shapes.h:129
void setTransformation(VectorTransformation2D transform)
Shape(MSPUBCollector *o)
Definition: Shapes.h:45
virtual void write(libwpg::WPGPaintInterface *painter)=0
Definition: PolygonUtils.h:77
VectorTransformation2D m_foldedTransform
Definition: Shapes.h:132
double m_width
Definition: Shapes.h:91
MSPUBCollector * owner
Definition: Shapes.h:55
bool m_coordinatesRotated90
Definition: Shapes.h:131
std::vector< int > m_adjustValues
Definition: Shapes.h:93
Definition: Shapes.h:75
Definition: VectorTransformation2D.h:44
Shape & operator=(const Shape &)
double getSpecialValue(const CustomShape &shape, int arg) const
unsigned m_bottom
Definition: Shapes.h:94
Definition: MSPUBCollector.h:66
std::vector< bool > m_valuesSeen
Definition: Shapes.h:123
virtual WPXPropertyListVector updateGraphicsProps()
#define DEFAULT_MARGIN
Definition: MSPUBConstants.h:34
virtual ~Shape()
Definition: Shapes.h:47
unsigned m_imgIndex
Definition: Shapes.h:89
virtual WPXPropertyListVector updateGraphicsProps()
ShapeType
Definition: ShapeType.h:34
Definition: Shapes.h:64
unsigned m_top
Definition: Shapes.h:94
virtual void write(libwpg::WPGPaintInterface *painter)
GeometricShape & operator=(const GeometricShape &)
bool m_filledDefaultAdjustValues
Definition: Shapes.h:124

Generated for libmspub by doxygen 1.8.5