Commit e70a2677 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - fix chart with defined names & local data

parent f3ac6ad2
......@@ -633,32 +633,37 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
boost::algorithm::split(distance_inp,expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d,distance_inp)
for (int i = 0; i < distance_inp.size(); i++)
{
std::wstring sheet;
std::vector<std::wstring> range;
std::vector<std::wstring> cells;
boost::algorithm::split(range,d, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
boost::algorithm::split(range, distance_inp[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &c,range)
for (int j = 0 ; j < range.size(); j++)
{
const ::std::string::size_type colon = c.find('!');
cells.push_back(c.substr(colon+1));
if (sheet.size()<1)
sheet=c.substr(0, colon);
int pos = range[j].find('!');
if (0 <= pos)
{
if (sheet.empty())
sheet = range[j].substr(0, pos);
}
cells.push_back(range[j].substr(pos + 1));
}
std::wstring cells_out;
BOOST_FOREACH(std::wstring &c,cells)
for (int c = 0; c < cells.size(); c++)
{
cells_out.append(sheet+L".");
cells_out.append(c);
cells_out.append(L":");
if (!sheet.empty())
cells_out += sheet + L".";
cells_out += cells[c];
cells_out += L":";
}
int res1 = sheet.find(L"-");
int res2 = sheet.find(L"'");
if (res1>=0 && !(res2==0))
if (res1 >= 0 && !(res2 == 0))
{
sheet = L"'" + sheet + L"'";
}
......@@ -667,10 +672,10 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
}
std::wstring result;
BOOST_FOREACH(std::wstring &d,distance_out)
for (int i = 0 ; i < distance_out.size(); i++)
{
result.append(d);
result.append(L" ");
result += distance_out[i];
result += L" ";
}
return result.substr(0, result.size()-1);
}
......
......@@ -45,14 +45,6 @@ namespace cpdoccore {
namespace oox {
//_ASSERTE(getColAddress(0) == L"A");
//_ASSERTE(getColAddress(1) == L"B");
//_ASSERTE(getColAddress(25) == L"Z");
//_ASSERTE(getColAddress(26) == L"AA");
//_ASSERTE(getColAddress(51) == L"AZ");
//_ASSERTE(getColAddress(52) == L"BA");
//_ASSERTE(getColAddress(77) == L"BZ");
//_ASSERTE(getColAddress(26 * 26 + 25) == L"ZZ");
std::wstring getColAddress(size_t col)
{
static const size_t r = (L'Z' - L'A' + 1);
......
......@@ -397,7 +397,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.start_table_column(columnsRepeated, defaultCellStyleName, cMin, cMax);
if ( cMin > 16384 ) return;
if ( cMax > 16384 ) cMax = 16384;
if ( cMax > 16384 ) return;
double pt_width = 0.0;
double cm_width = 0.0;
......
......@@ -1088,6 +1088,10 @@
RelativePath="..\include\cpdoccore\CPWeakPtr.h"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFileW\source\OdfFormat\odf_chart_context.h"
>
</File>
<File
RelativePath="..\src\common\readdocelement.cpp"
>
......
......@@ -144,9 +144,8 @@ public:
void set_layout_w(double *val,int mode);
void set_layout_h(double *val,int mode);
void set_local_table(bool Val);
//void set_cash(std::wstring format, std::vector<double> &data);
void set_cash(std::wstring format, std::vector<std::wstring> &data,bool label = false);
void set_local_table(bool Val, bool use_cash_only = false);
void set_cash(std::wstring format, std::vector<std::wstring> &data, bool categories, bool label);
void end_chart();
......
......@@ -1654,6 +1654,9 @@ void odf_drawing_context::set_line_dash_preset(int style)
{
if (!impl_->current_graphic_properties)return;
if ((impl_->current_graphic_properties->content().draw_stroke_) &&
(impl_->current_graphic_properties->content().draw_stroke_->get_type() == line_style::None)) return;
switch(style) //+создать стиль, привзать имена
{
case 0://presetlinedashvalDash
......
......@@ -256,10 +256,10 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ
{
if (style_state_list_[i]->odf_style_)
{
if (style_state_list_[i]->get_family_type() == family &&
style_state_list_[i]->root_ == root &&
style_state_list_[i]->automatic_ == automatic &&
style_state_list_[i]->conditional_ == false &&
if (style_state_list_[i]->get_family_type() == family &&
style_state_list_[i]->root_ == root &&
style_state_list_[i]->automatic_ == automatic &&
style_state_list_[i]->conditional_ == false &&
style_state_list_[i]->default_ == false)
{
if (oox_id_style >=0 && style_state_list_[i]->style_oox_id_ == oox_id_style)
......@@ -325,7 +325,7 @@ bool odf_style_context::find_odf_style(std::wstring style_name, style_family::ty
}
office_element_ptr odf_style_context::find_odf_style_default(style_family::type family)
{
for (int i=0;i<current_default_styles_.size(); i++)
for (int i=0; i < current_default_styles_.size(); i++)
{
if (current_default_styles_[i]->odf_style_)
{
......@@ -336,11 +336,12 @@ office_element_ptr odf_style_context::find_odf_style_default(style_family::type
}
std::wstring odf_style_context::find_odf_style_name_default(style_family::type family)
{
for (int i=0;i<current_default_styles_.size(); i++)
for (int i = 0; i < current_default_styles_.size(); i++)
{
if (current_default_styles_[i]->odf_style_)
{
if (current_default_styles_[i]->get_family_type() == family) return current_default_styles_[i]->get_name();
if (current_default_styles_[i]->get_family_type() == family)
return current_default_styles_[i]->get_name();
}
}
return L"";
......
......@@ -103,9 +103,8 @@ void odf_style_state::set_display_name(std::wstring name)
}
std::wstring odf_style_state::get_name()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return odf_style_name_;
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_) return odf_style_name_;
return style_->style_name_;
}
......@@ -161,7 +160,12 @@ void odf_style_state::set_default(bool val)
}
void odf_style_state::set_conditional(bool val)
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_) return;
conditional_ = val;
if (val)
style_->style_name_ = L"dx_" + style_->style_name_;
}
//------------------------------------------------------------------------------------
bool odf_style_state::get_list_style_exist()
......
......@@ -120,8 +120,8 @@ private:
///////
bool automatic_;
bool root_;
bool default_; // это для тех стилей что в root
bool conditional_; //стили накладываемые по условию
bool default_; // это для тех стилей что в root
bool conditional_; //стили накладываемые по условию
bool writable_;
......
......@@ -99,15 +99,26 @@ void ods_conversion_context::end_document()
odf_conversion_context::end_document();
}
void ods_conversion_context::start_autofilter(std::wstring ref)
void ods_conversion_context::add_autofilter(std::wstring ref)
{
table_context_.start_autofilter(ref);
table_context_.add_autofilter(ref);
}
void ods_conversion_context::start_conditional_formats()
{
current_table().start_conditional_formats();
}
void ods_conversion_context::start_table_part(std::wstring name, std::wstring ref)
{
table_context_.start_table_part(name, ref);
}
void ods_conversion_context::set_table_part_autofilter(bool val)
{
table_context_.set_table_part_autofilter(val);
}
void ods_conversion_context::end_table_part()
{
table_context_.end_table_part();
}
void ods_conversion_context::add_defined_range(const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable)
{
table_context_.add_defined_range(name,cell_range, sheet_id, printable);
......
......@@ -105,11 +105,13 @@ public:
double convert_symbol_width(double val);
void add_defined_range(const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);
void add_defined_expression(const std::wstring & name, const std::wstring & value, int sheet_id, bool printable = false);
void add_defined_range (const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);
void add_defined_expression (const std::wstring & name, const std::wstring & value, int sheet_id, bool printable = false);
void add_autofilter (std::wstring ref);
void start_autofilter(std::wstring ref);
void end_autofilter(){}
void start_table_part (std::wstring name, std::wstring ref);
void end_table_part ();
void set_table_part_autofilter(bool val);
void start_conditional_formats();
void end_conditional_formats(){}
......
......@@ -56,7 +56,48 @@ ods_table_state & ods_table_context::state()
{
return table_state_list_.back();
}
void ods_table_context::start_autofilter(std::wstring ref)
void ods_table_context::start_table_part(std::wstring name, std::wstring ref)
{
if (!table_database_ranges_.root) create_element(L"table", L"database-ranges",table_database_ranges_.root,&context_);
office_element_ptr elm;
create_element(L"table", L"database-range",elm, &context_);
table_database_range * d_range = dynamic_cast<table_database_range*>(elm.get());
if (!d_range)return;
formulasconvert::oox2odf_converter formulas_converter;
std::wstring odf_range = formulas_converter.convert_named_ref(ref);
boost::algorithm::replace_all(odf_range, L"[", L"");
boost::algorithm::replace_all(odf_range, L"]", L"");
d_range->table_target_range_address_ = odf_range;
d_range->table_name_ = name;
//d_range->table_display_filter_buttons_= true;
table_database_ranges_.root->add_child_element(elm);
table_database_ranges_.elements.push_back(elm);
}
void ods_table_context::set_table_part_autofilter(bool val)
{
if (!val) return;
if (table_database_ranges_.elements.empty()) return;
table_database_range * d_range = dynamic_cast<table_database_range*>(table_database_ranges_.elements.back().get());
if (!d_range) return;
d_range->table_display_filter_buttons_= true;
}
void ods_table_context::end_table_part()
{
}
void ods_table_context::add_autofilter(std::wstring ref)
{
if (!table_database_ranges_.root) create_element(L"table", L"database-ranges",table_database_ranges_.root,&context_);
......@@ -140,8 +181,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
formulasconvert::oox2odf_converter formulas_converter;
std::wstring odf_value = formulas_converter.convert_formula(value);
//formulas_converter.convert_named_ref(value); -> ChartDateRange2007.xlsx
std::wstring odf_value = formulas_converter.convert_named_ref(value);
std::wstring odf_base_cell = formulas_converter.find_base_cell(value);
named_expression->table_name_ = name;
......
......@@ -72,8 +72,11 @@ public:
void add_defined_range(const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);
void add_defined_expression(const std::wstring & name, const std::wstring & value, int sheet_id, bool printable = false);
void start_autofilter(std::wstring ref);
void add_autofilter(std::wstring ref);
void start_table_part(std::wstring name, std::wstring ref);
void set_table_part_autofilter(bool val);
void end_table_part();
private:
......
......@@ -326,14 +326,14 @@ void ods_table_state::set_table_dimension(int col, int row)
{
if (col<1 || row <1 )return;
if (dimension_columns < col) dimension_columns = col +1;
if (dimension_row < row) dimension_row = row+1;
if (dimension_columns < col) dimension_columns = col + 1;
if (dimension_row < row) dimension_row = row + 1;
}
void ods_table_state::add_row(office_element_ptr & elm, short repeated, office_element_ptr & style_elm)
{
current_table_column_ = 0;
current_table_row_+=repeated;
current_table_column_ = 0;
current_table_row_ += repeated;
current_level_.back()->add_child_element(elm);
......@@ -352,7 +352,7 @@ void ods_table_state::add_row(office_element_ptr & elm, short repeated, office_e
if (style_name.length()>0) row->table_table_row_attlist_.table_style_name_ = style_ref(style_name);
row->table_table_row_attlist_.table_number_rows_repeated_ = repeated;
row_default_cell_style_name_= L"";
row_default_cell_style_name_ = L"";
}
void ods_table_state::set_row_hidden(bool Val)
......
......@@ -134,8 +134,18 @@ namespace utils {
std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.end());
}
static void parsing_ref (const std::wstring & ref, int & col,int & row)
static void parsing_ref (std::wstring ref, int & col,int & row)
{
int pos = ref.rfind(L"!");//oox table name
if (pos >= 0)
ref = ref.substr(pos + 1);
else
{
pos = ref.rfind(L".");//odf table name
if (pos >= 0)
ref = ref.substr(pos + 1);
}
std::wstring strCol, strRow;
splitCellAddress(ref,strCol,strRow);
......
......@@ -449,7 +449,7 @@ void chart_domain::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"chart:table-cell-range-address", table_cell_range_address_);
CP_XML_ATTR_OPT(L"table:cell-range-address", table_cell_range_address_);
}
}
}
......
......@@ -317,7 +317,7 @@ public:
// attr
std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_;
odf_types::style_family style_family_;
_CP_OPT( std::wstring ) style_parent_style_name_;
_CP_OPT( std::wstring ) style_next_style_name_;
......
......@@ -1223,6 +1223,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oLatinFont->m_oTypeFace->GetValue());
else
{
text_properties->content().fo_font_family_ = L"Calibri";//default_font; ????
}
}
if (oox_run_pr->m_oAsianFont.IsInit())
......
......@@ -448,8 +448,8 @@ public:
void convert(OOX::Spreadsheet::CT_Marker *marker);
void convert(OOX::Spreadsheet::CT_Marker *marker, std::vector<OOX::Spreadsheet::CT_DPt*> & dPt);
void convert(OOX::Spreadsheet::CT_ExternalData *external_data);
void convert(OOX::Spreadsheet::CT_NumData *num_data, bool label = false);
void convert(OOX::Spreadsheet::CT_StrData *str_data, bool label = false);
void convert(OOX::Spreadsheet::CT_NumData *num_data, bool categories, bool label);
void convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label);
//.vml............................................................................................................................
......
......@@ -770,8 +770,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,1);
convert(ser->m_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.size() > 0)
{
......@@ -822,8 +824,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,1);
convert(ser->m_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
odf_context()->chart_context()->end_series();
}
......@@ -836,8 +840,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PieSer* ser)
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_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.size() > 0)
{
......@@ -852,8 +858,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,1);
convert(ser->m_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_dPt.size() > 0)
{
......@@ -871,27 +879,37 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser)
{
if (ser == NULL)return;
odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_xVal, 2);//domain
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_yVal);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
if (ser->m_yVal)
{
odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_xVal, 2);//domain
convert(ser->m_yVal);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
else if (ser->m_xVal)
{
odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls);
convert(ser->m_xVal, 1);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
convert(ser->m_marker, ser->m_dPt);
}
odf_context()->chart_context()->end_series();
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_RadarSer* ser)
{
......@@ -900,8 +918,10 @@ 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,1);
convert(ser->m_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
......@@ -916,8 +936,10 @@ 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,1);
convert(ser->m_cat, 1);
convert(ser->m_val);
convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
{
......@@ -1016,60 +1038,60 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
if (ser_tx->m_strRef)
{
if (ser_tx->m_strRef->m_f)odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f));
if (ser_tx->m_strRef->m_f)
odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f));
convert(ser_tx->m_strRef->m_strCache,true);
convert(ser_tx->m_strRef->m_strCache, false, true);
}
//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, int type)
{
if (cat == NULL)
{
odf_context()->chart_context()->set_category_axis_formula(L"", type);
return;
}
if (cat == NULL) return;
if (cat->m_numLit)
{
odf_context()->chart_context()->set_series_value_formula(L"");
convert(cat->m_numLit);
convert(cat->m_numLit, false, false);
}
else if (cat->m_strLit)
{
odf_context()->chart_context()->set_category_axis_formula(L"", type);
convert(cat->m_strLit, true);
convert(cat->m_strLit, true, false);
}
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);
if (cat->m_strRef->m_f)
odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f), type);
convert(cat->m_strRef->m_strCache, true/*, type == 1 ? true:false*/);
convert(cat->m_strRef->m_strCache, true, false);
}
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), type);
if (cat->m_numRef->m_f)
odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f), type);
convert(cat->m_numRef->m_numCache, true);
convert(cat->m_numRef->m_numCache, true, false);
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
{
if (val == NULL)return;
if (val == NULL) return;
if (val->m_numLit)
{
odf_context()->chart_context()->set_series_value_formula(L"");
convert(val->m_numLit);
convert(val->m_numLit, false, false);
}
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);
convert(val->m_numRef->m_numCache, false, false);
}
}
......@@ -1111,7 +1133,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ExternalData *external_data)
odf_context()->chart_context()->set_local_table(true);//пока пользуем кэш ....
}
void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool label)
void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool categories, bool label)
{
if (num_data == NULL)return;
......@@ -1120,7 +1142,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool label)
for (unsigned int i=0; i < num_data->m_pt.size(); i++)
{
if (num_data->m_pt[i] && num_data->m_pt[i]->m_v)
{
data.push_back(string2std_string(*num_data->m_pt[i]->m_v));
......@@ -1137,10 +1158,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool label)
std::wstring format;
if (num_data->m_formatCode) format = string2std_string(*num_data->m_formatCode);
odf_context()->chart_context()->set_cash(format, data, label);
odf_context()->chart_context()->set_cash(format, data, categories, label);
}
void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool label)
void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label)
{
if (str_data == NULL)return;
std::vector<std::wstring> data;
......@@ -1153,6 +1174,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool label)
}
std::wstring format;
odf_context()->chart_context()->set_cash(format, data, label);
odf_context()->chart_context()->set_cash(format, data, categories, label);
}
}
......@@ -341,17 +341,28 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
{
if (!oox_table_part) return;
//nullable<SimpleTypes::CRelationshipId > m_oRef;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oHeaderRowCount;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oTotalsRowCount;
//nullable<CString > m_oDisplayName;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oHeaderRowCount;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oTotalsRowCount;
//nullable<CSortState > m_oSortState;
//nullable<CTableColumns > m_oTableColumns;
//nullable<CTableStyleInfo > m_oTableStyleInfo;
//nullable<CSortState > m_oSortState;
//nullable<CTableColumns > m_oTableColumns;
//----------------------------------------------------------------------------------------------------------------
std::wstring name;
std::wstring ref;
if (oox_table_part->m_oDisplayName.IsInit() && oox_table_part->m_oRef.IsInit())
{
name = oox_table_part->m_oDisplayName.get();
ref = oox_table_part->m_oRef->GetValue();
}
convert(oox_table_part->m_oAutoFilter.GetPointer());
ods_context->start_table_part(name, ref);
if (oox_table_part->m_oAutoFilter.IsInit())
ods_context->set_table_part_autofilter(true);
ods_context->end_table_part();
}
......@@ -777,7 +788,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCol *oox_column)
{
int xfd_id = oox_column->m_oStyle->GetValue();
style_cell_name = ods_context->styles_context()->find_odf_style_name(xfd_id,odf_types::style_family::TableCell,false,true);
style_cell_name = ods_context->styles_context()->find_odf_style_name(xfd_id, odf_types::style_family::TableCell, false, true);
}
else
{
......@@ -907,7 +918,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
if (oox_sheet_views->m_arrItems[i]->m_oSelection->m_oActiveCell.IsInit())
{
odf_writer::utils::parsing_ref (oox_sheet_views->m_arrItems[i]->m_oSelection->m_oActiveCell->GetBuffer(), ActiveCellX, ActiveCellY);
std::wstring ref(oox_sheet_views->m_arrItems[i]->m_oSelection->m_oActiveCell->GetBuffer());
odf_writer::utils::parsing_ref (ref, ActiveCellX, ActiveCellY);
if (ActiveCellX >= 0 && ActiveCellY >= 0)
{
......@@ -1027,11 +1039,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
//if (default_cell_style) ods_context->styles_context()->add_default(default_cell_style);
odf_writer::odf_style_state_ptr default_cell_style;
ods_context->styles_context()->find_odf_style_state(0, odf_types::style_family::TableCell, default_cell_style, true,true);
if (default_cell_style) ods_context->styles_context()->add_default(default_cell_style);
ods_context->styles_context()->find_odf_style_state (0, odf_types::style_family::TableCell, default_cell_style, true, false);
if (default_cell_style)
ods_context->styles_context()->add_default( default_cell_style );
///Column///////////////////////////////////////////////////////////////////////////////////////
ods_context->styles_context()->create_style(L"",odf_types::style_family::TableColumn, true, false, -1);
ods_context->styles_context()->create_style(L"", odf_types::style_family::TableColumn, true, false, -1);
{
double width = 8.1; // из приложния MS Office 2010
//в xlsx необязательно задавать ширину (колонок) - дефолтное по приложению. в oo - обязательно
......@@ -1051,7 +1065,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
column_properties->style_table_column_properties_attlist_.style_column_width_ = odf_types::length(odf_types::length(width,odf_types::length::pt).get_value_unit(odf_types::length::cm),odf_types::length::cm);
}
}
ods_context->styles_context()->add_default(ods_context->styles_context()->last_state());
ods_context->styles_context()->add_default( ods_context->styles_context()->last_state() );
}
//Row default //////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
......@@ -1073,7 +1087,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
row_properties->style_table_row_properties_attlist_.common_break_attlist_.fo_break_before_ = odf_types::fo_break(odf_types::fo_break::Auto);
}
}
ods_context->styles_context()->add_default(ods_context->styles_context()->last_state());
ods_context->styles_context()->add_default( ods_context->styles_context()->last_state() );
}
}
void XlsxConverter::convert_styles()
......@@ -1565,16 +1579,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style)
//придется копировать свойства все .. они автоматические стили удалить (не сохранять в файл)
odf_writer::odf_style_state_ptr parent_style_state;
if (ods_context->styles_context()->find_odf_style_state(parent_id, odf_types::style_family::TableCell,parent_style_state, true, true) && parent_style_state)
if (ods_context->styles_context()->find_odf_style_state(parent_id, odf_types::style_family::TableCell, parent_style_state, true, true) && parent_style_state)
{
parent_style_state->set_dont_write(true);
//parent_style_state->set_dont_write(true);
odf_writer::style_text_properties *text_props = style_state->get_text_properties();
odf_writer::style_paragraph_properties *para_props = style_state->get_paragraph_properties() ;
odf_writer::style_text_properties *text_props = style_state->get_text_properties();
odf_writer::style_paragraph_properties *para_props = style_state->get_paragraph_properties() ;
odf_writer::style_table_cell_properties *cell_props = style_state->get_table_cell_properties();
odf_writer::style_text_properties *parent_text_props = parent_style_state->get_text_properties();
odf_writer::style_paragraph_properties *parent_para_props = parent_style_state->get_paragraph_properties() ;
odf_writer::style_text_properties *parent_text_props = parent_style_state->get_text_properties();
odf_writer::style_paragraph_properties *parent_para_props = parent_style_state->get_paragraph_properties() ;
odf_writer::style_table_cell_properties *parent_cell_props = parent_style_state->get_table_cell_properties();
if (text_props) text_props->apply_from(parent_text_props);
......@@ -1583,18 +1597,19 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style)
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_id)
void XlsxConverter::convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_dx_id)
{
if (!dxFmt)return;
ods_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, false, true, oox_id);
ods_context->styles_context()->create_style(L"", odf_types::style_family::TableCell, false, true, oox_dx_id);
ods_context->styles_context()->last_state()->set_conditional(true);
odf_writer::style_text_properties * text_properties = ods_context->styles_context()->last_state()->get_text_properties();
odf_writer::style_text_properties * text_properties = ods_context->styles_context()->last_state()->get_text_properties();
odf_writer::style_table_cell_properties * table_cell_properties = ods_context->styles_context()->last_state()->get_table_cell_properties();
convert(dxFmt->m_oBorder.GetPointer(), table_cell_properties);
convert(dxFmt->m_oFill.GetPointer(), table_cell_properties);
convert(dxFmt->m_oFont.GetPointer(), text_properties);
convert(dxFmt->m_oBorder.GetPointer() , table_cell_properties);
convert(dxFmt->m_oFill.GetPointer() , table_cell_properties);
convert(dxFmt->m_oFont.GetPointer() , text_properties);
if (dxFmt->m_oNumFmt.IsInit())
{
......@@ -1624,9 +1639,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
int font_id = xfc_style->m_oFontId.IsInit() ? xfc_style->m_oFontId->GetValue() : -1;
int border_id = xfc_style->m_oBorderId.IsInit() ? xfc_style->m_oBorderId->GetValue(): -1;
ods_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, automatic, root, oox_id);
ods_context->styles_context()->create_style(L"", odf_types::style_family::TableCell, automatic, root, oox_id);
odf_writer::style_text_properties * text_properties = ods_context->styles_context()->last_state()->get_text_properties();
odf_writer::style_text_properties * text_properties = ods_context->styles_context()->last_state()->get_text_properties();
odf_writer::style_table_cell_properties * table_cell_properties = ods_context->styles_context()->last_state()->get_table_cell_properties();
if (xlsx_styles->m_oFonts.IsInit() && font_id >=0 && (id_parent < 0 || xfc_style->m_oApplyFont.IsInit()))
......@@ -2178,14 +2193,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAutofilter *oox_filter)
if (oox_filter->m_oSortState->m_oCaseSensitive.IsInit() && oox_filter->m_oSortState->m_oCaseSensitive->GetValue()==1)
caseSensitive = true;
}
ods_context->start_autofilter(ref);//target
{
for (unsigned int i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo
{
}
}
ods_context->end_autofilter();
ods_context->add_autofilter(ref);//target
//for (unsigned int i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo
//{
//}
}
} // namespace Docx2Odt
......@@ -709,10 +709,6 @@
RelativePath="..\OdfFormat\odf_chart_context.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\odf_chart_context.h"
>
</File>
<File
RelativePath="..\OdfFormat\odf_comment_context.cpp"
>
......
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