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_;
} }
......
...@@ -40,54 +40,186 @@ namespace oox { ...@@ -40,54 +40,186 @@ namespace oox {
class xlsx_pivots_context::Impl class xlsx_pivots_context::Impl
{ {
public: public:
struct _pivot_cache struct _pivot_xml
{ {
std::wstring definitionsData_; std::wstring definitionsData_; //cacheData
std::wstring recordsData_; std::wstring recordsData_; //cacheRecorda
};
struct _pivot_view std::wstring viewData_; //tableView
{
std::wstring data_;
int indexCache_;
};
struct _pivot_field
{
std::wstring view_;
std::wstring cache_;
}; };
Impl() {} Impl() {}
std::vector<_pivot_cache> caches_; std::vector<_pivot_xml> pivot_xmls_;
std::vector<_pivot_view> views_;
std::wstring connections_; std::wstring connections_;
std::vector<_pivot_field> fields_; struct _field
{
std::wstringstream view_; std::wstring name;
std::wstringstream cache_; int type = -1;
int function = -1;
std::wstring user_function;
std::vector<int> subtotals;
std::vector<std::wstring> caches;
};
struct _desc struct _desc
{ {
void clear() void clear()
{ {
name.clear();
location_ref.clear();
source_ref.clear();
fields.clear();
row_fields.clear();
page_fields.clear();
col_fields.clear();
data_fields.clear();
} }
std::wstring name; std::wstring name;
std::wstring location_ref;
std::wstring source_ref;
std::vector<_field> fields;
std::vector<int> row_fields;
std::vector<int> page_fields;
std::vector<int> col_fields;
std::vector<int> data_fields;
}current_; }current_;
void serialize_view(std::wostream & strm);
}; };
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl()) xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
{ {
} }
void xlsx_pivots_context::add_cache(std::wstring definitions, std::wstring records) void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
{ {
Impl::_pivot_cache c = {definitions, records}; CP_XML_WRITER(strm)
impl_->caches_.push_back(c); {
CP_XML_NODE(L"pivotTableDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"name", current_.name);
CP_XML_ATTR(L"cacheId", pivot_xmls_.size());
//CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
//CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
//CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
//CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
//CP_XML_ATTR(L"applyPatternFormats", view->fAtrPat);
//CP_XML_ATTR(L"applyAlignmentFormats", view->fAtrAlc);
//CP_XML_ATTR(L"applyWidthHeightFormats", view->fAtrProc);
//if (!view->stData.value().empty())
//{
// CP_XML_ATTR(L"dataCaption", view->stData.value());
//}
//CP_XML_ATTR(L"asteriskTotals", 1);
//CP_XML_ATTR(L"showMemberPropertyTips", 0);
//CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
//CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"itemPrintTitles", 1);
CP_XML_ATTR(L"indent", 0);
CP_XML_ATTR(L"compact", 0);
CP_XML_ATTR(L"compactData", 0);
CP_XML_ATTR(L"gridDropZones", 1);
CP_XML_NODE(L"location")
{
CP_XML_ATTR(L"ref", current_.location_ref);
//CP_XML_ATTR(L"firstHeaderRow", view->rwFirstHead - view->ref.rowFirst );
//CP_XML_ATTR(L"firstDataRow", view->rwFirstData - view->ref.rowFirst);
//CP_XML_ATTR(L"firstDataCol", view->colFirstData - view->ref.columnFirst);
CP_XML_ATTR(L"rowPageCount", 1);
CP_XML_ATTR(L"colPageCount", 1);
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", current_.fields.size());
for (size_t i = 0; i < current_.fields.size(); i++)
{
CP_XML_NODE(L"pivotField")
{
switch(current_.fields[i].type)
{
case 0: CP_XML_ATTR(L"axis", L"axisCol"); break;
case 1: break;// data,
case 2: break;// hidden,
case 3: CP_XML_ATTR(L"axis", L"axisPage"); break;
case 4: CP_XML_ATTR(L"axis", L"axisRow"); break;
}
CP_XML_ATTR(L"defaultSubtotal", 0);
//compact="0" outline="0" subtotalTop="0" showAll="0" includeNewItemsInFilter="1" sortType="ascending"
CP_XML_NODE(L"items")
{
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
{
CP_XML_NODE(L"item")
{
CP_XML_ATTR(L"x", j);
}
}
}
}
//CP_XML_STREAM() << fields_[i].view_;
}
}
CP_XML_NODE(L"rowFields")
{
CP_XML_ATTR(L"count", current_.row_fields.size());
for (size_t i = 0; i < current_.row_fields.size(); i++)
{
CP_XML_NODE(L"field")
{
CP_XML_ATTR(L"x", current_.row_fields[i]);
}
}
}
CP_XML_NODE(L"colFields")
{
CP_XML_ATTR(L"count", current_.col_fields.size());
for (size_t i = 0; i < current_.col_fields.size(); i++)
{
CP_XML_NODE(L"field")
{
CP_XML_ATTR(L"x", current_.col_fields[i]);
}
}
}
CP_XML_NODE(L"pageFields")
{
CP_XML_ATTR(L"count", current_.page_fields.size());
for (size_t i = 0; i < current_.page_fields.size(); i++)
{
CP_XML_NODE(L"pageField")
{
CP_XML_ATTR(L"fld", current_.page_fields[i]);
CP_XML_ATTR(L"item", 0);
CP_XML_ATTR(L"hier", -1);
}
}
}
CP_XML_NODE(L"dataFields")
{
CP_XML_ATTR(L"count", current_.data_fields.size());
for (size_t i = 0; i < current_.data_fields.size(); i++)
{
CP_XML_NODE(L"dataField")
{
CP_XML_ATTR(L"fld", current_.data_fields[i]);
CP_XML_ATTR(L"baseField", 0);
//CP_XML_ATTR(L"baseItem", -1);
//CP_XML_ATTR(L"name", L"");
}
}
}
}
}
} }
int xlsx_pivots_context::get_cache_count() int xlsx_pivots_context::get_count()
{ {
return (int)impl_->caches_.size(); return (int)impl_->pivot_xmls_.size();
} }
bool xlsx_pivots_context::is_connections() bool xlsx_pivots_context::is_connections()
{ {
...@@ -95,7 +227,7 @@ bool xlsx_pivots_context::is_connections() ...@@ -95,7 +227,7 @@ bool xlsx_pivots_context::is_connections()
} }
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels) void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
{ {
if (impl_->caches_[index].recordsData_.empty() == false) if (impl_->pivot_xmls_[index].recordsData_.empty() == false)
{ {
Rels.add(relationship(L"rId1", Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
...@@ -104,16 +236,13 @@ void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels) ...@@ -104,16 +236,13 @@ void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
} }
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels) void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
{ {
if (impl_->views_[index].indexCache_ >= 0) Rels.add(relationship(L"rId1",
{ L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
Rels.add(relationship(L"rId1", L"../pivotCache/pivotCacheDefinition" + std::to_wstring(index + 1) + L".xml", L""));
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(impl_->views_[index].indexCache_ + 1) + L".xml", L""));
}
} }
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm) void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
{ {
strm << impl_->caches_[index].definitionsData_; strm << impl_->pivot_xmls_[index].definitionsData_;
} }
void xlsx_pivots_context::write_connections_to(std::wostream & strm) void xlsx_pivots_context::write_connections_to(std::wostream & strm)
{ {
...@@ -130,123 +259,101 @@ void xlsx_pivots_context::write_connections_to(std::wostream & strm) ...@@ -130,123 +259,101 @@ void xlsx_pivots_context::write_connections_to(std::wostream & strm)
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm) void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
{ {
strm << impl_->caches_[index].recordsData_; strm << impl_->pivot_xmls_[index].recordsData_;
} }
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm) void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
{ {
strm << impl_->views_[index].data_; strm << impl_->pivot_xmls_[index].viewData_;
} }
void xlsx_pivots_context::start_table() void xlsx_pivots_context::start_table()
{ {
impl_->current_.clear(); impl_->current_.clear();
impl_->fields_.clear();
} }
int xlsx_pivots_context::end_table() int xlsx_pivots_context::end_table()
{ {
std::wstringstream strm; std::wstringstream view_strm;
CP_XML_WRITER(strm) std::wstringstream cache_strm;
{ std::wstringstream rec_strm;
CP_XML_NODE(L"pivotTableDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"name", impl_->current_.name);
//CP_XML_ATTR(L"cacheId", view->iCache);
//CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
//CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
//CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
//CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
//CP_XML_ATTR(L"applyPatternFormats", view->fAtrPat);
//CP_XML_ATTR(L"applyAlignmentFormats", view->fAtrAlc);
//CP_XML_ATTR(L"applyWidthHeightFormats", view->fAtrProc);
//if (!view->stData.value().empty())
//{
// CP_XML_ATTR(L"dataCaption", view->stData.value());
//}
//CP_XML_ATTR(L"asteriskTotals", 1);
//CP_XML_ATTR(L"showMemberPropertyTips", 0);
//CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
//CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"itemPrintTitles", 1);
CP_XML_ATTR(L"indent", 0);
CP_XML_ATTR(L"compact", 0);
CP_XML_ATTR(L"compactData", 0);
CP_XML_ATTR(L"gridDropZones", 1);
CP_XML_NODE(L"location") impl_->serialize_view(view_strm);
{
//CP_XML_ATTR(L"ref", view->ref.toString());
//CP_XML_ATTR(L"firstHeaderRow", view->rwFirstHead - view->ref.rowFirst );
//CP_XML_ATTR(L"firstDataRow", view->rwFirstData - view->ref.rowFirst);
//CP_XML_ATTR(L"firstDataCol", view->colFirstData - view->ref.columnFirst);
CP_XML_ATTR(L"rowPageCount", 1);
CP_XML_ATTR(L"colPageCount", 1);
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", impl_->fields_.size());
for (size_t i = 0; i < impl_->fields_.size(); i++)
{
CP_XML_STREAM() << impl_->fields_[i].view_;
}
}
}
}
Impl::_pivot_view v = {strm.str(), impl_->views_.size() + 1};
impl_->views_.push_back(v);
return impl_->views_.size(); Impl::_pivot_xml v = {cache_strm.str(), rec_strm.str(), view_strm.str()};
impl_->pivot_xmls_.push_back(v);
return impl_->pivot_xmls_.size();
} }
void xlsx_pivots_context::set_view_name(std::wstring name) void xlsx_pivots_context::set_view_name(std::wstring name)
{ {
impl_->current_.name = name; impl_->current_.name = name;
} }
void xlsx_pivots_context::set_view_target_range(std::wstring ref)
{
impl_->current_.location_ref = ref;
}
void xlsx_pivots_context::start_field() void xlsx_pivots_context::start_field()
{ {
Impl::_field f;
impl_->current_.fields.push_back(f);
} }
void xlsx_pivots_context::end_field() void xlsx_pivots_context::set_field_name(std::wstring name)
{ {
std::wstringstream strm; impl_->current_.fields.back().name = name;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotField")
{
}
}
Impl::_pivot_field f = {strm.str(), L""};
impl_->fields_.push_back(f);
} }
void xlsx_pivots_context::set_field_type(int type)
void xlsx_pivots_context::add_connections(std::wstring connections)
{ {
if (connections.empty()) return; impl_->current_.fields.back().type = type;
impl_->connections_ = connections; switch(type)
{
case 0: impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1); break;// column,
case 1: impl_->current_.data_fields.push_back(impl_->current_.fields.size() - 1); break;// data,
case 2: break;// hidden,
case 3: impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1); break;// page,
case 4: impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1); break;// row
}
} }
void xlsx_pivots_context::set_field_function(int type)
int xlsx_pivots_context::get_view_count() {
impl_->current_.fields.back().function = type;
}
void xlsx_pivots_context::set_field_user_function(std::wstring f)
{
impl_->current_.fields.back().user_function = f;
}
void xlsx_pivots_context::add_field_subtotal(int function_type)
{ {
return (int)impl_->views_.size(); impl_->current_.fields.back().subtotals.push_back(function_type);
}
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
{
while (index > impl_->current_.fields.back().caches.size())
{
impl_->current_.fields.back().caches.push_back(L"");
}
impl_->current_.fields.back().caches.push_back(value);
} }
void xlsx_pivots_context::end_field()
{
xlsx_pivots_context::~xlsx_pivots_context() }
void xlsx_pivots_context::set_source_range(std::wstring ref)
{ {
impl_->current_.source_ref = ref;
} }
std::wostream & xlsx_pivots_context::stream_view() void xlsx_pivots_context::add_connections(std::wstring connections)
{ {
return impl_->view_; if (connections.empty()) return;
impl_->connections_ = connections;
} }
std::wostream & xlsx_pivots_context::stream_cache() xlsx_pivots_context::~xlsx_pivots_context()
{ {
return impl_->cache_;
} }
......
...@@ -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