// 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 namespace xlnt { /// /// Text can be aligned horizontally within a cell in these enumerated ways. /// enum class XLNT_API horizontal_alignment { general, left, center, right, fill, justify, center_continuous, distributed }; /// /// Text can be aligned vertically within a cell in these enumerated ways. /// enum class XLNT_API vertical_alignment { top, center, bottom, justify, distributed }; /// /// Alignment options that determine how text should be displayed within a cell. /// class XLNT_API alignment { public: /// /// Returns true if shrink-to-fit has been enabled. /// bool shrink() const; /// /// Sets whether the font size should be reduced until all of the text fits in a cell without wrapping. /// alignment &shrink(bool shrink_to_fit); /// /// Returns true if text-wrapping has been enabled. /// bool wrap() const; /// /// Sets whether text in a cell should continue to multiple lines if it doesn't fit in one line. /// alignment &wrap(bool wrap_text); /// /// Returns the optional value of indentation width in number of spaces. /// optional indent() const; /// /// Sets the indent size in number of spaces from the side of the cell. This will only /// take effect when left or right horizontal alignment has also been set. /// alignment &indent(int indent_size); /// /// Returns the optional value of rotation for text in the cell in degrees. /// optional rotation() const; /// /// Sets the rotation for text in the cell in degrees. /// alignment &rotation(int text_rotation); /// /// Returns the optional horizontal alignment. /// optional horizontal() const; /// /// Sets the horizontal alignment. /// alignment &horizontal(horizontal_alignment horizontal); /// /// Returns the optional vertical alignment. /// optional vertical() const; /// /// Sets the vertical alignment. /// alignment &vertical(vertical_alignment vertical); /// /// Returns true if this alignment is equivalent to other. /// bool operator==(const alignment &other) const; /// /// Returns true if this alignment is not equivalent to other. /// bool operator!=(const alignment &other) const; private: /// /// Whether or not to shrink font size until it fits on one line /// bool shrink_to_fit_ = false; /// /// Whether or not to wrap text to the next line /// bool wrap_text_ = false; /// /// The indent in number of spaces from the side /// optional indent_; /// /// The text roation in degrees /// optional text_rotation_; /// /// The horizontal alignment /// optional horizontal_; /// /// The vertical alignment /// optional vertical_; }; } // namespace xlnt