Commit 3044d112 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - fix pilot tables (groups & references)

parent fb00ba7e
......@@ -51,6 +51,7 @@ public:
void start_field ();
void set_field_name (std::wstring name);
void set_field_display (std::wstring name);
void set_field_type (int type, int hierarchy);
void set_field_function (int type);
void set_field_user_function (std::wstring f);
......@@ -59,9 +60,22 @@ public:
void set_field_show_empty (bool val);
void set_field_data_layout (bool val);
void set_field_sort (int type);
void set_repeat_item_labels(bool val);
void set_field_groups (int type);
void set_field_groups_source(std::wstring name);
void set_repeat_item_labels(bool val);
void start_field_group();
void set_field_group_name (std::wstring name);
void end_field_group();
void start_field_reference();
void set_field_ref_name(std::wstring name);
void set_field_ref_type (int type);
void set_field_ref_member_name(std::wstring name);
void set_field_ref_member_type(int type);
void end_field_reference();
void end_field();
int get_count();
......@@ -73,6 +87,7 @@ public:
void add_button_header(std::wstring ref);
void set_identify_categories(bool val);
void set_ignore_empty_rows(bool val);
void set_drill(bool val);
void set_source_range(std::wstring table_name, std::wstring ref);
......@@ -98,7 +113,6 @@ public:
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}
......
......@@ -123,6 +123,9 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
if (table_identify_categories_)
Context.get_pivots_context().set_identify_categories(table_identify_categories_->get());
if (table_ignore_empty_rows_)
Context.get_pivots_context().set_ignore_empty_rows(table_ignore_empty_rows_->get());
if (table_drill_down_ondouble_click_)
Context.get_pivots_context().set_drill(table_drill_down_ondouble_click_->get());
......@@ -155,6 +158,7 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"loext:ignore-selected-page" , loext_ignore_selected_page_);
CP_APPLY_ATTR(L"table:selected-page" , table_selected_page_);
CP_APPLY_ATTR(L"table:is-data-layout-field" , table_is_data_layout_field_);
CP_APPLY_ATTR(L"tableooo:display-name" , table_display_name_);
}
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......@@ -175,6 +179,9 @@ void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
if (table_display_name_)
Context.get_pivots_context().set_field_display(*table_display_name_);
if (table_is_data_layout_field_)
Context.get_pivots_context().set_field_data_layout(table_is_data_layout_field_->get());
......@@ -217,7 +224,24 @@ void table_data_pilot_field_reference::add_attributes( const xml::attributes_wc_
void table_data_pilot_field_reference::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_pivots_context().start_field_reference();
if (table_field_name_)
{
Context.get_pivots_context().set_field_ref_name(*table_field_name_);
}
if (table_type_)
{
Context.get_pivots_context().set_field_ref_type(table_type_->get_type());
}
if (table_member_name_)
{
Context.get_pivots_context().set_field_ref_member_name(*table_member_name_);
}
if (table_member_type_)
{
Context.get_pivots_context().set_field_ref_member_type(table_member_type_->get_type());
}
Context.get_pivots_context().end_field_reference();
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_table::ns = L"table";
......@@ -405,6 +429,8 @@ void table_data_pilot_groups::xlsx_convert(oox::xlsx_conversion_context & Contex
{
if (table_grouped_by_)
Context.get_pivots_context().set_field_groups(table_grouped_by_->get_type());
else
Context.get_pivots_context().set_field_groups(7);
if (table_source_field_name_)
Context.get_pivots_context().set_field_groups_source(*table_source_field_name_);
......@@ -429,10 +455,16 @@ void table_data_pilot_group::add_child_element( xml::sax * Reader, const std::ws
}
void table_data_pilot_group::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
Context.get_pivots_context().start_field_group();
if (table_name_)
Context.get_pivots_context().set_field_group_name (*table_name_);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
Context.get_pivots_context().end_field_group();
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_members::ns = L"table";
......@@ -470,12 +502,12 @@ const wchar_t * table_data_pilot_group_member::name = L"data-pilot-group-member"
void table_data_pilot_group_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:name", table_name_);
CP_APPLY_ATTR(L"table:name", table_name_);
}
void table_data_pilot_group_member::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""));
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_subtotals::ns = L"table";
......
......@@ -130,6 +130,7 @@ public:
_CP_OPT(odf_types::Bool) loext_ignore_selected_page_;
_CP_OPT(std::wstring) table_selected_page_;
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
_CP_OPT(std::wstring) table_display_name_;
office_element_ptr reference_;
office_element_ptr level_;
......
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