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 .. .. ???
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -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)
{
......@@ -669,13 +686,50 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
odf_formula = res;
}
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,11 +799,20 @@ 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);
......
......@@ -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();
{
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);
......
......@@ -176,11 +176,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
ods_context->set_sheet_dimension(string2std_string(oox_sheet->m_oDimension->m_oRef.get()));
}
//
if (oox_sheet->m_oSheetFormatPr.IsInit())
// &
convert(oox_sheet->m_oSheetFormatPr.GetPointer());
if (oox_sheet->m_oSheetPr.IsInit())
convert(oox_sheet->m_oSheetPr.GetPointer());
convert(oox_sheet->m_oSheetViews.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
......@@ -382,6 +382,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCell *oox_cell)
{
convert_sharing_string(_wtoi(oox_cell->m_oValue->m_sText));
}
else
{
ods_context->current_table().set_cell_value (string2std_string(oox_cell->m_oValue->m_sText));
......@@ -389,7 +390,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCell *oox_cell)
}
}
//m_oRichText - xlsx
ods_context->end_cell();
}
void XlsxConverter::convert_sharing_string(int number)
......@@ -510,6 +510,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::Single);break;
}
}
text_properties->content().style_text_underline_color_ = odf::underline_color(odf::underline_color::FontColor);
}
if (oox_run_pr->m_oItalic.IsInit())
{
......@@ -532,14 +533,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oRFont->m_sVal.get());
}
if (oox_run_pr->m_oScheme.IsInit() && oox_run_pr->m_oScheme->m_oFontScheme.IsInit())
{
SimpleTypes::Spreadsheet::EFontScheme type = oox_run_pr->m_oScheme->m_oFontScheme->GetValue();
if (type == SimpleTypes::Spreadsheet::fontschemeMajor)
{
}
if (type == SimpleTypes::Spreadsheet::fontschemeMinor)
{
if (oox_run_pr->m_oVertAlign.IsInit() && oox_run_pr->m_oVertAlign->m_oVerticalAlign.IsInit())
{
switch(oox_run_pr->m_oVertAlign->m_oVerticalAlign->GetValue())
......@@ -552,8 +545,17 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
text_properties->content().style_text_position_ = odf::text_position(-33.); break;// 58% -
}
}
else
text_properties->content().style_text_position_ = odf::text_position(-33.);
if (oox_run_pr->m_oScheme.IsInit() && oox_run_pr->m_oScheme->m_oFontScheme.IsInit())
{
SimpleTypes::Spreadsheet::EFontScheme type = oox_run_pr->m_oScheme->m_oFontScheme->GetValue();
if (type == SimpleTypes::Spreadsheet::fontschemeMajor)
{
text_properties->content().style_text_scale_ = odf::percent(+30.);
}
if (type == SimpleTypes::Spreadsheet::fontschemeMinor && !text_properties->content().style_text_position_)
{
//text_properties->content().style_text_position_ = odf::text_position(-33.);
text_properties->content().style_text_scale_ = odf::percent(-30.);
}
}
if (oox_run_pr->m_oStrike.IsInit())
......@@ -592,12 +594,15 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFormula *oox_formula)
}
else if (oox_formula->m_oT->GetValue() == SimpleTypes::Spreadsheet::cellformulatypeArray)
{
ods_context->current_table().set_cell_array_formula(formula,ref);
}
else if (oox_formula->m_oT->GetValue() == SimpleTypes::Spreadsheet::cellformulatypeDataTable)
{
}
}
if (formula.length() > 0)ods_context->current_table().set_cell_formula(formula);
else
ods_context->current_table().set_cell_formula(formula);
}else
ods_context->current_table().set_cell_formula(formula);
//nullable<SimpleTypes::COnOff<>> m_oAca;
//nullable<SimpleTypes::COnOff<>> m_oBx;
......@@ -678,6 +683,54 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetPr *oox_sheet_pr)
ods_context->current_table().set_table_tab_color(odf_color);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
if (!oox_sheet_views)return;
for (long i =0; i < oox_sheet_views->m_arrItems.GetSize(); i++)
{
if (oox_sheet_views->m_arrItems[i])
{
if (oox_sheet_views->m_arrItems[i]->m_oWorkbookViewId.IsInit())
{}
if (oox_sheet_views->m_arrItems[i]->m_oRightToLeft.IsInit() && oox_sheet_views->m_arrItems[i]->m_oRightToLeft->GetValue()==1)
ods_context->current_table().set_table_rtl(true);
if (oox_sheet_views->m_arrItems[i]->m_oShowGridLines.IsInit() && oox_sheet_views->m_arrItems[i]->m_oShowGridLines->GetValue()==0)
{
//ods_context->set_settings_show_gridlines(false);
}
if (oox_sheet_views->m_arrItems[i]->m_oView.IsInit())
{
// ..
//ods_context->set_settings_table_viewtype(oox_sheet_views->m_arrItems[i]->m_oView->GetValue());
}
//nullable<CPane> m_oPane;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oColorId;
//nullable<SimpleTypes::COnOff<>> m_oDefaultGridColor;
//nullable<SimpleTypes::COnOff<>> m_oShowFormulas;
//nullable<SimpleTypes::COnOff<>> m_oShowGridLines;
//nullable<SimpleTypes::COnOff<>> m_oShowOutlineSymbols;
//nullable<SimpleTypes::COnOff<>> m_oShowRowColHeaders;
//nullable<SimpleTypes::COnOff<>> m_oShowRuler;
//nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
//nullable<SimpleTypes::COnOff<>> m_oShowZeros;
//nullable<SimpleTypes::COnOff<>> m_oTabSelected;
//nullable<CString> m_oTopLeftCell;
//nullable<SimpleTypes::Spreadsheet::CSheetViewType<>>m_oView;
//nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oWorkbookViewId;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScale;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScalePageLayoutView;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleSheetLayoutView;
}
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_pr)
{
if (!oox_sheet_format_pr)return;
......@@ -839,14 +892,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf::style_text_prop
text_properties->content().style_font_family_asian_ = font_name;
text_properties->content().style_font_family_complex_ = font_name;
}
if (font->m_oScheme.IsInit() && font->m_oScheme->m_oFontScheme.IsInit())
{
SimpleTypes::Spreadsheet::EFontScheme type = font->m_oScheme->m_oFontScheme->GetValue();
if (type == SimpleTypes::Spreadsheet::fontschemeMajor)
{
}
if (type == SimpleTypes::Spreadsheet::fontschemeMinor)
{
if (font->m_oVertAlign.IsInit() && font->m_oVertAlign->m_oVerticalAlign.IsInit())
{
switch(font->m_oVertAlign->m_oVerticalAlign->GetValue())
......@@ -859,8 +904,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf::style_text_prop
text_properties->content().style_text_position_ = odf::text_position(-33.); break;// 58% -
}
}
else
text_properties->content().style_text_position_ = odf::text_position(-33.);
if (font->m_oScheme.IsInit() && font->m_oScheme->m_oFontScheme.IsInit())
{
SimpleTypes::Spreadsheet::EFontScheme type = font->m_oScheme->m_oFontScheme->GetValue();
if (type == SimpleTypes::Spreadsheet::fontschemeMajor)
{
text_properties->content().style_text_scale_ = odf::percent(+30.);
}
if (type == SimpleTypes::Spreadsheet::fontschemeMinor && !text_properties->content().style_text_position_)
{
text_properties->content().style_text_scale_ = odf::percent(-30.);
}
}
if (font->m_oStrike.IsInit())
......@@ -924,6 +977,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa
{
if (!aligment)return;
bool rtl = false;
if (aligment->m_oReadingOrder.IsInit() && (aligment->m_oReadingOrder->GetValue() == 1))
{
paragraph_properties->content().style_writing_mode_= odf::writing_mode(odf::writing_mode::RlTb);
rtl = true;
}
if (aligment->m_oVertical.IsInit())
{
switch(aligment->m_oVertical->GetValue())
......@@ -952,30 +1011,25 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa
{
switch(aligment->m_oHorizontal->GetValue())
{
case SimpleTypes::Spreadsheet::horizontalalignmentCenter: paragraph_properties->content().fo_text_align_ =
odf::text_align(odf::text_align::Center); break;
//case SimpleTypes::Spreadsheet::horizontalalignmentContinuous: paragraph_properties->content().fo_text_align_ =
// odf::text_align(odf::text_align::Left); break;
//case SimpleTypes::Spreadsheet::horizontalalignmentDistributed: paragraph_properties->content().fo_text_align_ =
// odf::text_align(odf::text_align::Left); break;
case SimpleTypes::Spreadsheet::horizontalalignmentFill: paragraph_properties->content().fo_text_align_ =
odf::text_align(odf::text_align::Start); break;
//case SimpleTypes::Spreadsheet::horizontalalignmentGeneral: paragraph_properties->content().fo_text_align_ =
// odf::text_align(odf::text_align::Left); break;
case SimpleTypes::Spreadsheet::horizontalalignmentJustify: paragraph_properties->content().fo_text_align_ =
odf::text_align(odf::text_align::Justify); break;
case SimpleTypes::Spreadsheet::horizontalalignmentLeft: paragraph_properties->content().fo_text_align_ =
odf::text_align(odf::text_align::Start); break;
case SimpleTypes::Spreadsheet::horizontalalignmentRight: paragraph_properties->content().fo_text_align_ =
odf::text_align(odf::text_align::End); break;
}
}
if(aligment->m_oWrapText.IsInit())
case SimpleTypes::Spreadsheet::horizontalalignmentCenter:
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::Center); break;
case SimpleTypes::Spreadsheet::horizontalalignmentFill:
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::Start); break;
case SimpleTypes::Spreadsheet::horizontalalignmentJustify:
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::Justify); break;
case SimpleTypes::Spreadsheet::horizontalalignmentLeft:
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::Start); break;
case SimpleTypes::Spreadsheet::horizontalalignmentRight:
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::End); break;
}
}
if (aligment->m_oWrapText.IsInit())
{
if (aligment->m_oWrapText->GetValue())
cell_properties->style_table_cell_properties_attlist_.fo_wrap_option_ = odf::wrap_option(odf::wrap_option::Wrap);
}
if(aligment->m_oShrinkToFit.IsInit())
if (aligment->m_oShrinkToFit.IsInit())
{
cell_properties->style_table_cell_properties_attlist_.style_shrink_to_fit_ = aligment->m_oShrinkToFit->GetValue();
}
......@@ -983,7 +1037,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa
{
}
//nullable<SimpleTypes::COnOff<>> m_oJustifyLastLine;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oReadingOrder;
//nullable<SimpleTypes::CDecimalNumber<>> m_oRelativeIndent;
}
......@@ -1236,6 +1289,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
odf::style_text_properties * text_properties = ods_context->styles_context()->last_state().get_text_properties();
odf::style_table_cell_properties * table_cell_properties = ods_context->styles_context()->last_state().get_table_cell_properties();
if (root)
{
table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
}
if (xlsx_styles->m_oFonts.IsInit() && font_id >=0 && (id_parent < 0 || xfc_style->m_oApplyFont.IsInit()))
{
convert(xlsx_styles->m_oFonts->m_arrItems[font_id], text_properties);
......@@ -1256,7 +1314,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
odf::style_paragraph_properties * paragraph_properties = ods_context->styles_context()->last_state().get_paragraph_properties();
paragraph_properties->content().style_writing_mode_ = odf::writing_mode(odf::writing_mode::Page);
paragraph_properties->content().fo_text_align_ = odf::text_align(odf::text_align::Start);
if (xfc_style->m_oAligment.IsInit() && xfc_style->m_oApplyAlignment.IsInit())
{
......@@ -1441,7 +1498,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
if (type == 2000)ods_context->drawing_context()->start_text_box();
else ods_context->drawing_context()->start_shape(type);
{
OoxConverter::convert(oox_shape->m_oSpPr.GetPointer());
OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
if (oox_shape->m_oNvSpPr.IsInit())
{
......
......@@ -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