Blame src/lib/ShapeInfo.h

rpm-build 9243a4
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
rpm-build 9243a4
/*
rpm-build 9243a4
 * This file is part of the libmspub project.
rpm-build 9243a4
 *
rpm-build 9243a4
 * This Source Code Form is subject to the terms of the Mozilla Public
rpm-build 9243a4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
rpm-build 9243a4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
rpm-build 9243a4
 */
rpm-build 9243a4
rpm-build 9243a4
#ifndef INCLUDED_SHAPEINFO_H
rpm-build 9243a4
#define INCLUDED_SHAPEINFO_H
rpm-build 9243a4
rpm-build 9243a4
#include <functional>
rpm-build 9243a4
#include <map>
rpm-build 9243a4
#include <memory>
rpm-build 9243a4
#include <vector>
rpm-build 9243a4
rpm-build 9243a4
#include <boost/optional.hpp>
rpm-build 9243a4
rpm-build 9243a4
#include "Arrow.h"
rpm-build 9243a4
#include "ColorReference.h"
rpm-build 9243a4
#include "Coordinate.h"
rpm-build 9243a4
#include "Dash.h"
rpm-build 9243a4
#include "Fill.h"
rpm-build 9243a4
#include "Line.h"
rpm-build 9243a4
#include "MSPUBTypes.h"
rpm-build 9243a4
#include "Margins.h"
rpm-build 9243a4
#include "PolygonUtils.h"
rpm-build 9243a4
#include "Shadow.h"
rpm-build 9243a4
#include "ShapeType.h"
rpm-build 9243a4
#include "TableInfo.h"
rpm-build 9243a4
#include "VerticalAlign.h"
rpm-build 9243a4
rpm-build 9243a4
namespace libmspub
rpm-build 9243a4
{
rpm-build 9243a4
void noop(const CustomShape *);
rpm-build 9243a4
struct ShapeInfo
rpm-build 9243a4
{
rpm-build 9243a4
  boost::optional<ShapeType> m_type;
rpm-build 9243a4
  boost::optional<ShapeType> m_cropType;
rpm-build 9243a4
  boost::optional<unsigned> m_imgIndex;
rpm-build 9243a4
  boost::optional<unsigned> m_borderImgIndex;
rpm-build 9243a4
  boost::optional<Coordinate> m_coordinates;
rpm-build 9243a4
  std::vector<Line> m_lines;
rpm-build 9243a4
  boost::optional<unsigned> m_pageSeqNum;
rpm-build 9243a4
  boost::optional<unsigned> m_textId;
rpm-build 9243a4
  std::map<unsigned, int> m_adjustValuesByIndex;
rpm-build 9243a4
  std::vector<int> m_adjustValues;
rpm-build 9243a4
  boost::optional<double> m_rotation;
rpm-build 9243a4
  boost::optional<std::pair<bool, bool> > m_flips;
rpm-build 9243a4
  boost::optional<Margins> m_margins;
rpm-build 9243a4
  boost::optional<BorderPosition> m_borderPosition; // Irrelevant except for rectangular shapes
rpm-build 9243a4
  std::shared_ptr<const Fill> m_fill;
rpm-build 9243a4
  boost::optional<DynamicCustomShape> m_customShape;
rpm-build 9243a4
  bool m_stretchBorderArt;
rpm-build 9243a4
  boost::optional<ColorReference> m_lineBackColor;
rpm-build 9243a4
  boost::optional<Dash> m_dash;
rpm-build 9243a4
  boost::optional<TableInfo> m_tableInfo;
rpm-build 9243a4
  boost::optional<unsigned> m_numColumns;
rpm-build 9243a4
  unsigned m_columnSpacing;
rpm-build 9243a4
  boost::optional<Arrow> m_beginArrow;
rpm-build 9243a4
  boost::optional<Arrow> m_endArrow;
rpm-build 9243a4
  boost::optional<VerticalAlign> m_verticalAlign;
rpm-build 9243a4
  boost::optional<ColorReference> m_pictureRecolor;
rpm-build 9243a4
  boost::optional<Shadow> m_shadow;
rpm-build 9243a4
  boost::optional<int> m_innerRotation;
rpm-build 9243a4
  std::vector<libmspub::Vertex> m_clipPath;
rpm-build 9243a4
  boost::optional<int> m_pictureBrightness;
rpm-build 9243a4
  boost::optional<int> m_pictureContrast;
rpm-build 9243a4
  ShapeInfo() : m_type(), m_cropType(), m_imgIndex(), m_borderImgIndex(),
rpm-build 9243a4
    m_coordinates(), m_lines(), m_pageSeqNum(),
rpm-build 9243a4
    m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
rpm-build 9243a4
    m_rotation(), m_flips(), m_margins(), m_borderPosition(),
rpm-build 9243a4
    m_fill(), m_customShape(), m_stretchBorderArt(false),
rpm-build 9243a4
    m_lineBackColor(), m_dash(), m_tableInfo(),
rpm-build 9243a4
    m_numColumns(),
rpm-build 9243a4
    m_columnSpacing(0), m_beginArrow(), m_endArrow(),
rpm-build 9243a4
    m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath(), m_pictureBrightness(), m_pictureContrast()
rpm-build 9243a4
  {
rpm-build 9243a4
  }
rpm-build 9243a4
  std::shared_ptr<const CustomShape> getCustomShape() const
rpm-build 9243a4
  {
rpm-build 9243a4
    if (bool(m_customShape))
rpm-build 9243a4
    {
rpm-build 9243a4
      return getFromDynamicCustomShape(m_customShape.get());
rpm-build 9243a4
    }
rpm-build 9243a4
    if (bool(m_cropType))
rpm-build 9243a4
    {
rpm-build 9243a4
      return std::shared_ptr<const CustomShape>(
rpm-build 9243a4
               libmspub::getCustomShape(m_cropType.get()),
rpm-build 9243a4
               std::function<void (const CustomShape *)>(noop));
rpm-build 9243a4
    }
rpm-build 9243a4
    return std::shared_ptr<const CustomShape>(
rpm-build 9243a4
             libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
rpm-build 9243a4
             std::function<void (const CustomShape *)>(noop));
rpm-build 9243a4
  }
rpm-build 9243a4
};
rpm-build 9243a4
}
rpm-build 9243a4
#endif
rpm-build 9243a4
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */