// Copyright (c) 2014-2021 Thomas Fussell // Copyright (c) 2010-2015 openpyxl // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE // // @license: http://www.opensource.org/licenses/mit-license.php // @author: see AUTHORS file #pragma once #include #include #include #include #include #include #include namespace xlnt { /// /// Enumerates the sides of a cell to which a border style can be applied. /// enum class XLNT_API border_side { start, end, top, bottom, diagonal, vertical, horizontal }; /// /// Enumerates the pattern of the border lines on a particular side. /// enum class XLNT_API border_style { none, dashdot, dashdotdot, dashed, dotted, double_, hair, medium, mediumdashdot, mediumdashdotdot, mediumdashed, slantdashdot, thick, thin }; /// /// Cells can have borders that go from the top-left to bottom-right /// or from the top-right to bottom-left, or both, or neither. /// Used by style->border. /// enum class XLNT_API diagonal_direction { neither, up, down, both }; } // namespace xlnt namespace xlnt { /// /// Describes the border style of a particular cell. /// class XLNT_API border { public: /// /// Each side of a cell can have a border_property applied to it to change /// how it is displayed. /// class XLNT_API border_property { public: /// /// Returns the color of the side. /// optional color() const; /// /// Sets the color of the side and returns a reference to the side properties. /// border_property &color(const xlnt::color &c); /// /// Returns the style of the side. /// optional style() const; /// /// Sets the style of the side and returns a reference to the side properties. /// border_property &style(border_style style); /// /// Returns true if left is exactly equal to right. /// bool operator==(const border_property &right) const; /// /// Returns true if left is not exactly equal to right. /// bool operator!=(const border_property &right) const; private: /// /// The color of the side /// optional color_; /// /// The style of the side /// optional style_; }; /// /// Returns a vector containing all of the border sides to be used for iteration. /// static const std::vector &all_sides(); /// /// Constructs a default border. /// border(); /// /// Returns the border properties of the given side. /// optional side(border_side s) const; /// /// Sets the border properties of the side s to prop. /// border &side(border_side s, const border_property &prop); /// /// Returns the diagonal direction of this border. /// optional diagonal() const; /// /// Sets the diagonal direction of this border to dir. /// border &diagonal(diagonal_direction dir); /// /// Returns true if left is exactly equal to right. /// bool operator==(const border &right) const; /// /// Returns true if left is not exactly equal to right. /// bool operator!=(const border &right) const; private: /// /// Start side (i.e. left) border properties /// optional start_; /// /// End side (i.e. right) border properties /// optional end_; /// /// Top side border properties /// optional top_; /// /// Bottom side border properties /// optional bottom_; /// /// Vertical border properties /// optional vertical_; /// /// Horizontal border properties /// optional horizontal_; /// /// Diagonal border properties /// optional diagonal_; /// /// Direction of diagonal border properties to be applied /// optional diagonal_direction_; }; } // namespace xlnt