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

(1.2.0.62): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56532 954022d7-b5bf-4e40-9824-e11837661b57
parent 2f958852
......@@ -154,8 +154,8 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
std::wstring c1 = what[2].str();
std::wstring c2 = what[3].str();
int res;
if (sheet1.length() > 0 && (res = c1.find(L"$")) >=0 ) sheet1 = L"$" + sheet1;
int res=0;
if (sheet1.length() > 0 && (res = c1.find(L"$")) >=0) sheet1 = L"$" + sheet1;
const std::wstring s = std::wstring(L"[") + sheet1 + L"." +
c1 +
......@@ -522,6 +522,13 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
&oox2odf_converter::Impl::replace_arguments,boost::match_default | boost::format_all);
if (res1 == res)
{
res = convert(res1);
boost::algorithm::replace_all(res, L"[", L"");
boost::algorithm::replace_all(res, L"]", L"");
}
boost::algorithm::replace_all(res, L"SCOBCAIN", L"(");
boost::algorithm::replace_all(res, L"SCOBCAOUT", L")");
......
......@@ -316,12 +316,7 @@ void common_value_and_type_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"office:time-value", office_time_value_);
CP_XML_ATTR_OPT(L"office:boolean-value", office_boolean_value_);
CP_XML_ATTR_OPT(L"office:string-value", office_string_value_);
if (office_string_value_ || office_boolean_value_|| office_time_value_ || office_date_value_ || office_value_ || office_value_type_)
{
CP_XML_ATTR_OPT(L"office:value-type", office_value_type_);
//todooo .. .. ???
}
CP_XML_ATTR_OPT(L"office:value-type", office_value_type_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -103,7 +103,7 @@ static const def_language_code LanguageCodeTable[] =
{L"German Luxembourg", L"", L"de", 0x01007},
{L"Greek", L"", L"", 0x0408},
{L"Gujarati", L"", L"", 0x0447},
{L"Hebrew", L"", L"", 0x040D},
{L"Hebrew", L"IN", L"hi", 0x040D},
{L"Hindi", L"", L"", 0x0439},
{L"Hungarian", L"", L"", 0x040E},
{L"Icelandic", L"", L"", 0x040F},
......
......@@ -131,6 +131,16 @@ void ods_table_state::set_table_hidden(bool Val)
table_properties->table_format_properties_.table_display_ = !Val;
}
void ods_table_state::set_table_rtl(bool Val)
{
if (!office_table_style_)return;
style_table_properties *table_properties = office_table_style_->style_content_.get_style_table_properties();
if (table_properties == NULL)return;
table_properties->table_format_properties_.common_writing_mode_attlist_.style_writing_mode_ = writing_mode(writing_mode::RlTb);
}
void ods_table_state::set_print_range(std::wstring range)
......@@ -559,6 +569,8 @@ static formulasconvert::oox2odf_converter formulas_converter;
void ods_table_state::set_cell_formula(std::wstring & formula)
{
if (formula.length() < 1)return;
std::wstring odfFormula = formulas_converter.convert_formula(formula);
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
......@@ -612,6 +624,9 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
{
if (ind < 0)return;
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
if (cell == NULL)return;
std::wstring odf_formula;
if (formula.size() > 0)
......@@ -633,6 +648,9 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
}
ods_shared_formula_state state = {ind, odf_formula,ref, current_table_column_,current_table_row_, moving_type};
shared_formulas_.push_back(state);
cell->table_table_cell_attlist_.table_formula_ = odf_formula;
cells_.back().empty = false;
}
else
{
......@@ -641,8 +659,7 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
if (shared_formulas_[i].index == ind)
{
odf_formula = shared_formulas_[i].formula;
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
if (cell == NULL)return;
// ref !!!
if (shared_formulas_[i].moving_type == 1)
{
......@@ -668,14 +685,51 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
boost::match_default | boost::format_all);
odf_formula = res;
}
cell->table_table_cell_attlist_.table_formula_ = odf_formula;
cell->table_table_cell_attlist_.table_formula_ = odf_formula;
cells_.back().empty = false;
}
}
}
}
void ods_table_state::set_cell_array_formula(std::wstring & formula, std::wstring ref)
{
set_cell_formula(formula);
//; ??? C2:D5 D1;F1;G; ... ???
std::vector<std::wstring> ref_cells;
boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
int row_span =0;
int col_span =0;
if (ref_cells.size() ==2)
{
int col1 = -1, row1 = -1;
int col2 = -1, row2 = -1;
utils::parsing_ref (ref_cells[0], col1, row1);
utils::parsing_ref (ref_cells[1], col2, row2);
row_span = abs(row2-row1) +1;
col_span = abs(col2-col1) +1;
}
else if (ref_cells.size() ==1) row_span = col_span = 1;
else
{
row_span = col_span = 1;//???
}
if (col_span >0 && row_span > 0)
{
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
if (cell == NULL)return;
cell->table_table_cell_attlist_extra_.table_number_matrix_columns_spanned_ = col_span;
cell->table_table_cell_attlist_extra_.table_number_matrix_rows_spanned_ = row_span;
}
}
void ods_table_state::add_child_element(office_element_ptr & child_element)
......@@ -734,16 +788,6 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
cells_.back().elm->add_child_element(text_context->text_elements_list_[i].elm);
}
}
style* style_ = dynamic_cast<style*>(cells_.back().style_elm.get());
if (!style_)return;
odf::style_table_cell_properties * table_cell_properties = style_->style_content_.get_style_table_cell_properties();
if (table_cell_properties)
{
table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
}
if (cash_value == false)
{
_CP_OPT(office_value_type) cell_type = office_value_type(office_value_type::String);
......@@ -755,12 +799,21 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
{
cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
}
//if (!cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_)
//{
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = cell_type;
//}
}
cells_.back().empty = false;
}
style* style_ = dynamic_cast<style*>(cells_.back().style_elm.get());
if (!style_)return;
odf::style_table_cell_properties * table_cell_properties = style_->style_content_.get_style_table_cell_properties();
if (table_cell_properties)
{
table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
}
}
void ods_table_state::set_cell_value(std::wstring & value)
{
......
......@@ -160,6 +160,12 @@ struct ods_shared_formula_state
int moving_type; //1 - col, 2 - row
};
struct ods_array_formula_state
{
std::wstring formula;
std::wstring ref;
};
class ods_table_state
{
public:
......@@ -167,6 +173,7 @@ public:
void set_table_name(std::wstring name);
void set_table_style(office_element_ptr & _style);
void set_table_hidden(bool Val);
void set_table_rtl(bool Val);
void set_table_tab_color(_CP_OPT(color) & _color);
void set_table_dimension(int col, int row);
void set_print_range(std::wstring range);
......@@ -196,6 +203,7 @@ public:
void set_cell_value(std::wstring & value);
void set_cell_text(odf_text_context *text_context, bool cash_value = false);
void set_cell_formula(std::wstring &formula);
void set_cell_array_formula(std::wstring & formula, std::wstring ref);
void add_or_find_cell_shared_formula(std::wstring & formula, std::wstring ref, int ind);
static std::wstring replace_cell_row(boost::wsmatch const & what);
......@@ -277,7 +285,7 @@ private:
std::vector<ods_hyperlink_state> hyperlinks_;
std::vector<ods_comment_state> comments_;
std::vector<ods_shared_formula_state> shared_formulas_;
std::vector<ods_shared_formula_state> shared_formulas_;
odf_drawing_context drawing_context_;
......
......@@ -143,10 +143,48 @@ void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spP
}
}
void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr)
void OoxConverter::convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref)
{
if (!style_matrix_ref) return;
int fmt_index = style_matrix_ref->m_oIdx.GetValue()-1;
OOX::CTheme *theme = oox_theme();
if (!theme || fmt_index <0) return;
CString color = style_matrix_ref->m_oShemeClr.m_oVal.ToString();
if (style_matrix_ref->getType() == OOX::et_a_fillRef && fmt_index < theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems.GetSize())
{
switch(theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems[fmt_index]->getType())
{
case OOX::et_a_blipFill:
convert((OOX::Drawing::CBlipFillProperties *)theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems[fmt_index], &color);break;
case OOX::et_a_gradFill:
convert((OOX::Drawing::CGradientFillProperties *)theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems[fmt_index], &color);break;
case OOX::et_a_pattFill:
convert((OOX::Drawing::CPatternFillProperties *)theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems[fmt_index], &color);break;
case OOX::et_a_solidFill:
convert((OOX::Drawing::CSolidColorFillProperties *)theme->m_oThemeElements.m_oFmtScheme.m_oFillStyleLst.m_arrItems[fmt_index], &color);break;
case OOX::Drawing::filltypeNo:
odf_context()->drawing_context()->set_no_fill();break;
}
}
if (style_matrix_ref->getType() == OOX::et_a_lnRef && fmt_index < theme->m_oThemeElements.m_oFmtScheme.m_oLineStyleLst.m_arrLn.GetSize())
{
convert(&theme->m_oThemeElements.m_oFmtScheme.m_oLineStyleLst.m_arrLn[fmt_index], &color);
}
}
void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Drawing::CShapeStyle* oox_sp_style)
{
if (!oox_spPr) return;
bool use_fill_from_style = false;
bool use_line_from_style = false;
switch(oox_spPr->m_eGeomType)
{
case OOX::Drawing::geomtypeCustom :
......@@ -166,16 +204,26 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr)
case OOX::Drawing::filltypePattern: convert(oox_spPr->m_oPattFill.GetPointer());break;
case OOX::Drawing::filltypeSolid: convert(oox_spPr->m_oSolidFill.GetPointer());break;
case OOX::Drawing::filltypeGroup:
case OOX::Drawing::filltypeNo: odf_context()->drawing_context()->set_no_fill();
case OOX::Drawing::filltypeNo: odf_context()->drawing_context()->set_no_fill();break;
default:
use_fill_from_style = true;
break;
}
//....
if ((use_fill_from_style && oox_sp_style) && (oox_sp_style->m_oFillRef.getType() == OOX::et_a_fillRef))
{
convert(&oox_sp_style->m_oFillRef);
}
}
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->start_line_properies();
{
convert(oox_spPr->m_oLn.GetPointer()); //CLineProperties
if (oox_spPr->m_oLn.IsInit())
convert(oox_spPr->m_oLn.GetPointer()); //CLineProperties
else if ((oox_sp_style) && (oox_sp_style->m_oLnRef.getType() == OOX::et_a_lnRef))
{
convert(&oox_sp_style->m_oLnRef);
}
}
odf_context()->drawing_context()->end_line_properies();
////////
......@@ -239,15 +287,15 @@ void OoxConverter::convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom)
convert(&oox_cust_geom->m_oPthLst.m_arrPath[i]);
}
}
void OoxConverter::convert(OOX::Drawing::CLineProperties *oox_line_prop)
void OoxConverter::convert(OOX::Drawing::CLineProperties *oox_line_prop, CString *change_sheme_color )
{
if (!oox_line_prop)return;
switch (oox_line_prop->m_eFillType)
{
case OOX::Drawing::filltypeGradient: convert(oox_line_prop->m_oGradFill.GetPointer());break;
case OOX::Drawing::filltypePattern: convert(oox_line_prop->m_oPattFill.GetPointer());break;
case OOX::Drawing::filltypeSolid: convert(oox_line_prop->m_oSolidFill.GetPointer());break;
case OOX::Drawing::filltypeGradient: convert(oox_line_prop->m_oGradFill.GetPointer(), change_sheme_color);break;
case OOX::Drawing::filltypePattern: convert(oox_line_prop->m_oPattFill.GetPointer(), change_sheme_color);break;
case OOX::Drawing::filltypeSolid: convert(oox_line_prop->m_oSolidFill.GetPointer(), change_sheme_color);break;
case OOX::Drawing::filltypeGroup:
case OOX::Drawing::filltypeNo: odf_context()->drawing_context()->set_no_fill();
break;
......@@ -319,7 +367,7 @@ void OoxConverter::convert(OOX::Drawing::CPath2D *oox_geom_path)
}
}
//////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill)
void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill, CString *change_sheme_color)
{
if (!oox_bitmap_fill)return;
......@@ -382,7 +430,7 @@ void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill)
odf_context()->drawing_context()->end_bitmap_style();
}
void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill)
void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill, CString *change_sheme_color)
{
if (!oox_grad_fill)return;
......@@ -414,6 +462,11 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill)
std::wstring hexColorStart, hexColorEnd;
_CP_OPT(double) opacityStart, opacityEnd;
if (change_sheme_color && oox_grad_fill->m_oGsLst->m_arrGs[0].m_eType == OOX::Drawing::colorSheme)
{
oox_grad_fill->m_oGsLst->m_arrGs[0].m_oShemeClr.m_oVal.FromString(*change_sheme_color);
oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1].m_oShemeClr.m_oVal.FromString(*change_sheme_color);
}
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[0]),hexColorStart, opacityStart);
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1]),hexColorEnd, opacityEnd);
......@@ -425,7 +478,7 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill)
}
odf_context()->drawing_context()->end_gradient_style();
}
void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill)
void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill, CString *change_sheme_color)
{
if (!oox_pattern_fill)return;
......@@ -445,6 +498,9 @@ void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fil
}
if (oox_pattern_fill->m_oBgClr.IsInit())
{
if (change_sheme_color && oox_pattern_fill->m_oBgClr.IsInit() && oox_pattern_fill->m_oBgClr->m_eType == OOX::Drawing::colorSheme)
oox_pattern_fill->m_oBgClr->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
std::wstring hexColor;
_CP_OPT(double) opacity;
convert((OOX::Drawing::CColor*)oox_pattern_fill->m_oBgClr.GetPointer(),hexColor, opacity);
......@@ -479,13 +535,16 @@ void OoxConverter::convert(OOX::Drawing::CColor *oox_color,std::wstring & hexCol
case OOX::Drawing::colorSys: convert(&oox_color->m_oSysClr, hexColor, opacity); break;
}
}
void OoxConverter::convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill)
void OoxConverter::convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill, CString *change_sheme_color)
{
if (!oox_solid_fill)return;
std::wstring hexColor;
_CP_OPT(double) opacity;
if (change_sheme_color && oox_solid_fill->m_eType == OOX::Drawing::colorSheme)
oox_solid_fill->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
convert(oox_solid_fill, hexColor, opacity);
odf_context()->drawing_context()->set_solid_fill(hexColor);
......
......@@ -58,6 +58,8 @@ namespace OOX
class CRunProperty;
class CLineSpacing;
class CColor;
class CShapeStyle;
class CStyleMatrixReference;
namespace Colors
{
......@@ -228,19 +230,20 @@ public:
void convert(OOX::WritingElement *oox_unknown);
void convert(OOX::Drawing::CNonVisualDrawingProps *oox_cnvPr);
void convert(OOX::Drawing::CShapeProperties *oox_spPr);
void convert(OOX::Drawing::CShapeProperties *oox_spPr, OOX::Drawing::CShapeStyle* oox_sp_style /*= NULL)*/);
void convert(OOX::Drawing::CGroupShapeProperties *oox_groupSpPr);
void convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr);
void convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom);
void convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom);
void convert(OOX::Drawing::CLineProperties *oox_line_prop);
void convert(OOX::Drawing::CLineProperties *oox_line_prop, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill);
void convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill);
void convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill);
void convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill , CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill , CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref);
//////////////////////////////////////////////
void convert(OOX::Drawing::CPath2D *oox_geom_path);
void convert(OOX::Drawing::CPath2DLineTo *oox_geom_path);
......
......@@ -55,6 +55,7 @@ namespace OOX
class CConditionalFormatValueObject;
class CAutofilter;
class CFilterColumn;
class CSheetViews;
}
}
......@@ -137,6 +138,7 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_pr);
void convert(OOX::Spreadsheet::CSheetPr *oox_sheet_pr);
void convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views);
void convert(OOX::Spreadsheet::CFont *font, odf::style_text_properties *text_properties);
void convert(OOX::Spreadsheet::CBorder *border, odf::style_table_cell_properties *cell_properties);
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//60
#define INTVER 1,2,0,60
#define STRVER "1,2,0,60\0"
//62
#define INTVER 1,2,0,62
#define STRVER "1,2,0,62\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