ShapeInfo.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_SHAPEINFO_H
#define INCLUDED_SHAPEINFO_H
#include <functional>
#include <map>
#include <memory>
#include <vector>
#include <boost/optional.hpp>
#include "Arrow.h"
#include "ColorReference.h"
#include "Coordinate.h"
#include "Dash.h"
#include "Fill.h"
#include "Line.h"
#include "MSPUBTypes.h"
#include "Margins.h"
#include "PolygonUtils.h"
#include "Shadow.h"
#include "ShapeType.h"
#include "TableInfo.h"
#include "VerticalAlign.h"
namespace libmspub
{
void noop(const CustomShape *);
struct ShapeInfo
{
boost::optional<ShapeType> m_type;
boost::optional<ShapeType> m_cropType;
boost::optional<unsigned> m_imgIndex;
boost::optional<unsigned> m_borderImgIndex;
boost::optional<Coordinate> m_coordinates;
std::vector<Line> m_lines;
boost::optional<unsigned> m_pageSeqNum;
boost::optional<unsigned> m_textId;
std::map<unsigned, int> m_adjustValuesByIndex;
std::vector<int> m_adjustValues;
boost::optional<double> m_rotation;
boost::optional<std::pair<bool, bool> > m_flips;
boost::optional<Margins> m_margins;
boost::optional<BorderPosition> m_borderPosition; // Irrelevant except for rectangular shapes
std::shared_ptr<const Fill> m_fill;
boost::optional<DynamicCustomShape> m_customShape;
bool m_stretchBorderArt;
boost::optional<ColorReference> m_lineBackColor;
boost::optional<Dash> m_dash;
boost::optional<TableInfo> m_tableInfo;
boost::optional<unsigned> m_numColumns;
unsigned m_columnSpacing;
boost::optional<Arrow> m_beginArrow;
boost::optional<Arrow> m_endArrow;
boost::optional<VerticalAlign> m_verticalAlign;
boost::optional<ColorReference> m_pictureRecolor;
boost::optional<Shadow> m_shadow;
boost::optional<int> m_innerRotation;
std::vector<libmspub::Vertex> m_clipPath;
boost::optional<int> m_pictureBrightness;
boost::optional<int> m_pictureContrast;
ShapeInfo() : m_type(), m_cropType(), m_imgIndex(), m_borderImgIndex(),
m_coordinates(), m_lines(), m_pageSeqNum(),
m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
m_rotation(), m_flips(), m_margins(), m_borderPosition(),
m_fill(), m_customShape(), m_stretchBorderArt(false),
m_lineBackColor(), m_dash(), m_tableInfo(),
m_numColumns(),
m_columnSpacing(0), m_beginArrow(), m_endArrow(),
m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath(), m_pictureBrightness(), m_pictureContrast()
{
}
std::shared_ptr<const CustomShape> getCustomShape() const
{
if (bool(m_customShape))
{
return getFromDynamicCustomShape(m_customShape.get());
}
if (bool(m_cropType))
{
return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_cropType.get()),
std::function<void (const CustomShape *)>(noop));
}
return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
std::function<void (const CustomShape *)>(noop));
}
};
}
#endif
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Arrow.h
ColorReference.h
Coordinate.h
Dash.h
Fill.h
Line.h
MSPUBTypes.h
Margins.h
PolygonUtils.h
Shadow.h
ShapeType.h
TableInfo.h
VerticalAlign.h
libmspub
Definition Arrow.h:14
libmspub::RECTANGLE
@ RECTANGLE
Definition ShapeType.h:19
libmspub::noop
void noop(const CustomShape *)
Definition MSPUBCollector.cpp:524
libmspub::getFromDynamicCustomShape
std::shared_ptr< const CustomShape > getFromDynamicCustomShape(const DynamicCustomShape &dcs)
Definition PolygonUtils.cpp:6368
libmspub::getCustomShape
const CustomShape * getCustomShape(ShapeType type)
Definition PolygonUtils.cpp:5245
libmspub::CustomShape
Definition PolygonUtils.h:60
libmspub::ShapeInfo::m_customShape
boost::optional< DynamicCustomShape > m_customShape
Definition ShapeInfo.h:54
libmspub::ShapeInfo::getCustomShape
std::shared_ptr< const CustomShape > getCustomShape() const
Definition ShapeInfo.h:81
libmspub::ShapeInfo::m_numColumns
boost::optional< unsigned > m_numColumns
Definition ShapeInfo.h:59
libmspub::ShapeInfo::m_lineBackColor
boost::optional< ColorReference > m_lineBackColor
Definition ShapeInfo.h:56
libmspub::ShapeInfo::m_fill
std::shared_ptr< const Fill > m_fill
Definition ShapeInfo.h:53
libmspub::ShapeInfo::m_adjustValuesByIndex
std::map< unsigned, int > m_adjustValuesByIndex
Definition ShapeInfo.h:47
libmspub::ShapeInfo::m_clipPath
std::vector< libmspub::Vertex > m_clipPath
Definition ShapeInfo.h:67
libmspub::ShapeInfo::m_pictureRecolor
boost::optional< ColorReference > m_pictureRecolor
Definition ShapeInfo.h:64
libmspub::ShapeInfo::m_tableInfo
boost::optional< TableInfo > m_tableInfo
Definition ShapeInfo.h:58
libmspub::ShapeInfo::m_flips
boost::optional< std::pair< bool, bool > > m_flips
Definition ShapeInfo.h:50
libmspub::ShapeInfo::m_columnSpacing
unsigned m_columnSpacing
Definition ShapeInfo.h:60
libmspub::ShapeInfo::m_pictureBrightness
boost::optional< int > m_pictureBrightness
Definition ShapeInfo.h:68
libmspub::ShapeInfo::m_adjustValues
std::vector< int > m_adjustValues
Definition ShapeInfo.h:48
libmspub::ShapeInfo::m_rotation
boost::optional< double > m_rotation
Definition ShapeInfo.h:49
libmspub::ShapeInfo::m_endArrow
boost::optional< Arrow > m_endArrow
Definition ShapeInfo.h:62
libmspub::ShapeInfo::m_pageSeqNum
boost::optional< unsigned > m_pageSeqNum
Definition ShapeInfo.h:45
libmspub::ShapeInfo::m_textId
boost::optional< unsigned > m_textId
Definition ShapeInfo.h:46
libmspub::ShapeInfo::m_dash
boost::optional< Dash > m_dash
Definition ShapeInfo.h:57
libmspub::ShapeInfo::m_beginArrow
boost::optional< Arrow > m_beginArrow
Definition ShapeInfo.h:61
libmspub::ShapeInfo::m_type
boost::optional< ShapeType > m_type
Definition ShapeInfo.h:39
libmspub::ShapeInfo::m_shadow
boost::optional< Shadow > m_shadow
Definition ShapeInfo.h:65
libmspub::ShapeInfo::m_innerRotation
boost::optional< int > m_innerRotation
Definition ShapeInfo.h:66
libmspub::ShapeInfo::m_cropType
boost::optional< ShapeType > m_cropType
Definition ShapeInfo.h:40
libmspub::ShapeInfo::m_pictureContrast
boost::optional< int > m_pictureContrast
Definition ShapeInfo.h:69
libmspub::ShapeInfo::m_borderImgIndex
boost::optional< unsigned > m_borderImgIndex
Definition ShapeInfo.h:42
libmspub::ShapeInfo::m_coordinates
boost::optional< Coordinate > m_coordinates
Definition ShapeInfo.h:43
libmspub::ShapeInfo::m_imgIndex
boost::optional< unsigned > m_imgIndex
Definition ShapeInfo.h:41
libmspub::ShapeInfo::m_stretchBorderArt
bool m_stretchBorderArt
Definition ShapeInfo.h:55
libmspub::ShapeInfo::ShapeInfo
ShapeInfo()
Definition ShapeInfo.h:70
libmspub::ShapeInfo::m_verticalAlign
boost::optional< VerticalAlign > m_verticalAlign
Definition ShapeInfo.h:63
libmspub::ShapeInfo::m_lines
std::vector< Line > m_lines
Definition ShapeInfo.h:44
libmspub::ShapeInfo::m_borderPosition
boost::optional< BorderPosition > m_borderPosition
Definition ShapeInfo.h:52
libmspub::ShapeInfo::m_margins
boost::optional< Margins > m_margins
Definition ShapeInfo.h:51