// Copyright (c) 2014-2021 Thomas Fussell // // 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 namespace xlnt { /// /// A comment can be applied to a cell to provide extra information about its contents. /// class XLNT_API comment { public: /// /// Constructs a new blank comment. /// comment(); /// /// Constructs a new comment with the given text and author. /// comment(const rich_text &text, const std::string &author); /// /// Constructs a new comment with the given unformatted text and author. /// comment(const std::string &text, const std::string &author); /// /// Returns the text that will be displayed for this comment. /// rich_text text() const; /// /// Returns the plain text that will be displayed for this comment without formatting information. /// std::string plain_text() const; /// /// Returns the author of this comment. /// std::string author() const; /// /// Makes this comment only visible when the associated cell is hovered. /// void hide(); /// /// Makes this comment always visible. /// void show(); /// /// Returns true if this comment is not hidden. /// bool visible() const; /// /// Sets the absolute position of this cell to the given coordinates. /// void position(int left, int top); /// /// Returns the distance from the left side of the sheet to the left side of the comment. /// int left() const; /// /// Returns the distance from the top of the sheet to the top of the comment. /// int top() const; /// /// Sets the size of the comment. /// void size(int width, int height); /// /// Returns the width of this comment. /// int width() const; /// /// Returns the height of this comment. /// int height() const; /// /// Return true if this comment is equivalent to other. /// bool operator==(const comment &other) const; /// /// Returns true if this comment is not equivalent to other. /// bool operator!=(const comment &other) const; private: /// /// The formatted textual content in this cell displayed directly after the author. /// rich_text text_; /// /// The name of the person that created this comment. /// std::string author_; /// /// True if this comment is not hidden. /// bool visible_ = false; /// /// The fill color /// std::string fill_; /// /// Distance from the left side of the sheet. /// int left_ = 0; /// /// Distance from the top of the sheet. /// int top_ = 0; /// /// Width of the comment box. /// int width_ = 200; /// /// Height of the comment box. /// int height_ = 100; }; } // namespace xlnt