diff --git a/include/xlnt/cell/cell.hpp b/include/xlnt/cell/cell.hpp index 06db1193..0fa9c9a3 100644 --- a/include/xlnt/cell/cell.hpp +++ b/include/xlnt/cell/cell.hpp @@ -42,6 +42,7 @@ class cell_style; class comment; class fill; class font; +class format; class number_format; class protection; class relationship; @@ -53,9 +54,7 @@ struct datetime; struct time; struct timedelta; -namespace detail { -struct cell_impl; -} +namespace detail { struct cell_impl; } /// /// Describes cell associated properties. @@ -191,21 +190,21 @@ public: // style /// - /// Return true if this cell has had a style applied to it. + /// Return true if this cell has had a format applied to it. /// - bool has_style() const; + bool has_format() const; /// - /// Return a reference to the style applied to this cell. + /// Return a reference to the format applied to this cell. /// - cell_style &get_style(); + format &get_format(); /// - /// Return a reference to the style applied to this cell. + /// Return a reference to the format applied to this cell. /// - const cell_style &get_style() const; + const format &get_format() const; - void set_style(const cell_style &style); + void set_format(const format &new_format); /// /// Return the number format of this cell. @@ -384,7 +383,7 @@ public: friend XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell); private: - std::size_t get_style_id() const; + std::size_t get_format_id() const; // make these friends so they can use the private constructor friend class style; diff --git a/include/xlnt/serialization/style_serializer.hpp b/include/xlnt/serialization/style_serializer.hpp index a98f6924..d99c6353 100644 --- a/include/xlnt/serialization/style_serializer.hpp +++ b/include/xlnt/serialization/style_serializer.hpp @@ -28,24 +28,24 @@ #include #include -#include +#include #include namespace xlnt { class alignment; class border; -class cell_style; class color; -class common_style; class conditional_format; class fill; class font; class format; -class named_style; +class formattable; +class style; class number_format; class protection; class side; +class style; class xml_document; class xml_node; @@ -140,15 +140,15 @@ public: /// these is "applied". For example, a style with a defined font id, font=# but with /// "applyFont=0" will not use the font in formatting. /// - cell_style read_cell_style(const xml_node &style_node); + format read_format(const xml_node &format_node); /// /// Read a single named style from the given named_style_node. In styles.xml, this is a /// (confusingly named) "cellStyle" element. This node defines the name, whether it is - /// built-in and an xfId which is the index of an element in cellStyleXfs which should - /// be provided as the style_node parameter (cellStyleXfs itself, not the child xf node). + /// built-in and an xfId which is the index of an element in cellStyleXfs. style_format_node + /// should be the XML node of the element at the index of xfId. /// - named_style read_named_style(const xml_node &named_style_node, const xml_node &style_parent_node); + style read_style(const xml_node &style_node, const xml_node &style_format_node); // // Non-static element readers (i.e. readers that modify internal state) @@ -184,13 +184,13 @@ public: /// Read all cell styles from cell_styles_node and add them to workbook. /// Return true on success. /// - bool read_cell_styles(const xml_node &cell_styles_node); + bool read_formats(const xml_node &formats_node); /// /// Read all named styles from named_style_node and cell_styles_node and add them to workbook. /// Return true on success. /// - bool read_named_styles(const xml_node &cell_styles_node, const xml_node &cell_style_formats_node); + bool read_styles(const xml_node &styles_node, const xml_node &style_formats_node); /// /// Read all borders from number_formats_node and add them to workbook. @@ -232,27 +232,15 @@ public: /// bool write_number_formats(xml_node &number_formats_node) const; - bool write_style_common(const common_style &style, xml_node xf_node) const; - - /// - /// Build an xml tree representing the given style into style_node. - /// Returns true on success. - /// - bool write_cell_style(const cell_style &style, xml_node &style_node) const; + bool write_formattable(const formattable &xf, xml_node xf_node) const; /// /// Build an xml tree representing the given style into style_node. /// Returns true on success. /// - bool write_cell_styles(xml_node &styles_node) const; + bool write_formats(xml_node &styles_node) const; - /// - /// Build an xml tree representing the given style into cell_styles_node and styles_node. - /// Returns true on success. - /// - bool write_named_style(const named_style &style, xml_node &cell_styles_node) const; - - bool write_named_styles(xml_node &cell_styles_node, xml_node &styles_node) const; + bool write_styles(xml_node &cell_styles_node, xml_node &cell_style_formats_node) const; bool write_colors(xml_node &colors_node) const; @@ -281,8 +269,8 @@ private: std::vector fills_; std::vector fonts_; std::vector number_formats_; - std::vector cell_styles_; - std::unordered_map named_styles_; + std::vector formats_; + std::vector