diff --git a/OdfFile/Common/odf_elements_type.h b/OdfFile/Common/odf_elements_type.h index cf45bf988c..455d00ac71 100644 --- a/OdfFile/Common/odf_elements_type.h +++ b/OdfFile/Common/odf_elements_type.h @@ -617,6 +617,7 @@ enum ElementType typeChartRegressionCurve, typeChartEquation, typeChartDateScale, + typeChartDataTable, typeStyleChartProperties, diff --git a/OdfFile/DataTypes/common_attlists.h b/OdfFile/DataTypes/common_attlists.h index 3330f6e8e5..141a90029b 100644 --- a/OdfFile/DataTypes/common_attlists.h +++ b/OdfFile/DataTypes/common_attlists.h @@ -335,7 +335,6 @@ public: void serialize(CP_ATTR_NODE); _CP_OPT(unsigned int) style_rotation_angle_; - }; // common-num-format-attlist diff --git a/OdfFile/Reader/Converter/oox_chart_context.h b/OdfFile/Reader/Converter/oox_chart_context.h index 98844832ac..5878d4725c 100644 --- a/OdfFile/Reader/Converter/oox_chart_context.h +++ b/OdfFile/Reader/Converter/oox_chart_context.h @@ -69,6 +69,10 @@ public: title_.set_content(t); title_.set_sub_content(sub); } + void set_data_table(odf_reader::chart::simple & v) + { + plot_area_.set_data_table(v); + } void add_axis(int type, odf_reader::chart::axis & content) { plot_area_.add_axis(type, content); diff --git a/OdfFile/Reader/Converter/oox_plot_area.cpp b/OdfFile/Reader/Converter/oox_plot_area.cpp index 30892f41f7..8abc6d61b0 100644 --- a/OdfFile/Reader/Converter/oox_plot_area.cpp +++ b/OdfFile/Reader/Converter/oox_plot_area.cpp @@ -37,6 +37,7 @@ #include #include +#include "../Format/odfcontext.h" #include "../Format/style_text_properties.h" #include "../Format/style_chart_properties.h" @@ -113,6 +114,10 @@ namespace cpdoccore { { no_used_local_tables_ = val; } + void oox_plot_area::set_data_table(odf_reader::chart::simple & content) + { + data_table_content_ = content; + } void oox_plot_area::reset_cross_axis()//обязательно после всех добавлений { for (size_t i = 0; i < axis_.size(); i++) @@ -263,6 +268,72 @@ namespace cpdoccore { axis_[i]->oox_serialize(CP_XML_STREAM()); } } + if (data_table_content_.bEnabled) + { + _CP_OPT(bool) boolVal; + + CP_XML_NODE(L"c:dTable") + { + odf_reader::GetProperty(data_table_content_.properties_, L"show-horizontal-border", boolVal); + if (boolVal) + { + CP_XML_NODE(L"c:showHorzBorder") + { + CP_XML_ATTR(L"val", *boolVal); + } + } + odf_reader::GetProperty(data_table_content_.properties_, L"show-vertical-border", boolVal); + if (boolVal) + { + CP_XML_NODE(L"c:showVertBorder") + { + CP_XML_ATTR(L"val", *boolVal); + } + } + odf_reader::GetProperty(data_table_content_.properties_, L"show-outline", boolVal); + if (boolVal) + { + CP_XML_NODE(L"c:showOutline") + { + CP_XML_ATTR(L"val", *boolVal); + } + } + odf_reader::GetProperty(data_table_content_.properties_, L"show-keys", boolVal); + if (boolVal) + { + CP_XML_NODE(L"c:showKeys") + { + CP_XML_ATTR(L"val", *boolVal); + } + } + + oox_chart_shape shape_table; + shape_table.set(data_table_content_.graphic_properties_, data_table_content_.fill_); + shape_table.oox_serialize(CP_XML_STREAM()); + + if (data_table_content_.text_properties_) + { + CP_XML_NODE(L"c:txPr") + { + CP_XML_NODE(L"a:bodyPr") {} + CP_XML_NODE(L"a:lstStyle") {} + + CP_XML_NODE(L"a:p") + { + CP_XML_NODE(L"a:pPr") + { + CP_XML_NODE(L"a:defRPr") + { + //odf_reader::fonts_container & fonts = context.fontContainer(); + odf_reader::fonts_container fonts; + data_table_content_.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts); + } + } + } + } + } + } + } shape.oox_serialize(CP_XML_STREAM()); } } diff --git a/OdfFile/Reader/Converter/oox_plot_area.h b/OdfFile/Reader/Converter/oox_plot_area.h index 1100400e59..aaa2c56d94 100644 --- a/OdfFile/Reader/Converter/oox_plot_area.h +++ b/OdfFile/Reader/Converter/oox_plot_area.h @@ -35,7 +35,6 @@ #include "oox_types_chart.h" #include "oox_chart_axis.h" - namespace cpdoccore { namespace oox { @@ -65,13 +64,12 @@ public: void set_no_local_table (bool val); //whithout embedded tables //void set_content_series (odf_reader::chart::series & content); - + void set_data_table(odf_reader::chart::simple & content); private: + odf_reader::chart::simple data_table_content_; void reset_cross_axis(); //обязательно после всех добавлений bool no_used_local_tables_; - unsigned int axis_id_ = 0xf2905; - }; } diff --git a/OdfFile/Reader/Format/chart_build_oox.cpp b/OdfFile/Reader/Format/chart_build_oox.cpp index b6bd50b3c9..64190dc0c7 100644 --- a/OdfFile/Reader/Format/chart_build_oox.cpp +++ b/OdfFile/Reader/Format/chart_build_oox.cpp @@ -380,10 +380,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context) chart_context.set_wall (wall_); chart_context.set_floor (floor_); chart_context.set_legend (legend_); - - chart_context.set_plot_area_properties (plot_area_.properties_, plot_area_.fill_); - chart_context.set_chart_graphic_properties (graphic_properties_, chart_fill_); - + chart_context.set_data_table(data_table_); + + chart_context.set_plot_area_properties (plot_area_.properties_, plot_area_.fill_); + chart_context.set_chart_graphic_properties (graphic_properties_, chart_fill_); + //chart_context.set_footer(footer_); //chart_context.set_chart_properties(chart_graphic_properties_); @@ -1016,7 +1017,16 @@ void process_build_object::visit(chart_data_point & val) object_odf_context_.series_.back().points_.back().fill_); ApplyTextProperties (style_name, object_odf_context_.series_.back().points_.back().text_properties_); } +} +void process_build_object::visit(chart_data_table & val) +{ + std::wstring style_name = val.common_attlist_.chart_style_name_.get_value_or(L""); + object_odf_context_.data_table_.bEnabled = true; + + ApplyChartProperties(style_name, object_odf_context_.data_table_.properties_); + ApplyGraphicProperties(style_name, object_odf_context_.data_table_.graphic_properties_, object_odf_context_.data_table_.fill_); + ApplyTextProperties(style_name, object_odf_context_.data_table_.text_properties_); } void process_build_object::visit(chart_mean_value & val) { @@ -1028,6 +1038,10 @@ void process_build_object::visit(chart_date_scale & val) { object_odf_context_.axises_.back().type_ = 4; } +void process_build_object::visit(chartooo_date_scale & val) +{ + object_odf_context_.axises_.back().type_ = 4; +} void process_build_object::visit(chart_error_indicator & val) { object_odf_context_.series_.back().error_indicator_.bEnabled = true; diff --git a/OdfFile/Reader/Format/chart_build_oox.h b/OdfFile/Reader/Format/chart_build_oox.h index 3ceffe7e96..2d9f1f3226 100644 --- a/OdfFile/Reader/Format/chart_build_oox.h +++ b/OdfFile/Reader/Format/chart_build_oox.h @@ -152,6 +152,7 @@ public: chart::legend legend_; chart::plot_area plot_area_; + chart::simple data_table_; chart::simple wall_; chart::simple floor_; @@ -213,8 +214,11 @@ class process_build_object public visitor, public visitor, public visitor, + public visitor, public visitor, + public visitor, + public visitor, public visitor, public visitor, @@ -293,8 +297,10 @@ public: virtual void visit(chart_wall & val); virtual void visit(chart_floor & val); virtual void visit(chart_date_scale & val); - - virtual void visit(table_table & val); + virtual void visit(chartooo_date_scale & val); + virtual void visit(chart_data_table & val); + + virtual void visit(table_table & val); virtual void visit(table_table_rows & val); virtual void visit(table_table_row & val); diff --git a/OdfFile/Reader/Format/office_chart.cpp b/OdfFile/Reader/Format/office_chart.cpp index ee37756ba7..ba1747b598 100644 --- a/OdfFile/Reader/Format/office_chart.cpp +++ b/OdfFile/Reader/Format/office_chart.cpp @@ -441,9 +441,12 @@ void chart_stock_range_line::add_attributes( const xml::attributes_wc_ptr & Attr common_attlist_.add_attributes(Attributes); } -//chartooo:date-scale +//chart:date-scale ////////////////////////////////////////////////////////////////////////////////////////////////// -const wchar_t * chart_date_scale::ns = L"chartooo"; +const wchar_t * chartooo_date_scale::ns = L"chartooo"; +const wchar_t * chartooo_date_scale::name = L"date-scale"; + +const wchar_t * chart_date_scale::ns = L"chart"; const wchar_t * chart_date_scale::name = L"date-scale"; void chart_date_scale::add_attributes( const xml::attributes_wc_ptr & Attributes ) @@ -454,6 +457,13 @@ void chart_date_scale::add_attributes( const xml::attributes_wc_ptr & Attributes CP_APPLY_ATTR(L"chart:minor-interval-value", minor_interval_value_); CP_APPLY_ATTR(L"chart:minor-interval-unit", minor_interval_unit_); } - +//loext:data-table +////////////////////////////////////////////////////////////////////////////////////////////////// +const wchar_t * chart_data_table::ns = L"loext"; +const wchar_t * chart_data_table::name = L"data-table"; +void chart_data_table::add_attributes(const xml::attributes_wc_ptr & Attributes) +{ + common_attlist_.add_attributes(Attributes); +} } } diff --git a/OdfFile/Reader/Format/office_chart.h b/OdfFile/Reader/Format/office_chart.h index 093fe07476..854ee4b2bc 100644 --- a/OdfFile/Reader/Format/office_chart.h +++ b/OdfFile/Reader/Format/office_chart.h @@ -75,7 +75,7 @@ class common_chart_attlist public: void add_attributes( const xml::attributes_wc_ptr & Attributes ); - _CP_OPT(std::wstring) chart_style_name_; + _CP_OPT(std::wstring) chart_style_name_; }; /// chart-chart-attlist @@ -676,8 +676,37 @@ public: _CP_OPT(odf_types::chart_time_unit) major_interval_unit_; _CP_OPT(unsigned int) minor_interval_value_; - _CP_OPT(odf_types::chart_time_unit) minor_interval_unit_; + _CP_OPT(odf_types::chart_time_unit) minor_interval_unit_; }; CP_REGISTER_OFFICE_ELEMENT2(chart_date_scale); +class chartooo_date_scale : public chart_date_scale +{ +public: + static const wchar_t * ns; + static const wchar_t * name; + static const xml::NodeType xml_type = xml::typeElement; + static const ElementType type = typeChartDateScale; +}; +CP_REGISTER_OFFICE_ELEMENT2(chartooo_date_scale); + +//loext:data-table +class chart_data_table : 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 = typeChartDataTable; + CPDOCCORE_DEFINE_VISITABLE(); + +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) + {} + +public: + common_chart_attlist common_attlist_; +}; +CP_REGISTER_OFFICE_ELEMENT2(chart_data_table); } } diff --git a/OdfFile/Reader/Format/style_chart_properties.cpp b/OdfFile/Reader/Format/style_chart_properties.cpp index a91f28d664..1a495beb2e 100644 --- a/OdfFile/Reader/Format/style_chart_properties.cpp +++ b/OdfFile/Reader/Format/style_chart_properties.cpp @@ -31,6 +31,7 @@ */ #include "style_chart_properties.h" +#include "../../DataTypes/linestyle.h" #include @@ -92,7 +93,18 @@ void chart_format_properties::add_attributes( const xml::attributes_wc_ptr & Att _CP_OPT(std::wstring) strVal; - CP_APPLY_ATTR(L"chartooo:axis-type", strVal); if (strVal) push_back(_property(L"axis-type", strVal.get())); + CP_APPLY_ATTR(L"chartooo:axis-type", strVal); + if (strVal) push_back(_property(L"axis-type", strVal.get())); + else + { + CP_APPLY_ATTR(L"chart:axis-type", strVal); + if (strVal) push_back(_property(L"axis-type", strVal.get())); + else + { + CP_APPLY_ATTR(L"loext:axis-type", strVal); + if (strVal) push_back(_property(L"axis-type", strVal.get())); + } + } CP_APPLY_ATTR(L"chart:symbol-type", strVal); if (strVal) push_back(_property(L"symbol-type",chart_symbol_type(chart_symbol_type::parse(strVal.get())).get_type())); @@ -127,104 +139,68 @@ void chart_format_properties::add_attributes( const xml::attributes_wc_ptr & Att CP_APPLY_ATTR(L"chart:tick-mark-position", strVal); if (strVal) push_back(_property(L"tick-mark-position", *strVal)); - CP_APPLY_ATTR(L"chart:interpolation", strVal); + CP_APPLY_ATTR(L"chart:interpolation", strVal); if (strVal) push_back(_property(L"interpolation", chart_interpolation(chart_interpolation::parse(strVal.get())).get_type())); - CP_APPLY_ATTR(L"chart:solid-type", strVal); + CP_APPLY_ATTR(L"chart:solid-type", strVal); if (strVal) push_back(_property(L"solid-type", chart_solid_type(chart_solid_type::parse(strVal.get())).get_type())); - CP_APPLY_ATTR(L"chart:label-arrangement", strVal); + CP_APPLY_ATTR(L"chart:label-arrangement", strVal); if (strVal) push_back(_property(L"label-arrangement",chart_label_arrangement(chart_label_arrangement::parse(strVal.get())).get_type())); - CP_APPLY_ATTR(L"style:direction", strVal); + CP_APPLY_ATTR(L"style:direction", strVal); if (strVal) push_back(_property(L"direction", direction(direction::parse(strVal.get())).get_type() )); - CP_APPLY_ATTR(L"chart:series-source", strVal); + CP_APPLY_ATTR(L"chart:series-source", strVal); if (strVal) push_back(_property(L"series-source", chart_series_source(chart_series_source::parse(strVal.get())).get_type() )); - CP_APPLY_ATTR(L"chart:symbol-width", strVal); + CP_APPLY_ATTR(L"chart:symbol-width", strVal); if (strVal) { push_back(_property(L"symbol-width-value", length(length::parse(strVal.get())).get_value() )); push_back(_property(L"symbol-width-unit", length(length::parse(strVal.get())).get_unit() )); } - CP_APPLY_ATTR(L"chart:symbol-height", strVal); + CP_APPLY_ATTR(L"chart:symbol-height", strVal); if (strVal) { push_back(_property(L"symbol-height-value", length(length::parse(strVal.get())).get_value() )); - push_back(_property(L"symbol-height-unit", length(length::parse(strVal.get())).get_unit() )); + push_back(_property(L"symbol-height-unit", length(length::parse(strVal.get())).get_unit() )); } - CP_APPLY_ATTR(L"chart:regression-type", strVal); + CP_APPLY_ATTR(L"chart:regression-type", strVal); if (strVal) push_back(_property(L"regression-type", chart_regression_type(chart_regression_type::parse(strVal.get())).get_type() )); - CP_APPLY_ATTR(L"chart:data-label-number", strVal); + CP_APPLY_ATTR(L"chart:data-label-number", strVal); if (strVal) push_back(_property(L"data-label-number", chart_data_label_number(chart_data_label_number::parse(strVal.get())).get_type() )); - CP_APPLY_ATTR(L"chart:error-category", strVal); + CP_APPLY_ATTR(L"chart:error-category", strVal); if (strVal) push_back(_property(L"error-category", chart_error_category(chart_error_category::parse(strVal.get())).get_type() )); - CP_APPLY_ATTR(L"chart:label-position", strVal); + CP_APPLY_ATTR(L"chart:label-position", strVal); if (strVal) push_back(_property(L"label-position", chart_label_position(chart_label_position::parse(strVal.get())).get_type() )); common_rotation_angle_attlist_.add_attributes(Attributes); + + CP_APPLY_ATTR(L"loext:show-horizontal-border", bVal); if (bVal) push_back(_property(L"show-horizontal-border", bVal.get())); + CP_APPLY_ATTR(L"loext:show-vertical-border", bVal); if (bVal) push_back(_property(L"show-vertical-border", bVal.get())); + CP_APPLY_ATTR(L"loext:show-outline", bVal); if (bVal) push_back(_property(L"show-outline", bVal.get())); + CP_APPLY_ATTR(L"loext:show-keys", bVal); if (bVal) push_back(_property(L"show-keys", bVal.get())); - //CP_APPLY_ATTR(L"chart:scale-text", chart_scale_text_ ); - // CP_APPLY_ATTR(L"chart:three-dimensional", chart_three_dimensional_ ); - //CP_APPLY_ATTR(L"chart:vertical", chart_vertical_ ); - //CP_APPLY_ATTR(L"chart:stacked", chart_stacked_ ); - //CP_APPLY_ATTR(L"chart:visible", chart_visible_ ); - //CP_APPLY_ATTR(L"chart:logarithmic", chart_logarithmic_ ); - //CP_APPLY_ATTR(L"chart:percentage", chart_percentage_ ); - //CP_APPLY_ATTR(L"chart:connect-bars", chart_connect_bars_ ); - //CP_APPLY_ATTR(L"chart:deep", chart_deep_ ); - //CP_APPLY_ATTR(L"chart:tick-marks-major-outer",chart_tick_marks_major_outer_ ); - //CP_APPLY_ATTR(L"chart:tick-marks-minor-inner",chart_tick_marks_minor_inner_ ); - //CP_APPLY_ATTR(L"chart:tick-marks-minor-outer",chart_marks_minor_outer_ ); - //CP_APPLY_ATTR(L"chart:lines", chart_lines_ ); - //CP_APPLY_ATTR(L"chart:display-label", chart_display_label_ ); - //CP_APPLY_ATTR(L"chart:reverse-direction", chart_reverse_direction_ ); - //CP_APPLY_ATTR(L"text:line-break", chart_line_break_ ); - //CP_APPLY_ATTR(L"chart:text-overlap", chart_text_overlap_ ); - //CP_APPLY_ATTR(L"chart:link-data-style-to-source",chart_link-data-style-to-source_ ); - //CP_APPLY_ATTR(L"chart:data-label-symbol", chart_data-label-symbol_ ); - //CP_APPLY_ATTR(L"chart:data-label-text", chart_data-label-text_ ); - //CP_APPLY_ATTR(L"chart:mean-value", chart_mean-value_ ); - //CP_APPLY_ATTR(L"chart:error-upper-indicator",chart_error_upper_indicator_ ); - //CP_APPLY_ATTR(L"chart:error-lower-indicator",chart_error_lower_indicator_ ); + _CP_OPT(odf_types::color) color_;; + CP_APPLY_ATTR(L"loext:label-stroke-color", color_); + if (color_) push_back(_property(L"label-stroke-color", color_->get_hex_value())); - //CP_APPLY_ATTR(L"chart:symbol-type", chart_symbol_type_); - //CP_APPLY_ATTR(L"chart:symbol-name", chart_symbol_name_); - // - //CP_APPLY_ATTR(L"chart:gap-width", chart_gap_width_); - //CP_APPLY_ATTR(L"chart:overlap", chart_overlap_); - //CP_APPLY_ATTR(L"chart:spline-order", chart_spline_order_); - //CP_APPLY_ATTR(L"chart:spline-resolution", chart_spline_resolution_); - //CP_APPLY_ATTR(L"chart:pie-offset", chart_pie_offset_); - //CP_APPLY_ATTR(L"chart:interval-minor-divisor",chart_interval_minor_divisor_); - // - //CP_APPLY_ATTR(L"chart:maximum", chart_maximum_); - //CP_APPLY_ATTR(L"chart:minimum", chart_minimum_); - //CP_APPLY_ATTR(L"chart:origin", chart_origin_); - //CP_APPLY_ATTR(L"chart:interval-major", chart_interval_major_); - //CP_APPLY_ATTR(L"chart:error-percentage", chart_error_percentage_); - //CP_APPLY_ATTR(L"chart:error-margin", chart_error_margin_); - //CP_APPLY_ATTR(L"chart:error-upper-limit", chart_error_upper_limit_); + _CP_OPT(odf_types::line_style) line_; + CP_APPLY_ATTR(L"loext:label-stroke", line_); + if (line_) push_back(_property(L"label-stroke", (int)line_->get_type())); - //CP_APPLY_ATTR(L"chart:symbol-width", chart_symbol_width_); - //CP_APPLY_ATTR(L"chart:symbol-height", chart_symbol_height_); - - // CP_APPLY_ATTR(L"chart:interpolation", chart_interpolation_); - //CP_APPLY_ATTR(L"chart:solid-type", chart_solid_type_); - //CP_APPLY_ATTR(L"chart:label-arrangement", chart_label_arrangement_); - //CP_APPLY_ATTR(L"style:direction", style_direction_); - //CP_APPLY_ATTR(L"chart:series-source", chart_series_source_); - //CP_APPLY_ATTR(L"chart:regression-type", chart_regression_type_); - //CP_APPLY_ATTR(L"chart:data-label-number", chart_data_label_number_); - //CP_APPLY_ATTR(L"chart:error-category", chart_error_category_); - - //common_rotation_angle_attlist_.add_attributes(Attributes); + CP_APPLY_ATTR(L"loext:label-fill-color", color_); + if (color_) push_back(_property(L"label-fill-color", color_->get_hex_value())); + + _CP_OPT(draw_fill) fill_; + CP_APPLY_ATTR(L"loext:label-fill", fill_); + if (fill_) push_back(_property(L"label-fill", fill_->get_type())); } void style_chart_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) diff --git a/OdfFile/Writer/Converter/Converter.h b/OdfFile/Writer/Converter/Converter.h index 021df4daba..aa0ae12dcd 100644 --- a/OdfFile/Writer/Converter/Converter.h +++ b/OdfFile/Writer/Converter/Converter.h @@ -639,6 +639,7 @@ public: void convert(OOX::Spreadsheet::CT_ExternalData *external_data); void convert(OOX::Spreadsheet::CT_NumData *num_data, bool categories, bool label); void convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label); + void convert(OOX::Spreadsheet::CT_DTable *dTable); void convert(OOX::CSizeAnchor *sz_anchor, double x0, double y0, double width, double height); //.chart.ex........................................................................................................................... diff --git a/OdfFile/Writer/Converter/ConverterChart.cpp b/OdfFile/Writer/Converter/ConverterChart.cpp index 66e521f592..be0926f14b 100644 --- a/OdfFile/Writer/Converter/ConverterChart.cpp +++ b/OdfFile/Writer/Converter/ConverterChart.cpp @@ -307,9 +307,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea) case OOX::Spreadsheet::itemschoicetype5SURFACECHART: convert((OOX::Spreadsheet::CT_SurfaceChart*) ct_plotArea->m_Items[i]);break; } } - if (ct_plotArea->m_dTable) - { - } + convert(ct_plotArea->m_dTable); + convert(ct_plotArea->m_spPr.GetPointer()); if (chart3D/* == false*/) { @@ -320,6 +319,26 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea) odf_context()->chart_context()->end_element(); } } +void OoxConverter::convert(OOX::Spreadsheet::CT_DTable *dTable) +{ + if (dTable == NULL)return; + + odf_context()->chart_context()->start_data_table(); + + if (dTable->m_showHorzBorder.IsInit()) + odf_context()->chart_context()->set_showHorzBorder(*dTable->m_showHorzBorder); + if (dTable->m_showVertBorder.IsInit()) + odf_context()->chart_context()->set_m_showVertBorder(*dTable->m_showVertBorder); + if (dTable->m_showOutline.IsInit()) + odf_context()->chart_context()->set_showOutline(*dTable->m_showOutline); + if (dTable->m_showKeys.IsInit()) + odf_context()->chart_context()->set_showKeys(*dTable->m_showKeys); + + convert(dTable->m_spPr.GetPointer()); + convert(dTable->m_txPr.GetPointer()); + odf_context()->chart_context()->end_element(); +} + void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis) { if (axis == NULL)return; diff --git a/OdfFile/Writer/Format/odf_chart_context.cpp b/OdfFile/Writer/Format/odf_chart_context.cpp index 883658327d..9990032703 100644 --- a/OdfFile/Writer/Format/odf_chart_context.cpp +++ b/OdfFile/Writer/Format/odf_chart_context.cpp @@ -936,7 +936,56 @@ void odf_chart_context::add_categories(const std::wstring & odf_ref, const std:: odf_element_state state(elm, L"", office_element_ptr(), level); impl_->current_chart_state_.elements_.push_back(state); } +void odf_chart_context::start_data_table() +{ + office_element_ptr elm; + create_element(L"loext", L"data-table", elm, impl_->odf_context_); + + chart_data_table *data_table = dynamic_cast(elm.get()); + if (data_table == NULL)return; +////////// + impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1); + office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element(); + + std::wstring style_name; + + style* style_ = dynamic_cast(style_elm.get()); + if (style_) + { + style_name = style_->style_name_; + data_table->common_attlist_.chart_style_name_ = style_name; + + style_->content_.add_get_style_chart_properties(); + style_->content_.add_get_style_graphic_properties(); + style_->content_.add_get_style_text_properties(); + } + start_element(elm, style_elm, style_name); +} +void odf_chart_context::set_showHorzBorder(bool val) +{ + if (!impl_->current_level_.back().chart_properties)return; + + impl_->current_level_.back().chart_properties->show_horizontal_border_ = val; +} +void odf_chart_context::set_m_showVertBorder(bool val) +{ + if (!impl_->current_level_.back().chart_properties)return; + + impl_->current_level_.back().chart_properties->show_vertical_border_ = val; +} +void odf_chart_context::set_showOutline(bool val) +{ + if (!impl_->current_level_.back().chart_properties)return; + + impl_->current_level_.back().chart_properties->show_outline_ = val; +} +void odf_chart_context::set_showKeys(bool val) +{ + if (!impl_->current_level_.back().chart_properties)return; + + impl_->current_level_.back().chart_properties->show_keys_ = val; +} void odf_chart_context::start_axis() { office_element_ptr elm; diff --git a/OdfFile/Writer/Format/odf_chart_context.h b/OdfFile/Writer/Format/odf_chart_context.h index 726e41701e..bff491d6c3 100644 --- a/OdfFile/Writer/Format/odf_chart_context.h +++ b/OdfFile/Writer/Format/odf_chart_context.h @@ -105,8 +105,14 @@ public: void set_label_show_legend_key (bool val); void set_label_show_percent (bool val); void set_label_show_ser_name( bool val); - void set_label_show_values (bool val); - + void set_label_show_values (bool val); + + void start_data_table(); + void set_showHorzBorder(bool val); + void set_m_showVertBorder(bool val); + void set_showOutline(bool val); + void set_showKeys(bool val); + void start_axis(); void set_axis_id(unsigned int id); void set_axis_dimension(int type); diff --git a/OdfFile/Writer/Format/office_chart.cpp b/OdfFile/Writer/Format/office_chart.cpp index c9428f7611..9e50cf3b82 100644 --- a/OdfFile/Writer/Format/office_chart.cpp +++ b/OdfFile/Writer/Format/office_chart.cpp @@ -617,5 +617,21 @@ void chart_date_scale::serialize(std::wostream & _Wostream) } } } +// chartooo:date-scale +////////////////////////////////////////////////////////////////////////////////////////////////// +const wchar_t * chart_data_table::ns = L"loext"; +const wchar_t * chart_data_table::name = L"data-table"; + +void chart_data_table::serialize(std::wostream & _Wostream) +{ + CP_XML_WRITER(_Wostream) + { + CP_XML_NODE_SIMPLE() + { + common_attlist_.serialize(CP_GET_XML_NODE()); + } + } +} + } } diff --git a/OdfFile/Writer/Format/office_chart.h b/OdfFile/Writer/Format/office_chart.h index d06cc9c97e..5371ab63b3 100644 --- a/OdfFile/Writer/Format/office_chart.h +++ b/OdfFile/Writer/Format/office_chart.h @@ -616,8 +616,7 @@ public: static const wchar_t * ns; static const wchar_t * name; - static const ElementType type = typeChartDateScale; - + static const ElementType type = typeChartDateScale; virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( const office_element_ptr & child_element){} @@ -633,5 +632,22 @@ public: _CP_OPT(odf_types::chart_time_unit) minor_interval_unit_; }; CP_REGISTER_OFFICE_ELEMENT2(chart_date_scale); + +class chart_data_table : public office_element_impl +{ +public: + static const wchar_t * ns; + static const wchar_t * name; + + static const ElementType type = typeChartDataTable; + + virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name) {} + virtual void add_child_element(const office_element_ptr & child_element) {} + + virtual void serialize(std::wostream & _Wostream); + + common_chart_attlist common_attlist_; +}; +CP_REGISTER_OFFICE_ELEMENT2(chart_data_table); } } diff --git a/OdfFile/Writer/Format/style_chart_properties.cpp b/OdfFile/Writer/Format/style_chart_properties.cpp index 233776a105..f310d9e187 100644 --- a/OdfFile/Writer/Format/style_chart_properties.cpp +++ b/OdfFile/Writer/Format/style_chart_properties.cpp @@ -117,6 +117,11 @@ void chart_format_properties::serialize(std::wostream & _Wostream ,const wchar_t CP_XML_ATTR_OPT(L"chart:right-angled-axes", right_angled_axes_); common_rotation_angle_attlist_.serialize(CP_GET_XML_NODE()); + + CP_XML_ATTR_OPT(L"chart:show-horizontal-border", show_horizontal_border_); + CP_XML_ATTR_OPT(L"chart:show-vertical-border", show_vertical_border_); + CP_XML_ATTR_OPT(L"chart:show-outline", show_outline_); + CP_XML_ATTR_OPT(L"chart:show-keys", show_keys_); } } } diff --git a/OdfFile/Writer/Format/style_chart_properties.h b/OdfFile/Writer/Format/style_chart_properties.h index a81b119714..0982266f3b 100644 --- a/OdfFile/Writer/Format/style_chart_properties.h +++ b/OdfFile/Writer/Format/style_chart_properties.h @@ -118,10 +118,15 @@ public: _CP_OPT(odf_types::chart_error_category) error_category_; _CP_OPT(odf_types::Bool) right_angled_axes_; - _CP_OPT(std::wstring) axis_label_position_; - _CP_OPT(std::wstring) axis_position_; + _CP_OPT(std::wstring) axis_label_position_; + _CP_OPT(std::wstring) axis_position_; odf_types::common_rotation_angle_attlist common_rotation_angle_attlist_; + + _CP_OPT(odf_types::Bool) show_horizontal_border_; + _CP_OPT(odf_types::Bool) show_vertical_border_; + _CP_OPT(odf_types::Bool) show_outline_; + _CP_OPT(odf_types::Bool) show_keys_; }; typedef boost::shared_ptr chart_format_properties_ptr;