Commit 2f9a8eb7 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - pilots converting ..

parent a70087e1
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
std::wstring convert_named_ref (std::wstring const & expr); std::wstring convert_named_ref (std::wstring const & expr);
std::wstring convert_named_formula(std::wstring const & expr); std::wstring convert_named_formula(std::wstring const & expr);
std::wstring get_base_cell_formula(); std::wstring get_table_name();
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19 //Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
std::wstring convert_chart_distance(std::wstring const & expr); std::wstring convert_chart_distance(std::wstring const & expr);
......
...@@ -602,6 +602,13 @@ namespace formulasconvert { ...@@ -602,6 +602,13 @@ namespace formulasconvert {
XmlUtils::replace_all( workstr, L"PROBEL" , L" "); XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'"); XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L"."); XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
if (impl_->table_name_.empty() == false)
{
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
}
return workstr; return workstr;
} }
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName) std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
...@@ -641,6 +648,13 @@ namespace formulasconvert { ...@@ -641,6 +648,13 @@ namespace formulasconvert {
XmlUtils::replace_all( workstr, L"PROBEL" , L" "); XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'"); XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L"."); XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
if (impl_->table_name_.empty() == false)
{
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
}
} }
return workstr; return workstr;
} }
......
...@@ -65,11 +65,11 @@ public: ...@@ -65,11 +65,11 @@ public:
static bool isFindBaseCell_; static bool isFindBaseCell_;
static std::wstring base_cell_formula_; static std::wstring table_name_;
}; };
bool oox2odf_converter::Impl::isFindBaseCell_ = false; bool oox2odf_converter::Impl::isFindBaseCell_ = false;
std::wstring oox2odf_converter::Impl::base_cell_formula_ = L""; std::wstring oox2odf_converter::Impl::table_name_ = L"";
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr) void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
{ {
...@@ -117,9 +117,9 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat ...@@ -117,9 +117,9 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
{ {
XmlUtils::replace_all( sheet, L"!", L""); XmlUtils::replace_all( sheet, L"!", L"");
if (isFindBaseCell_ && base_cell_formula_.empty() && !sheet.empty()) if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
{ {
base_cell_formula_ = sheet + L".$A$1"; table_name_ = sheet + L".$A$1";
} }
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet; if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
...@@ -161,7 +161,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat ...@@ -161,7 +161,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr) void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
{ {
base_cell_formula_.clear(); table_name_.clear();
isFindBaseCell_ = true; isFindBaseCell_ = true;
expr = convert_formula(expr); expr = convert_formula(expr);
...@@ -171,7 +171,7 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr) ...@@ -171,7 +171,7 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
// Лист1!$A$1 -> $Лист1.$A$1 // Лист1!$A$1 -> $Лист1.$A$1
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr) void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
{ {
base_cell_formula_.clear(); table_name_.clear();
isFindBaseCell_ = true; isFindBaseCell_ = true;
std::wstring workstr = expr, out; std::wstring workstr = expr, out;
...@@ -207,6 +207,15 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr) ...@@ -207,6 +207,15 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
if (!out.empty()) expr = out.substr(0, out.length() - 1); if (!out.empty()) expr = out.substr(0, out.length() - 1);
isFindBaseCell_ = false; isFindBaseCell_ = false;
if (table_name_.empty() == false)
{
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
}
} }
...@@ -471,6 +480,21 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr) ...@@ -471,6 +480,21 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
XmlUtils::replace_all( res, L"PROBEL", L" "); XmlUtils::replace_all( res, L"PROBEL", L" ");
if (table_name_.empty() == false)
{
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
XmlUtils::replace_all( table_name_, L"KVADRATIN", L"[");
XmlUtils::replace_all( table_name_, L"KVADRATOUT", L"]");
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
}
return std::wstring(L"of:=") + res; return std::wstring(L"of:=") + res;
} }
...@@ -614,9 +638,9 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr) ...@@ -614,9 +638,9 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
impl_->replace_named_formula(workstr); impl_->replace_named_formula(workstr);
return workstr; return workstr;
} }
std::wstring oox2odf_converter::get_base_cell_formula() std::wstring oox2odf_converter::get_table_name()
{ {
return impl_->base_cell_formula_; return impl_->table_name_;
} }
......
...@@ -50,14 +50,20 @@ public: ...@@ -50,14 +50,20 @@ public:
int end_table(); int end_table();
void start_field(); void start_field();
void set_field_name(std::wstring name);
void set_field_type(int type);
void set_field_function(int type);
void set_field_user_function(std::wstring f);
void add_field_subtotal(int function_type);
void add_field_cache(int index, std::wstring value);
void end_field(); void end_field();
int get_view_count();//equal in libre int get_count();
int get_cache_count();
void set_view_name(std::wstring name); void set_view_name(std::wstring name);
void set_view_target_range(std::wstring ref);
void add_cache(std::wstring definitions, std::wstring records); void set_source_range(std::wstring ref);
void write_cache_definitions_to (int index, std::wostream & strm); void write_cache_definitions_to (int index, std::wostream & strm);
void write_cache_records_to (int index, std::wostream & strm); void write_cache_records_to (int index, std::wostream & strm);
...@@ -71,9 +77,6 @@ public: ...@@ -71,9 +77,6 @@ public:
void add_connections(std::wstring connections); void add_connections(std::wstring connections);
bool is_connections(); bool is_connections();
std::wostream & stream_view();
std::wostream & stream_cache();
private: private:
class Impl; class Impl;
_CP_PTR(Impl) impl_; _CP_PTR(Impl) impl_;
......
...@@ -148,9 +148,9 @@ void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableS ...@@ -148,9 +148,9 @@ void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableS
void xlsx_table_context::end_table() void xlsx_table_context::end_table()
{ {
xlsx_table_states_.pop_back(); //xlsx_table_states_.pop_back();
} }
void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned) void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned)
{ {
state()->start_cell(columnsSpanned, rowsSpanned); state()->start_cell(columnsSpanned, rowsSpanned);
......
...@@ -232,7 +232,7 @@ void xlsx_conversion_context::end_document() ...@@ -232,7 +232,7 @@ void xlsx_conversion_context::end_document()
get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM()); get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
int pivot_cache_count = xlsx_pivots_context_.get_cache_count(); int pivot_cache_count = xlsx_pivots_context_.get_count();
if (pivot_cache_count > 0) if (pivot_cache_count > 0)
{ {
CP_XML_NODE(L"pivotCaches") CP_XML_NODE(L"pivotCaches")
...@@ -259,7 +259,7 @@ void xlsx_conversion_context::end_document() ...@@ -259,7 +259,7 @@ void xlsx_conversion_context::end_document()
} }
} }
} }
int pivot_view_count = xlsx_pivots_context_.get_view_count(); int pivot_view_count = xlsx_pivots_context_.get_count();
if (pivot_view_count > 0) if (pivot_view_count > 0)
{ {
for (int i = 0; i < pivot_view_count; i++) for (int i = 0; i < pivot_view_count; i++)
...@@ -363,17 +363,33 @@ oox_chart_context & xlsx_conversion_context::current_chart() ...@@ -363,17 +363,33 @@ oox_chart_context & xlsx_conversion_context::current_chart()
throw std::runtime_error("internal error"); throw std::runtime_error("internal error");
} }
} }
xlsx_xml_worksheet & xlsx_conversion_context::current_sheet() xlsx_xml_worksheet & xlsx_conversion_context::current_sheet(int index)
{ {
if (!sheets_.empty()) if (!sheets_.empty())
{ {
return *sheets_.back().get(); if (index < 0) return *sheets_.back().get();
else return *sheets_[index].get();
} }
else else
{ {
throw std::runtime_error("internal error"); throw std::runtime_error("internal error");
} }
} }
int xlsx_conversion_context::find_sheet_by_name(std::wstring tableName)
{
if (tableName.empty()) return -1;
if (0 == tableName.find(L"'"))
{
tableName = tableName.substr(1, tableName.length() - 2);
}
for (size_t i = 0; i < sheets_.size(); i++)
{
if (sheets_[i]->name() == tableName)
return i;
}
return -1;
}
void xlsx_conversion_context::create_new_sheet(std::wstring const & name) void xlsx_conversion_context::create_new_sheet(std::wstring const & name)
{ {
sheets_.push_back(xlsx_xml_worksheet::create(name)); sheets_.push_back(xlsx_xml_worksheet::create(name));
......
...@@ -102,7 +102,10 @@ public: ...@@ -102,7 +102,10 @@ public:
bool start_table (std::wstring tableName, std::wstring tableStyleName); bool start_table (std::wstring tableName, std::wstring tableStyleName);
void end_table (); void end_table ();
void start_table_column (unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax); int find_sheet_by_name(std::wstring tableName);
xlsx_xml_worksheet & current_sheet(int index = -1);
void start_table_column (unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax);
void table_column_last_width (double w); void table_column_last_width (double w);
double table_column_last_width (); double table_column_last_width ();
void end_table_column (); void end_table_column ();
...@@ -162,7 +165,6 @@ public: ...@@ -162,7 +165,6 @@ public:
xlsx_table_context & get_table_context() { return xlsx_table_context_; } xlsx_table_context & get_table_context() { return xlsx_table_context_; }
const xlsx_table_context & get_table_context() const { return xlsx_table_context_; } const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
xlsx_style_manager & get_style_manager() { return xlsx_style_; } xlsx_style_manager & get_style_manager() { return xlsx_style_; }
xlsx_xml_worksheet & current_sheet();
oox_chart_context & current_chart(); oox_chart_context & current_chart();
math_context & get_math_context() { return math_context_; } math_context & get_math_context() { return math_context_; }
......
...@@ -89,6 +89,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context ...@@ -89,6 +89,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
{ {
if (!source_) return; if (!source_) return;
int table_index = -1;
Context.get_pivots_context().start_table(); Context.get_pivots_context().start_table();
if (table_name_) Context.get_pivots_context().set_view_name(*table_name_); if (table_name_) Context.get_pivots_context().set_view_name(*table_name_);
...@@ -99,12 +101,11 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context ...@@ -99,12 +101,11 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false); std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
std::wstring table_name = formulas_converter.get_table_name(); std::wstring table_name = formulas_converter.get_table_name();
//Context.get_table_context() table_index = Context.find_sheet_by_name(table_name);
//Context.get_pivots_context()->set_view_target_range(ref); Context.get_pivots_context().set_view_target_range(ref);
//Context.get_pivots_context()->set_view_target_table(table_index); //Context.get_pivots_context().set_view_target_table(table_index);
} }
source_->xlsx_convert(Context); source_->xlsx_convert(Context);
for (size_t i = 0; i < fields_.size(); i++) for (size_t i = 0; i < fields_.size(); i++)
...@@ -116,7 +117,7 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context ...@@ -116,7 +117,7 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
if (index_view > 0) if (index_view > 0)
{ {
Context.current_sheet().sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(index_view), Context.current_sheet(table_index).sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(index_view),
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable",
L"../pivotTables/pivotTable" + std::to_wstring(index_view) + L".xml")); L"../pivotTables/pivotTable" + std::to_wstring(index_view) + L".xml"));
} }
...@@ -138,16 +139,37 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr ...@@ -138,16 +139,37 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
CP_CREATE_ELEMENT (content_); if (L"table" == Ns && L"data-pilot-field-reference" == Name)
CP_CREATE_ELEMENT (reference_);
else if (L"table" == Ns && L"data-pilot-level" == Name)
CP_CREATE_ELEMENT (level_);
else if (L"table" == Ns && L"data-pilot-groups" == Name)
CP_CREATE_ELEMENT (groups_);
} }
void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context) void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
Context.get_pivots_context().start_field(); Context.get_pivots_context().start_field();
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
Context.get_pivots_context().set_field_type(table_orientation_.get_value_or(table_orientation::hidden).get_type());
for (size_t i = 0; i < content_.size(); i++) if (table_function_)
{ {
content_[i]->xlsx_convert(Context); table_function::type type = table_function_->get_type();
}
if (type == table_function::String)
{
Context.get_pivots_context().set_field_user_function(table_function_->get_string());
}
else
{
Context.get_pivots_context().set_field_function(type);
}
}
if (reference_) reference_->xlsx_convert(Context);
if (groups_) groups_->xlsx_convert(Context);
if (level_) level_->xlsx_convert(Context);
Context.get_pivots_context().end_field(); Context.get_pivots_context().end_field();
} }
...@@ -226,9 +248,14 @@ void table_source_cell_range::add_child_element( xml::sax * Reader, const std::w ...@@ -226,9 +248,14 @@ void table_source_cell_range::add_child_element( xml::sax * Reader, const std::w
} }
void table_source_cell_range::xlsx_convert(oox::xlsx_conversion_context & Context) void table_source_cell_range::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
for (size_t i = 0; i < content_.size(); i++) if (table_cellrange_address_)
{ {
content_[i]->xlsx_convert(Context); formulasconvert::odf2oox_converter formulas_converter;
std::wstring ref = formulas_converter.convert_named_ref(*table_cellrange_address_, false);
std::wstring table_name = formulas_converter.get_table_name();
Context.get_pivots_context().set_source_range(ref);
} }
} }
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
...@@ -257,15 +284,36 @@ void table_data_pilot_level::add_attributes( const xml::attributes_wc_ptr & Attr ...@@ -257,15 +284,36 @@ void table_data_pilot_level::add_attributes( const xml::attributes_wc_ptr & Attr
} }
void table_data_pilot_level::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void table_data_pilot_level::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
CP_CREATE_ELEMENT (content_); if (L"table" == Ns && L"data-pilot-members" == Name)
CP_CREATE_ELEMENT (members_);
else if (L"table" == Ns && L"data-pilot-subtotals" == Name)
CP_CREATE_ELEMENT (subtotals_);
else if (L"table" == Ns && L"data-pilot-display-info" == Name)
CP_CREATE_ELEMENT ( display_info_);
else if (L"table" == Ns && L"data-pilot-layout-info" == Name)
CP_CREATE_ELEMENT ( layout_info_);
else if (L"table" == Ns && L"data-pilot-sort-info" == Name)
CP_CREATE_ELEMENT (sort_info_);
} }
void table_data_pilot_level::xlsx_convert(oox::xlsx_conversion_context & Context) void table_data_pilot_level::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
for (size_t i = 0; i < content_.size(); i++) table_data_pilot_members* members = dynamic_cast<table_data_pilot_members*>(members_.get());
{ table_data_pilot_subtotals* subtotals = dynamic_cast<table_data_pilot_subtotals*>(subtotals_.get());
content_[i]->xlsx_convert(Context);
for (size_t i = 0; members && i < members->content_.size(); i++)
{
table_data_pilot_member* member = dynamic_cast<table_data_pilot_member*>(members->content_[i].get());
if (member)
Context.get_pivots_context().add_field_cache(i, member->table_name_.get_value_or(L""));
}
for (size_t i = 0; subtotals && i < subtotals->content_.size(); i++)
{
table_data_pilot_subtotal* subtotal = dynamic_cast<table_data_pilot_subtotal*>(subtotals->content_[i].get());
if (subtotal)
{
Context.get_pivots_context().add_field_subtotal(subtotal->table_function_.get_value_or(table_function::Auto).get_type());
}
} }
} }
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_groups::ns = L"table"; const wchar_t * table_data_pilot_groups::ns = L"table";
......
...@@ -65,8 +65,8 @@ private: ...@@ -65,8 +65,8 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){} virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
office_element_ptr_array content_; public:
office_element_ptr_array content_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_tables); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_tables);
...@@ -87,6 +87,7 @@ private: ...@@ -87,6 +87,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_name_; _CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_target_range_address_; _CP_OPT(std::wstring) table_target_range_address_;
_CP_OPT(std::wstring) table_application_data_; _CP_OPT(std::wstring) table_application_data_;
...@@ -119,6 +120,7 @@ private: ...@@ -119,6 +120,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_source_field_name_; _CP_OPT(std::wstring) table_source_field_name_;
_CP_OPT(odf_types::table_orientation) table_orientation_; _CP_OPT(odf_types::table_orientation) table_orientation_;
_CP_OPT(int) table_used_hierarchy_; _CP_OPT(int) table_used_hierarchy_;
...@@ -127,7 +129,9 @@ private: ...@@ -127,7 +129,9 @@ private:
_CP_OPT(std::wstring) table_selected_page_; _CP_OPT(std::wstring) table_selected_page_;
_CP_OPT(odf_types::Bool) table_is_data_layout_field_; _CP_OPT(odf_types::Bool) table_is_data_layout_field_;
office_element_ptr_array content_; office_element_ptr reference_;
office_element_ptr level_;
office_element_ptr groups_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field);
...@@ -147,6 +151,7 @@ private: ...@@ -147,6 +151,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_field_name_; _CP_OPT(std::wstring) table_field_name_;
_CP_OPT(std::wstring) table_member_name_; _CP_OPT(std::wstring) table_member_name_;
_CP_OPT(odf_types::member_type) table_member_type_; _CP_OPT(odf_types::member_type) table_member_type_;
...@@ -171,6 +176,7 @@ private: ...@@ -171,6 +176,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_database_name_; _CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_database_table_name_; _CP_OPT(std::wstring) table_database_table_name_;
}; };
...@@ -193,6 +199,7 @@ private: ...@@ -193,6 +199,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_database_name_; _CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_query_name_; _CP_OPT(std::wstring) table_query_name_;
}; };
...@@ -215,6 +222,7 @@ private: ...@@ -215,6 +222,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_database_name_; _CP_OPT(std::wstring) table_database_name_;
_CP_OPT(odf_types::Bool)table_parse_sql_statement_; _CP_OPT(odf_types::Bool)table_parse_sql_statement_;
_CP_OPT(std::wstring) table_sql_statement_; _CP_OPT(std::wstring) table_sql_statement_;
...@@ -238,8 +246,9 @@ private: ...@@ -238,8 +246,9 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_cellrange_address_; _CP_OPT(std::wstring) table_cellrange_address_;
office_element_ptr_array content_; office_element_ptr_array content_; //filters
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_source_cell_range); CP_REGISTER_OFFICE_ELEMENT2(table_source_cell_range);
...@@ -260,6 +269,7 @@ private: ...@@ -260,6 +269,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_name_; _CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_object_name_; _CP_OPT(std::wstring) table_object_name_;
_CP_OPT(std::wstring) table_password_; _CP_OPT(std::wstring) table_password_;
...@@ -285,8 +295,14 @@ private: ...@@ -285,8 +295,14 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(odf_types::Bool) table_show_empty_; _CP_OPT(odf_types::Bool) table_show_empty_;
office_element_ptr_array content_;
office_element_ptr members_;
office_element_ptr subtotals_;
office_element_ptr display_info_;
office_element_ptr layout_info_;
office_element_ptr sort_info_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_level); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_level);
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
...@@ -306,6 +322,7 @@ private: ...@@ -306,6 +322,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_date_end_; _CP_OPT(std::wstring) table_date_end_;
_CP_OPT(std::wstring) table_date_start_; _CP_OPT(std::wstring) table_date_start_;
_CP_OPT(std::wstring) table_start; //double 18.2 or auto. _CP_OPT(std::wstring) table_start; //double 18.2 or auto.
...@@ -334,6 +351,7 @@ private: ...@@ -334,6 +351,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_name_; _CP_OPT(std::wstring) table_name_;
office_element_ptr_array content_; office_element_ptr_array content_;
}; };
...@@ -356,7 +374,8 @@ private: ...@@ -356,7 +374,8 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){} virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
office_element_ptr_array content_; public:
office_element_ptr_array content_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_members); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_members);
...@@ -377,8 +396,9 @@ private: ...@@ -377,8 +396,9 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
_CP_OPT(odf_types::Bool) table_display_; public:
_CP_OPT(std::wstring) table_name_; _CP_OPT(std::wstring) table_name_;
_CP_OPT(odf_types::Bool) table_display_;
_CP_OPT(odf_types::Bool) table_show_details_; _CP_OPT(odf_types::Bool) table_show_details_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_member); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_member);
...@@ -399,6 +419,7 @@ private: ...@@ -399,6 +419,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_name_; _CP_OPT(std::wstring) table_name_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_group_member); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_group_member);
...@@ -419,6 +440,7 @@ private: ...@@ -419,6 +440,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){} virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
office_element_ptr_array content_; office_element_ptr_array content_;
}; };
...@@ -440,6 +462,7 @@ private: ...@@ -440,6 +462,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(odf_types::table_function) table_function_; _CP_OPT(odf_types::table_function) table_function_;
}; };
...@@ -461,6 +484,7 @@ private: ...@@ -461,6 +484,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(odf_types::Bool) table_add_empty_lines_; _CP_OPT(odf_types::Bool) table_add_empty_lines_;
_CP_OPT(std::wstring) table_layout_mode_; //tabular-layout, outlinesubtotals-top or outline-subtotals-bottom. _CP_OPT(std::wstring) table_layout_mode_; //tabular-layout, outlinesubtotals-top or outline-subtotals-bottom.
}; };
...@@ -482,6 +506,7 @@ private: ...@@ -482,6 +506,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_data_field_; _CP_OPT(std::wstring) table_data_field_;
_CP_OPT(odf_types::table_order) table_order_; _CP_OPT(odf_types::table_order) table_order_;
_CP_OPT(std::wstring) table_sort_mode_; //data, none, manual or name. _CP_OPT(std::wstring) table_sort_mode_; //data, none, manual or name.
...@@ -504,6 +529,7 @@ private: ...@@ -504,6 +529,7 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) table_data_field_; _CP_OPT(std::wstring) table_data_field_;
_CP_OPT(std::wstring) table_display_member_mode_; //from-top or from-bottom. _CP_OPT(std::wstring) table_display_member_mode_; //from-top or from-bottom.
_CP_OPT(odf_types::Bool) table_enabled_; _CP_OPT(odf_types::Bool) table_enabled_;
...@@ -512,6 +538,5 @@ private: ...@@ -512,6 +538,5 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_display_info); CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_display_info);
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
} }
} }
\ No newline at end of file
...@@ -138,7 +138,7 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std:: ...@@ -138,7 +138,7 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
XmlUtils::replace_all( odf_range, L"[", L""); XmlUtils::replace_all( odf_range, L"[", L"");
XmlUtils::replace_all( odf_range, L"]", L""); XmlUtils::replace_all( odf_range, L"]", L"");
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(); std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
named_range->table_name_ = name; named_range->table_name_ = name;
named_range->table_cell_range_address_ = odf_range; named_range->table_cell_range_address_ = odf_range;
...@@ -182,7 +182,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const ...@@ -182,7 +182,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_named_formula(value); std::wstring odf_value = formulas_converter.convert_named_formula(value);
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(); std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
named_expression->table_name_ = name; named_expression->table_name_ = name;
named_expression->table_expression_ = odf_value; named_expression->table_expression_ = odf_value;
......
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