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& ...@@ -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::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::wstring sheet;
std::vector<std::wstring> range; std::vector<std::wstring> range;
std::vector<std::wstring> cells; 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('!'); int pos = range[j].find('!');
cells.push_back(c.substr(colon+1)); if (0 <= pos)
if (sheet.size()<1) {
sheet=c.substr(0, colon); if (sheet.empty())
sheet = range[j].substr(0, pos);
}
cells.push_back(range[j].substr(pos + 1));
} }
std::wstring cells_out; std::wstring cells_out;
BOOST_FOREACH(std::wstring &c,cells) for (int c = 0; c < cells.size(); c++)
{ {
cells_out.append(sheet+L"."); if (!sheet.empty())
cells_out.append(c); cells_out += sheet + L".";
cells_out.append(L":"); cells_out += cells[c];
cells_out += L":";
} }
int res1 = sheet.find(L"-"); int res1 = sheet.find(L"-");
int res2 = sheet.find(L"'"); int res2 = sheet.find(L"'");
if (res1>=0 && !(res2==0)) if (res1 >= 0 && !(res2 == 0))
{ {
sheet = L"'" + sheet + L"'"; sheet = L"'" + sheet + L"'";
} }
...@@ -667,10 +672,10 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring& ...@@ -667,10 +672,10 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
} }
std::wstring result; std::wstring result;
BOOST_FOREACH(std::wstring &d,distance_out) for (int i = 0 ; i < distance_out.size(); i++)
{ {
result.append(d); result += distance_out[i];
result.append(L" "); result += L" ";
} }
return result.substr(0, result.size()-1); return result.substr(0, result.size()-1);
} }
......
...@@ -45,14 +45,6 @@ namespace cpdoccore { ...@@ -45,14 +45,6 @@ namespace cpdoccore {
namespace oox { 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) std::wstring getColAddress(size_t col)
{ {
static const size_t r = (L'Z' - L'A' + 1); 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) ...@@ -397,7 +397,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.start_table_column(columnsRepeated, defaultCellStyleName, cMin, cMax); Context.start_table_column(columnsRepeated, defaultCellStyleName, cMin, cMax);
if ( cMin > 16384 ) return; if ( cMin > 16384 ) return;
if ( cMax > 16384 ) cMax = 16384; if ( cMax > 16384 ) return;
double pt_width = 0.0; double pt_width = 0.0;
double cm_width = 0.0; double cm_width = 0.0;
......
...@@ -1088,6 +1088,10 @@ ...@@ -1088,6 +1088,10 @@
RelativePath="..\include\cpdoccore\CPWeakPtr.h" RelativePath="..\include\cpdoccore\CPWeakPtr.h"
> >
</File> </File>
<File
RelativePath="..\..\ASCOfficeOdfFileW\source\OdfFormat\odf_chart_context.h"
>
</File>
<File <File
RelativePath="..\src\common\readdocelement.cpp" RelativePath="..\src\common\readdocelement.cpp"
> >
......
...@@ -86,8 +86,9 @@ namespace odf_writer ...@@ -86,8 +86,9 @@ namespace odf_writer
std::wstring ref; std::wstring ref;
std::wstring format; std::wstring format;
bool categories;
bool label; bool label;
//std::vector<double> data_double;
std::vector<std::wstring> data_str; std::vector<std::wstring> data_str;
}; };
struct odf_chart_state struct odf_chart_state
...@@ -126,8 +127,9 @@ class odf_chart_context::Impl ...@@ -126,8 +127,9 @@ class odf_chart_context::Impl
public: public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context) Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{ {
styles_context_ = NULL; styles_context_ = NULL;
current_series_count_= 0; current_series_count_ = 0;
local_table_reset_ref_ = false;
if (odf_context_->type == SpreadsheetDocument) if (odf_context_->type == SpreadsheetDocument)
{ {
...@@ -151,13 +153,19 @@ public: ...@@ -151,13 +153,19 @@ public:
struct _range struct _range
{ {
_range(std::wstring &r, bool l, chart_series *s) : label(l), index_cash(-1), series(s), ref(r) {}
_range() : label(false), index_cash(-1), series(NULL) {}
chart_series *series;
std::wstring ref; std::wstring ref;
bool label; bool label;
int index_cash;
}; };
std::vector<_range> data_cell_ranges_; std::vector<_range> data_cell_ranges_;
std::vector<odf_cash_state> cash_; std::vector<odf_cash_state> cash_;
bool local_table_enabled_; bool local_table_enabled_;
bool local_table_reset_ref_;
std::vector<odf_chart_level_state> current_level_; //постоянно меняющийся список уровней наследования std::vector<odf_chart_level_state> current_level_; //постоянно меняющийся список уровней наследования
std::vector<odf_chart_state> chart_list_; //все элементы .. для удобства разделение по "топам" std::vector<odf_chart_state> chart_list_; //все элементы .. для удобства разделение по "топам"
...@@ -171,9 +179,72 @@ public: ...@@ -171,9 +179,72 @@ public:
chart_axis *get_current_axis(); chart_axis *get_current_axis();
chart_series *get_current_series(); chart_series *get_current_series();
std::wstring convert_formula(std::wstring oox_formula);
void create_local_table(); void create_local_table();
void create_local_table_rows(ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header ); int create_local_table_rows(int current_row, ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header );
}; };
static formulasconvert::oox2odf_converter formulas_converter_chart;
std::wstring odf_chart_context::Impl::convert_formula(std::wstring oox_formula)
{
std::vector<std::wstring> refs;
boost::algorithm::split(refs, oox_formula, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (refs.empty()) return L"";
if (local_table_enabled_)
{
if (local_table_reset_ref_) return L"";
//remove table name
if (!refs.empty())
{
int pos = refs[0].rfind(L"!");//в имени таблички может быть...
if (pos > 0)
{
refs[0] = L"local-table!" + refs[0].substr(pos + 1, refs[0].size() - pos);
}
int col = -1, row = -1;
utils::parsing_ref( refs[0], col, row);
if (col < 0 && row < 0)
return L"";
oox_formula = refs[0];
if (refs.size() > 1)
{
int r = refs[1].rfind(L"!");
if (r > 0)
{
refs[1] = L"local-table!" + refs[1].substr(r + 1, refs[1].size() - r);
}
oox_formula += L":" + refs[1];
}
}
}
else
{
//open office dont support defined names in chart formula
int col = -1, row = -1;
utils::parsing_ref( refs[0], col, row);
if (col < 0 && row < 0)
{
local_table_enabled_ = true;
//find defined name ????
local_table_reset_ref_ = true;
return L"";
}
}
std::wstring odf_formula = formulas_converter_chart.convert_chart_distance(oox_formula);
//boost::algorithm::replace_all(odf_formula, L"$", L"");
return odf_formula;
}
chart_chart* odf_chart_context::Impl::get_current_chart() chart_chart* odf_chart_context::Impl::get_current_chart()
{ {
for (long i=current_level_.size()-1; i>=0; i--) for (long i=current_level_.size()-1; i>=0; i--)
...@@ -207,7 +278,8 @@ void odf_chart_context::Impl::clear_current() ...@@ -207,7 +278,8 @@ void odf_chart_context::Impl::clear_current()
data_cell_ranges_.clear(); data_cell_ranges_.clear();
cash_.clear(); cash_.clear();
current_series_count_ = 0; current_series_count_ = 0;
local_table_reset_ref_ = false;
if (odf_context_->type == SpreadsheetDocument) if (odf_context_->type == SpreadsheetDocument)
{ {
...@@ -679,6 +751,7 @@ void odf_chart_context::end_group_series() ...@@ -679,6 +751,7 @@ void odf_chart_context::end_group_series()
impl_->group_series_.clear(); impl_->group_series_.clear();
impl_->axis_group_series_.clear(); impl_->axis_group_series_.clear();
} }
void odf_chart_context::add_domain(std::wstring formula) void odf_chart_context::add_domain(std::wstring formula)
{ {
int level = impl_->current_level_.size(); int level = impl_->current_level_.size();
...@@ -697,7 +770,8 @@ void odf_chart_context::add_domain(std::wstring formula) ...@@ -697,7 +770,8 @@ void odf_chart_context::add_domain(std::wstring formula)
odf_element_state state={elm, L"",office_element_ptr(), level}; odf_element_state state={elm, L"",office_element_ptr(), level};
impl_->current_chart_state_.elements_.push_back(state); impl_->current_chart_state_.elements_.push_back(state);
} }
void odf_chart_context::add_categories(std::wstring formula, office_element_ptr & axis)
void odf_chart_context::add_categories(std::wstring odf_formula, office_element_ptr & axis)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"chart", L"categories", elm, impl_->odf_context_); create_element(L"chart", L"categories", elm, impl_->odf_context_);
...@@ -705,7 +779,7 @@ void odf_chart_context::add_categories(std::wstring formula, office_element_ptr ...@@ -705,7 +779,7 @@ void odf_chart_context::add_categories(std::wstring formula, office_element_ptr
chart_categories *categories = dynamic_cast<chart_categories*>(elm.get()); chart_categories *categories = dynamic_cast<chart_categories*>(elm.get());
if (categories== NULL)return; if (categories== NULL)return;
categories->table_cell_range_address_ = formula; categories->table_cell_range_address_ = odf_formula;
int level = impl_->current_level_.size(); int level = impl_->current_level_.size();
if (axis)axis->add_child_element(elm); if (axis)axis->add_child_element(elm);
...@@ -824,7 +898,7 @@ void odf_chart_context::end_plot_area() ...@@ -824,7 +898,7 @@ void odf_chart_context::end_plot_area()
if (plot_area) if (plot_area)
{ {
std::wstring cell_range; std::wstring cell_range;
for (long i=0; i< impl_->data_cell_ranges_.size();i++) for (long i = 0; i < impl_->data_cell_ranges_.size(); i++)
{ {
cell_range = cell_range + impl_->data_cell_ranges_[i].ref + L" "; cell_range = cell_range + impl_->data_cell_ranges_[i].ref + L" ";
} }
...@@ -1324,19 +1398,28 @@ void odf_chart_context::end_chart() ...@@ -1324,19 +1398,28 @@ void odf_chart_context::end_chart()
/////////////////// ///////////////////
for (long i=0; i< impl_->axis_.size() && impl_->categories_.size() > 0; i++) int cat = 0;
for (long i = 0; i < impl_->axis_.size() && impl_->categories_.size() > 0; i++)
{ {
if (impl_->axis_[i].elm == NULL)continue; if (impl_->axis_[i].elm == NULL) continue;
if (impl_->categories_[0].second == 1)
{ if (impl_->axis_[i].dimension == 1 )
add_categories(impl_->categories_[0].first,impl_->axis_[i].elm);
}
else
{ {
if (i==0) if (cat < impl_->categories_.size())
{ {
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get()); if (impl_->categories_[cat].second == 1)
axis->chart_axis_attlist_.chart_dimension_ = L"x"; {
add_categories(impl_->categories_[cat].first, impl_->axis_[i].elm);
}
else
{
if (i == 0)
{
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"x";
}
}
cat++;
} }
} }
} }
...@@ -1346,103 +1429,47 @@ void odf_chart_context::end_chart() ...@@ -1346,103 +1429,47 @@ void odf_chart_context::end_chart()
impl_->clear_current(); impl_->clear_current();
} }
static formulasconvert::oox2odf_converter formulas_converter_chart;
void odf_chart_context::set_series_value_formula(std::wstring oox_formula) void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
{ {
std::wstring odfFormula; std::wstring odf_formula = impl_->convert_formula(oox_formula);
if (oox_formula.length() > 0)
odfFormula = formulas_converter_chart.convert_chart_distance(oox_formula);
//----------------------------------------------------------------------------
std::vector<std::wstring> refs;
boost::algorithm::split(refs, oox_formula, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (refs.size() > 0)
{
int col = -1, row = -1;
utils::parsing_ref( refs[0], col, row);
if (col < 0 && row < 0)
{
odfFormula.clear(); //reset by cash
}
}
//----------------------------------------------------------------------------
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
if (series == NULL)return; if (series == NULL)return;
Impl::_range r = {odfFormula, false}; Impl::_range r (odf_formula, false, series);
impl_->data_cell_ranges_.push_back(r); impl_->data_cell_ranges_.push_back(r);
if (!oox_formula.empty()) if (!odf_formula.empty())
{ {
series->chart_series_attlist_.chart_values_cell_range_address_ = odfFormula; series->chart_series_attlist_.chart_values_cell_range_address_ = odf_formula;
impl_->current_data_points_series_count_ = formulas_converter_chart.get_count_value_points(oox_formula); impl_->current_data_points_series_count_ = formulas_converter_chart.get_count_value_points(oox_formula);
} }
} }
void odf_chart_context::set_series_label_formula(std::wstring oox_formula) void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
{ {
std::wstring odfFormula; std::wstring odf_formula = impl_->convert_formula(oox_formula);
if (oox_formula.length() > 0) chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
odfFormula = formulas_converter_chart.convert_chart_distance(oox_formula); if (series == NULL)return;
//----------------------------------------------------------------------------
std::vector<std::wstring> refs;
boost::algorithm::split(refs, oox_formula, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (refs.size() > 0)
{
int col = -1, row = -1;
utils::parsing_ref( refs[0], col, row);
if (col < 0 && row < 0) Impl::_range r (odf_formula, true, series);
{
odfFormula.clear(); //reset by cash
}
}
//----------------------------------------------------------------------------
Impl::_range r = {odfFormula, true};
impl_->data_cell_ranges_.push_back(r); impl_->data_cell_ranges_.push_back(r);
if (!odfFormula.empty()) if (!odf_formula.empty())
{ {
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); series->chart_series_attlist_.chart_label_cell_address_ = odf_formula;
if (series == NULL)return;
series->chart_series_attlist_.chart_label_cell_address_ = odfFormula;
} }
} }
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type) void odf_chart_context::set_category_axis_formula(std::wstring oox_formula, int type)
{ {
std::wstring odfFormula; std::wstring odf_formula = impl_->convert_formula(oox_formula);
if (oox_formula.length() > 0)
odfFormula = formulas_converter_chart.convert_chart_distance(oox_formula);
//----------------------------------------------------------------------------
std::vector<std::wstring> refs;
boost::algorithm::split(refs, oox_formula, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (refs.size() > 0)
{
int col = -1, row = -1;
utils::parsing_ref( refs[0], col, row);
if (col < 0 && row < 0) Impl::_range r (odf_formula, true, NULL);
{
odfFormula.clear(); //reset by cash
}
}
//----------------------------------------------------------------------------
Impl::_range r = {odfFormula, true};
impl_->data_cell_ranges_.push_back(r); impl_->data_cell_ranges_.push_back(r);
if (!odfFormula.empty()) impl_->categories_.push_back(std::pair<std::wstring,int>(odf_formula, type));
{
impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula, type));
}
} }
void odf_chart_context::set_series_pie_explosion(int val)//или точка серии void odf_chart_context::set_series_pie_explosion(int val)//или точка серии
...@@ -1462,56 +1489,121 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с ...@@ -1462,56 +1489,121 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
// impl_->cash_.push_back(state); // impl_->cash_.push_back(state);
//} //}
void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str, bool label) void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str, bool categories, bool label)
{ {
if (data_str.size() < 1) return; if (impl_->data_cell_ranges_.empty()) return;
if (impl_->data_cell_ranges_.size() < 1) return; if (data_str.empty()) return;
std::wstring ref = impl_->data_cell_ranges_.back().ref; std::wstring ref = impl_->data_cell_ranges_.back().ref;
int count_cash_values = 0;
bool by_row = true;
int start_col = 0;
int start_row = 0;
if (ref.empty()) if(ref.empty() && label && categories)
{ {
std::wstring col; for (int i = 0 ; i < impl_->cash_.size(); i++)
if (label) col = L"A";
else
{ {
int curr_col = 0; if (impl_->cash_[i].label || impl_->cash_[i].categories)
for (long i=0; i < impl_->data_cell_ranges_.size(); i++)
{ {
if (impl_->data_cell_ranges_[i].label)continue; ref = impl_->cash_[i].ref;
curr_col++; data_str = impl_->cash_[i].data_str;
format = impl_->cash_[i].format;
break;
} }
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); }
if (ref.empty() && impl_->data_cell_ranges_.size() > 1)
{//direction, count cash points
int index_cash_y = impl_->data_cell_ranges_[impl_->data_cell_ranges_.size() - 2].index_cash;
impl_->data_cell_ranges_.back().ref = ref; std::wstring ref_y = impl_->data_cell_ranges_[impl_->data_cell_ranges_.size() - 2].ref;
std::vector<std::wstring> refs;
boost::algorithm::split(refs, ref_y, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); int col1 = -1, col2 = -1, row1 = -1, row2 = -1;
if (series == NULL)return;
if (refs.size() < 1) return;
utils::parsing_ref( refs[0], col1, row1);
int count_cols = col2 - col1;
int count_rows = row2 - row1;
if (label == false) if (refs.size() > 1)
{ {
series->chart_series_attlist_.chart_values_cell_range_address_ = ref; utils::parsing_ref( refs[1], col2, row2);
} }
else else
{ {
series->chart_series_attlist_.chart_label_cell_address_ = ref; col2 = col1; row2 = row1;
if (!impl_->categories_.empty())
impl_->categories_.back().first = ref;
} }
} if (count_cols == 0)
std::vector<double> data_double; {
start_col = col2;
start_row = row1;
count_cash_values = count_rows;
}
else
{
start_col = col1;
start_row = row2;
by_row = false;
count_cash_values = count_cols;
}
if (data_str.empty())
{
for (int i = 0 ; i < count_cash_values; i++)
data_str.push_back(L"non");
}
std::wstring ref1, ref2;
odf_cash_state state = {ref, format/*,data_double*/,label,data_str}; ref1 = std::wstring(L"local-table.") + utils::getColAddress(start_col) + boost::lexical_cast<std::wstring>(start_row);
//
if (by_row)
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col) + boost::lexical_cast<std::wstring>(start_row + count_cash_values);
else
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col + count_cash_values) + boost::lexical_cast<std::wstring>(start_row);
impl_->cash_.push_back(state); ref = ref1 + L":" + ref2;
}
if(ref.empty() && !data_str.empty())
{
// банальнейшая генерация А1 ... Аххх
ref = std::wstring(L"local-table.A1:") + std::wstring(L".A") + boost::lexical_cast<std::wstring>(data_str.size());
}
if (!ref.empty() && !data_str.empty())
{
odf_cash_state state = {ref, format, categories, label, data_str};
impl_->cash_.push_back(state);
int cash_ind = impl_->cash_.size() - 1;
impl_->data_cell_ranges_.back().index_cash = cash_ind;
if (impl_->data_cell_ranges_.back().ref.empty())
impl_->data_cell_ranges_.back().ref = ref;
if (!categories && !label && (impl_->data_cell_ranges_.back().series) &&
(!impl_->data_cell_ranges_.back().series->chart_series_attlist_.chart_values_cell_range_address_))
{
impl_->data_cell_ranges_.back().series->chart_series_attlist_.chart_values_cell_range_address_ = ref;
}
else if (categories && !impl_->categories_.empty())
{
if (impl_->categories_.back().first.empty())
impl_->categories_.back().first = ref;
}
}
} }
void odf_chart_context::set_local_table (bool Val) void odf_chart_context::set_local_table (bool Val, bool use_cash_only)
{ {
impl_->local_table_enabled_ = Val; impl_->local_table_enabled_ = Val;
impl_->local_table_reset_ref_ = use_cash_only;
} }
struct _sort_cells struct _sort_cells
...@@ -1525,43 +1617,47 @@ struct _sort_cells ...@@ -1525,43 +1617,47 @@ struct _sort_cells
} }
} sort_cells; } sort_cells;
void odf_chart_context::Impl::create_local_table_rows(ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header ) int odf_chart_context::Impl::create_local_table_rows(int curr_row, ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header )
{ {
int curr_row = 0;
int curr_cell = 0; int curr_cell = 0;
office_element_ptr style_null; office_element_ptr style_null;
bool add = false; bool add = false;
for (long i = 0; i< cells.size(); i++)
for (long i = 0; i < cells.size(); i++)
{ {
if (cells[i].cash_only) if (cells[i].cash_only)
continue; continue;
add = false; add = false;
if (cells[i].row > curr_row + 1) if (cells[i].row > curr_row + 1 && !header)
{ {
office_element_ptr row_elm; office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_); create_element(L"table", L"table-row", row_elm, odf_context_);
table_state->add_row(row_elm,cells[i].row - curr_row -2, style_null); table_state->add_row(row_elm, cells[i].row - curr_row - 1, style_null);
curr_row = cells[i].row-1; table_state->set_row_hidden(true);
create_element(L"table", L"table-row", row_elm, odf_context_);
table_state->add_row(row_elm, 1, style_null);
curr_row = cells[i].row - 1;
add = true; add = true;
} }
if (cells[i].row == curr_row + 1) if (cells[i].row == curr_row + 1)
{ {
if (cells[i].label == header && !add) if (!add)
{ {
office_element_ptr row_elm; office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_); create_element(L"table", L"table-row", row_elm, odf_context_);
table_state->add_row(row_elm, 1 , style_null); table_state->add_row(row_elm, 1, style_null);
} }
curr_row++; curr_row++;
curr_cell=0; curr_cell=0;
} }
if (cells[i].label == !header)continue;
if (curr_cell + 1 < cells[i].col) if (curr_cell + 1 < cells[i].col)
table_state->add_default_cell(cells[i].col - curr_cell-1); table_state->add_default_cell(cells[i].col - curr_cell-1);
...@@ -1576,11 +1672,12 @@ void odf_chart_context::Impl::create_local_table_rows(ods_table_state * table_st ...@@ -1576,11 +1672,12 @@ void odf_chart_context::Impl::create_local_table_rows(ods_table_state * table_st
curr_cell = cells[i].col; curr_cell = cells[i].col;
} }
return curr_row;
} }
void odf_chart_context::Impl::create_local_table() void odf_chart_context::Impl::create_local_table()
{ {
if (local_table_enabled_ == false)return; if (local_table_enabled_ == false) return;
std::vector<_cell_cash> cells_cash; std::vector<_cell_cash> cells_cash;
std::vector<_cell_cash> cells_cash_label; std::vector<_cell_cash> cells_cash_label;
...@@ -1590,6 +1687,9 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1590,6 +1687,9 @@ void odf_chart_context::Impl::create_local_table()
bool col_header = false; bool col_header = false;
bool row_header = false; bool row_header = false;
int min_col = 0xffff;
int min_row = 0xffff;
//выкинем дублирующие ref //выкинем дублирующие ref
for (long i = 0; i < cash_.size(); i++) for (long i = 0; i < cash_.size(); i++)
...@@ -1618,36 +1718,34 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1618,36 +1718,34 @@ void odf_chart_context::Impl::create_local_table()
table_name = refs[0].substr (0, r); table_name = refs[0].substr (0, r);
refs[0] = refs[0].substr(r + 1, refs[0].size() - r); refs[0] = refs[0].substr(r + 1, refs[0].size() - r);
} }
utils::parsing_ref( refs[0], col1, row1); utils::parsing_ref( refs[0], col1, row1);
if (col1 < 0 && row1 < 0) //ChartDateRange2007.xlsx if (col1 < min_col) min_col = col1;
{ if (row1 < min_row) min_row = row1;
//recalc_refs = true;
//table_name = L"local-table";
////defined name?
//row1 = i + 1;
//col1 = 0;
//row2 = i + 1; if (refs.size() > 1)
//col2 = cash_[i].data_str.size() - 1; {
r = refs[1].rfind(L".");
//cash_[i].ref = table_name + L"." + L"$" + utils::getColAddress(col1) + L"$" + boost::lexical_cast<std::wstring>(row1) + if (r >= 0)
// + L":" + L"." + L"$" + utils::getColAddress(col2) + L"$" + boost::lexical_cast<std::wstring>(row2); refs[1] = refs[1].substr(r + 1, refs[1].size() - r);
utils::parsing_ref( refs[1], col2, row2);
if (col2 < min_col) min_col = col2;
if (row2 < min_row) min_row = row2;
} }
else else
{ {
if (refs.size() > 1) col2 = col1; row2 = row1;
{ }
r = refs[1].rfind(L".");
if (r >= 0) if (cash_[i].categories || cash_[i].label)
refs[1] = refs[1].substr(r + 1, refs[1].size() - r); {
utils::parsing_ref( refs[1], col2, row2); if (col2 - col1 == 0 && cash_[i].label)
} col_header = true;
else
{ if (row2 - row1 == 0)
col2 = col1; row2 = row1; row_header = true;
}
} }
for (long j = 0; j < cash_[i].data_str.size(); j++) for (long j = 0; j < cash_[i].data_str.size(); j++)
...@@ -1658,6 +1756,7 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1658,6 +1756,7 @@ void odf_chart_context::Impl::create_local_table()
{ {
c.col = (col2 == col1) ? col1 : col1 + j; c.col = (col2 == col1) ? col1 : col1 + j;
c.row = (row2 == row1) ? row1 : row1 + j; c.row = (row2 == row1) ? row1 : row1 + j;
c.val = cash_[i].data_str[j]; c.val = cash_[i].data_str[j];
c.label = false; c.label = false;
} }
...@@ -1667,27 +1766,22 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1667,27 +1766,22 @@ void odf_chart_context::Impl::create_local_table()
c.cash_only = true; c.cash_only = true;
} }
if (cash_[i].label && c.row == 1) if ((cash_[i].categories || cash_[i].label) && row_header)
{ {
c.label = cash_[i].label; cells_cash_label.push_back(c);
row_header = true;
} }
if (cash_[i].label && c.col == 1) else
{ {
col_header = true; cells_cash.push_back(c);
} }
cells_cash.push_back(c);
if (c.label) cells_cash_label.push_back(c);
//else cells_cash.push_back(c);
if (c.col > max_columns && c.col < 10000) max_columns = c.col; if (c.col > max_columns && c.col < 10000) max_columns = c.col;
} }
} }
std::sort(cells_cash.begin() , cells_cash.end() ,sort_cells); std::sort(cells_cash.begin() , cells_cash.end() ,sort_cells);
std::sort(cells_cash_label.begin() , cells_cash_label.end() ,sort_cells); std::sort(cells_cash_label.begin() , cells_cash_label.end() ,sort_cells);
///////////////////////// /////////////////////////
//create tables //create tables
...@@ -1699,7 +1793,7 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1699,7 +1793,7 @@ void odf_chart_context::Impl::create_local_table()
{ {
current_level_[0].elm->add_child_element(table_elm); current_level_[0].elm->add_child_element(table_elm);
int level = current_level_.size(); int level = current_level_.size();
odf_element_state state={table_elm, L"", office_element_ptr(), level+1}; odf_element_state state={table_elm, L"", office_element_ptr(), level + 1};
current_chart_state_.elements_.push_back(state); current_chart_state_.elements_.push_back(state);
table_state->set_table_name(table_name); table_state->set_table_name(table_name);
...@@ -1717,7 +1811,7 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1717,7 +1811,7 @@ void odf_chart_context::Impl::create_local_table()
} }
office_element_ptr cols_elm; office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_); create_element(L"table", L"table-columns", cols_elm, odf_context_);
table_elm->add_child_element(cols_elm); table_elm->add_child_element(cols_elm);
...@@ -1728,6 +1822,8 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1728,6 +1822,8 @@ void odf_chart_context::Impl::create_local_table()
office_element_ptr row_elm; office_element_ptr row_elm;
office_element_ptr style_null; office_element_ptr style_null;
int current_row = 0;
if (cells_cash_label.size() > 0 || cells_cash.size() > 0) if (cells_cash_label.size() > 0 || cells_cash.size() > 0)
{ {
if (cells_cash_label.size() > 0 && row_header) if (cells_cash_label.size() > 0 && row_header)
...@@ -1735,23 +1831,26 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1735,23 +1831,26 @@ void odf_chart_context::Impl::create_local_table()
create_element(L"table", L"table-header-rows",row_headers_elm, odf_context_); create_element(L"table", L"table-header-rows",row_headers_elm, odf_context_);
table_state->start_headers(row_headers_elm); table_state->start_headers(row_headers_elm);
create_local_table_rows(table_state, cells_cash_label ,true); current_row = create_local_table_rows(current_row, table_state, cells_cash_label, true);
table_state->end_headers(); table_state->end_headers();
} }
if (cells_cash.size() > 0) create_local_table_rows(table_state, cells_cash ,false); if (cells_cash.size() > 0)
{
current_row = create_local_table_rows(current_row, table_state, cells_cash, false);
}
else else
{ {
create_element(L"table", L"table-rows",row_elm, odf_context_); create_element(L"table", L"table-rows", row_elm, odf_context_);
table_state->add_row(row_elm,1, style_null); table_state->add_row(row_elm, 1, style_null);
} }
} }
else else
{ {
create_element(L"table", L"table-header-rows",row_headers_elm, odf_context_); create_element(L"table", L"table-header-rows", row_headers_elm, odf_context_);
table_state->start_headers(row_headers_elm); table_state->start_headers(row_headers_elm);
{ {
create_element(L"table", L"table-row",row_elm, odf_context_); create_element(L"table", L"table-row", row_elm, odf_context_);
table_state->add_row(row_elm, 1, style_null); table_state->add_row(row_elm, 1, style_null);
{ {
office_element_ptr cell_elm; office_element_ptr cell_elm;
...@@ -1763,7 +1862,7 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1763,7 +1862,7 @@ void odf_chart_context::Impl::create_local_table()
} }
table_state->end_headers(); table_state->end_headers();
create_element(L"table", L"table-rows",row_elm, odf_context_); create_element(L"table", L"table-rows", row_elm, odf_context_);
table_state->add_row(row_elm, 1, style_null); table_state->add_row(row_elm, 1, style_null);
} }
} }
......
...@@ -144,9 +144,8 @@ public: ...@@ -144,9 +144,8 @@ public:
void set_layout_w(double *val,int mode); void set_layout_w(double *val,int mode);
void set_layout_h(double *val,int mode); void set_layout_h(double *val,int mode);
void set_local_table(bool Val); void set_local_table(bool Val, bool use_cash_only = false);
//void set_cash(std::wstring format, std::vector<double> &data); void set_cash(std::wstring format, std::vector<std::wstring> &data, bool categories, bool label);
void set_cash(std::wstring format, std::vector<std::wstring> &data,bool label = false);
void end_chart(); void end_chart();
......
...@@ -1654,6 +1654,9 @@ void odf_drawing_context::set_line_dash_preset(int style) ...@@ -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)return;
if ((impl_->current_graphic_properties->content().draw_stroke_) &&
(impl_->current_graphic_properties->content().draw_stroke_->get_type() == line_style::None)) return;
switch(style) //+создать стиль, привзать имена switch(style) //+создать стиль, привзать имена
{ {
case 0://presetlinedashvalDash case 0://presetlinedashvalDash
......
...@@ -256,10 +256,10 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ ...@@ -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]->odf_style_)
{ {
if (style_state_list_[i]->get_family_type() == family && if (style_state_list_[i]->get_family_type() == family &&
style_state_list_[i]->root_ == root && style_state_list_[i]->root_ == root &&
style_state_list_[i]->automatic_ == automatic && style_state_list_[i]->automatic_ == automatic &&
style_state_list_[i]->conditional_ == false && style_state_list_[i]->conditional_ == false &&
style_state_list_[i]->default_ == false) style_state_list_[i]->default_ == false)
{ {
if (oox_id_style >=0 && style_state_list_[i]->style_oox_id_ == oox_id_style) 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 ...@@ -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) 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_) if (current_default_styles_[i]->odf_style_)
{ {
...@@ -336,11 +336,12 @@ office_element_ptr odf_style_context::find_odf_style_default(style_family::type ...@@ -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) 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]->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""; return L"";
......
...@@ -103,9 +103,8 @@ void odf_style_state::set_display_name(std::wstring name) ...@@ -103,9 +103,8 @@ void odf_style_state::set_display_name(std::wstring name)
} }
std::wstring odf_style_state::get_name() std::wstring odf_style_state::get_name()
{ {
style* style_ = dynamic_cast<style*>(odf_style_.get()); style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_) return odf_style_name_;
if (!style_)return odf_style_name_;
return style_->style_name_; return style_->style_name_;
} }
...@@ -161,7 +160,12 @@ void odf_style_state::set_default(bool val) ...@@ -161,7 +160,12 @@ void odf_style_state::set_default(bool val)
} }
void odf_style_state::set_conditional(bool val) void odf_style_state::set_conditional(bool val)
{ {
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_) return;
conditional_ = val; conditional_ = val;
if (val)
style_->style_name_ = L"dx_" + style_->style_name_;
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
bool odf_style_state::get_list_style_exist() bool odf_style_state::get_list_style_exist()
......
...@@ -120,8 +120,8 @@ private: ...@@ -120,8 +120,8 @@ private:
/////// ///////
bool automatic_; bool automatic_;
bool root_; bool root_;
bool default_; // это для тех стилей что в root bool default_; // это для тех стилей что в root
bool conditional_; //стили накладываемые по условию bool conditional_; //стили накладываемые по условию
bool writable_; bool writable_;
......
...@@ -99,15 +99,26 @@ void ods_conversion_context::end_document() ...@@ -99,15 +99,26 @@ void ods_conversion_context::end_document()
odf_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() void ods_conversion_context::start_conditional_formats()
{ {
current_table().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) 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); table_context_.add_defined_range(name,cell_range, sheet_id, printable);
......
...@@ -105,11 +105,13 @@ public: ...@@ -105,11 +105,13 @@ public:
double convert_symbol_width(double val); 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_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_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 start_table_part (std::wstring name, std::wstring ref);
void end_autofilter(){} void end_table_part ();
void set_table_part_autofilter(bool val);
void start_conditional_formats(); void start_conditional_formats();
void end_conditional_formats(){} void end_conditional_formats(){}
......
...@@ -56,7 +56,48 @@ ods_table_state & ods_table_context::state() ...@@ -56,7 +56,48 @@ ods_table_state & ods_table_context::state()
{ {
return table_state_list_.back(); 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_); 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 ...@@ -140,8 +181,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
formulasconvert::oox2odf_converter formulas_converter; formulasconvert::oox2odf_converter formulas_converter;
std::wstring odf_value = formulas_converter.convert_formula(value); std::wstring odf_value = formulas_converter.convert_named_ref(value);
//formulas_converter.convert_named_ref(value); -> ChartDateRange2007.xlsx
std::wstring odf_base_cell = formulas_converter.find_base_cell(value); std::wstring odf_base_cell = formulas_converter.find_base_cell(value);
named_expression->table_name_ = name; named_expression->table_name_ = name;
......
...@@ -72,8 +72,11 @@ public: ...@@ -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_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_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 start_table_part(std::wstring name, std::wstring ref);
void set_table_part_autofilter(bool val);
void end_table_part();
private: private:
......
...@@ -326,14 +326,14 @@ void ods_table_state::set_table_dimension(int col, int row) ...@@ -326,14 +326,14 @@ void ods_table_state::set_table_dimension(int col, int row)
{ {
if (col<1 || row <1 )return; if (col<1 || row <1 )return;
if (dimension_columns < col) dimension_columns = col +1; if (dimension_columns < col) dimension_columns = col + 1;
if (dimension_row < row) dimension_row = row+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) void ods_table_state::add_row(office_element_ptr & elm, short repeated, office_element_ptr & style_elm)
{ {
current_table_column_ = 0; current_table_column_ = 0;
current_table_row_+=repeated; current_table_row_ += repeated;
current_level_.back()->add_child_element(elm); 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 ...@@ -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); 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->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) void ods_table_state::set_row_hidden(bool Val)
......
...@@ -134,8 +134,18 @@ namespace utils { ...@@ -134,8 +134,18 @@ namespace utils {
std::reverse(col.begin(), col.end()); std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.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; std::wstring strCol, strRow;
splitCellAddress(ref,strCol,strRow); splitCellAddress(ref,strCol,strRow);
......
...@@ -449,7 +449,7 @@ void chart_domain::serialize(std::wostream & _Wostream) ...@@ -449,7 +449,7 @@ void chart_domain::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() 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: ...@@ -317,7 +317,7 @@ public:
// attr // attr
std::wstring style_name_; std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_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_parent_style_name_;
_CP_OPT( std::wstring ) style_next_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:: ...@@ -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()); text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oLatinFont->m_oTypeFace->GetValue());
else else
{ {
text_properties->content().fo_font_family_ = L"Calibri";//default_font; ????
} }
} }
if (oox_run_pr->m_oAsianFont.IsInit()) if (oox_run_pr->m_oAsianFont.IsInit())
......
...@@ -448,8 +448,8 @@ public: ...@@ -448,8 +448,8 @@ public:
void convert(OOX::Spreadsheet::CT_Marker *marker); 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_Marker *marker, std::vector<OOX::Spreadsheet::CT_DPt*> & dPt);
void convert(OOX::Spreadsheet::CT_ExternalData *external_data); void convert(OOX::Spreadsheet::CT_ExternalData *external_data);
void convert(OOX::Spreadsheet::CT_NumData *num_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 label = false); void convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label);
//.vml............................................................................................................................ //.vml............................................................................................................................
......
...@@ -770,8 +770,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AreaSer* ser) ...@@ -770,8 +770,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AreaSer* ser)
odf_context()->chart_context()->start_series(L"area"); odf_context()->chart_context()->start_series(L"area");
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls); convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
if (ser->m_dPt.size() > 0) if (ser->m_dPt.size() > 0)
{ {
...@@ -822,8 +824,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceSer* ser) ...@@ -822,8 +824,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SurfaceSer* ser)
odf_context()->chart_context()->start_series(L"surface"); odf_context()->chart_context()->start_series(L"surface");
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
odf_context()->chart_context()->end_series(); odf_context()->chart_context()->end_series();
} }
...@@ -836,8 +840,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PieSer* ser) ...@@ -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); odf_context()->chart_context()->set_series_pie_explosion(*ser->m_explosion->m_val);
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls); convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
if (ser->m_dPt.size() > 0) if (ser->m_dPt.size() > 0)
{ {
...@@ -852,8 +858,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser) ...@@ -852,8 +858,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarSer* ser)
odf_context()->chart_context()->start_series(L"bar"); odf_context()->chart_context()->start_series(L"bar");
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls); convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
if (ser->m_dPt.size() > 0) if (ser->m_dPt.size() > 0)
{ {
...@@ -871,27 +879,37 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser) ...@@ -871,27 +879,37 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ScatterSer* ser)
{ {
if (ser == NULL)return; if (ser == NULL)return;
odf_context()->chart_context()->start_series(L"scatter"); if (ser->m_yVal)
convert(ser->m_oSpPr.GetPointer()); {
convert(ser->m_dLbls); odf_context()->chart_context()->start_series(L"scatter");
convert(ser->m_xVal, 2);//domain convert(ser->m_oSpPr.GetPointer());
convert(ser->m_tx); convert(ser->m_dLbls);
if (ser->m_marker || ser->m_dPt.size() > 0)
{ convert(ser->m_xVal, 2);//domain
convert(ser->m_marker, ser->m_dPt); convert(ser->m_yVal);
}
odf_context()->chart_context()->end_series(); convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0)
odf_context()->chart_context()->start_series(L"scatter"); {
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_marker, ser->m_dPt);
convert(ser->m_dLbls); }
convert(ser->m_yVal); odf_context()->chart_context()->end_series();
convert(ser->m_tx); }
if (ser->m_marker || ser->m_dPt.size() > 0) else if (ser->m_xVal)
{ {
convert(ser->m_marker, ser->m_dPt); odf_context()->chart_context()->start_series(L"scatter");
} convert(ser->m_oSpPr.GetPointer());
odf_context()->chart_context()->end_series(); 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) void OoxConverter::convert(OOX::Spreadsheet::CT_RadarSer* ser)
{ {
...@@ -900,8 +918,10 @@ 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"); odf_context()->chart_context()->start_series(L"radar");
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls); convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0) if (ser->m_marker || ser->m_dPt.size() > 0)
{ {
...@@ -916,8 +936,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LineSer* ser) ...@@ -916,8 +936,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LineSer* ser)
odf_context()->chart_context()->start_series(L"line"); odf_context()->chart_context()->start_series(L"line");
convert(ser->m_oSpPr.GetPointer()); convert(ser->m_oSpPr.GetPointer());
convert(ser->m_dLbls); convert(ser->m_dLbls);
convert(ser->m_cat,1);
convert(ser->m_cat, 1);
convert(ser->m_val); convert(ser->m_val);
convert(ser->m_tx); convert(ser->m_tx);
if (ser->m_marker || ser->m_dPt.size() > 0) if (ser->m_marker || ser->m_dPt.size() > 0)
{ {
...@@ -1016,60 +1038,60 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx) ...@@ -1016,60 +1038,60 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
if (ser_tx->m_strRef) 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)); //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) void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
{ {
if (cat == NULL) if (cat == NULL) return;
{
odf_context()->chart_context()->set_category_axis_formula(L"", type);
return;
}
if (cat->m_numLit) if (cat->m_numLit)
{ {
odf_context()->chart_context()->set_series_value_formula(L""); odf_context()->chart_context()->set_series_value_formula(L"");
convert(cat->m_numLit); convert(cat->m_numLit, false, false);
} }
else if (cat->m_strLit) else if (cat->m_strLit)
{ {
odf_context()->chart_context()->set_category_axis_formula(L"", type); 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) 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) 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) void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
{ {
if (val == NULL)return; if (val == NULL) return;
if (val->m_numLit) if (val->m_numLit)
{ {
odf_context()->chart_context()->set_series_value_formula(L""); odf_context()->chart_context()->set_series_value_formula(L"");
convert(val->m_numLit); convert(val->m_numLit, false, false);
} }
else if (val->m_numRef) 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)); 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) ...@@ -1111,7 +1133,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ExternalData *external_data)
odf_context()->chart_context()->set_local_table(true);//пока пользуем кэш .... 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; if (num_data == NULL)return;
...@@ -1120,7 +1142,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool label) ...@@ -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++) 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) 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)); 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) ...@@ -1137,10 +1158,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool label)
std::wstring format; std::wstring format;
if (num_data->m_formatCode) format = string2std_string(*num_data->m_formatCode); 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; if (str_data == NULL)return;
std::vector<std::wstring> data; std::vector<std::wstring> data;
...@@ -1153,6 +1174,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool label) ...@@ -1153,6 +1174,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool label)
} }
std::wstring format; 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) ...@@ -341,17 +341,28 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part) void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
{ {
if (!oox_table_part) return; if (!oox_table_part) return;
//nullable<SimpleTypes::CRelationshipId > m_oRef; //nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oHeaderRowCount;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oHeaderRowCount; //nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oTotalsRowCount;
//nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oTotalsRowCount;
//nullable<CString > m_oDisplayName;
//nullable<CSortState > m_oSortState; //nullable<CSortState > m_oSortState;
//nullable<CTableColumns > m_oTableColumns; //nullable<CTableColumns > m_oTableColumns;
//nullable<CTableStyleInfo > m_oTableStyleInfo;
//----------------------------------------------------------------------------------------------------------------
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) ...@@ -777,7 +788,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCol *oox_column)
{ {
int xfd_id = oox_column->m_oStyle->GetValue(); 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 else
{ {
...@@ -907,7 +918,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) ...@@ -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()) 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) if (ActiveCellX >= 0 && ActiveCellY >= 0)
{ {
...@@ -1027,11 +1039,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p ...@@ -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); //if (default_cell_style) ods_context->styles_context()->add_default(default_cell_style);
odf_writer::odf_style_state_ptr 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/////////////////////////////////////////////////////////////////////////////////////// ///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 double width = 8.1; // из приложния MS Office 2010
//в xlsx необязательно задавать ширину (колонок) - дефолтное по приложению. в oo - обязательно //в xlsx необязательно задавать ширину (колонок) - дефолтное по приложению. в oo - обязательно
...@@ -1051,7 +1065,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p ...@@ -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); 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 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Row default //////////////////////////////////////////////////////////////////////////////////////////////////////////////
{ {
...@@ -1073,7 +1087,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p ...@@ -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); 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() void XlsxConverter::convert_styles()
...@@ -1565,16 +1579,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style) ...@@ -1565,16 +1579,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style)
//придется копировать свойства все .. они автоматические стили удалить (не сохранять в файл) //придется копировать свойства все .. они автоматические стили удалить (не сохранять в файл)
odf_writer::odf_style_state_ptr parent_style_state; 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_text_properties *text_props = style_state->get_text_properties();
odf_writer::style_paragraph_properties *para_props = style_state->get_paragraph_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_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_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_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(); 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); if (text_props) text_props->apply_from(parent_text_props);
...@@ -1583,18 +1597,19 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style) ...@@ -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; 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); 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(); 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_oBorder.GetPointer() , table_cell_properties);
convert(dxFmt->m_oFill.GetPointer(), table_cell_properties); convert(dxFmt->m_oFill.GetPointer() , table_cell_properties);
convert(dxFmt->m_oFont.GetPointer(), text_properties); convert(dxFmt->m_oFont.GetPointer() , text_properties);
if (dxFmt->m_oNumFmt.IsInit()) if (dxFmt->m_oNumFmt.IsInit())
{ {
...@@ -1624,9 +1639,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool ...@@ -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 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; 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(); 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())) 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) ...@@ -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) if (oox_filter->m_oSortState->m_oCaseSensitive.IsInit() && oox_filter->m_oSortState->m_oCaseSensitive->GetValue()==1)
caseSensitive = true; caseSensitive = true;
} }
ods_context->start_autofilter(ref);//target ods_context->add_autofilter(ref);//target
{
//for (unsigned int i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo
for (unsigned int i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo //{
{ //}
}
}
ods_context->end_autofilter();
} }
} // namespace Docx2Odt } // namespace Docx2Odt
...@@ -709,10 +709,6 @@ ...@@ -709,10 +709,6 @@
RelativePath="..\OdfFormat\odf_chart_context.cpp" RelativePath="..\OdfFormat\odf_chart_context.cpp"
> >
</File> </File>
<File
RelativePath="..\OdfFormat\odf_chart_context.h"
>
</File>
<File <File
RelativePath="..\OdfFormat\odf_comment_context.cpp" 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