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

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57848 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f546acc
......@@ -100,7 +100,13 @@ public:
std::vector<odf_axis_state> axis_;
std::vector<office_element_ptr> group_series_;
std::vector<unsigned int> axis_group_series_;
std::vector<std::wstring> data_cell_ranges_;
struct _range
{
std::wstring ref;
bool label;
};
std::vector<_range> data_cell_ranges_;
std::vector<odf_cash_state> cash_;
bool local_table_enabled_;
......@@ -644,7 +650,6 @@ void odf_chart_context::add_categories(std::wstring formula, office_element_ptr
if (categories== NULL)return;
categories->table_cell_range_address_ = formula;
int level = impl_->current_level_.size();
if (axis)axis->add_child_element(elm);
......@@ -765,7 +770,7 @@ void odf_chart_context::end_plot_area()
std::wstring cell_range;
for (long i=0; i< impl_->data_cell_ranges_.size();i++)
{
cell_range = cell_range + impl_->data_cell_ranges_[i] + L" ";
cell_range = cell_range + impl_->data_cell_ranges_[i].ref + L" ";
}
//plot_area->chart_plot_area_attlist_.table_cell_range_address_ = cell_range; - !!!
}
......@@ -1288,32 +1293,51 @@ static formulasconvert::oox2odf_converter formulas_converter;
void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
{
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
std::wstring odfFormula;
if (oox_formula.length() > 0)
odfFormula = formulas_converter.convert_chart_distance(oox_formula);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
if (series == NULL)return;
series->chart_series_attlist_.chart_values_cell_range_address_ = odfFormula;
Impl::_range r = {odfFormula, false};
impl_->data_cell_ranges_.push_back(r);
impl_->data_cell_ranges_.push_back(odfFormula);
if (oox_formula.length() > 0)
{
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)
{
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
std::wstring odfFormula;
if (oox_formula.length() > 0)
odfFormula = formulas_converter.convert_chart_distance(oox_formula);
Impl::_range r = {odfFormula, true};
impl_->data_cell_ranges_.push_back(r);
if (odfFormula.length() > 0)
{
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
if (series == NULL)return;
impl_->data_cell_ranges_.push_back(odfFormula);
series->chart_series_attlist_.chart_label_cell_address_ = odfFormula;
}
}
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type)
{
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
std::wstring odfFormula;
if (oox_formula.length() > 0)
odfFormula = formulas_converter.convert_chart_distance(oox_formula);
Impl::_range r = {odfFormula, true};
impl_->data_cell_ranges_.push_back(r);
impl_->data_cell_ranges_.push_back(odfFormula);
impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula,type));
}
......@@ -1333,12 +1357,41 @@ void odf_chart_context::set_series_pie_explosion(int val)//
// odf_cash_state state = {ref, format,/*data_double,*/data_str};
// impl_->cash_.push_back(state);
//}
void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str,bool label)
{
if (data_str.size() <1 || impl_->data_cell_ranges_.size() < 1) return;
if (data_str.size() <1) return;
if (impl_->data_cell_ranges_.size()<1) return;
std::wstring ref = impl_->data_cell_ranges_.back();
std::wstring ref = impl_->data_cell_ranges_.back().ref;
if (ref.length() < 1)
{
std::wstring col;
if (label) col = L"A";
else
{
int curr_col = 0;
for (long i=0; i<impl_->data_cell_ranges_.size(); i++)
{
if (impl_->data_cell_ranges_[i].label)continue;
curr_col++;
}
col = utils::getColAddress(curr_col);
}
ref = std::wstring(L"local-table.$") + col + std::wstring(L"$") + boost::lexical_cast<std::wstring>(2) + L":.$" + col + std::wstring(L"$") + boost::lexical_cast<std::wstring>(data_str.size()+1);
impl_->data_cell_ranges_.back().ref = ref;
if (label == false)
{
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
if (series == NULL)return;
series->chart_series_attlist_.chart_values_cell_range_address_ = ref;
}
else
impl_->categories_.back().first = ref;
}
std::vector<double> data_double;
odf_cash_state state = {ref, format/*,data_double*/,label,data_str};
......@@ -1417,17 +1470,21 @@ void odf_chart_context::Impl::create_local_table()
std::wstring table_name = L"local-table";
int max_columns=0;
bool col_header = false;
bool row_header = false;
// ref
for (long i=0; i < cash_.size(); i++)
{
for (long j=i+1; j < cash_.size(); j++)
{
if (cash_[j].ref == cash_[i].ref)
if (cash_[j].ref == cash_[i].ref && cash_[j].ref.length() > 1)
{
cash_.erase(cash_.begin()+j);
}
}
}
for (long i=0; i < cash_.size(); i++)
{
std::vector<std::wstring> refs;
......@@ -1448,7 +1505,7 @@ void odf_chart_context::Impl::create_local_table()
if (refs.size()>1)
{
r = refs[1].find(L".");
if (r>0)refs[1] = refs[1].substr(r+1,refs[1].size()-r);
if (r>=0)refs[1] = refs[1].substr(r+1,refs[1].size()-r);
utils::parsing_ref( refs[1],col2,row2);
}
else
......@@ -1461,8 +1518,17 @@ void odf_chart_context::Impl::create_local_table()
c.col = (col2==col1) ? col1 : col1+j;
c.row = (row2==row1) ? row1 : row1+j;
c.val = cash_[i].data_str[j];
c.label = cash_[i].label;
c.label = false;
if (cash_[i].label && c.row == 1)
{
c.label = cash_[i].label;
row_header = true;
}
if (cash_[i].label && c.col == 1)
{
col_header = true;
}
cells_cash.push_back(c);
if (c.label) cells_cash_label.push_back(c);
......@@ -1470,8 +1536,8 @@ void odf_chart_context::Impl::create_local_table()
if (c.col > max_columns) max_columns = c.col;
}
}
std::sort(cells_cash.begin(), cells_cash.end(),sort_cells);
std::sort(cells_cash_label.begin(), cells_cash_label.end(),sort_cells);
......@@ -1495,17 +1561,20 @@ void odf_chart_context::Impl::create_local_table()
office_element_ptr col_elm;
create_element(L"table", L"table-column",col_elm, odf_context_);
if (col_header)
{
office_element_ptr cols_header_elm;
create_element(L"table", L"table-header-columns",cols_header_elm, odf_context_);
table_elm->add_child_element(cols_header_elm);
cols_header_elm->add_child_element(col_elm);
}
office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_);
table_elm->add_child_element(cols_elm);
for (long i=0; i < max_columns-1; i++)
for (long i=0; i < max_columns - (col_header ? 1 : 0); i++)
cols_elm->add_child_element(col_elm);
office_element_ptr row_headers_elm;
......@@ -1513,7 +1582,7 @@ void odf_chart_context::Impl::create_local_table()
if (cells_cash_label.size() > 0 || cells_cash.size() > 0)
{
if (cells_cash_label.size() > 0)
if (cells_cash_label.size() > 0 && row_header)
{
create_element(L"table", L"table-header-rows",row_headers_elm, odf_context_);
......
......@@ -709,7 +709,7 @@ void odf_drawing_context::end_shape()
if (shape_define)
{
impl_->current_drawing_state_.rotateAngle = boost::none;
//impl_->current_drawing_state_.rotateAngle = boost::none; ??? ???
enhanced->svg_viewbox_ = shape_define->view_box;
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
......@@ -972,9 +972,9 @@ void odf_drawing_context::set_flip_V(bool bVal)
impl_->current_drawing_state_.flipV = bVal;
}
void odf_drawing_context::set_rotate(int iVal)
void odf_drawing_context::set_rotate(double dVal)
{
double dRotate = (360 - iVal/60000.)/180. * 3.14159265358979323846;
double dRotate = dVal / 180. * 3.14159265358979323846;
impl_->current_drawing_state_.rotateAngle = dRotate;
}
void odf_drawing_context::set_drawings_rect(_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt)// "- 1"
......@@ -1050,16 +1050,22 @@ void odf_drawing_context::set_vertical_rel(int from)
set_anchor(anchor_type::Page); //??? /???
break;// relfromvPage
case 6: type = vertical_rel::Paragraph;
set_anchor(anchor_type::Paragraph);
if (!impl_->is_footer_header_)set_anchor(anchor_type::Paragraph);
break;// relfromvParagraph
case 7: type = vertical_rel::Baseline; break;// relfromvTopMargin ???
}
if (impl_->is_footer_header_ && ( from ==3 /*|| 5*/))
{
set_anchor(anchor_type::Paragraph);
//
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
impl_->anchor_settings_.style_vertical_rel_ = vertical_rel(type);
if (!impl_->anchor_settings_.style_vertical_pos_)//default
impl_->anchor_settings_.style_vertical_pos_ = vertical_pos(vertical_pos::FromTop);
}
void odf_drawing_context::set_vertical_pos(int align)
{
......
......@@ -111,7 +111,7 @@ public:
void set_flip_H(bool bVal);
void set_flip_V(bool bVal);
void set_rotate(int iVal);
void set_rotate(double iVal);
void set_no_fill();
void set_solid_fill(std::wstring hexColor);
......
......@@ -248,6 +248,7 @@ void odf_page_layout_context::add_footer(int type)
{
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
footer_props->style_header_footer_properties_attlist_.fo_min_height_ = length(abs(length_cm),length::cm);
}
else if (-length_cm >0.01)
{
......@@ -293,11 +294,13 @@ void odf_page_layout_context::add_header(int type)
if (length_cm > 0.01)
{
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
header_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
header_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);
header_props->style_header_footer_properties_attlist_.fo_min_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
else if (-length_cm >0.01)
{
header_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);//fo_min_height_
header_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);
header_props->style_header_footer_properties_attlist_.fo_min_height_ = length(-length_cm,length::cm);//fo_min_height_
}
}
else
......
......@@ -62,6 +62,10 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
convert(vml_shape_type->m_arrItems[i]);
}
if (vml_shape_type->m_oAdj.IsInit())//
{
}
//o:spt
//nullable<CString> m_oAdj;
//nullable<SimpleTypes::Vml::CVmlPath> m_oPath;
......@@ -136,7 +140,7 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
case SimpleTypes::Vml::cssptMsoPositionVerticalRelative:
switch(vml_style->m_arrProperties[i].get_Value().eMsoPosVerRel)
{
case SimpleTypes::Vml::cssmsoposverrelMargin: odf_context()->drawing_context()->set_vertical_rel(3); break;
case SimpleTypes::Vml::cssmsoposverrelMargin: odf_context()->drawing_context()->set_vertical_rel(3); break;//3 ???
case SimpleTypes::Vml::cssmsoposverrelPage: odf_context()->drawing_context()->set_vertical_rel(5); break;
case SimpleTypes::Vml::cssmsoposverrelText: odf_context()->drawing_context()->set_vertical_rel(6); break;
case SimpleTypes::Vml::cssmsoposverrelLine: odf_context()->drawing_context()->set_vertical_rel(2); break;
......@@ -156,6 +160,10 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
case SimpleTypes::Vml::csspositionRelative: break;
}
}break;
case SimpleTypes::Vml::cssptRotation:
{
odf_context()->drawing_context()->set_rotate(180 + vml_style->m_arrProperties[i].get_Value().dValue);
}break;
}
}
odf_context()->drawing_context()->set_drawings_rect(x, y, width_pt, height_pt);
......@@ -226,6 +234,9 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context()->drawing_context()->start_area_properties();
if (vml_fill->m_oOpacity.GetValue() > 0)
odf_context()->drawing_context()->set_opacity(100 - vml_fill->m_oOpacity.GetValue() * 100);
odf_context()->drawing_context()->end_area_properties();
}
void OoxConverter::convert(OOX::Vml::CLine *vml_line)
......@@ -393,7 +404,24 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
}
void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
{
if (vml_textpath == NULL) return;
if (vml_textpath == NULL) return; //
if (vml_textpath->m_sString.IsInit()==false) return;
//DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
odf_context()->start_text_context();
odf_context()->text_context()->start_paragraph(false);
odf_context()->text_context()->start_span(false);
odf_context()->text_context()->add_text_content(string2std_string(vml_textpath->m_sString.get()));
odf_context()->text_context()->end_span();
odf_context()->text_context()->end_paragraph();
odf_context()->drawing_context()->set_text( odf_context()->text_context());
odf_context()->end_text_context();
odf_context()->drawing_context()->set_textarea_wrap(true);
}
void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
......
......@@ -158,6 +158,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{
OOX::Vml::CPath *vml = static_cast<OOX::Vml::CPath*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_textpath:
{
OOX::Vml::CTextPath *vml = static_cast<OOX::Vml::CTextPath*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_fill:
{
......@@ -440,7 +445,7 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
if (oox_spPr->m_oXfrm->m_oFlipV.GetValue() == SimpleTypes::onoffTrue)
odf_context()->drawing_context()->set_flip_V(true);
if (oox_spPr->m_oXfrm->m_oRot.GetValue() > 0)
odf_context()->drawing_context()->set_rotate(oox_spPr->m_oXfrm->m_oRot.GetValue());
odf_context()->drawing_context()->set_rotate(180. - oox_spPr->m_oXfrm->m_oRot.GetValue()/60000.);
}
switch(oox_spPr->m_eGeomType)
{
......@@ -525,6 +530,10 @@ void OoxConverter::convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom)
{
convert(&oox_cust_geom->m_oPthLst.m_arrPath[i]);
}
for (long i=0; i< oox_cust_geom->m_oPthLst.m_arrPath.GetSize();i++)
{
convert(&oox_cust_geom->m_oPthLst.m_arrPath[i]);
}
}
void OoxConverter::convert(OOX::Drawing::CLineProperties *oox_line_prop, CString *change_sheme_color )
{
......
......@@ -969,8 +969,18 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
odf_context()->chart_context()->set_category_axis_formula(L"",type);
return;
}
if (cat->m_numLit)
{
odf_context()->chart_context()->set_series_value_formula(L"");
if (cat->m_strRef)
convert(cat->m_numLit);
}
else if (cat->m_strLit)
{
odf_context()->chart_context()->set_category_axis_formula(L"", type);
convert(cat->m_strLit,true);
}
else 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),type);
......@@ -982,25 +992,25 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
convert(cat->m_numRef->m_numCache);
}
else if (cat->m_numLit)
{
}
else if (cat->m_strLit)
{
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
{
if (val == NULL)return;
if (val->m_numRef)
if (val->m_numLit)
{
if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(string2std_string(*val->m_numRef->m_f));
odf_context()->chart_context()->set_series_value_formula(L"");
convert(val->m_numRef->m_numCache);
convert(val->m_numLit);
}
else if (val->m_numLit)
else if (val->m_numRef)
{
if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(string2std_string(*val->m_numRef->m_f));
convert(val->m_numRef->m_numCache);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_Surface* ct_surface, int type, bool chart3D)
......
......@@ -223,6 +223,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CDrawing* pDrawing= static_cast<OOX::Logic::CDrawing*>(oox_unknown);
convert(pDrawing);
}break;
case OOX::et_c_chart:
{
OOX::Drawing::CChart* pChart = static_cast<OOX::Drawing::CChart*>(oox_unknown);
convert(pChart);
}break;
case OOX::et_w_Shape:
{
OOX::Logic::CShape* pShape = static_cast<OOX::Logic::CShape*>(oox_unknown);
......@@ -1585,6 +1590,7 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
OoxConverter::convert(oox_pic->m_oShape->m_oStyle.GetPointer());
odf_context()->drawing_context()->start_drawing();
if (oox_pic->m_oShapeOval.IsInit())
{
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeEllipse);
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//128
#define INTVER 1,2,0,128
#define STRVER "1,2,0,128\0"
//129
#define INTVER 1,2,0,129
#define STRVER "1,2,0,129\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