ShapeInfo.h Source File documentation

ShapeInfo.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 __SHAPEINFO_H__
11 #define __SHAPEINFO_H__
12 #include <boost/optional.hpp>
13 #include <boost/shared_ptr.hpp>
14 #include <map>
15 #include <vector>
16 #include <boost/function.hpp>
17 #include "ShapeType.h"
18 #include "Coordinate.h"
19 #include "Line.h"
20 #include "Margins.h"
21 #include "MSPUBTypes.h"
22 #include "Fill.h"
23 #include "PolygonUtils.h"
24 #include "Dash.h"
25 #include "TableInfo.h"
26 #include "Arrow.h"
27 #include "VerticalAlign.h"
28 #include "ColorReference.h"
29 #include "Shadow.h"
30
31 namespace libmspub
32 {
33 void noop(const CustomShape *);
34 struct ShapeInfo
35 {
36 boost::optional<ShapeType> m_type;
37 boost::optional<ShapeType> m_cropType;
38 boost::optional<unsigned> m_imgIndex;
39 boost::optional<unsigned> m_borderImgIndex;
40 boost::optional<Coordinate> m_coordinates;
41 std::vector<Line> m_lines;
42 boost::optional<unsigned> m_pageSeqNum;
43 boost::optional<unsigned> m_textId;
44 std::map<unsigned, int> m_adjustValuesByIndex;
45 std::vector<int> m_adjustValues;
46 boost::optional<double> m_rotation;
47 boost::optional<std::pair<bool, bool> > m_flips;
48 boost::optional<Margins> m_margins;
49 boost::optional<BorderPosition> m_borderPosition; // Irrelevant except for rectangular shapes
50 boost::shared_ptr<const Fill> m_fill;
51 boost::optional<DynamicCustomShape> m_customShape;
52 bool m_stretchBorderArt;
53 boost::optional<ColorReference> m_lineBackColor;
54 boost::optional<Dash> m_dash;
55 boost::optional<TableInfo> m_tableInfo;
56 boost::optional<unsigned> m_numColumns;
57 unsigned m_columnSpacing;
58 boost::optional<Arrow> m_beginArrow;
59 boost::optional<Arrow> m_endArrow;
60 boost::optional<VerticalAlign> m_verticalAlign;
61 boost::optional<ColorReference> m_pictureRecolor;
62 boost::optional<Shadow> m_shadow;
63 boost::optional<int> m_innerRotation;
64 std::vector<libmspub::Vertex> m_clipPath;
65 boost::optional<int> m_pictureBrightness;
66 boost::optional<int> m_pictureContrast;
67 ShapeInfo() : m_type(), m_cropType(), m_imgIndex(), m_borderImgIndex(),
68 m_coordinates(), m_lines(), m_pageSeqNum(),
69 m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
70 m_rotation(), m_flips(), m_margins(), m_borderPosition(),
71 m_fill(), m_customShape(), m_stretchBorderArt(false),
72 m_lineBackColor(), m_dash(), m_tableInfo(),
73 m_numColumns(),
74 m_columnSpacing(0), m_beginArrow(), m_endArrow(),
75 m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath(), m_pictureBrightness(), m_pictureContrast()
76 {
77 }
78 boost::shared_ptr<const CustomShape> getCustomShape() const
79 {
80 if (bool(m_customShape))
81 {
82 return getFromDynamicCustomShape(m_customShape.get());
83 }
84 if (bool(m_cropType))
85 {
86 return boost::shared_ptr<const CustomShape>(
87 libmspub::getCustomShape(m_cropType.get()),
88 boost::function<void (const CustomShape *)>(noop));
89 }
90 return boost::shared_ptr<const CustomShape>(
91 libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
92 boost::function<void (const CustomShape *)>(noop));
93 }
94 };
95 }
96 #endif
97 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::ShapeInfo::m_imgIndex
boost::optional< unsigned > m_imgIndex
Definition: ShapeInfo.h:38
Shadow.h
libmspub::ShapeInfo::m_fill
boost::shared_ptr< const Fill > m_fill
Definition: ShapeInfo.h:50
libmspub::ShapeInfo::m_numColumns
boost::optional< unsigned > m_numColumns
Definition: ShapeInfo.h:56
libmspub::ShapeInfo::m_dash
boost::optional< Dash > m_dash
Definition: ShapeInfo.h:54
libmspub::ShapeInfo::m_borderImgIndex
boost::optional< unsigned > m_borderImgIndex
Definition: ShapeInfo.h:39
Line.h
ColorReference.h
libmspub::ShapeInfo::m_margins
boost::optional< Margins > m_margins
Definition: ShapeInfo.h:48
Fill.h
PolygonUtils.h
libmspub::ShapeInfo::m_pageSeqNum
boost::optional< unsigned > m_pageSeqNum
Definition: ShapeInfo.h:42
libmspub::ShapeInfo::m_pictureContrast
boost::optional< int > m_pictureContrast
Definition: ShapeInfo.h:66
libmspub::ShapeInfo::m_pictureBrightness
boost::optional< int > m_pictureBrightness
Definition: ShapeInfo.h:65
VerticalAlign.h
libmspub::ShapeInfo::m_verticalAlign
boost::optional< VerticalAlign > m_verticalAlign
Definition: ShapeInfo.h:60
libmspub::ShapeInfo::m_beginArrow
boost::optional< Arrow > m_beginArrow
Definition: ShapeInfo.h:58
ShapeType.h
libmspub::ShapeInfo::m_customShape
boost::optional< DynamicCustomShape > m_customShape
Definition: ShapeInfo.h:51
libmspub::ShapeInfo::m_stretchBorderArt
bool m_stretchBorderArt
Definition: ShapeInfo.h:52
libmspub::getFromDynamicCustomShape
boost::shared_ptr< const CustomShape > getFromDynamicCustomShape(const DynamicCustomShape &dcs)
Definition: PolygonUtils.cpp:6381
libmspub::ShapeInfo::m_flips
boost::optional< std::pair< bool, bool > > m_flips
Definition: ShapeInfo.h:47
libmspub::ShapeInfo::m_adjustValuesByIndex
std::map< unsigned, int > m_adjustValuesByIndex
Definition: ShapeInfo.h:44
libmspub::RECTANGLE
Definition: ShapeType.h:19
Dash.h
Margins.h
libmspub::ShapeInfo::m_tableInfo
boost::optional< TableInfo > m_tableInfo
Definition: ShapeInfo.h:55
libmspub::ShapeInfo::m_adjustValues
std::vector< int > m_adjustValues
Definition: ShapeInfo.h:45
libmspub::ShapeInfo::m_type
boost::optional< ShapeType > m_type
Definition: ShapeInfo.h:36
libmspub::ShapeInfo::m_coordinates
boost::optional< Coordinate > m_coordinates
Definition: ShapeInfo.h:40
libmspub::ShapeInfo::m_endArrow
boost::optional< Arrow > m_endArrow
Definition: ShapeInfo.h:59
libmspub::ShapeInfo::m_clipPath
std::vector< libmspub::Vertex > m_clipPath
Definition: ShapeInfo.h:64
libmspub::ShapeInfo::m_cropType
boost::optional< ShapeType > m_cropType
Definition: ShapeInfo.h:37
libmspub
Definition: Arrow.h:13
libmspub::ShapeInfo::getCustomShape
boost::shared_ptr< const CustomShape > getCustomShape() const
Definition: ShapeInfo.h:78
Arrow.h
libmspub::CustomShape
Definition: PolygonUtils.h:58
libmspub::ShapeInfo::m_textId
boost::optional< unsigned > m_textId
Definition: ShapeInfo.h:43
libmspub::ShapeInfo::m_columnSpacing
unsigned m_columnSpacing
Definition: ShapeInfo.h:57
TableInfo.h
libmspub::ShapeInfo::m_pictureRecolor
boost::optional< ColorReference > m_pictureRecolor
Definition: ShapeInfo.h:61
Coordinate.h
libmspub::ShapeInfo::ShapeInfo
ShapeInfo()
Definition: ShapeInfo.h:67
libmspub::getCustomShape
const CustomShape * getCustomShape(ShapeType type)
Definition: PolygonUtils.cpp:5245
libmspub::ShapeInfo::m_borderPosition
boost::optional< BorderPosition > m_borderPosition
Definition: ShapeInfo.h:49
MSPUBTypes.h
libmspub::ShapeInfo::m_innerRotation
boost::optional< int > m_innerRotation
Definition: ShapeInfo.h:63
libmspub::ShapeInfo::m_lines
std::vector< Line > m_lines
Definition: ShapeInfo.h:41
libmspub::noop
void noop(const CustomShape *)
Definition: MSPUBCollector.cpp:416
libmspub::ShapeInfo::m_lineBackColor
boost::optional< ColorReference > m_lineBackColor
Definition: ShapeInfo.h:53
libmspub::ShapeInfo::m_rotation
boost::optional< double > m_rotation
Definition: ShapeInfo.h:46
libmspub::ShapeInfo
Definition: ShapeInfo.h:34
libmspub::ShapeInfo::m_shadow
boost::optional< Shadow > m_shadow
Definition: ShapeInfo.h:62