// 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 { /// /// The orientation of the worksheet when it is printed. /// enum class XLNT_API orientation { default_orientation, portrait, landscape }; /// /// The types of page breaks. /// enum class XLNT_API page_break { none = 0, row = 1, column = 2 }; /// /// The possible paper sizes for printing. /// enum class XLNT_API paper_size { letter = 1, letter_small = 2, tabloid = 3, ledger = 4, legal = 5, statement = 6, executive = 7, a3 = 8, a4 = 9, a4_small = 10, a5 = 11 }; /// /// Defines how a worksheet appears in the workbook. /// A workbook must have at least one sheet which is visible at all times. /// enum class XLNT_API sheet_state { visible, hidden, very_hidden }; /// /// Describes how a worksheet will be converted into a page during printing. /// struct XLNT_API page_setup { public: /// /// Default constructor. /// page_setup(); /// /// Returns the page break. /// xlnt::page_break page_break() const; /// /// Sets the page break to b. /// void page_break(xlnt::page_break b); /// /// Returns the current sheet state of this page setup. /// xlnt::sheet_state sheet_state() const; /// /// Sets the sheet state to sheet_state. /// void sheet_state(xlnt::sheet_state sheet_state); /// /// Returns the paper size which should be used to print the worksheet using this page setup. /// xlnt::paper_size paper_size() const; /// /// Sets the paper size of this page setup. /// void paper_size(xlnt::paper_size paper_size); /// /// Check if current paper setting has paper size setting /// bool has_paper_size() const; /// /// Returns true if this worksheet should be scaled to fit on a single page during printing. /// bool fit_to_page() const; /// /// If true, forces the worksheet to be scaled to fit on a single page during printing. /// void fit_to_page(bool fit_to_page); /// /// Returns true if the height of this worksheet should be scaled to fit on a printed page. /// bool fit_to_height() const; /// /// Sets whether the height of the page should be scaled to fit on a printed page. /// void fit_to_height(bool fit_to_height); /// /// Returns true if the width of this worksheet should be scaled to fit on a printed page. /// bool fit_to_width() const; /// /// Sets whether the width of the page should be scaled to fit on a printed page. /// void fit_to_width(bool fit_to_width); /// /// Sets the factor by which the page should be scaled during printing. /// void scale(double scale); /// /// Returns the factor by which the page should be scaled during printing. /// double scale() const; /// /// Check if current paper setting has scale setting /// bool has_scale() const; /// /// Gets reference relationship Id /// const std::string& rel_id() const; /// /// Sets reference relationship Id /// void rel_id(const std::string& val); /// /// Check if current paper setting has a reference relationship /// bool has_rel_id() const; /// /// The orientation /// xlnt::optional orientation_; /// /// The horizontal dpi /// xlnt::optional horizontal_dpi_; /// /// The vertical dpi /// xlnt::optional vertical_dpi_; bool operator==(const page_setup &rhs) const; private: /// /// Relationship Id /// std::string rel_id_; /// /// The break /// xlnt::page_break break_; /// /// The sheet state /// xlnt::sheet_state sheet_state_; /// /// The paper size /// xlnt::optional paper_size_; /// /// Whether or not to fit to page /// bool fit_to_page_; /// /// Whether or not to fit to height /// bool fit_to_height_; /// /// Whether or not to fit to width /// bool fit_to_width_; /// /// The amount to scale the worksheet /// xlnt::optional scale_; }; } // namespace xlnt