Commit 886cca11 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

(1.0.1.197): ASCOfficeOdfFile

25141

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57093 954022d7-b5bf-4e40-9824-e11837661b57
parent df14c70f
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//1 //1
//196 //197
#define INTVER 1,0,1,196 #define INTVER 1,0,1,197
#define STRVER "1,0,1,196\0" #define STRVER "1,0,1,197\0"
...@@ -124,11 +124,12 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream) ...@@ -124,11 +124,12 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
//oox_serialize_ln(_Wostream,content_.graphic_properties_); //oox_serialize_ln(_Wostream,content_.graphic_properties_);
oox_chart_shape shape; oox_chart_shape shape;
shape.content_ = content_.graphic_properties_; shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream); shape.oox_serialize(_Wostream);
BOOST_FOREACH(odf::chart::axis::grid const & g, content_.grids_) BOOST_FOREACH(odf::chart::axis::grid & g, content_.grids_)
{ {
shape.content_ = g.graphic_properties_; _oox_fill fill_null;
shape.set(g.graphic_properties_, fill_null);
if (g.type_ == odf::chart::axis::grid::major) if (g.type_ == odf::chart::axis::grid::major)
{ {
......
...@@ -71,7 +71,7 @@ void oox_chart_context::write_to(std::wostream & strm) ...@@ -71,7 +71,7 @@ void oox_chart_context::write_to(std::wostream & strm)
} }
} }
oox_chart_shape shape; oox_chart_shape shape;
shape.content_ = graphic_properties_; shape.set(graphic_properties_,fill_);
shape.oox_serialize(CP_XML_STREAM()); shape.oox_serialize(CP_XML_STREAM());
......
...@@ -61,6 +61,7 @@ public: ...@@ -61,6 +61,7 @@ public:
{ {
//plot_area_.wall_graphic_properties_ = l.graphic_properties_; //plot_area_.wall_graphic_properties_ = l.graphic_properties_;
plot_area_.graphic_properties_ = l.graphic_properties_; plot_area_.graphic_properties_ = l.graphic_properties_;
plot_area_.fill_ = l.fill_;
} }
void set_floor(odf::chart::simple & l) void set_floor(odf::chart::simple & l)
{ {
...@@ -71,23 +72,26 @@ public: ...@@ -71,23 +72,26 @@ public:
legend_.content_= l; legend_.content_= l;
} }
void set_chart_graphic_properties(std::vector<odf::_property> & prop) void set_chart_graphic_properties(std::vector<odf::_property> & prop, _oox_fill &fill)
{ {
graphic_properties_= prop; graphic_properties_= prop;
fill_ = fill;
} }
void set_plot_area_properties(std::vector<odf::_property> & prop) void set_plot_area_properties(std::vector<odf::_property> & prop, _oox_fill &fill)
{ {
plot_area_.properties_ = prop; plot_area_.properties_ = prop;
plot_area_.fill_ = fill;
} }
private: private:
class Impl; class Impl;
_CP_SCOPED_PTR(Impl) impl_; _CP_SCOPED_PTR(Impl) impl_;
cpdoccore::oox::oox_title title_; cpdoccore::oox::oox_title title_;
cpdoccore::oox::oox_plot_area plot_area_; cpdoccore::oox::oox_plot_area plot_area_;
cpdoccore::oox::oox_chart_legend legend_; cpdoccore::oox::oox_chart_legend legend_;
std::vector<odf::_property> graphic_properties_; std::vector<odf::_property> graphic_properties_;
_oox_fill fill_;
}; };
//autoTitleDeleted (Auto Title Is Deleted) 21.2.2.7 //autoTitleDeleted (Auto Title Is Deleted) 21.2.2.7
......
...@@ -72,11 +72,11 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream) ...@@ -72,11 +72,11 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
} }
shape.content_ = content_.graphic_properties_; shape.set(content_.graphic_properties_,content_.fill_);
shape.oox_serialize(CP_XML_STREAM()); shape.oox_serialize(CP_XML_STREAM());
oox_chart_shape shape; //oox_chart_shape shape;
shape.content_ = content_.graphic_properties_; //shape.set(content_.graphic_properties_,content_.fill_);
oox_serialize_default_text(CP_XML_STREAM()); oox_serialize_default_text(CP_XML_STREAM());
......
...@@ -54,11 +54,22 @@ void oox_chart_series::setName(std::wstring &value) ...@@ -54,11 +54,22 @@ void oox_chart_series::setName(std::wstring &value)
void oox_chart_series::setFormula(int ind, std::wstring &value) void oox_chart_series::setFormula(int ind, std::wstring &value)
{ {
formulasconvert::odf2oox_converter converter; formulasconvert::odf2oox_converter converter;
values_[ind].numRef_.formula=converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].present = true;
if (ind == 4)
{
long res = value.find(L"local-table");
if (res >=0) return;
values_[ind].strRef_.formula=converter.convert_chart_distance(value);
values_[ind].strRef_.present = true;
values_[ind].present = true;
}
else
{
values_[ind].numRef_.formula=converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].present = true;
}
} }
void oox_chart_series::parse_properties() void oox_chart_series::parse_properties()
...@@ -81,11 +92,22 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values) ...@@ -81,11 +92,22 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{ {
values_[ind].present = true; values_[ind].present = true;
if (ind == 4)values_[ind].strRef_.present = true;
else values_[ind].numRef_.present = true;
BOOST_FOREACH(std::wstring & v, values) BOOST_FOREACH(std::wstring & v, values)
{ {
boost::algorithm::trim(v); boost::algorithm::trim(v);
values_[ind].numRef_.num_cash.push_back(v); if (ind == 4)
values_[ind].numRef_.num_cash_count++; {
values_[ind].strRef_.str_cash.push_back(v);
values_[ind].strRef_.str_cash_count++;
}
else
{
values_[ind].numRef_.num_cash.push_back(v);
values_[ind].numRef_.num_cash_count++;
}
} }
} }
void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
...@@ -93,7 +115,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -93,7 +115,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
parse_properties(); parse_properties();
oox_chart_shape shape; oox_chart_shape shape;
shape.content_ = content_.graphic_properties_; shape.set(content_.graphic_properties_, content_.fill_);
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
...@@ -107,7 +129,8 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -107,7 +129,8 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
} }
shape.oox_serialize(_Wostream); shape.oox_serialize(_Wostream);
for (int i=0;i<4;i++)
for (int i=0; i < 4; i++)
{ {
if (values_[i].present) if (values_[i].present)
{ {
...@@ -134,12 +157,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -134,12 +157,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{ {
CP_XML_ATTR(L"val", values_[i].numRef_.num_cash_count); CP_XML_ATTR(L"val", values_[i].numRef_.num_cash_count);
} }
int i=0; int j=0;
BOOST_FOREACH(std::wstring & v, values_[i].numRef_.num_cash) BOOST_FOREACH(std::wstring & v, values_[i].numRef_.num_cash)
{ {
CP_XML_NODE(L"c:pt") CP_XML_NODE(L"c:pt")
{ {
CP_XML_ATTR(L"idx", i++); CP_XML_ATTR(L"idx", j++);
CP_XML_NODE(L"c:v") CP_XML_NODE(L"c:v")
{ {
CP_XML_CONTENT(boost::lexical_cast<double>(v)); CP_XML_CONTENT(boost::lexical_cast<double>(v));
...@@ -150,13 +173,46 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -150,13 +173,46 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
} }
} }
} }
//if (values_[i].strRef_.present)
//{
// CP_XML_NODE(L"c:strRef")
// {
// CP_XML_NODE(L"c:f")
// {
// CP_XML_CONTENT(values_[i].strRef_.formula);
// }
//
// if (values_[i].strRef_.str_cash_count>0)
// {
// CP_XML_NODE(L"c:strCache")//
// {
// CP_XML_NODE(L"c:ptCount")
// {
// CP_XML_ATTR(L"val", values_[i].strRef_.str_cash_count);
// }
// int j=0;
// BOOST_FOREACH(std::wstring & v, values_[i].strRef_.str_cash)
// {
// CP_XML_NODE(L"c:pt")
// {
// CP_XML_ATTR(L"idx", j++);
// CP_XML_NODE(L"c:v")
// {
// CP_XML_CONTENT(v);
// }
// }
// }
// }
// }
// }
//}
} }
} }
} }
if (content_.regression_curve_.line_properties_.size()>0) if (content_.regression_curve_.line_properties_.size()>0)
{ {
std::wstring typeTrendline= L"log"; //"exp" | "linear" | "log" | "movingAvg" | "poly" | "power" std::wstring typeTrendline= L"log"; //"exp" | "linear" | "log" | "movingAvg" | "poly" | "power"
shape.content_ = content_.regression_curve_.line_properties_; shape.set(content_.regression_curve_.line_properties_,_oox_fill());
_CP_OPT(int) iType; _CP_OPT(int) iType;
odf::GetProperty(content_.properties_, L"regression-type",iType); // none, linear, logarithmic, exponential, power odf::GetProperty(content_.properties_, L"regression-type",iType); // none, linear, logarithmic, exponential, power
...@@ -184,12 +240,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -184,12 +240,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{ {
CP_XML_NODE(L"c:trendlineLbl") CP_XML_NODE(L"c:trendlineLbl")
{ {
shape.content_ = content_.regression_curve_.equation_properties_.graphic_properties_; shape.set(content_.regression_curve_.equation_properties_.graphic_properties_,content_.regression_curve_.equation_properties_.fill_);
shape.oox_serialize(CP_XML_STREAM()); shape.oox_serialize(CP_XML_STREAM());
} }
} }
shape.content_ = content_.regression_curve_.line_properties_; shape.set( content_.regression_curve_.line_properties_,_oox_fill());
shape.oox_serialize(CP_XML_STREAM()); shape.oox_serialize(CP_XML_STREAM());
......
...@@ -22,6 +22,7 @@ public: ...@@ -22,6 +22,7 @@ public:
values_[1].type=L"c:xVal"; values_[1].type=L"c:xVal";
values_[2].type=L"c:yVal"; values_[2].type=L"c:yVal";
values_[3].type=L"c:bubbleSize";// !!!! values_[3].type=L"c:bubbleSize";// !!!!
values_[4].type=L"c:cat";//
iSymbolMarkerType_ =0; iSymbolMarkerType_ =0;
} }
...@@ -30,7 +31,7 @@ public: ...@@ -30,7 +31,7 @@ public:
void oox_serialize_common(std::wostream & _Wostream); void oox_serialize_common(std::wostream & _Wostream);
virtual void oox_serialize(std::wostream & _Wostream){} virtual void oox_serialize(std::wostream & _Wostream){}
_oox_chart_values values_[4]; //common,x, y, bubble _oox_chart_values values_[5]; //common,x, y, bubble, cat(labels)
int id_; int id_;
......
...@@ -15,19 +15,23 @@ namespace oox { ...@@ -15,19 +15,23 @@ namespace oox {
void oox_chart_shape::oox_serialize(std::wostream & _Wostream) void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
{ {
_CP_OPT(std::wstring) strVal;
_CP_OPT(double) dVal;
_CP_OPT(int) iVal;
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
CP_XML_NODE(L"c:spPr") CP_XML_NODE(L"c:spPr")
{ {
oox_serialize_fill(CP_XML_STREAM(),fill); oox_serialize_fill(CP_XML_STREAM(),fill_);
oox_serialize_ln(CP_XML_STREAM(),content_); oox_serialize_ln(CP_XML_STREAM(),content_);
} }
} }
} }
void oox_chart_shape::set(std::vector<odf::_property> & prop,_oox_fill & fill)
{
content_ = prop;
fill_ = fill;
}
} }
} }
...@@ -15,12 +15,14 @@ class oox_chart_shape: boost::noncopyable ...@@ -15,12 +15,14 @@ class oox_chart_shape: boost::noncopyable
public: public:
oox_chart_shape(){} oox_chart_shape(){}
~oox_chart_shape(){} ~oox_chart_shape(){}
void set(std::vector<odf::_property> & prop,_oox_fill & fill);
void oox_serialize(std::wostream & _Wostream); void oox_serialize(std::wostream & _Wostream);
private:
std::vector<odf::_property> content_; std::vector<odf::_property> content_;
_oox_fill fill_;
_oox_fill fill;
private: private:
......
...@@ -27,6 +27,15 @@ struct _oox_numLit ...@@ -27,6 +27,15 @@ struct _oox_numLit
// int formatCode; // int formatCode;
// std::vector<std::wstring>num_cash; // std::vector<std::wstring>num_cash;
//}; //};
struct _oox_strRef
{
bool present;
std::wstring formula;
int str_cash_count;
std::vector<std::wstring>str_cash;
};
struct _oox_numRef struct _oox_numRef
{ {
bool present; bool present;
...@@ -51,6 +60,9 @@ public: ...@@ -51,6 +60,9 @@ public:
numRef_.formatCode = L"General"; numRef_.formatCode = L"General";
numRef_.num_cash_count=0; numRef_.num_cash_count=0;
strRef_.present=false;
strRef_.str_cash_count=0;
present = false; present = false;
} }
...@@ -59,6 +71,8 @@ public: ...@@ -59,6 +71,8 @@ public:
_oox_numLit numLit_; _oox_numLit numLit_;
_oox_numRef numRef_; _oox_numRef numRef_;
_oox_strRef strRef_;
}; };
//numLit (Number Literal) 21.2.2.122 //numLit (Number Literal) 21.2.2.122
//numRef (Number Reference) 21.2.2.123 //numRef (Number Reference) 21.2.2.123
......
...@@ -60,6 +60,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf::_property> & ...@@ -60,6 +60,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf::_property> &
_CP_OPT(std::wstring) strVal; _CP_OPT(std::wstring) strVal;
_CP_OPT(int) iVal; _CP_OPT(int) iVal;
_CP_OPT(double) dVal; _CP_OPT(double) dVal;
odf::GetProperty(prop,L"stroke-color",strVal); odf::GetProperty(prop,L"stroke-color",strVal);
odf::GetProperty(prop,L"stroke",iVal); odf::GetProperty(prop,L"stroke",iVal);
odf::GetProperty(prop,L"stroke-width",dVal); odf::GetProperty(prop,L"stroke-width",dVal);
......
...@@ -61,7 +61,7 @@ void oox_plot_area::oox_serialize(std::wostream & _Wostream) ...@@ -61,7 +61,7 @@ void oox_plot_area::oox_serialize(std::wostream & _Wostream)
reset_cross_axis(); reset_cross_axis();
oox_chart_shape shape; oox_chart_shape shape;
shape.content_ = graphic_properties_; shape.set(graphic_properties_, fill_);
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
......
...@@ -22,6 +22,8 @@ public: ...@@ -22,6 +22,8 @@ public:
std::vector<odf::_property> graphic_properties_; std::vector<odf::_property> graphic_properties_;
std::vector<odf::_property> properties_; std::vector<odf::_property> properties_;
_oox_fill fill_;
//std::vector<odf::_property> wall_graphic_properties_; //std::vector<odf::_property> wall_graphic_properties_;
void oox_serialize(std::wostream & _Wostream); void oox_serialize(std::wostream & _Wostream);
......
...@@ -369,7 +369,7 @@ void oox_stock_chart::set_properties(std::vector<odf::_property> g) ...@@ -369,7 +369,7 @@ void oox_stock_chart::set_properties(std::vector<odf::_property> g)
void oox_stock_chart::oox_serialize(std::wostream & _Wostream) void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
{ {
oox_chart_shape shape; oox_chart_shape shape;
shape.content_ = graphic_properties_; shape.set(graphic_properties_, fill_);
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
......
...@@ -294,6 +294,8 @@ class oox_stock_chart: public oox_chart ...@@ -294,6 +294,8 @@ class oox_stock_chart: public oox_chart
std::vector<odf::_property> properties_; std::vector<odf::_property> properties_;
std::vector<odf::_property> graphic_properties_; std::vector<odf::_property> graphic_properties_;
_oox_fill fill_;
//dropLines (Drop Lines) 21.2.2.53 //dropLines (Drop Lines) 21.2.2.53
//hiLowLines (High Low Lines) 21.2.2.80 //hiLowLines (High Low Lines) 21.2.2.80
//ser (Line Chart Series) 21.2.2.171 //ser (Line Chart Series) 21.2.2.171
......
...@@ -83,6 +83,11 @@ void chart_build::end_axis() ...@@ -83,6 +83,11 @@ void chart_build::end_axis()
in_axis_ = false; in_axis_ = false;
} }
void chart_build::add_categories(std::wstring const & cellRange)
{
categories_.push_back(cellRange);
}
void chart_build::add_grid(std::wstring const & className, std::wstring const & styleName) void chart_build::add_grid(std::wstring const & className, std::wstring const & styleName)
{ {
if (!axises_.empty()) if (!axises_.empty())
...@@ -180,9 +185,9 @@ void chart_build::oox_convert(oox::oox_chart_context & chart) ...@@ -180,9 +185,9 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
chart.set_wall(wall_); chart.set_wall(wall_);
chart.set_floor(floor_); chart.set_floor(floor_);
chart.set_legend(legend_); chart.set_legend(legend_);
chart.set_plot_area_properties(plot_area_.properties_); chart.set_plot_area_properties(plot_area_.properties_, plot_area_.fill_);
//chart.set_footer(footer_); //chart.set_footer(footer_);
chart.set_chart_graphic_properties(chart_graphic_properties_); chart.set_chart_graphic_properties(chart_graphic_properties_, chart_fill_);
//chart.set_chart_properties(chart_graphic_properties_); //chart.set_chart_properties(chart_graphic_properties_);
class_type last_set_type=chart_unknown; class_type last_set_type=chart_unknown;
...@@ -202,13 +207,18 @@ void chart_build::oox_convert(oox::oox_chart_context & chart) ...@@ -202,13 +207,18 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
current->set_properties(plot_area_.properties_); current->set_properties(plot_area_.properties_);
current->set_additional_properties(chart_graphic_properties_); current->set_additional_properties(chart_graphic_properties_);
current->add_series(series_id++); current->add_series(series_id++);
if (s.cell_range_address_.length()<1) s.cell_range_address_ = plot_area_.cell_range_address_;//SplitByColumn(ind_ser,range);
std::vector<std::wstring> cell_cash; //SplitByRow(ind_ser,range)
// - -
calc_cash_series(s.cell_range_address_,cell_cash); // -
//
// - = todooo
std::vector<std::wstring> cell_cash;
calc_cash_series(s.cell_range_address_, cell_cash);
if (domain_cell_range_adress_.length()>0) if (domain_cell_range_adress_.length()>0)
{ {
...@@ -238,6 +248,15 @@ void chart_build::oox_convert(oox::oox_chart_context & chart) ...@@ -238,6 +248,15 @@ void chart_build::oox_convert(oox::oox_chart_context & chart)
current->set_formula_series(0, s.cell_range_address_);//common current->set_formula_series(0, s.cell_range_address_);//common
current->set_values_series(0, cell_cash);//common current->set_values_series(0, cell_cash);//common
} }
if (categories_.size() > 0)//
{
std::vector<std::wstring> cat_cash;
calc_cash_series(categories_[0], cat_cash);
current->set_formula_series(4,categories_[0]);
current->set_values_series(4,cat_cash);
}
current->set_name(s.name_); current->set_name(s.name_);
chart.set_content_series(s); chart.set_content_series(s);
} }
...@@ -302,12 +321,14 @@ void process_build_chart::ApplyTextProperties(std::wstring style,std::vector<_pr ...@@ -302,12 +321,14 @@ void process_build_chart::ApplyTextProperties(std::wstring style,std::vector<_pr
properties.apply_to(propertiesOut); properties.apply_to(propertiesOut);
} }
} }
void process_build_chart::ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut) void process_build_chart::ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut,oox::_oox_fill & fill)
{ {
style_instance* styleInst = styles_.style_by_name(style, odf::style_family::Chart,false/*Context.process_headers_footers_*/); style_instance* styleInst = styles_.style_by_name(style, odf::style_family::Chart,false/*Context.process_headers_footers_*/);
if(styleInst) if(styleInst)
{ {
graphic_format_properties properties = calc_graphic_properties_content(styleInst); graphic_format_properties properties = calc_graphic_properties_content(styleInst);
Compute_GraphicFill(properties.common_draw_fill_attlist_, draw_styles_ , fill);
properties.apply_to(propertiesOut); properties.apply_to(propertiesOut);
} }
} }
...@@ -370,7 +391,7 @@ void process_build_chart::visit(const chart_chart& val) ...@@ -370,7 +391,7 @@ void process_build_chart::visit(const chart_chart& val)
{ {
chart_build_.set_height(val.chart_chart_attlist_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt)); chart_build_.set_height(val.chart_chart_attlist_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt));
} }
ApplyGraphicProperties (val.chart_chart_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.chart_graphic_properties_); ApplyGraphicProperties (val.chart_chart_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.chart_graphic_properties_, chart_build_.chart_fill_);
chart_build_.set_class(val.chart_chart_attlist_.chart_class_); chart_build_.set_class(val.chart_chart_attlist_.chart_class_);
...@@ -420,14 +441,14 @@ void process_build_chart::visit(const chart_subtitle & val) ...@@ -420,14 +441,14 @@ void process_build_chart::visit(const chart_subtitle & val)
void process_build_chart::visit(const chart_footer& val) void process_build_chart::visit(const chart_footer& val)
{ {
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.properties_); ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.properties_);
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.graphic_properties_); ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.graphic_properties_, chart_build_.footer_.fill_);
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.text_properties_); ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.footer_.text_properties_);
} }
void process_build_chart::visit(const chart_legend& val) void process_build_chart::visit(const chart_legend& val)
{ {
ApplyChartProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.properties_); ApplyChartProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.properties_);
ApplyGraphicProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.graphic_properties_); ApplyGraphicProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.graphic_properties_,chart_build_.legend_.fill_);
ApplyTextProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.text_properties_); ApplyTextProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.legend_.text_properties_);
} }
...@@ -435,8 +456,10 @@ void process_build_chart::visit(const chart_plot_area& val) ...@@ -435,8 +456,10 @@ void process_build_chart::visit(const chart_plot_area& val)
{ {
ACCEPT_ALL_CONTENT_CONST(val.content_); ACCEPT_ALL_CONTENT_CONST(val.content_);
chart_build_.plot_area_.cell_range_address_ = val.chart_plot_area_attlist_.table_cell_range_address_.get_value_or(L"");
ApplyChartProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.properties_); ApplyChartProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.properties_);
ApplyGraphicProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.graphic_properties_); ApplyGraphicProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.graphic_properties_, chart_build_.plot_area_.fill_);
ApplyTextProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.text_properties_); ApplyTextProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.plot_area_.text_properties_);
} }
...@@ -450,7 +473,7 @@ void process_build_chart::visit(const chart_axis& val) ...@@ -450,7 +473,7 @@ void process_build_chart::visit(const chart_axis& val)
ACCEPT_ALL_CONTENT_CONST(val.content_); ACCEPT_ALL_CONTENT_CONST(val.content_);
ApplyChartProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().properties_); ApplyChartProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().properties_);
ApplyGraphicProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().graphic_properties_); ApplyGraphicProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().graphic_properties_,chart_build_.axises_.back().fill_);
ApplyTextProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().text_properties_); ApplyTextProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().text_properties_);
chart_build_.end_axis(); chart_build_.end_axis();
...@@ -473,7 +496,7 @@ void process_build_chart::visit(const chart_series& val) ...@@ -473,7 +496,7 @@ void process_build_chart::visit(const chart_series& val)
ACCEPT_ALL_CONTENT_CONST(val.content_); ACCEPT_ALL_CONTENT_CONST(val.content_);
ApplyChartProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().properties_); ApplyChartProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().properties_);
ApplyGraphicProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().graphic_properties_); ApplyGraphicProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().graphic_properties_,chart_build_.series_.back().fill_);
ApplyTextProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().text_properties_); ApplyTextProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().text_properties_);
} }
...@@ -487,20 +510,22 @@ void process_build_chart::visit(const chart_grid& val) ...@@ -487,20 +510,22 @@ void process_build_chart::visit(const chart_grid& val)
chart_build_.add_grid(val.chart_grid_attlist_.chart_class_.get_value_or(L""), chart_build_.add_grid(val.chart_grid_attlist_.chart_class_.get_value_or(L""),
val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L"") ); val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L"") );
ApplyGraphicProperties (val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), (chart_build_.axises_.back()).grids_.back().graphic_properties_); oox::_oox_fill fill;
ApplyGraphicProperties (val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), (chart_build_.axises_.back()).grids_.back().graphic_properties_, fill);
} }
void process_build_chart::visit(const chart_wall& val) void process_build_chart::visit(const chart_wall& val)
{ {
ApplyChartProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.properties_); ApplyChartProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.properties_);
ApplyGraphicProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.graphic_properties_); ApplyGraphicProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.graphic_properties_,chart_build_.wall_.fill_);
ApplyTextProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.text_properties_); ApplyTextProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.wall_.text_properties_);
} }
void process_build_chart::visit(const chart_floor& val) void process_build_chart::visit(const chart_floor& val)
{ {
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.properties_); ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.properties_);
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.graphic_properties_); ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.graphic_properties_,chart_build_.floor_.fill_);
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.text_properties_); ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.floor_.text_properties_);
} }
...@@ -513,15 +538,16 @@ void process_build_chart::visit(const chart_data_point & val) ...@@ -513,15 +538,16 @@ void process_build_chart::visit(const chart_data_point & val)
void process_build_chart::visit(const chart_mean_value & val) void process_build_chart::visit(const chart_mean_value & val)
{ {
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().mean_value_.properties_); ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().mean_value_.properties_);
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().mean_value_.graphic_properties_); ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().mean_value_.graphic_properties_,chart_build_.series_.back().mean_value_.fill_);
} }
void process_build_chart::visit(const chart_error_indicator & val) void process_build_chart::visit(const chart_error_indicator & val)
{ {
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().error_indicator_.graphic_properties_); ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().error_indicator_.graphic_properties_,chart_build_.series_.back().error_indicator_.fill_ );
} }
void process_build_chart::visit(const chart_regression_curve & val) void process_build_chart::visit(const chart_regression_curve & val)
{ {
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.line_properties_); oox::_oox_fill fill;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.line_properties_, fill);
if (val.chart_equation_) if (val.chart_equation_)
{ {
...@@ -538,13 +564,13 @@ void process_build_chart::visit(const chart_equation & val) ...@@ -538,13 +564,13 @@ void process_build_chart::visit(const chart_equation & val)
if (val.display_r_square_) if (val.display_r_square_)
chart_build_.series_.back().regression_curve_.bREquation = val.display_r_square_.get(); chart_build_.series_.back().regression_curve_.bREquation = val.display_r_square_.get();
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.equation_properties_.graphic_properties_); ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.equation_properties_.graphic_properties_,chart_build_.series_.back().regression_curve_.equation_properties_.fill_);
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.equation_properties_.text_properties_); ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), chart_build_.series_.back().regression_curve_.equation_properties_.text_properties_);
} }
void process_build_chart::visit(const chart_categories& val) void process_build_chart::visit(const chart_categories& val)
{ {
// TODO if (val.table_cell_range_address_) chart_build_.add_categories(*val.table_cell_range_address_);
} }
void process_build_chart::visit(const table_table& val) void process_build_chart::visit(const table_table& val)
{ {
......
...@@ -96,6 +96,8 @@ public: ...@@ -96,6 +96,8 @@ public:
void end_axis(); void end_axis();
void add_categories(std::wstring const & cellRangeAddress);
void add_grid(std::wstring const & className, std::wstring const & styleName); void add_grid(std::wstring const & className, std::wstring const & styleName);
void add_series(std::wstring const & cellRangeAddress, void add_series(std::wstring const & cellRangeAddress,
std::wstring const & labelCell, std::wstring const & labelCell,
...@@ -124,8 +126,10 @@ public: ...@@ -124,8 +126,10 @@ public:
std::wstring name_; std::wstring name_;
bool in_axis_; bool in_axis_;
std::vector<chart::axis> axises_; std::vector<chart::axis> axises_;
std::vector<chart::series> series_; std::vector<chart::series> series_;
std::vector<std::wstring> categories_;
std::wstring domain_cell_range_adress_; std::wstring domain_cell_range_adress_;
chart::title title_; chart::title title_;
...@@ -134,15 +138,16 @@ public: ...@@ -134,15 +138,16 @@ public:
chart::title sub_title_; chart::title sub_title_;
chart::simple legend_; chart::simple legend_;
chart::simple plot_area_; chart::plot_area plot_area_;
chart::simple wall_; chart::simple wall_;
chart::simple floor_; chart::simple floor_;
chart::simple footer_; chart::simple footer_;
std::vector<_property> chart_properties_; std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_; std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
std::vector<_cell> cash_values; std::vector<_cell> cash_values;
public: public:
...@@ -217,10 +222,11 @@ class process_build_chart : public base_visitor, ...@@ -217,10 +222,11 @@ class process_build_chart : public base_visitor,
{ {
public: public:
process_build_chart(chart_build & chartBuild, styles_container & styles): process_build_chart(chart_build & chartBuild, styles_container & styles, styles_lite_container & draw_styles):
stop_(false) stop_(false)
,chart_build_(chartBuild) ,chart_build_(chartBuild)
,styles_(styles) ,styles_(styles)
,draw_styles_(draw_styles)
{ {
_CP_LOG(warning) << L"[process_draw_object] \"" << L"\"" << std::endl; _CP_LOG(warning) << L"[process_draw_object] \"" << L"\"" << std::endl;
...@@ -229,7 +235,7 @@ public: ...@@ -229,7 +235,7 @@ public:
private: private:
void ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut); void ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut);
void ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut); void ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut);
void ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut); void ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
bool visit_table(std::wstring const & name); bool visit_table(std::wstring const & name);
void visit_column(unsigned int repeated); void visit_column(unsigned int repeated);
...@@ -283,8 +289,10 @@ public: ...@@ -283,8 +289,10 @@ public:
private: private:
bool stop_; bool stop_;
chart_build & chart_build_;
styles_container & styles_; chart_build & chart_build_;
styles_container & styles_;
styles_lite_container & draw_styles_;
}; };
......
#pragma once #pragma once
#include <cpdoccore/xml/attributes.h> #include <cpdoccore/xml/attributes.h>
#include "..\docx\oox_drawing_fills.h"
// ( ) xlsx & odf - // ( ) xlsx & odf -
namespace cpdoccore { namespace cpdoccore {
...@@ -43,6 +43,7 @@ namespace chart { ...@@ -43,6 +43,7 @@ namespace chart {
std::vector<_property> properties_; std::vector<_property> properties_;
std::vector<_property> text_properties_; std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_; std::vector<_property> graphic_properties_;
oox::_oox_fill fill_;
}; };
struct treadline struct treadline
{ {
...@@ -54,7 +55,13 @@ namespace chart { ...@@ -54,7 +55,13 @@ namespace chart {
treadline(){bEquation = false;bREquation = false;} treadline(){bEquation = false;bREquation = false;}
}; };
struct axis struct plot_area : public simple
{
std::wstring cell_range_address_;
//series_in_column_or_row
//uses_first_as_label
};
struct axis: public simple
{ {
struct grid struct grid
{ {
...@@ -73,11 +80,8 @@ namespace chart { ...@@ -73,11 +80,8 @@ namespace chart {
std::wstring style_name_; std::wstring style_name_;
std::vector<grid> grids_; std::vector<grid> grids_;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
}; };
struct series struct series : public simple
{ {
struct point struct point
{ {
...@@ -101,10 +105,6 @@ namespace chart { ...@@ -101,10 +105,6 @@ namespace chart {
simple error_indicator_; simple error_indicator_;
treadline regression_curve_; treadline regression_curve_;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
series(){} series(){}
series( series(
std::wstring const & rangeAddress, std::wstring const & rangeAddress,
......
...@@ -1182,7 +1182,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1182,7 +1182,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
return; return;
chart_build chartBuild; chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer()); process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles());
contentSubDoc->accept(process_build_chart_); contentSubDoc->accept(process_build_chart_);
if (chartBuild.object_type_ != 1)return; if (chartBuild.object_type_ != 1)return;
......
...@@ -267,7 +267,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -267,7 +267,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
chart_build chartBuild; chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer()); process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles());
contentSubDoc->accept(process_build_chart_); contentSubDoc->accept(process_build_chart_);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -238,7 +238,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -238,7 +238,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
chart_build chartBuild; chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer()); process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles() );
contentSubDoc->accept(process_build_chart_); contentSubDoc->accept(process_build_chart_);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment