Line data Source code
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 __SHAPEINFO_H__
29 : #define __SHAPEINFO_H__
30 : #include <boost/optional.hpp>
31 : #include <boost/shared_ptr.hpp>
32 : #include <map>
33 : #include <vector>
34 : #include <boost/function.hpp>
35 : #include "ShapeType.h"
36 : #include "Coordinate.h"
37 : #include "Line.h"
38 : #include "Margins.h"
39 : #include "MSPUBTypes.h"
40 : #include "Fill.h"
41 : #include "PolygonUtils.h"
42 : #include "Dash.h"
43 : #include "TableInfo.h"
44 : #include "Arrow.h"
45 : #include "VerticalAlign.h"
46 : #include "ColorReference.h"
47 : #include "Shadow.h"
48 :
49 : namespace libmspub
50 : {
51 : void noop(const CustomShape *);
52 0 : struct ShapeInfo
53 : {
54 : boost::optional<ShapeType> m_type;
55 : boost::optional<unsigned> m_imgIndex;
56 : boost::optional<unsigned> m_borderImgIndex;
57 : boost::optional<Coordinate> m_coordinates;
58 : std::vector<Line> m_lines;
59 : boost::optional<unsigned> m_pageSeqNum;
60 : boost::optional<unsigned> m_textId;
61 : std::map<unsigned, int> m_adjustValuesByIndex;
62 : std::vector<int> m_adjustValues;
63 : boost::optional<double> m_rotation;
64 : boost::optional<std::pair<bool, bool> > m_flips;
65 : boost::optional<Margins> m_margins;
66 : boost::optional<BorderPosition> m_borderPosition; // Irrelevant except for rectangular shapes
67 : boost::shared_ptr<const Fill> m_fill;
68 : boost::optional<DynamicCustomShape> m_customShape;
69 : bool m_stretchBorderArt;
70 : boost::optional<ColorReference> m_lineBackColor;
71 : boost::optional<Dash> m_dash;
72 : boost::optional<TableInfo> m_tableInfo;
73 : boost::optional<std::vector<unsigned> > m_tableCellTextEnds;
74 : boost::optional<unsigned> m_numColumns;
75 : unsigned m_columnSpacing;
76 : boost::optional<Arrow> m_beginArrow;
77 : boost::optional<Arrow> m_endArrow;
78 : boost::optional<VerticalAlign> m_verticalAlign;
79 : boost::optional<ColorReference> m_pictureRecolor;
80 : boost::optional<Shadow> m_shadow;
81 0 : ShapeInfo() : m_type(), m_imgIndex(), m_borderImgIndex(),
82 : m_coordinates(), m_lines(), m_pageSeqNum(),
83 : m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
84 : m_rotation(), m_flips(), m_margins(), m_borderPosition(),
85 : m_fill(), m_customShape(), m_stretchBorderArt(false),
86 : m_lineBackColor(), m_dash(), m_tableInfo(),
87 : m_tableCellTextEnds(), m_numColumns(),
88 : m_columnSpacing(0), m_beginArrow(), m_endArrow(),
89 0 : m_verticalAlign(), m_pictureRecolor(), m_shadow()
90 : {
91 0 : }
92 0 : boost::shared_ptr<const CustomShape> getCustomShape() const
93 : {
94 0 : if (m_customShape.is_initialized())
95 : {
96 0 : return getFromDynamicCustomShape(m_customShape.get());
97 : }
98 : return boost::shared_ptr<const CustomShape>(
99 0 : libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
100 0 : boost::function<void (const CustomShape *)>(noop));
101 : }
102 : };
103 : }
104 : #endif
105 : /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|