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

продолжение предыдущего ..

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56235 954022d7-b5bf-4e40-9824-e11837661b57
parent db51fc34
......@@ -465,7 +465,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
int res = expr.find(L"(");
if (res >=0) expr = expr.substr(res + 1, expr.size()-1);
res= expr.find(L")");
res= expr.rfind(L")");
if (res >=0) expr = expr.substr(0, res);
//ðàñïàðñèòü ïî äèàïàçîíàì - îäô-ïðîáåë, èê-ýëü-çàïÿòàÿ
......@@ -627,6 +627,8 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
int count =0;
std::vector< std::wstring > splitted;
boost::algorithm::replace_all(expr, L"(", L"");
boost::algorithm::replace_all(expr, L")", L"");
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (long i=0; i < splitted.size(); i++)
......
......@@ -246,7 +246,7 @@ void odf_chart_context::set_marker_type(int 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;
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::horizontal_barSymbol); 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,
......@@ -262,9 +262,9 @@ void odf_chart_context::set_marker_type(int type)
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;
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::arrow_upSymbol); break;
case 10://st_markerstyleX = 10,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::asteriskSymbol); break;
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::xSymbol); 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:
......@@ -332,6 +332,10 @@ void odf_chart_context::start_series(std::wstring type)
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->set_default_series_color();
}
//if (type == L"scatter" || type == L"line" || type == L"radar")
//{
// impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
//}
impl_->current_series_count_ ++;
}
void odf_chart_context::end_series()
......@@ -380,20 +384,44 @@ void odf_chart_context::end_group_series()
{
std::wstring axis_name;
bool presentZ = false;
long countX = 0;
long countY = 0;
for (long j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].dimension ==1) countX++;
else if (impl_->axis_[j].dimension ==3) presentZ = true;
else countY++;
}
if (countX < 1 && countY > 1)
{
impl_->axis_[0].dimension == 1;
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[0].elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"x";
countY--;
}
if (presentZ == false && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
{
impl_->axis_.back().dimension == 3;
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"z";
countY--;
}
for (long i=0; i < impl_->axis_group_series_.size(); i++)
{
for (long j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].dimension ==1)continue;
if (impl_->axis_[j].oox_id == impl_->axis_group_series_[i])
if (impl_->axis_[j].oox_id == impl_->axis_group_series_[i] && impl_->axis_[j].dimension ==2)
{
axis_name = impl_->axis_[j].name;
axis_name = impl_->axis_[j].name;// Y
break;
}
}
if (axis_name.length() > 0)break;
}
for (long i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
{
chart_series *series= dynamic_cast<chart_series*>(impl_->group_series_[i].get());
......@@ -867,6 +895,7 @@ void odf_chart_context::end_element()
case writing_mode::Tb:
impl_->current_level_.back().chart_properties_->content().style_direction_ = direction(direction::Ttb); break;
}
impl_->current_level_.back().chart_properties_->content().common_rotation_angle_attlist_.style_rotation_angle_ =0;
}
}
}
......@@ -890,12 +919,11 @@ void odf_chart_context::end_chart()
}
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";
}
//if (i==0)
//{
// chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get());
// axis->chart_axis_attlist_.chart_dimension_ = L"x";
//}
}
}
///////////////
......@@ -933,5 +961,12 @@ void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int t
impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula,type));
}
void odf_chart_context::set_series_pie_explosion(int val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_pie_offset_ = val;
}
}
}
\ No newline at end of file
......@@ -47,6 +47,8 @@ public:
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 set_series_pie_explosion(int val);
void end_series();
void end_group_series();
......
......@@ -505,16 +505,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DoughnutChart *chart)
odf_context()->chart_context()->set_chart_type(L"ring");
//m_holeSize
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]);
}
//for (long i=0; i< chart->m_axId.GetCount(); i++)
//{
// odf_context()->chart_context()->add_axis_group_series(*chart->m_axId[i]->m_val);
//}
odf_context()->chart_context()->end_group_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterChart *chart)
......@@ -601,6 +599,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AreaSer* ser)
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.GetCount() > 0)
{
convert(NULL, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BubbleSer* ser)
......@@ -610,9 +612,13 @@ 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,2);
convert(ser->m_xVal, 2);
convert(ser->m_yVal);
convert(ser->m_tx);
if (ser->m_dPt.GetCount() > 0)
{
convert(NULL, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceSer* ser)
......@@ -631,11 +637,17 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PieSer* ser)
if (ser == NULL)return;
odf_context()->chart_context()->start_series(L"circle");
if (ser->m_explosion && ser->m_explosion->m_val)
odf_context()->chart_context()->set_series_pie_explosion(*ser->m_explosion->m_val);
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.GetCount() > 0)
{
convert(NULL, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser)
......@@ -648,6 +660,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser)
convert(ser->m_cat,1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.GetCount() > 0)
{
convert(NULL, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser)
......@@ -700,11 +716,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LineSer* ser)
}
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 , -1);
if (dPt.GetCount() <1) return convert(marker , count_point);
long current_point = 1;
long count_point = odf_context()->chart_context()->get_count_data_points_series();
long current_point = 0;
long set_point;
for (long i =0 ;i < dPt.GetCount(); i++)
{
......@@ -714,15 +729,13 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, CAtlArray<OOX::S
if (set_point - current_point > 0)convert(marker,set_point - current_point);
convert(dPt[i]->m_marker,1);
current_point = set_point;
current_point = set_point+1;
}
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 (count >0)odf_context()->chart_context()->start_data_point_series(count);
if (marker)
{
if (marker->m_symbol && marker->m_symbol->m_val)
......@@ -731,7 +744,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, int count)
odf_context()->chart_context()->set_marker_size(*marker->m_size->m_val);
convert(marker->m_oSpPr.GetPointer());
}
odf_context()->chart_context()->end_element();
if (count >0)odf_context()->chart_context()->end_element();
}
void OoxConverter::convert(OOX::Spreadsheet::CT_DLbls* ser_lbls)
{
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//43
#define INTVER 1,2,0,43
#define STRVER "1,2,0,43\0"
//44
#define INTVER 1,2,0,44
#define STRVER "1,2,0,44\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