// 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 #include namespace xlnt { /// /// Phonetic properties /// Element provides a collection of properties that affect display of East Asian Languages /// [Serialised phoneticPr] /// class XLNT_API phonetic_pr { public: static std::string Serialised_ID(); /// /// possible values for alignment property /// enum class align { center, distributed, left, no_control }; /// /// possible values for type property /// enum class phonetic_type { full_width_katakana, half_width_katakana, hiragana, no_conversion }; /// /// FontID represented by an unsigned 32-bit integer /// using font_id_t = std::uint32_t; /// /// Default ctor for phonetic properties /// phonetic_pr() = default; /// /// FontID ctor for phonetic properties /// explicit phonetic_pr(font_id_t font); /// /// adds the xml serialised representation of this element to the stream /// void serialise(std::ostream &output_stream) const; /// /// get the font index /// font_id_t font_id() const; /// /// set the font index /// void font_id(font_id_t font); /// /// is the phonetic type set /// bool has_type() const; /// /// returns the phonetic type /// phonetic_type type() const; /// /// sets the phonetic type /// void type(phonetic_type type); /// /// is the alignment set /// bool has_alignment() const; /// /// get the alignment /// align alignment() const; /// /// set the alignment /// void alignment(align align); // serialisation /// /// string form of the type enum /// static const std::string &type_as_string(phonetic_type type); /// /// type enum from string /// static phonetic_type type_from_string(const std::string &str); /// /// string form of alignment enum /// static const std::string &alignment_as_string(xlnt::phonetic_pr::align type); /// /// alignment enum from string /// static align alignment_from_string(const std::string &str); bool operator==(const phonetic_pr &rhs) const; private: /// /// zero based index into style sheet font record. /// Default: 0 /// font_id_t font_id_ = 0; /// /// Type of characters to use. /// Default: full width katakana /// xlnt::optional type_; /// /// align across the cell(s). /// Default: Left /// xlnt::optional alignment_; }; } // namespace xlnt