/* -*- 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 #include #include #include #include #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 m_type; boost::optional m_cropType; boost::optional m_imgIndex; boost::optional m_borderImgIndex; boost::optional m_coordinates; std::vector m_lines; boost::optional m_pageSeqNum; boost::optional m_textId; std::map m_adjustValuesByIndex; std::vector m_adjustValues; boost::optional m_rotation; boost::optional > m_flips; boost::optional m_margins; boost::optional m_borderPosition; // Irrelevant except for rectangular shapes std::shared_ptr m_fill; boost::optional m_customShape; bool m_stretchBorderArt; boost::optional m_lineBackColor; boost::optional m_dash; boost::optional m_tableInfo; boost::optional m_numColumns; unsigned m_columnSpacing; boost::optional m_beginArrow; boost::optional m_endArrow; boost::optional m_verticalAlign; boost::optional m_pictureRecolor; boost::optional m_shadow; boost::optional m_innerRotation; std::vector m_clipPath; boost::optional m_pictureBrightness; boost::optional 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 getCustomShape() const { if (bool(m_customShape)) { return getFromDynamicCustomShape(m_customShape.get()); } if (bool(m_cropType)) { return std::shared_ptr( libmspub::getCustomShape(m_cropType.get()), std::function(noop)); } return std::shared_ptr( libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)), std::function(noop)); } }; } #endif /* vim:set shiftwidth=2 softtabstop=2 expandtab: */