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

миноритарные свойства диаграмм

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56226 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f53c262
......@@ -60,6 +60,8 @@ public:
std::wstring convert_spacechar(std::wstring expr);
int get_count_value_points(std::wstring expr);
// // =[.A1]+[.B1] -> table = ""; ref = "A1"
// // of:=['Sheet2 A'.B2] -> table= "Sheet2 A"; ref = "B2"
// bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
......
......@@ -3,7 +3,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore {
namespace formulasconvert {
......@@ -459,14 +459,14 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring& expr)
//â
//Sheet2.C3:Sheet2.C19 Sheet2.L29:Sheet2.L36
//todooo
std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring& expr)
std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring& expr1)
{
if (is_forbidden1(expr))
return L"NULLFORMULA()";
std::wstring expr = expr1;
int res = expr.find(L"(");
if (res >=0) expr = expr.substr(res + 1, expr.size()-1);
//std::wstring workstr = expr;
//replace_space(workstr);
//return workstr;
res= expr.find(L")");
if (res >=0) expr = expr.substr(0, res);
//ðàñïàðñèòü ïî äèàïàçîíàì - îäô-ïðîáåë, èê-ýëü-çàïÿòàÿ
......@@ -561,6 +561,94 @@ std::wstring oox2odf_converter::convert_spacechar(std::wstring expr)
}
return expr;
}
size_t getColAddressInv(const std::wstring & a_)
{
std::wstring a = a_;
::boost::algorithm::to_upper(a);
static const size_t r = (L'Z' - L'A' + 1);
size_t mul = 1;
bool f = true;
size_t res = 0;
BOOST_REVERSE_FOREACH(const wchar_t c, a)
{
size_t v = c - L'A';
if (f)
f = false;
else
v += 1;
res += v * mul;
mul *= r;
}
return res;
}
size_t getRowAdderssInv(const std::wstring & a_)
{
int sz = a_.length();
if (a_.length()>0)
{
return boost::lexical_cast<size_t>(a_)-1;
}
else
return 0;
}
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
{
std::wstring a = a_;
std::reverse(a.begin(), a.end());
::boost::algorithm::replace_all(a, L"$", L"");
//::boost::algorithm::replace_all(a, L"'", L"");
::boost::algorithm::to_upper(a);
BOOST_FOREACH(wchar_t c, a)
{
if (c >= L'0' && c <= L'9')
row +=c;
else
col += c;
}
std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.end());
}
void getCellAddressInv(const std::wstring & a_, int & col, int & row)
{
std::wstring colStr=L"", rowStr=L"";
splitCellAddress(a_, colStr, rowStr);
col = getColAddressInv(colStr);
row = getRowAdderssInv(rowStr);
}
int oox2odf_converter::get_count_value_points(std::wstring expr)
{
int count =0;
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (long i=0; i < splitted.size(); i++)
{
int res = splitted[i].find(L"!");
if (res > 0) splitted[i] = splitted[i].substr(res+1, splitted[i].size()-res);
std::vector< std::wstring >cells;
boost::algorithm::split(cells, splitted[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (cells.size() >1)
{
int col_1, row_1, col_2, row_2;
getCellAddressInv(cells[0],col_1,row_1);
getCellAddressInv(cells[1],col_2,row_2);
count += std::max(col_2-col_1+1, row_2-row_1+1);
}
else count ++;
}
return count;
}
//bool oox2odf_converter::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
......
......@@ -295,7 +295,7 @@ std::wstring xlsx_text_context::Impl::dump_text()
CP_XML_NODE(prefix_draw + L"t")
{
CP_XML_ATTR(L"xml:space", L"preserve");
if (!in_draw)CP_XML_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM() << content;
}
}
......
......@@ -107,6 +107,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0");
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart");
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_NODE(L"office:meta")
{
......@@ -294,6 +295,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
......@@ -356,6 +358,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
......
......@@ -28,6 +28,10 @@ namespace cpdoccore
{
namespace odf
{
static const std::wstring default_MS_series_colors[] =
{
L"#355a86", L"#883533", L"#6e963c", L"#594573", L"#327a8d", L"#3d679a", L"#9d3e3b", L"#7e9945", L"#674f84", L"#398ba2", L"#cb7934"
};
struct odf_element_state
{
office_element_ptr elm;
......@@ -57,36 +61,43 @@ namespace odf
std::vector<odf_element_state> elements_;
};
struct odf_chart_level_state
{
style_text_properties *text_properties_;
style_graphic_properties *graphic_properties_;
style_paragraph_properties *paragraph_properties_;
style_chart_properties *chart_properties_;
office_element_ptr elm;
};
class odf_chart_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
styles_context_ = NULL;
current_series_count_= 0;
current_text_properties_ = NULL;
current_paragraph_properties_ = NULL;
current_graphic_properties_ = NULL;
current_chart_properties_ = NULL;
}
odf_chart_state current_chart_state_;
int current_series_count_;
int current_data_points_series_count_;
std::vector<std::wstring> categories_;
std::vector<std::pair<std::wstring,int>>categories_;
std::vector<odf_axis_state> axis_;
std::vector<office_element_ptr> group_series_;
std::vector<unsigned int> axis_group_series_;
std::vector<office_element_ptr> current_level_; //
std::vector<odf_chart_level_state> current_level_; //
std::vector<odf_chart_state> chart_list_; // .. ""
////////
void set_default_series_color();
void clear_current();
odf_style_context *styles_context_;
odf_conversion_context *odf_context_;
style_text_properties *current_text_properties_;
style_graphic_properties *current_graphic_properties_;
style_paragraph_properties *current_paragraph_properties_;
style_chart_properties *current_chart_properties_;
chart_chart *get_current_chart();
chart_axis *get_current_axis();
};
......@@ -105,6 +116,24 @@ chart_axis * odf_chart_context::Impl::get_current_axis()
return NULL;
}
void odf_chart_context::Impl::clear_current()
{
current_chart_state_.clear();
categories_.clear();
axis_.clear();
group_series_.clear();
current_series_count_ = 0;
}
void odf_chart_context::Impl::set_default_series_color()
{
if (!current_level_.back().graphic_properties_)return;
color col = color(default_MS_series_colors[current_series_count_]);
current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->content().svg_stroke_color_ = col;
}
////////////////////////////////////////////////////////////////////////////
odf_chart_context::odf_chart_context(odf_conversion_context *odf_context)
......@@ -145,13 +174,17 @@ void odf_chart_context::start_chart(office_element_ptr & root)
office_element_ptr & style_elm = impl_->styles_context_->last_state().get_office_element();
int level = impl_->current_level_.size();
std::wstring style_name;
odf_element_state state={chart_elm, style_name, style_elm, level};
odf_chart_level_state level_state = {NULL,NULL,NULL,NULL,chart_elm};
style* style_ = dynamic_cast<style*>(style_elm.get());
if (style_)
{
style_name = style_->style_name_;
impl_->current_chart_properties_ = style_->style_content_.get_style_chart_properties();
level_state.chart_properties_ = style_->style_content_.get_style_chart_properties();
chart->chart_chart_attlist_.common_attlist_.chart_style_name_ = style_name;
}
......@@ -159,17 +192,15 @@ void odf_chart_context::start_chart(office_element_ptr & root)
drawing_context()->start_element(chart_elm, style_elm);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int level = impl_->current_level_.size();
//if (impl_->current_level_.size()>0) impl_->current_level_.back()->add_child_element(chart_elm); ... drawing
impl_->current_level_.push_back(chart_elm);
impl_->current_level_.push_back(level_state);
odf_element_state state={chart_elm, style_name, style_elm, level};
impl_->current_chart_state_.elements_.push_back(state);
}
void odf_chart_context::set_size_chart(double width_pt, double height_pt)
void odf_chart_context::set_chart_size(double width_pt, double height_pt)
{
impl_->current_chart_state_.chart_height_pt = height_pt;
impl_->current_chart_state_.chart_width_pt = width_pt;
......@@ -180,17 +211,93 @@ void odf_chart_context::set_size_chart(double width_pt, double height_pt)
chart->chart_chart_attlist_.common_draw_size_attlist_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
chart->chart_chart_attlist_.common_draw_size_attlist_.svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_chart_context::set_type_chart(std::wstring type)
void odf_chart_context::set_chart_type(std::wstring type)
{
chart_chart *chart = impl_->get_current_chart();
if (!chart)return;
chart->chart_chart_attlist_.chart_class_ = std::wstring(L"chart:") + type;
}
void odf_chart_context::set_3D(bool Val)
void odf_chart_context::set_chart_3D(bool val)
{
if (!impl_->current_chart_properties_) return;
impl_->current_chart_properties_->content().chart_three_dimensional_ = Val;
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val;
}
void odf_chart_context::set_chart_colored(bool val)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val;
}
void odf_chart_context::set_marker_size(int size)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_symbol_width_ = length(size,length::pt);
impl_->current_level_.back().chart_properties_->content().chart_symbol_height_ = length(size,length::pt);
}
void odf_chart_context::set_marker_type(int type)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::namedSymbol);
switch(type)
{
case 0://st_markerstyleCIRCLE = 0,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
case 1://st_markerstyleDASH = 1,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
case 2://st_markerstyleDIAMOND = 2,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::diamondSymbol); break;
case 3://st_markerstyleDOT = 3,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
case 4://st_markerstyleNONE = 4,
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol); break;
case 5://st_markerstylePICTURE = 5,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::asteriskSymbol); break;
case 6://st_markerstylePLUS = 6,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::plusSymbol); break;
case 7://st_markerstyleSQUARE = 7,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::squareSymbol); break;
case 8://st_markerstyleSTAR = 8,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::starSymbol); break;
case 9://st_markerstyleTRIANGLE = 9,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::hourglassSymbol); break;
case 10://st_markerstyleX = 10,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::asteriskSymbol); break;
case 11://st_markerstyleAUTO = 11
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::autoSymbol); break;
default:
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
}
}
void odf_chart_context::set_chart_scatter_type(int type)
{
if (!impl_->current_level_.back().chart_properties_) return;
switch(type)
{
case 0://st_scatterstyleNONE
break;
case 1://st_scatterstyleLINE
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
break;
case 2://st_scatterstyleLINEMARKER
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
case 3://st_scatterstyleMARKER
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
case 4://st_scatterstyleSMOOTH
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
impl_->current_level_.back().chart_properties_->content().chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
break;
case 5://st_scatterstyleSMOOTHMARKER
impl_->current_level_.back().chart_properties_->content().chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
}
}
void odf_chart_context::start_group_series()
{
......@@ -217,12 +324,28 @@ void odf_chart_context::start_series(std::wstring type)
series->chart_series_attlist_.chart_class_ = std::wstring(L"chart:") + type;
}
start_element(elm, style_elm, style_name);
impl_->group_series_.push_back(elm);
//////////////////////////////////////////////////////////////
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->set_default_series_color();
}
impl_->current_series_count_ ++;
}
void odf_chart_context::end_series()
{
if ((impl_->categories_.size() > 0) && impl_->categories_.back().second == 2)
{
add_domain(impl_->categories_.back().first);
}
end_element();
}
void odf_chart_context::set_label_delete(bool val)
{
if (!impl_->current_chart_properties_)return;
impl_->current_chart_properties_->content().chart_display_label_ = !val;
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = !val;
}
void odf_chart_context::set_label_show_bubble_size(bool val)
{
......@@ -238,16 +361,16 @@ void odf_chart_context::set_label_show_legend_key(bool val)
}
void odf_chart_context::set_label_show_percent(bool val)
{
if (!impl_->current_chart_properties_)return;
impl_->current_chart_properties_->content().chart_percentage_ = val;
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_percentage_ = val;
}
void odf_chart_context::set_label_show_ser_name(bool val)
{
}
void odf_chart_context::set_label_show_values(bool val)
{
if (!impl_->current_chart_properties_ || !val)return;
impl_->current_chart_properties_->content().chart_data_label_number_=chart_data_label_number(chart_data_label_number::value);
if (!impl_->current_level_.back().chart_properties_ || !val)return;
impl_->current_level_.back().chart_properties_->content().chart_data_label_number_=chart_data_label_number(chart_data_label_number::value);
}
void odf_chart_context::add_axis_group_series(unsigned int id)
{
......@@ -282,6 +405,24 @@ void odf_chart_context::end_group_series()
impl_->group_series_.clear();
impl_->axis_group_series_.clear();
}
void odf_chart_context::add_domain(std::wstring formula)
{
int level = impl_->current_level_.size();
if (level < 1)return;
office_element_ptr elm;
create_element(L"chart", L"domain", elm, impl_->odf_context_);
chart_domain *domain = dynamic_cast<chart_domain*>(elm.get());
if (domain == NULL)return;
domain->table_cell_range_address_ = formula;
if (impl_->current_level_.back().elm)impl_->current_level_.back().elm->add_child_element(elm);
odf_element_state state={elm, L"",office_element_ptr(), level};
impl_->current_chart_state_.elements_.push_back(state);
}
void odf_chart_context::add_categories(std::wstring formula, office_element_ptr & axis)
{
office_element_ptr elm;
......@@ -325,7 +466,7 @@ void odf_chart_context::start_axis()
odf_axis_state axis_state={0,0,L"",elm};
impl_->axis_.push_back(axis_state);
/////////////////////defaults
impl_->current_chart_properties_->content().chart_reverse_direction_ = false;
impl_->current_level_.back().chart_properties_->content().chart_reverse_direction_ = false;
}
void odf_chart_context::start_grid(int type)
{
......@@ -409,11 +550,11 @@ void odf_chart_context::start_text()
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
if (style_)
{
impl_->current_paragraph_properties_ = style_->style_content_.get_style_paragraph_properties();
impl_->current_text_properties_ = style_->style_content_.get_style_text_properties();
impl_->current_level_.back().paragraph_properties_ = style_->style_content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->style_content_.get_style_text_properties();
}
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_paragraph_properties_,impl_->current_text_properties_);
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
}
void odf_chart_context::end_text()
{
......@@ -424,7 +565,7 @@ void odf_chart_context::end_text()
{
if (text_context_->text_elements_list_[i].level ==0)
{
impl_->current_level_.back()->add_child_element(text_context_->text_elements_list_[i].elm);
impl_->current_level_.back().elm->add_child_element(text_context_->text_elements_list_[i].elm);
}
int level_root = impl_->current_level_.size() + 1;
......@@ -438,13 +579,61 @@ void odf_chart_context::end_text()
impl_->odf_context_->end_text_context();
}
void odf_chart_context::start_floor()
{
office_element_ptr elm;
create_element(L"chart", L"floor", elm, impl_->odf_context_);
chart_floor *floor = dynamic_cast<chart_floor*>(elm.get());
if (floor == 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*>(style_elm.get());
if (style_)
{
style_name = style_->style_name_;
floor->common_attlist_.chart_style_name_ = style_name;
}
start_element(elm, style_elm, style_name);
}
void odf_chart_context::start_wall()
{
office_element_ptr elm;
create_element(L"chart", L"wall", elm, impl_->odf_context_);
chart_wall *wall = dynamic_cast<chart_wall*>(elm.get());
if (wall == 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*>(style_elm.get());
if (style_)
{
style_name = style_->style_name_;
wall->chart_wall_attlist_.common_attlist_.chart_style_name_ = style_name;
}
start_element(elm, style_elm, style_name);
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
if (impl_->current_level_.back().graphic_properties_)
impl_->current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
}
}
void odf_chart_context::start_legend()
{
office_element_ptr chart_elm;
create_element(L"chart", L"legend", chart_elm, impl_->odf_context_);
office_element_ptr elm;
create_element(L"chart", L"legend", elm, impl_->odf_context_);
chart_legend *legend = dynamic_cast<chart_legend*>(chart_elm.get());
chart_legend *legend = dynamic_cast<chart_legend*>(elm.get());
if (legend == NULL)return;
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
......@@ -458,9 +647,36 @@ void odf_chart_context::start_legend()
style_name = style_->style_name_;
legend->chart_legend_attlist_.common_attlist_.chart_style_name_ = style_name;
}
start_element(chart_elm, style_elm, style_name);
start_element(elm, style_elm, style_name);
}
long odf_chart_context::get_count_data_points_series()
{
return impl_->current_data_points_series_count_;
}
void odf_chart_context::start_data_point_series(int count)
{
office_element_ptr elm;
create_element(L"chart", L"data-point", elm, impl_->odf_context_);
chart_data_point *data_point = dynamic_cast<chart_data_point*>(elm.get());
if (data_point == NULL)return;
if (count < 1) count = get_count_data_points_series();
data_point->chart_data_point_attlist_.chart_repeated_ = count;
//////////
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*>(style_elm.get());
if (style_)
{
style_name = style_->style_name_;
data_point->chart_data_point_attlist_.common_attlist_.chart_style_name_ = style_name;
}
start_element(elm, style_elm, style_name);
}
void odf_chart_context::set_legend_position(int val)
{
chart_legend *legend = dynamic_cast<chart_legend*>(impl_->current_chart_state_.elements_.back().elm.get());
......@@ -492,29 +708,29 @@ void odf_chart_context::set_layout_x(double *val,int mode)//edge, factor
}
void odf_chart_context::set_axis_label(int type)
{
if (!impl_->current_chart_properties_)return;
if (!impl_->current_level_.back().chart_properties_)return;
if (type == 1 || type == 2)
impl_->current_chart_properties_->content().chart_display_label_ = true;
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = true;
}
void odf_chart_context::set_axis_orientation(int type)
{
if (!impl_->current_chart_properties_)return;
if (type == 0) impl_->current_chart_properties_->content().chart_reverse_direction_ = true;
if (!impl_->current_level_.back().chart_properties_)return;
if (type == 0) impl_->current_level_.back().chart_properties_->content().chart_reverse_direction_ = true;
}
void odf_chart_context::set_axis_max(double val)
{
if (!impl_->current_chart_properties_)return;
impl_->current_chart_properties_->content().chart_maximum_ = val;
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_maximum_ = val;
}
void odf_chart_context::set_axis_min(double val)
{
if (!impl_->current_chart_properties_)return;
impl_->current_chart_properties_->content().chart_minimum_ = val;
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_minimum_ = val;
}
void odf_chart_context::set_axis_logarithmic(bool val)
{
if (!impl_->current_chart_properties_)return;
impl_->current_chart_properties_->content().chart_logarithmic_ = val;
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_logarithmic_ = val;
}
void odf_chart_context::set_axis_id(unsigned int id)
{
......@@ -541,28 +757,28 @@ void odf_chart_context::set_axis_dimension(int type)
}
void odf_chart_context::set_axis_position(int type)
{
if (!impl_->current_chart_properties_)return;
if (!impl_->current_level_.back().chart_properties_)return;
//st_axposB = 0,
//st_axposL = 1,
//st_axposR = 2,
//st_axposT = 3
//if (type ==0 || type ==2)
// impl_->current_chart_properties_->content().chart_axis_position_ = L"end";
// impl_->current_level_.back().chart_properties_->content().chart_axis_position_ = L"end";
//if (type ==1 || type ==3)
// impl_->current_chart_properties_->content().chart_axis_position_ = L"start";
// impl_->current_level_.back().chart_properties_->content().chart_axis_position_ = L"start";
//a value of type double the axis line is placed at the given value on the crossing axis.
//If the crossing axis is an axis displaying categories rather than values, a value of 1 indicates that the axis should be placed at the first category, a value of 2 indicates that the axis should be placed at the second category and so forth.
}
void odf_chart_context::set_axis_label_position(int type)
{
if (!impl_->current_chart_properties_)return;
if (!impl_->current_level_.back().chart_properties_)return;
//st_ticklblposHIGH = 0,
//st_ticklblposLOW = 1,
//st_ticklblposNEXTTO = 2,
//st_ticklblposNONE = 3
if (type ==1)impl_->current_chart_properties_->content().chart_axis_label_position_ = L"outside-start";
if (type ==0)impl_->current_chart_properties_->content().chart_axis_label_position_ = L"outside-end";
if (type ==2)impl_->current_chart_properties_->content().chart_axis_label_position_ = L"near-axis";
if (type ==1)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"outside-start";
if (type ==0)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"outside-end";
if (type ==2)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"near-axis";
//near-axis-other-side
//near-axis //default
......@@ -618,41 +834,38 @@ void odf_chart_context::start_element(office_element_ptr & elm, office_element_p
drawing_context()->start_element(elm, style_elm);
//if (impl_->current_level_.size()>0) impl_->current_level_.back()->add_child_element(elm); ... start_element drawing
impl_->current_level_.push_back(elm);// current_chart_properties ????
odf_element_state state={elm, style_name, style_elm, level};
odf_chart_level_state level_state = {NULL,NULL,NULL,NULL,elm};
impl_->current_text_properties_ = NULL;
impl_->current_paragraph_properties_ = NULL;
impl_->current_graphic_properties_ = NULL;
impl_->current_chart_properties_ = NULL;
impl_->current_chart_state_.elements_.push_back(state);
style* style_ = dynamic_cast<style*>(style_elm.get());
if (style_)
{
style_name = style_->style_name_;
impl_->current_chart_properties_ = style_->style_content_.get_style_chart_properties();
level_state.chart_properties_ = style_->style_content_.get_style_chart_properties();
}
odf_element_state state={elm, style_name, style_elm, level};
impl_->current_level_.push_back(level_state);// current_chart_properties ????
impl_->current_chart_state_.elements_.push_back(state);
}
void odf_chart_context::end_element()
{
//
{
if (impl_->current_paragraph_properties_)
if (impl_->current_level_.back().paragraph_properties_)
{
if (impl_->current_paragraph_properties_->content().style_writing_mode_)
if (impl_->current_level_.back().paragraph_properties_->content().style_writing_mode_)
{
switch(impl_->current_paragraph_properties_->content().style_writing_mode_->get_type())
switch(impl_->current_level_.back().paragraph_properties_->content().style_writing_mode_->get_type())
{
case writing_mode::LrTb:
case writing_mode::RlTb:
case writing_mode::Lr:
impl_->current_chart_properties_->content().style_direction_ = direction(direction::Ltr); break;
impl_->current_level_.back().chart_properties_->content().style_direction_ = direction(direction::Ltr); break;
case writing_mode::TbRl:
case writing_mode::TbLr:
case writing_mode::Tb:
impl_->current_chart_properties_->content().style_direction_ = direction(direction::Ttb); break;
impl_->current_level_.back().chart_properties_->content().style_direction_ = direction(direction::Ttb); break;
}
}
}
......@@ -660,10 +873,6 @@ void odf_chart_context::end_element()
impl_->current_level_.pop_back();
drawing_context()->end_element();
impl_->current_paragraph_properties_ = NULL;
impl_->current_graphic_properties_ = NULL;
impl_->current_chart_properties_ = NULL;
}
void odf_chart_context::end_chart()
......@@ -675,15 +884,24 @@ void odf_chart_context::end_chart()
for (long i=0; i< impl_->axis_.size() && impl_->categories_.size() > 0; i++)
{
if (impl_->axis_[i].elm == NULL)continue;
add_categories(impl_->categories_[0],impl_->axis_[i].elm);
if (impl_->categories_[0].second == 1)
{
add_categories(impl_->categories_[0].first,impl_->axis_[i].elm);
}
else
{
if (i==0)
{
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"x";
axis->chart_axis_attlist_.chart_name_ = L"axis-x";
}
}
}
///////////////
impl_->chart_list_.push_back(impl_->current_chart_state_);
impl_->current_chart_state_.clear();
impl_->categories_.clear();
impl_->axis_.clear();
impl_->group_series_.clear();
impl_->clear_current();
}
static formulasconvert::oox2odf_converter formulas_converter;
......@@ -695,6 +913,8 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
if (series == NULL)return;
series->chart_series_attlist_.chart_values_cell_range_address_ = odfFormula;
impl_->current_data_points_series_count_ = formulas_converter.get_count_value_points(oox_formula);
}
void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
{
......@@ -705,11 +925,13 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
series->chart_series_attlist_.chart_label_cell_address_ = odfFormula;
}
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula)
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type)
{
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
impl_->categories_.push_back(odfFormula);
impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula,type));
}
}
}
\ No newline at end of file
......@@ -30,16 +30,24 @@ public:
odf_text_context *text_context();
void start_chart(office_element_ptr & root);
void set_type_chart(std::wstring type);
void set_3D(bool Val);
void set_size_chart(double width_pt, double height_pt);
void set_chart_type(std::wstring type);
void set_chart_3D(bool Val);
void set_chart_size(double width_pt, double height_pt);
void set_chart_colored(bool val);
void set_chart_scatter_type(int type);
void set_marker_size(int size);
void set_marker_type(int type);
void start_group_series();
void add_axis_group_series(unsigned int id);
void start_series(std::wstring type);
void set_series_value_formula(std::wstring oox_formula);
void set_series_label_formula(std::wstring oox_formula);
void set_category_axis_formula(std::wstring oox_formula);
void set_category_axis_formula(std::wstring oox_formula,int type);
void start_data_point_series(int count);
long get_count_data_points_series();
void end_series();
void end_group_series();
void set_label_name(std::wstring name);
......@@ -66,6 +74,8 @@ public:
void start_grid(int type);
void start_plot_area();
void start_legend();
void start_floor();
void start_wall();
void set_legend_position(int val);
void start_element(office_element_ptr & elm, office_element_ptr & style_elm, std::wstring style_name);
......@@ -74,6 +84,7 @@ public:
void start_text();
void end_text();
void add_domain(std::wstring formula);
void add_categories(std::wstring formula, office_element_ptr & axis);
void set_layout_x(double *val,int mode);
......
......@@ -2,6 +2,7 @@
#include <boost_filesystem_version.h>
#include <cpdoccore/CPOptional.h>
#include <atlcoll.h>
static std::wstring string2std_string(CString val)
{
......@@ -293,7 +294,7 @@ public:
void convert(OOX::Spreadsheet::CT_ScatterSer *ser);
void convert(OOX::Spreadsheet::CT_RadarSer *ser);
void convert(OOX::Spreadsheet::CT_LineSer *ser);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat, int type);
void convert(OOX::Spreadsheet::CT_NumDataSource *val);
void convert(OOX::Spreadsheet::CRichText *rich);
void convert(OOX::Spreadsheet::CTextProperties *txPr);
......@@ -303,6 +304,8 @@ public:
void convert(OOX::Spreadsheet::CT_ChartLines *grid, int type);
void convert(OOX::Spreadsheet::CT_SerTx *ser_tx);
void convert(OOX::Spreadsheet::CT_DLbls *ser_lbls);
void convert(OOX::Spreadsheet::CT_Marker *marker, int count);
void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
};
......
......@@ -33,6 +33,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
convert(oox_chart->m_chart->m_sideWall, 2);
convert(oox_chart->m_chart->m_backWall, 3);
convert(oox_chart->m_chart->m_floor, 1);
}
void OoxConverter::convert(OOX::Spreadsheet::CRichText* rich)
......@@ -126,7 +127,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
if (ct_plotArea == NULL)return;
odf_context()->chart_context()->start_plot_area();
convert(ct_plotArea->m_oSpPr.GetPointer());
//convert(ct_plotArea->m_oSpPr.GetPointer());
convert(ct_plotArea->m_layout);
///////////////////////
for (long i=0; i< ct_plotArea->m_Items1.GetCount(); i++)
......@@ -166,7 +167,11 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
if (ct_plotArea->m_dTable)
{
}
odf_context()->chart_context()->start_wall();
convert(ct_plotArea->m_oSpPr.GetPointer());
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_element();
}
//////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
......@@ -303,8 +308,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Area3DChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"area");
odf_context()->chart_context()->set_3D(true);
odf_context()->chart_context()->set_chart_type(L"area");
odf_context()->chart_context()->set_chart_3D(true);
for (long i=0; i< chart->m_ser.GetCount(); i++)
{
......@@ -315,7 +320,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AreaChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"area");
odf_context()->chart_context()->set_chart_type(L"area");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -334,8 +339,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"bar");
odf_context()->chart_context()->set_3D(true);
odf_context()->chart_context()->set_chart_type(L"bar");
odf_context()->chart_context()->set_chart_3D(true);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -354,7 +359,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"bar");
odf_context()->chart_context()->set_chart_type(L"bar");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -371,8 +376,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Line3DChart *chart)
{
odf_context()->chart_context()->set_type_chart(L"line");
odf_context()->chart_context()->set_3D(true);
odf_context()->chart_context()->set_chart_type(L"line");
odf_context()->chart_context()->set_chart_3D(true);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -390,7 +395,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LineChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"line");
odf_context()->chart_context()->set_chart_type(L"line");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -408,8 +413,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Pie3DChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"circle");
odf_context()->chart_context()->set_3D(true);
odf_context()->chart_context()->set_chart_type(L"circle");
odf_context()->chart_context()->set_chart_3D(true);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -427,7 +432,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PieChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"circle");
odf_context()->chart_context()->set_chart_type(L"circle");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -445,8 +450,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Surface3DChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"surface");
odf_context()->chart_context()->set_3D(true);
odf_context()->chart_context()->set_chart_type(L"surface");
odf_context()->chart_context()->set_chart_3D(true);
odf_context()->chart_context()->start_group_series();
for (long i=0; i< chart->m_ser.GetCount(); i++)
......@@ -463,7 +468,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"surface");
odf_context()->chart_context()->set_chart_type(L"surface");
odf_context()->chart_context()->start_group_series();
for (long i=0; i< chart->m_ser.GetCount(); i++)
......@@ -480,7 +485,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BubbleChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"bubble");
odf_context()->chart_context()->set_chart_type(L"bubble");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -498,7 +503,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DoughnutChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"ring");
odf_context()->chart_context()->set_chart_type(L"ring");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -516,10 +521,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"scatter");
odf_context()->chart_context()->set_chart_type(L"scatter");
convert(chart->m_dLbls);
if (chart->m_varyColors && chart->m_varyColors->m_val)
odf_context()->chart_context()->set_chart_colored(*chart->m_varyColors->m_val);
if (chart->m_scatterStyle && chart->m_scatterStyle->m_val)
odf_context()->chart_context()->set_chart_scatter_type(*chart->m_scatterStyle->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
for (long i=0; i< chart->m_ser.GetCount(); i++)
{
convert(chart->m_ser[i]);
......@@ -534,7 +543,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_RadarChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"radar");
odf_context()->chart_context()->set_chart_type(L"radar");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -552,7 +561,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StockChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"stock");
odf_context()->chart_context()->set_chart_type(L"stock");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -570,7 +579,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_OfPieChart *chart)
{
if (chart == NULL)return;
odf_context()->chart_context()->set_type_chart(L"circle");
odf_context()->chart_context()->set_chart_type(L"circle");
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -589,10 +598,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AreaSer* ser)
odf_context()->chart_context()->start_series(L"area");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BubbleSer* ser)
{
......@@ -601,10 +610,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BubbleSer* ser)
odf_context()->chart_context()->start_series(L"bubble");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_xVal);
convert(ser->m_xVal,2);
convert(ser->m_yVal);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceSer* ser)
{
......@@ -612,10 +621,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceSer* ser)
odf_context()->chart_context()->start_series(L"surface");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_PieSer* ser)
{
......@@ -624,10 +633,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PieSer* ser)
odf_context()->chart_context()->start_series(L"circle");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser)
{
......@@ -636,10 +645,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser)
odf_context()->chart_context()->start_series(L"bar");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser)
{
......@@ -648,10 +657,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser)
odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_xVal);
convert(ser->m_xVal,2);//domain
convert(ser->m_yVal);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
if (ser->m_marker || ser->m_dPt.GetCount() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_RadarSer* ser)
{
......@@ -660,10 +673,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_RadarSer* ser)
odf_context()->chart_context()->start_series(L"radar");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_element();
if (ser->m_marker || ser->m_dPt.GetCount() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_LineSer* ser)
{
......@@ -672,9 +689,48 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LineSer* ser)
odf_context()->chart_context()->start_series(L"line");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.GetCount() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt)
{
long count_point = odf_context()->chart_context()->get_count_data_points_series();
if (dPt.GetCount() <1) return convert(marker , count_point);
long current_point = 1;
long set_point;
for (long i =0 ;i < dPt.GetCount(); i++)
{
if (dPt[i] == NULL)continue;
if (dPt[i]->m_idx && dPt[i]->m_idx->m_val) set_point = *dPt[i]->m_idx->m_val;
if (set_point - current_point > 0)convert(marker,set_point - current_point);
convert(dPt[i]->m_marker,1);
current_point = set_point;
}
if (count_point - current_point >0) convert(marker,count_point - current_point);
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, int count)
{
if (count < 1)return;
odf_context()->chart_context()->start_data_point_series(count);
if (marker)
{
if (marker->m_symbol && marker->m_symbol->m_val)
odf_context()->chart_context()->set_marker_type(*marker->m_symbol->m_val);
if (marker->m_size && marker->m_size->m_val)
odf_context()->chart_context()->set_marker_size(*marker->m_size->m_val);
convert(marker->m_oSpPr.GetPointer());
}
odf_context()->chart_context()->end_element();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_DLbls* ser_lbls)
......@@ -729,22 +785,22 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
//if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v));
}
void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat)
void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
{
if (cat == NULL)
{
odf_context()->chart_context()->set_category_axis_formula(L"");
odf_context()->chart_context()->set_category_axis_formula(L"",type);
return;
}
if (cat->m_strRef)
{
if (cat->m_strRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f));
if (cat->m_strRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f),type);
if (cat->m_strRef->m_strCache){}
}
else if (cat->m_numRef)
{
if (cat->m_numRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f));
if (cat->m_numRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f),type);
if (cat->m_numRef->m_numCache){}
}
else if (cat->m_numLit)
......@@ -769,6 +825,13 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
///////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_Surface* ct_surface, int type)
{
if (ct_surface == NULL)return;
//floor, side, back
//if (type == 1)odf_context()->chart_context()->start_floor();
//if (type == 2)odf_context()->chart_context()->start_side_wall();
//if (type == 3)odf_context()->chart_context()->start_back_wall();
//odf_context()->chart_context()->end_element();
}
}
\ No newline at end of file
......@@ -1266,9 +1266,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGraphicFrame* oox_graphic_frame)
if (pChart)
{
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
oox_current_chart = pChart;
odf_context()->start_chart();
odf_context()->chart_context()->set_size_chart(width, height);
odf_context()->chart_context()->set_chart_size(width, height);
OoxConverter::convert(&pChart->m_oChartSpace);
odf_context()->end_chart();
oox_current_chart = NULL; // object???
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//42
#define INTVER 1,2,0,42
#define STRVER "1,2,0,42\0"
//43
#define INTVER 1,2,0,43
#define STRVER "1,2,0,43\0"
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