/* * (c) Copyright Ascensio System SIA 2010-2023 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish * street, Riga, Latvia, EU, LV-1050. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ #pragma once #include #include #include #include "../../Common/CPNoncopyable.h" #include "../../Common/CPWeakPtr.h" #include "office_elements.h" #include "office_elements_create.h" #include "../../DataTypes/stylefamily.h" #include "../../DataTypes/textalign.h" #include "../../DataTypes/lengthorpercent.h" #include "../../DataTypes/styleverticalrel.h" #include "../../DataTypes/styleverticalpos.h" #include "../../DataTypes/verticalalign.h" #include "../../DataTypes/pageusage.h" #include "../../DataTypes/tablecentering.h" #include "../../DataTypes/layoutgridmode.h" #include "../../DataTypes/direction.h" #include "../../DataTypes/linestyle.h" #include "../../DataTypes/styletype.h" #include "../../DataTypes/common_attlists.h" #include "../../DataTypes/noteclass.h" #include "../../DataTypes/gradientstyle.h" #include "../../DataTypes/hatchstyle.h" #include "../../DataTypes/styleprint.h" #include "../../DataTypes/drawangle.h" #include "header_footer.h" #include "styles_list.h" #include "style_map.h" namespace cpdoccore { namespace odf_reader { class graphic_format_properties; class style_text_properties; class style_paragraph_properties; class style_section_properties; class style_table_cell_properties; class style_table_row_properties; class style_table_column_properties; class style_chart_properties; class style_table_properties; class style_drawing_page_properties; class style_content : noncopyable { public: void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context); void docx_convert(oox::docx_conversion_context & Context, bool in_styles = false); void xlsx_convert(oox::xlsx_conversion_context & Context); void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context); graphic_format_properties* get_graphic_properties()const; style_text_properties* get_style_text_properties() const; style_text_properties* get_style_text_properties(bool create); style_paragraph_properties* get_style_paragraph_properties()const; style_table_properties* get_style_table_properties()const; style_section_properties* get_style_section_properties()const; style_table_row_properties* get_style_table_row_properties()const; style_table_column_properties* get_style_table_column_properties() const; style_chart_properties* get_style_chart_properties()const; style_drawing_page_properties* get_style_drawing_page_properties() const; style_table_cell_properties* get_style_table_cell_properties(bool always = false); office_element_ptr text_list_style_; odf_types::style_family style_family_; bool bDefault = false; private: office_element_ptr style_text_properties_; office_element_ptr style_paragraph_properties_; office_element_ptr style_section_properties_; office_element_ptr style_ruby_properties_; office_element_ptr style_table_properties_; office_element_ptr style_table_column_properties_; office_element_ptr style_table_row_properties_; office_element_ptr style_chart_properties_; office_element_ptr style_graphic_properties_; office_element_ptr style_table_cell_properties_; office_element_ptr style_drawing_page_properties_; }; // style:default-style class default_style : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDefaultStyle; CPDOCCORE_DEFINE_VISITABLE(); default_style() { content_.bDefault = true; } virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const; style_content content_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(default_style); //------------------------------------------------------------------------------------------------- // draw:marker class draw_marker : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawMarker; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(std::wstring) svg_d_; _CP_OPT(std::wstring) svg_viewBox_; _CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_display_name_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_marker); //------------------------------------------------------------------------------------------------- // draw:stroke-dash class draw_stroke_dash : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawStrokeDash; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(odf_types::length_or_percent) draw_distance_; _CP_OPT(odf_types::length_or_percent) draw_dots1_length_; _CP_OPT(odf_types::length_or_percent) draw_dots2_length_; _CP_OPT(int) draw_dots1_; _CP_OPT(int) draw_dots2_; _CP_OPT(std::wstring) draw_style_; //rect or round: _CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_display_name_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_stroke_dash); //------------------------------------------------------------------------------------------------- // draw:gradient class draw_gradient : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawGradient; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(odf_types::color) draw_start_color_; _CP_OPT(odf_types::color) draw_end_color_; _CP_OPT(odf_types::percent) draw_end_intensity_; _CP_OPT(odf_types::percent) draw_start_intensity_; _CP_OPT(odf_types::percent) draw_cy_;//% _CP_OPT(odf_types::percent) draw_cx_; _CP_OPT(odf_types::percent) draw_border_; _CP_OPT(odf_types::draw_angle) draw_angle_; _CP_OPT(odf_types::gradient_style) draw_style_; _CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_display_name_; office_element_ptr_array content_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_gradient); //------------------------------------------------------------------------------------------------ // draw:hatch class draw_hatch : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawHatch; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(odf_types::hatch_style) draw_style_; _CP_OPT(int) draw_rotation_; _CP_OPT(odf_types::length) draw_distance_; _CP_OPT(odf_types::color) draw_color_; _CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_display_name_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_hatch); //------------------------------------------------------------------------------------------------ // style_draw_gradient class draw_opacity : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawGradient; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(odf_types::gradient_style) draw_style_;//linear, radial, .. _CP_OPT(odf_types::draw_angle) draw_angle_; _CP_OPT(odf_types::percent) draw_start_; _CP_OPT(odf_types::percent) draw_end_; _CP_OPT(odf_types::percent) draw_border_; _CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_display_name_; office_element_ptr_array content_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_opacity); //------------------------------------------------------------------------------------------------ // style_draw_fill_image class draw_fill_image : public office_element_impl { public: static const wchar_t * ns; static const wchar_t * name; static const xml::NodeType xml_type = xml::typeElement; static const ElementType type = typeStyleDrawFillImage; CPDOCCORE_DEFINE_VISITABLE(); std::wstring get_style_name(){return draw_name_.get_value_or(L"");} _CP_OPT(std::wstring) draw_name_; odf_types::common_xlink_attlist xlink_attlist_; office_element_ptr office_binary_data_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); }; CP_REGISTER_OFFICE_ELEMENT2(draw_fill_image); //------------------------------------------------------------------------------------------------ class style; typedef shared_ptr