mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-25 03:13:02 +08:00
Compare commits
10 Commits
core-linux
...
v4.5.dev.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 89aba918bc | |||
| 47c1e6f637 | |||
| f5284c967b | |||
| d465e29a0f | |||
| f43ef621cb | |||
| 2f9a8eb77f | |||
| a70087e1f2 | |||
| c3da9a66a1 | |||
| f907a90be7 | |||
| 89ce79dafc |
@ -51,6 +51,7 @@ public:
|
||||
|
||||
// $Лист1.$A$1 -> Лист1!$A$1
|
||||
std::wstring convert_named_ref(std::wstring const & expr, bool withTableName = true, std::wstring separator = L" ");
|
||||
std::wstring get_table_name();
|
||||
|
||||
//a-la convert without check formula
|
||||
std::wstring convert_named_expr(std::wstring const & expr, bool withTableName = true);
|
||||
@ -90,7 +91,7 @@ public:
|
||||
std::wstring convert_named_ref (std::wstring const & expr);
|
||||
std::wstring convert_named_formula(std::wstring const & expr);
|
||||
|
||||
std::wstring get_base_cell_formula(std::wstring const & expr);
|
||||
std::wstring get_table_name();
|
||||
|
||||
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
|
||||
std::wstring convert_chart_distance(std::wstring const & expr);
|
||||
|
||||
@ -43,7 +43,6 @@ namespace formulasconvert {
|
||||
class odf2oox_converter::Impl
|
||||
{
|
||||
public:
|
||||
static bool convert_with_TableName;
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
@ -61,8 +60,12 @@ namespace formulasconvert {
|
||||
void replace_named_ref(std::wstring & expr, bool w = true);
|
||||
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
};
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
std::wstring odf2oox_converter::Impl::table_name_ = L"";
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
@ -152,6 +155,8 @@ namespace formulasconvert {
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
|
||||
@ -180,6 +185,8 @@ namespace formulasconvert {
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c3) );
|
||||
@ -559,6 +566,11 @@ namespace formulasconvert {
|
||||
{
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::convert(const std::wstring& expr)
|
||||
{
|
||||
return impl_->convert(expr);
|
||||
@ -590,6 +602,13 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , 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;
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
@ -629,6 +648,13 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , 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;
|
||||
}
|
||||
|
||||
@ -65,11 +65,11 @@ public:
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
|
||||
static std::wstring base_cell_formula_;
|
||||
static std::wstring table_name_;
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
@ -117,9 +117,9 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
{
|
||||
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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
table_name_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
expr = convert_formula(expr);
|
||||
@ -171,7 +171,7 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
table_name_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
std::wstring workstr = expr, out;
|
||||
@ -207,6 +207,15 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
if (!out.empty()) expr = out.substr(0, out.length() - 1);
|
||||
|
||||
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)
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
@ -614,9 +638,9 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
|
||||
impl_->replace_named_formula(workstr);
|
||||
return workstr;
|
||||
}
|
||||
std::wstring oox2odf_converter::get_base_cell_formula(const std::wstring& expr)
|
||||
std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->base_cell_formula_;
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,111 +40,70 @@ namespace oox {
|
||||
class xlsx_pivots_context::Impl
|
||||
{
|
||||
public:
|
||||
struct _pivot_cache
|
||||
struct _pivot_xml
|
||||
{
|
||||
std::wstring definitionsData_;
|
||||
std::wstring recordsData_;
|
||||
};
|
||||
struct _pivot_view
|
||||
{
|
||||
std::wstring data_;
|
||||
int indexCache_;
|
||||
};
|
||||
struct _pivot_field
|
||||
{
|
||||
std::wstring view_;
|
||||
std::wstring cache_;
|
||||
std::wstring definitionsData_; //cacheData
|
||||
std::wstring recordsData_; //cacheRecorda
|
||||
|
||||
std::wstring viewData_; //tableView
|
||||
};
|
||||
|
||||
Impl() {}
|
||||
|
||||
std::vector<_pivot_cache> caches_;
|
||||
std::vector<_pivot_view> views_;
|
||||
std::vector<_pivot_xml> pivot_xmls_;
|
||||
std::wstring connections_;
|
||||
|
||||
std::vector<_pivot_field> fields_;
|
||||
|
||||
std::wstringstream view_;
|
||||
std::wstringstream cache_;
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
int type = -1;
|
||||
int function = -1;
|
||||
std::wstring user_function;
|
||||
std::vector<int> subtotals;
|
||||
std::vector<std::wstring> caches;
|
||||
};
|
||||
struct _desc
|
||||
{
|
||||
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 location_ref;
|
||||
std::wstring source_ref;
|
||||
std::wstring source_table_name;
|
||||
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_;
|
||||
|
||||
void serialize_view(std::wostream & strm);
|
||||
void serialize_cache(std::wostream & strm);
|
||||
};
|
||||
|
||||
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};
|
||||
impl_->caches_.push_back(c);
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_cache_count()
|
||||
{
|
||||
return (int)impl_->caches_.size();
|
||||
}
|
||||
bool xlsx_pivots_context::is_connections()
|
||||
{
|
||||
return !impl_->connections_.empty();
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->caches_[index].recordsData_.empty() == false)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
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",
|
||||
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)
|
||||
{
|
||||
strm << impl_->caches_[index].definitionsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connections")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_STREAM() << impl_->connections_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->caches_[index].recordsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->views_[index].data_;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::start_table()
|
||||
{
|
||||
impl_->fields_.clear();
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::end_table()
|
||||
{
|
||||
std::wstringstream strm;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotTableDefinition")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
//CP_XML_ATTR(L"name", view->stTable.value());
|
||||
//CP_XML_ATTR(L"cacheId", view->iCache);
|
||||
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);
|
||||
@ -168,7 +127,7 @@ int xlsx_pivots_context::end_table()
|
||||
|
||||
CP_XML_NODE(L"location")
|
||||
{
|
||||
//CP_XML_ATTR(L"ref", view->ref.toString());
|
||||
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);
|
||||
@ -177,36 +136,307 @@ int xlsx_pivots_context::end_table()
|
||||
}
|
||||
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_ATTR(L"count", current_.fields.size());
|
||||
for (size_t i = 0; i < current_.fields.size(); i++)
|
||||
{
|
||||
impl_->fields_[i].view_;
|
||||
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"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Impl::_pivot_view v = {strm.str(), impl_->views_.size() + 1};
|
||||
impl_->views_.push_back(v);
|
||||
|
||||
return impl_->views_.size();
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
//{ records file
|
||||
// CP_XML_ATTR(L"r:id", L"rId1" );
|
||||
//}
|
||||
CP_XML_ATTR(L"enableRefresh", 1);
|
||||
//CP_XML_ATTR(L"refreshedBy", db->rgb.value());
|
||||
//CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
|
||||
CP_XML_ATTR(L"recordCount", 0);
|
||||
//createdVersion="1"
|
||||
//refreshedVersion="2"
|
||||
//upgradeOnRefresh="1">
|
||||
|
||||
if (true)
|
||||
{
|
||||
CP_XML_NODE(L"cacheSource")
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"worksheet");
|
||||
CP_XML_NODE(L"worksheetSource")
|
||||
{
|
||||
CP_XML_ATTR(L"ref", current_.source_ref);
|
||||
CP_XML_ATTR(L"sheet", current_.source_table_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_.fields.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"cacheFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields.size());
|
||||
|
||||
for (size_t i = 0; i < current_.fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"cacheField")
|
||||
{
|
||||
CP_XML_ATTR(L"name", current_.fields[i].name);
|
||||
CP_XML_ATTR(L"numFmtId", 0);
|
||||
|
||||
if (current_.fields[i].caches.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"sharedItems")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
//CP_XML_ATTR(L"containsSemiMixedTypes", );
|
||||
CP_XML_ATTR(L"containsNonDate", 1);
|
||||
CP_XML_ATTR(L"containsDate", 0);
|
||||
CP_XML_ATTR(L"containsBlank", 0);
|
||||
//CP_XML_ATTR(L"containsString", );
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
std::wstring node_name = L"s";
|
||||
//switch(current_.fields[i].caches[j].type)
|
||||
//{
|
||||
//}
|
||||
CP_XML_NODE(node_name)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (pivot_cache->m_arSXFORMULA.empty() == false)
|
||||
//{
|
||||
// CP_XML_NODE(L"calculatedItems")
|
||||
// {
|
||||
// CP_XML_ATTR(L"count", pivot_cache->m_arSXFORMULA.size());
|
||||
|
||||
// for (size_t i = 0; i < pivot_cache->m_arSXFORMULA.size(); i++)
|
||||
// {
|
||||
// pivot_cache->m_arSXFORMULA[i]->serialize(CP_XML_STREAM());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_count()
|
||||
{
|
||||
return (int)impl_->pivot_xmls_.size();
|
||||
}
|
||||
bool xlsx_pivots_context::is_connections()
|
||||
{
|
||||
return !impl_->connections_.empty();
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->pivot_xmls_[index].recordsData_.empty() == false)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
|
||||
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].definitionsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connections")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_STREAM() << impl_->connections_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].recordsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].viewData_;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::start_table()
|
||||
{
|
||||
impl_->current_.clear();
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::end_table()
|
||||
{
|
||||
std::wstringstream view_strm;
|
||||
std::wstringstream cache_strm;
|
||||
std::wstringstream rec_strm;
|
||||
|
||||
impl_->serialize_view(view_strm);
|
||||
impl_->serialize_cache(cache_strm);
|
||||
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
Impl::_field f;
|
||||
impl_->current_.fields.push_back(f);
|
||||
}
|
||||
void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().type = type;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
std::wstringstream strm;
|
||||
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_source_range(std::wstring table_name, std::wstring ref)
|
||||
{
|
||||
impl_->current_.source_table_name = table_name;
|
||||
impl_->current_.source_ref = ref;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::add_connections(std::wstring connections)
|
||||
@ -216,25 +446,10 @@ void xlsx_pivots_context::add_connections(std::wstring connections)
|
||||
impl_->connections_ = connections;
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_view_count()
|
||||
{
|
||||
return (int)impl_->views_.size();
|
||||
}
|
||||
|
||||
xlsx_pivots_context::~xlsx_pivots_context()
|
||||
{
|
||||
}
|
||||
|
||||
std::wostream & xlsx_pivots_context::stream_view()
|
||||
{
|
||||
return impl_->view_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_pivots_context::stream_cache()
|
||||
{
|
||||
return impl_->cache_;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -50,13 +50,20 @@ public:
|
||||
int end_table();
|
||||
|
||||
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();
|
||||
|
||||
//int add_view(int indexCache);
|
||||
int get_view_count();
|
||||
int get_count();
|
||||
|
||||
void add_cache(std::wstring definitions, std::wstring records);
|
||||
int get_cache_count();
|
||||
void set_view_name(std::wstring name);
|
||||
void set_view_target_range(std::wstring ref);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
|
||||
void write_cache_definitions_to (int index, std::wostream & strm);
|
||||
void write_cache_records_to (int index, std::wostream & strm);
|
||||
@ -70,9 +77,6 @@ public:
|
||||
void add_connections(std::wstring connections);
|
||||
bool is_connections();
|
||||
|
||||
std::wostream & stream_view();
|
||||
std::wostream & stream_cache();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
@ -148,9 +148,9 @@ void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableS
|
||||
|
||||
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)
|
||||
{
|
||||
state()->start_cell(columnsSpanned, rowsSpanned);
|
||||
|
||||
@ -48,7 +48,6 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context * Context, xlsx_text_context & textCotnext);
|
||||
|
||||
public:
|
||||
void start_table(std::wstring tableName, std::wstring tableStyleName, int id);
|
||||
void end_table();
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
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)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCaches")
|
||||
@ -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)
|
||||
{
|
||||
for (int i = 0; i < pivot_view_count; i++)
|
||||
@ -363,17 +363,33 @@ oox_chart_context & xlsx_conversion_context::current_chart()
|
||||
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())
|
||||
{
|
||||
return *sheets_.back().get();
|
||||
if (index < 0) return *sheets_.back().get();
|
||||
else return *sheets_[index].get();
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
|
||||
@ -102,7 +102,10 @@ public:
|
||||
bool start_table (std::wstring tableName, std::wstring tableStyleName);
|
||||
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);
|
||||
double table_column_last_width ();
|
||||
void end_table_column ();
|
||||
@ -162,7 +165,6 @@ public:
|
||||
xlsx_table_context & get_table_context() { 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_xml_worksheet & current_sheet();
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
math_context & get_math_context() { return math_context_; }
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "table_data_pilot_tables.h"
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -72,7 +73,7 @@ void table_data_pilot_table::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
CP_APPLY_ATTR(L"table:identify-categories" , table_identify_categories_);
|
||||
CP_APPLY_ATTR(L"table:ignore-empty-rows" , table_ignore_empty_rows_);
|
||||
CP_APPLY_ATTR(L"table:show-filter-button" , table_show_filter_button_);
|
||||
CP_APPLY_ATTR(L"table:show-target-range-address", table_show_target_range_address_);
|
||||
CP_APPLY_ATTR(L"table:target-range-address" , table_target_range_address_);
|
||||
|
||||
}
|
||||
|
||||
@ -88,10 +89,26 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
{
|
||||
if (!source_) return;
|
||||
|
||||
int table_index = -1;
|
||||
|
||||
Context.get_pivots_context().start_table();
|
||||
|
||||
source_->xlsx_convert(Context);
|
||||
|
||||
if (table_name_) Context.get_pivots_context().set_view_name(*table_name_);
|
||||
if (table_target_range_address_)
|
||||
{
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
|
||||
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
|
||||
std::wstring table_name = formulas_converter.get_table_name();
|
||||
|
||||
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_table(table_index);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fields_.size(); i++)
|
||||
{
|
||||
fields_[i]->xlsx_convert(Context);
|
||||
@ -101,7 +118,7 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
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"../pivotTables/pivotTable" + std::to_wstring(index_view) + L".xml"));
|
||||
}
|
||||
@ -123,16 +140,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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
@ -202,7 +240,7 @@ const wchar_t * table_source_cell_range::name = L"source-cell-range";
|
||||
|
||||
void table_source_cell_range::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:cellrange-address", table_cellrange_address_);
|
||||
CP_APPLY_ATTR(L"table:cell-range-address", table_cell_range_address_);
|
||||
}
|
||||
|
||||
void table_source_cell_range::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -211,9 +249,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)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
if (table_cell_range_address_)
|
||||
{
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
|
||||
std::wstring ref = formulas_converter.convert_named_ref(*table_cell_range_address_, false);
|
||||
std::wstring table_name = formulas_converter.get_table_name();
|
||||
|
||||
Context.get_pivots_context().set_source_range(table_name, ref);
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
@ -242,15 +285,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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
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());
|
||||
|
||||
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";
|
||||
|
||||
@ -65,8 +65,8 @@ private:
|
||||
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);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_tables);
|
||||
@ -87,7 +87,9 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(std::wstring) table_target_range_address_;
|
||||
_CP_OPT(std::wstring) table_application_data_;
|
||||
_CP_OPT(std::wstring) table_buttons_;
|
||||
_CP_OPT(odf_types::Bool) table_drill_down_ondouble_click_;
|
||||
@ -95,7 +97,6 @@ private:
|
||||
_CP_OPT(odf_types::Bool) table_identify_categories_;
|
||||
_CP_OPT(odf_types::Bool) table_ignore_empty_rows_;
|
||||
_CP_OPT(odf_types::Bool) table_show_filter_button_;
|
||||
_CP_OPT(odf_types::Bool) table_show_target_range_address_;
|
||||
|
||||
office_element_ptr source_;
|
||||
office_element_ptr_array fields_;
|
||||
@ -119,6 +120,7 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_source_field_name_;
|
||||
_CP_OPT(odf_types::table_orientation) table_orientation_;
|
||||
_CP_OPT(int) table_used_hierarchy_;
|
||||
@ -127,7 +129,9 @@ private:
|
||||
_CP_OPT(std::wstring) table_selected_page_;
|
||||
_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);
|
||||
@ -147,6 +151,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_field_name_;
|
||||
_CP_OPT(std::wstring) table_member_name_;
|
||||
_CP_OPT(odf_types::member_type) table_member_type_;
|
||||
@ -171,6 +176,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(std::wstring) table_database_table_name_;
|
||||
};
|
||||
@ -193,6 +199,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(std::wstring) table_query_name_;
|
||||
};
|
||||
@ -215,6 +222,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(odf_types::Bool)table_parse_sql_statement_;
|
||||
_CP_OPT(std::wstring) table_sql_statement_;
|
||||
@ -238,8 +246,9 @@ private:
|
||||
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);
|
||||
|
||||
_CP_OPT(std::wstring) table_cellrange_address_;
|
||||
office_element_ptr_array content_;
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_cell_range_address_;
|
||||
office_element_ptr_array content_; //filters
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_source_cell_range);
|
||||
@ -260,6 +269,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(std::wstring) table_object_name_;
|
||||
_CP_OPT(std::wstring) table_password_;
|
||||
@ -285,8 +295,14 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
_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);
|
||||
//-------------------------------------------------------------------------------------
|
||||
@ -306,6 +322,7 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_date_end_;
|
||||
_CP_OPT(std::wstring) table_date_start_;
|
||||
_CP_OPT(std::wstring) table_start; //double 18.2 or auto.
|
||||
@ -334,6 +351,7 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
@ -356,7 +374,8 @@ private:
|
||||
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);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_members);
|
||||
|
||||
@ -377,8 +396,9 @@ private:
|
||||
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){}
|
||||
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(odf_types::Bool) table_show_details_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_member);
|
||||
@ -399,6 +419,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_group_member);
|
||||
@ -419,6 +440,7 @@ private:
|
||||
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);
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
@ -440,6 +462,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::table_function) table_function_;
|
||||
};
|
||||
|
||||
@ -461,6 +484,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::Bool) table_add_empty_lines_;
|
||||
_CP_OPT(std::wstring) table_layout_mode_; //tabular-layout, outlinesubtotals-top or outline-subtotals-bottom.
|
||||
};
|
||||
@ -482,6 +506,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_data_field_;
|
||||
_CP_OPT(odf_types::table_order) table_order_;
|
||||
_CP_OPT(std::wstring) table_sort_mode_; //data, none, manual or name.
|
||||
@ -504,6 +529,7 @@ private:
|
||||
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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_data_field_;
|
||||
_CP_OPT(std::wstring) table_display_member_mode_; //from-top or from-bottom.
|
||||
_CP_OPT(odf_types::Bool) table_enabled_;
|
||||
@ -512,6 +538,5 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_display_info);
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -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"");
|
||||
|
||||
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(cell_range);
|
||||
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
|
||||
|
||||
named_range->table_name_ = name;
|
||||
named_range->table_cell_range_address_ = odf_range;
|
||||
@ -182,7 +182,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
|
||||
formulasconvert::oox2odf_converter formulas_converter;
|
||||
|
||||
std::wstring odf_value = formulas_converter.convert_named_formula(value);
|
||||
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(value);
|
||||
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
|
||||
|
||||
named_expression->table_name_ = name;
|
||||
named_expression->table_expression_ = odf_value;
|
||||
|
||||
@ -219,6 +219,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDefinedName *oox_defined)
|
||||
bool printable = false;
|
||||
if (name == L"_xlnm.Print_Area")printable = true;
|
||||
|
||||
//todoooo !!!! сделать анализ на функцию, диапазон, константы .... !!!
|
||||
|
||||
if (false)//если простой - range, составной - выражение
|
||||
ods_context->add_defined_range (name, oox_defined->m_oRef.get2(), sheet_id, printable);
|
||||
else
|
||||
|
||||
@ -36,8 +36,10 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
|
||||
#include "../../Common/Base64.h"
|
||||
|
||||
|
||||
@ -62,6 +62,8 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
|
||||
|
||||
@ -118,6 +118,8 @@ namespace PPTX
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*embed);
|
||||
return _T("");
|
||||
}
|
||||
else if(link.IsInit())
|
||||
@ -137,6 +139,8 @@ namespace PPTX
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*link);
|
||||
return _T("");
|
||||
}
|
||||
return _T("");
|
||||
@ -150,6 +154,7 @@ namespace PPTX
|
||||
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().GetOleObject(oRId);
|
||||
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().GetOleObject(oRId);
|
||||
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().GetOleObject(oRId);
|
||||
|
||||
if (pOleObject.IsInit())
|
||||
return pOleObject->filename().m_strFilename;
|
||||
|
||||
@ -64,6 +64,8 @@ namespace PPTX
|
||||
sLink = parentFileAs<SlideMaster>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<Theme>())
|
||||
sLink = parentFileAs<Theme>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
sLink = parentFileAs<NotesSlide>().GetFullHyperlinkNameFromRId(rid);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all(sLink, L"\\", L"/");
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
|
||||
|
||||
|
||||
@ -42,6 +42,8 @@
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
|
||||
@ -88,7 +88,33 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
//return relsTable.Links.GetTargetById(rid);
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(NSBinPptxRW::NSMainTables::NotesSlides);
|
||||
|
||||
@ -1183,6 +1183,10 @@
|
||||
<Filter
|
||||
Name="Media"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\Source\DocxFormat\Media\ActiveX.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\DocxFormat\Media\Audio.h"
|
||||
>
|
||||
@ -1514,6 +1518,10 @@
|
||||
RelativePath="..\Source\XlsxFormat\Drawing\CellAnchor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Controls\Controls.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Drawing\Drawing.h"
|
||||
>
|
||||
@ -1523,11 +1531,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Ole\oleobjects.h"
|
||||
RelativePath="..\Source\XlsxFormat\Drawing\Pos.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Drawing\Pos.h"
|
||||
RelativePath="..\Source\DocxFormat\Media\VbaProject.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
#include "External/HyperLink.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "Media/ActiveX.h"
|
||||
#include "HeaderFooter.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
|
||||
@ -44,9 +44,11 @@
|
||||
#include "Footnote.h"
|
||||
#include "Endnote.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/ActiveX.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "Media/Audio.h"
|
||||
#include "Media/Video.h"
|
||||
#include "Media/VbaProject.h"
|
||||
#include "External/HyperLink.h"
|
||||
#include "External/ExternalVideo.h"
|
||||
#include "External/ExternalAudio.h"
|
||||
@ -136,6 +138,14 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == OOX::FileTypes::Chart )
|
||||
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_xml)
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( oRootPath, oFileName));
|
||||
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_bin)
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( oFileName ));
|
||||
else if ( oRelation.Type() == OOX::FileTypes::VbaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
|
||||
//else if ( oRelation.Type() == OOX::FileTypes::VbaData)
|
||||
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
|
||||
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile() );
|
||||
}
|
||||
@ -220,6 +230,14 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::Chart )
|
||||
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::ActiveX_xml)
|
||||
return smart_ptr<OOX::File>(new ActiveX_xml( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::ActiveX_bin)
|
||||
return smart_ptr<OOX::File>(new ActiveX_bin( oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::VbaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
|
||||
//else if ( pRelation->Type() == FileTypes::VbaData)
|
||||
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
|
||||
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile() );
|
||||
}
|
||||
|
||||
@ -172,6 +172,22 @@ namespace OOX
|
||||
_T("application/vnd.openxmlformats-officedocument.drawingml.chart+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"), true, true);
|
||||
|
||||
const FileType ActiveX_xml(L"activeX", L"",
|
||||
_T("application/vnd.ms-office.activeX+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"));
|
||||
|
||||
const FileType ActiveX_bin(L"activeX", L"",
|
||||
_T("application/vnd.ms-office.activeX"),
|
||||
_T("http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"));
|
||||
|
||||
const FileType VbaProject(L"", L"vbaProject.bin",
|
||||
_T("application/vnd.ms-office.vbaProject"),
|
||||
_T("http://schemas.microsoft.com/office/2006/relationships/vbaProject"));
|
||||
|
||||
const FileType VbaData(L"", L"vbaData.xml",
|
||||
_T("application/vnd.ms-word.vbaData+xml"),
|
||||
_T("http://schemas.microsoft.com/office/2006/relationships/wordVbaData"));
|
||||
|
||||
const FileType MicrosoftOfficeUnknown(L"embeddings", L"",
|
||||
_T(""),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
|
||||
|
||||
@ -64,8 +64,6 @@ namespace OOX
|
||||
|
||||
m_arrFootnote.clear();
|
||||
}
|
||||
public:
|
||||
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
@ -118,8 +116,6 @@ namespace OOX
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oPath );
|
||||
IFileContainer::Write( oPath, oDirectory, oContent );
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::FootNote;
|
||||
@ -133,8 +129,6 @@ namespace OOX
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
OOX::CFtnEdn* Find(const OOX::Logic::CFootnoteReference& oReference) const
|
||||
{
|
||||
if ( !oReference.m_oId.IsInit() )
|
||||
@ -157,10 +151,9 @@ namespace OOX
|
||||
return (unsigned int)m_arrFootnote.size();
|
||||
}
|
||||
|
||||
public:
|
||||
CPath m_oReadPath;
|
||||
std::vector<OOX::CFtnEdn*> m_arrFootnote;
|
||||
std::vector<std::wstring> m_arrShapeTypes;
|
||||
std::vector<std::wstring> m_arrShapeTypes;
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@
|
||||
#include "External/HyperLink.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "Media/ActiveX.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h"
|
||||
#include "../XlsxFormat/FileFactory_Spreadsheet.h"
|
||||
|
||||
@ -259,7 +261,21 @@ namespace OOX
|
||||
return smart_ptr<HyperLink>();
|
||||
return pPair->second.smart_dynamic_cast<HyperLink>();
|
||||
}
|
||||
|
||||
|
||||
smart_ptr<ActiveX_xml> IFileContainer::GetActiveX_xml(const RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
if (pPair == m_mContainer.end ())
|
||||
return smart_ptr<ActiveX_xml>();
|
||||
return pPair->second.smart_dynamic_cast<ActiveX_xml>();
|
||||
}
|
||||
smart_ptr<ActiveX_bin> IFileContainer::GetActiveX_bin(const RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
if (pPair == m_mContainer.end ())
|
||||
return smart_ptr<ActiveX_bin>();
|
||||
return pPair->second.smart_dynamic_cast<ActiveX_bin>();
|
||||
}
|
||||
smart_ptr<OleObject> IFileContainer::GetOleObject (const RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
|
||||
@ -48,6 +48,8 @@ namespace OOX
|
||||
class Image;
|
||||
class HyperLink;
|
||||
class OleObject;
|
||||
class ActiveX_xml;
|
||||
class ActiveX_bin;
|
||||
}
|
||||
|
||||
namespace PPTX
|
||||
@ -85,6 +87,8 @@ namespace OOX
|
||||
virtual smart_ptr<Image> GetImage (const RId& rId) const;
|
||||
virtual smart_ptr<HyperLink> GetHyperlink(const RId& rId) const;
|
||||
virtual smart_ptr<OleObject> GetOleObject(const RId& rId) const;
|
||||
virtual smart_ptr<ActiveX_xml> GetActiveX_xml(const RId& rId) const;
|
||||
virtual smart_ptr<ActiveX_bin> GetActiveX_bin(const RId& rId) const;
|
||||
virtual smart_ptr<PPTX::LegacyDiagramText> GetLegacyDiagramText (const OOX::RId& rId) const;
|
||||
|
||||
OOX::CRels* GetCurRls()
|
||||
|
||||
@ -227,10 +227,9 @@ namespace ComplexTypes
|
||||
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
// Читаем атрибуты
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, (L"r:id"), m_oId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, (L"r:id"), m_oId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
|
||||
|
||||
239
Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h
Normal file
239
Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_ACTIVEX_INCLUDE_H_
|
||||
#define OOX_ACTIVEX_INCLUDE_H_
|
||||
|
||||
#include "Media.h"
|
||||
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
|
||||
#include "../../Common/SimpleTypes_Shared.h"
|
||||
#include "../IFileContainer.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class COcxPr : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(COcxPr)
|
||||
COcxPr()
|
||||
{
|
||||
}
|
||||
virtual ~COcxPr()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(_T("<ocxPr>"));
|
||||
writer.WriteString(_T("</ocxPr>"));
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( !oReader.IsEmptyNode() )
|
||||
oReader.ReadTillEnd();
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_OcxPr;
|
||||
}
|
||||
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start(oReader)
|
||||
|
||||
WritingElement_ReadAttributes_Read_if (oReader, _T("ax:name") , m_oName)
|
||||
WritingElement_ReadAttributes_Read_else_if (oReader, _T("ax:value") , m_oValue)
|
||||
|
||||
WritingElement_ReadAttributes_End(oReader)
|
||||
}
|
||||
nullable<std::wstring> m_oName;
|
||||
nullable<std::wstring> m_oValue;
|
||||
|
||||
//font
|
||||
//picture
|
||||
};
|
||||
class ActiveX_xml : public File, public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
ActiveX_xml()
|
||||
{
|
||||
m_bDocument = false;
|
||||
}
|
||||
ActiveX_xml(const CPath& oRootPath, const CPath& filename)
|
||||
{
|
||||
m_bDocument = false;
|
||||
read( oRootPath, filename );
|
||||
}
|
||||
virtual ~ActiveX_xml()
|
||||
{
|
||||
ClearItems();
|
||||
}
|
||||
void ClearItems()
|
||||
{
|
||||
for (size_t nIndex = 0; nIndex < m_arrOcxPr.size(); ++nIndex)
|
||||
{
|
||||
delete m_arrOcxPr[nIndex];
|
||||
}
|
||||
m_arrOcxPr.clear();
|
||||
}
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
CPath oRootPath;
|
||||
read(oRootPath, oPath);
|
||||
}
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_oReadPath = oPath;
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( _T("ocx") == sName)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( !oReader.IsEmptyNode() )
|
||||
{
|
||||
int nDocumentDepth = oReader.GetDepth();
|
||||
while ( oReader.ReadNextSiblingNode( nDocumentDepth ) )
|
||||
{
|
||||
sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("ocxPr") == sName )
|
||||
{
|
||||
COcxPr* pOcxPr = new COcxPr(oReader);
|
||||
m_arrOcxPr.push_back(pOcxPr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start(oReader)
|
||||
|
||||
WritingElement_ReadAttributes_Read_if (oReader, L"ax:classid" , m_oClassId)
|
||||
WritingElement_ReadAttributes_Read_else_if (oReader, L"ax:persistence" , m_oPersistence)
|
||||
WritingElement_ReadAttributes_Read_else_if (oReader, L"r:id" , m_oId)
|
||||
WritingElement_ReadAttributes_Read_else_if (oReader, L"ax:license" , m_oLicense)
|
||||
|
||||
WritingElement_ReadAttributes_End(oReader)
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
|
||||
{
|
||||
}
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return OOX::FileTypes::ActiveX_xml;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
if (m_bDocument) return type().DefaultDirectory();
|
||||
else return L"../" + type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
bool m_bDocument;
|
||||
protected:
|
||||
CPath m_oReadPath;
|
||||
|
||||
nullable<std::wstring> m_oClassId;
|
||||
nullable<std::wstring> m_oLicense;
|
||||
nullable<std::wstring> m_oPersistence; //(§3.6.2.1, ST_Persistence).
|
||||
nullable<SimpleTypes::CRelationshipId > m_oId;
|
||||
std::vector<OOX::COcxPr*> m_arrOcxPr;
|
||||
};
|
||||
|
||||
class ActiveX_bin : public Media
|
||||
{
|
||||
public:
|
||||
ActiveX_bin(bool bDocument = true) : Media (bDocument)
|
||||
{
|
||||
}
|
||||
ActiveX_bin(const OOX::CPath& filename)
|
||||
{
|
||||
read(filename);
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
|
||||
{
|
||||
}
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return OOX::FileTypes::ActiveX_bin;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
if (m_bDocument) return type().DefaultDirectory();
|
||||
else return L"../" + type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return m_filename.GetFilename();
|
||||
}
|
||||
void set_filename_cache(const std::wstring & file_path)
|
||||
{
|
||||
m_filenameCache = file_path;
|
||||
}
|
||||
void set_filename_cache(CPath & file_path)
|
||||
{
|
||||
m_filenameCache = file_path;
|
||||
}
|
||||
CPath filename_cache()
|
||||
{
|
||||
return m_filenameCache;
|
||||
}
|
||||
protected:
|
||||
CPath m_filenameCache; //image
|
||||
};
|
||||
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_ACTIVEX_INCLUDE_H_
|
||||
@ -78,8 +78,11 @@ namespace OOX
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
void copy_to(const CPath& path) const
|
||||
virtual void copy_to(const CPath& path) const
|
||||
{
|
||||
OOX::CPath pathSaveItem = path + FILE_SEPARATOR_STR + m_filename.GetFilename();
|
||||
|
||||
NSFile::CFileBinary::Copy(m_filename.GetPath(), pathSaveItem.GetPath());
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
|
||||
76
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Normal file
76
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_VBA_PROJECT_INCLUDE_H_
|
||||
#define OOX_VBA_PROJECT_INCLUDE_H_
|
||||
|
||||
#include "Media.h"
|
||||
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class VbaProject : public Media, public OOX::IFileContainer
|
||||
{
|
||||
public:
|
||||
VbaProject( )
|
||||
{
|
||||
}
|
||||
VbaProject(const CPath& oRootPath, const CPath& filename)
|
||||
{
|
||||
read( oRootPath, filename );
|
||||
}
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
|
||||
Media::read(oPath);
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
|
||||
{
|
||||
}
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return OOX::FileTypes::VbaProject;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return m_filename.GetFilename();
|
||||
}
|
||||
protected:
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_VBA_PROJECT_INCLUDE_H_
|
||||
@ -1063,7 +1063,11 @@ namespace OOX
|
||||
et_x_OleObjects,
|
||||
et_x_OleObject,
|
||||
et_x_OleObjectPr,
|
||||
et_x_OleObjectAnchor,
|
||||
et_x_ExtAnchor,
|
||||
et_x_Controls,
|
||||
et_x_Control,
|
||||
et_x_ControlPr,
|
||||
et_x_OcxPr,
|
||||
et_x_TableParts,
|
||||
et_x_TablePart,
|
||||
et_x_Table,
|
||||
|
||||
395
Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h
Normal file
395
Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h
Normal file
@ -0,0 +1,395 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_CONTROLS_FILE_INCLUDE_H_
|
||||
#define OOX_CONTROLS_FILE_INCLUDE_H_
|
||||
|
||||
#include "../CommonInclude.h"
|
||||
#include "../Drawing/FromTo.h"
|
||||
#include "../Ole/OleObjects.h"
|
||||
#include "../../DocxFormat/Media/ActiveX.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class CControlPr : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CControlPr)
|
||||
CControlPr()
|
||||
{
|
||||
}
|
||||
virtual ~CControlPr()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<controlPr");
|
||||
WritingStringNullableAttrEncodeXmlString(L"altText", m_oAltText, m_oAltText.get());
|
||||
WritingStringNullableAttrBool(L"autoFill", m_oAutoFill);
|
||||
WritingStringNullableAttrBool(L"autoLine", m_oAutoLine);
|
||||
WritingStringNullableAttrBool(L"autoPict", m_oAutoPict);
|
||||
WritingStringNullableAttrBool(L"dde", m_oDde);
|
||||
WritingStringNullableAttrBool(L"defaultSize", m_oDefaultSize);
|
||||
WritingStringNullableAttrBool(L"disabled", m_oDisabled);
|
||||
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
|
||||
WritingStringNullableAttrBool(L"locked", m_oLocked);
|
||||
WritingStringNullableAttrEncodeXmlString(L"macro", m_oMacro, m_oMacro.get());
|
||||
WritingStringNullableAttrBool(L"print", m_oPrint);
|
||||
WritingStringNullableAttrBool(L"uiObject", m_oUiObject);
|
||||
writer.WriteString(L">");
|
||||
if (m_oAnchor.IsInit())
|
||||
{
|
||||
m_oAnchor->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</controlPr>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("anchor") == sName )
|
||||
{
|
||||
m_oAnchor = oReader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_ControlPr;
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("altText"), m_oAltText )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoFill"), m_oAutoFill )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoLine"), m_oAutoLine )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoPict"), m_oAutoPict )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dde"), m_oDde )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("defaultSize"), m_oDefaultSize )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("disabled"), m_oDisabled )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:id"), m_oRid )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("locked"), m_oLocked )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("macro"), m_oMacro )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("print"), m_oPrint )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("uiObject"), m_oUiObject )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<std::wstring> m_oAltText;
|
||||
nullable<SimpleTypes::COnOff<>> m_oAutoFill;
|
||||
nullable<SimpleTypes::COnOff<>> m_oAutoLine;
|
||||
nullable<SimpleTypes::COnOff<>> m_oAutoPict;
|
||||
nullable<SimpleTypes::COnOff<>> m_oDde;
|
||||
nullable<SimpleTypes::COnOff<>> m_oDefaultSize;
|
||||
nullable<SimpleTypes::COnOff<>> m_oDisabled;
|
||||
nullable<SimpleTypes::CRelationshipId> m_oRid;
|
||||
nullable<SimpleTypes::COnOff<>> m_oLocked;
|
||||
nullable<std::wstring> m_oMacro;
|
||||
nullable<SimpleTypes::COnOff<>> m_oPrint;
|
||||
nullable<SimpleTypes::COnOff<>> m_oUiObject;
|
||||
|
||||
nullable<CExtAnchor> m_oAnchor;
|
||||
};
|
||||
|
||||
class CControl : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CControl)
|
||||
CControl()
|
||||
{
|
||||
}
|
||||
virtual ~CControl()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
bool bAlternateContent = m_oControlPr.IsInit();
|
||||
if (bAlternateContent)
|
||||
{
|
||||
writer.WriteString(L"<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"><mc:Choice Requires=\"x14\">");
|
||||
toXML2(writer, true);
|
||||
writer.WriteString(L"</mc:Choice><mc:Fallback>");
|
||||
toXML2(writer, false);
|
||||
writer.WriteString(L"</mc:Fallback></mc:AlternateContent>");
|
||||
}
|
||||
else
|
||||
{
|
||||
toXML2(writer, true);
|
||||
}
|
||||
}
|
||||
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool bControlPr) const
|
||||
{
|
||||
writer.WriteString(L"<control");
|
||||
WritingStringNullableAttrEncodeXmlString(L"progId", m_oProgId, m_oProgId.get());
|
||||
WritingStringNullableAttrString(L"dvAspect", m_oDvAspect, m_oDvAspect->ToString());
|
||||
WritingStringNullableAttrEncodeXmlString(L"link", m_oLink, m_oLink.get());
|
||||
WritingStringNullableAttrString(L"oleUpdate", m_oOleUpdate, m_oOleUpdate->ToString());
|
||||
WritingStringNullableAttrBool(L"autoLoad", m_oAutoLoad);
|
||||
WritingStringNullableAttrInt(L"shapeId", m_oShapeId, m_oShapeId->GetValue());
|
||||
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
|
||||
if (bControlPr && m_oControlPr.IsInit())
|
||||
{
|
||||
writer.WriteString(L">");
|
||||
m_oControlPr->toXML(writer);
|
||||
writer.WriteString(L"</control>");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteString(L"/>");
|
||||
}
|
||||
}
|
||||
// void toXMLPptx(NSStringUtils::CStringBuilder& writer, std::wstring qqq)
|
||||
//{
|
||||
// std::wstring sRoot;
|
||||
// writer.WriteString(L"<o:OLEObject");
|
||||
// if(m_oDvAspect.IsInit())
|
||||
// {
|
||||
// writer.WriteString(L" DrawAspect=\"");
|
||||
// if(SimpleTypes::Spreadsheet::Content == m_oDvAspect->GetValue())
|
||||
// writer.WriteString(L"Content");
|
||||
// else
|
||||
// writer.WriteString(L"Icon");
|
||||
// writer.WriteString(L"\"");
|
||||
// }
|
||||
// WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
|
||||
// WritingStringNullableAttrEncodeXmlString(L"ProgID", m_oProgId, m_oProgId.get());
|
||||
// WritingStringNullableAttrInt(L"ShapeID", m_oShapeId, m_oShapeId->GetValue());
|
||||
// writer.WriteString(L" Type=\"Embed\"");
|
||||
// if(m_oOleUpdate.IsInit())
|
||||
// {
|
||||
// writer.WriteString(L" UpdateMode=\"");
|
||||
// if(SimpleTypes::Spreadsheet::Always == m_oOleUpdate->GetValue())
|
||||
// writer.WriteString(L"Always");
|
||||
// else
|
||||
// writer.WriteString(L"OnCall");
|
||||
// writer.WriteString(L"\"");
|
||||
// }
|
||||
// if (m_OleObjectFile.IsInit())
|
||||
// {
|
||||
// if (m_OleObjectFile->isMsPackage())
|
||||
// WritingStringAttrString(L"mspackage", L"true");
|
||||
|
||||
// WritingStringAttrEncodeXmlString(L"pathbin", m_OleObjectFile->filename().GetPath());
|
||||
// WritingStringAttrEncodeXmlString(L"pathimg", m_OleObjectFile->filename_cache().GetPath());
|
||||
// }
|
||||
// writer.WriteString(L"/>");
|
||||
//}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("controlPr") == sName )
|
||||
{
|
||||
m_oControlPr = oReader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_Control;
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("progId"), m_oProgId )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dvAspect"), m_oDvAspect )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("link"), m_oLink )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("oleUpdate"),m_oOleUpdate )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoLoad"), m_oAutoLoad )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("shapeId"), m_oShapeId )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:id"), m_oRid )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<std::wstring > m_oProgId;
|
||||
nullable<SimpleTypes::Spreadsheet::ST_DvAspect<>> m_oDvAspect;
|
||||
nullable<std::wstring > m_oLink;
|
||||
nullable<SimpleTypes::Spreadsheet::ST_OleUpdate<>> m_oOleUpdate;
|
||||
nullable<SimpleTypes::COnOff<>> m_oAutoLoad;
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oShapeId;
|
||||
nullable<SimpleTypes::CRelationshipId> m_oRid;
|
||||
nullable<CControlPr> m_oControlPr;
|
||||
//internal
|
||||
smart_ptr<OOX::ActiveX_xml> m_ControlFile;
|
||||
nullable<SimpleTypes::CRelationshipId> m_oRidImg;
|
||||
};
|
||||
|
||||
class CControls : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CControls)
|
||||
CControls()
|
||||
{
|
||||
}
|
||||
virtual ~CControls()
|
||||
{
|
||||
for(std::map<int, CControl*>::const_iterator it = m_mapControls.begin(); it != m_mapControls.end(); it++)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
m_mapControls.clear();
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
if(m_mapControls.size() > 0)
|
||||
{
|
||||
writer.WriteString(L"<controls>");
|
||||
for(std::map<int, CControl*>::const_iterator it = m_mapControls.begin(); it != m_mapControls.end(); it++)
|
||||
{
|
||||
it->second->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</controls>");
|
||||
}
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("controls") == sName )
|
||||
{
|
||||
CControl* pControl = new CControl(oReader);
|
||||
if(pControl->m_oShapeId.IsInit())
|
||||
{
|
||||
m_mapControls[pControl->m_oShapeId->GetValue()] = pControl;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete pControl;
|
||||
}
|
||||
}
|
||||
else if ( _T("AlternateContent") == sName )
|
||||
{
|
||||
int nSubDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nSubDepth ) )
|
||||
{
|
||||
std::wstring sSubName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( _T("Fallback") == sSubName || _T("Choice") == sSubName )
|
||||
{
|
||||
bool bFound = false;
|
||||
int nSubSubDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nSubSubDepth ) )
|
||||
{
|
||||
std::wstring sSubSubName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( _T("control") == sSubSubName )
|
||||
{
|
||||
CControl* pControl = new CControl(oReader);
|
||||
if(pControl->m_oShapeId.IsInit())
|
||||
{
|
||||
m_mapControls[pControl->m_oShapeId->GetValue()] = pControl;
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete pControl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bFound)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_Controls;
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
}
|
||||
public:
|
||||
std::map<int, CControl*> m_mapControls;
|
||||
};
|
||||
} //Spreadsheet
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_CONTROLS_FILE_INCLUDE_H_
|
||||
@ -36,7 +36,8 @@
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
#include "../DocxFormat/VmlDrawing.h"
|
||||
#include "../DocxFormat/Media/OleObject.h"
|
||||
|
||||
#include "../DocxFormat/Media/ActiveX.h"
|
||||
#include "../DocxFormat/Media/VbaProject.h"
|
||||
|
||||
#include "SharedStrings/SharedStrings.h"
|
||||
#include "Styles/Styles.h"
|
||||
@ -177,6 +178,10 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( oFileName, true ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::ActiveX_xml)
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::ActiveX_bin)
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( oFileName ));
|
||||
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile() );
|
||||
}
|
||||
|
||||
@ -40,14 +40,14 @@ namespace OOX
|
||||
{
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class COleObjectAnchor : public WritingElement
|
||||
class CExtAnchor : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(COleObjectAnchor)
|
||||
COleObjectAnchor()
|
||||
WritingElement_AdditionConstructors(CExtAnchor)
|
||||
CExtAnchor()
|
||||
{
|
||||
}
|
||||
virtual ~COleObjectAnchor()
|
||||
virtual ~CExtAnchor()
|
||||
{
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ namespace OOX
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_OleObjectAnchor;
|
||||
return et_x_ExtAnchor;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -219,7 +219,7 @@ namespace OOX
|
||||
nullable<SimpleTypes::COnOff<>> m_oPrint;
|
||||
nullable<SimpleTypes::COnOff<>> m_oUiObject;
|
||||
|
||||
nullable<COleObjectAnchor> m_oAnchor;
|
||||
nullable<CExtAnchor> m_oAnchor;
|
||||
};
|
||||
|
||||
class COleObject : public WritingElement
|
||||
@ -255,7 +255,7 @@ namespace OOX
|
||||
toXML2(writer, true);
|
||||
}
|
||||
}
|
||||
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool ObjectPr) const
|
||||
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool bObjectPr) const
|
||||
{
|
||||
writer.WriteString(L"<oleObject");
|
||||
WritingStringNullableAttrEncodeXmlString(L"progId", m_oProgId, m_oProgId.get());
|
||||
@ -265,7 +265,7 @@ namespace OOX
|
||||
WritingStringNullableAttrBool(L"autoLoad", m_oAutoLoad);
|
||||
WritingStringNullableAttrInt(L"shapeId", m_oShapeId, m_oShapeId->GetValue());
|
||||
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
|
||||
if (ObjectPr && m_oObjectPr.IsInit())
|
||||
if (bObjectPr && m_oObjectPr.IsInit())
|
||||
{
|
||||
writer.WriteString(L">");
|
||||
m_oObjectPr->toXML(writer);
|
||||
|
||||
@ -53,8 +53,6 @@ namespace OOX
|
||||
virtual ~CWorkbook()
|
||||
{
|
||||
}
|
||||
public:
|
||||
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
}
|
||||
@ -77,26 +75,19 @@ namespace OOX
|
||||
{
|
||||
return m_oReadPath;
|
||||
}
|
||||
public:
|
||||
|
||||
void ClearItems()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<WritingElement *> m_arrItems;
|
||||
private:
|
||||
CPath m_oReadPath;
|
||||
CPath m_oReadPath;
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
// Читаем атрибуты
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:conformance"), m_oConformance )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
std::vector<WritingElement *> m_arrItems;
|
||||
|
||||
};
|
||||
} //Spreadsheet
|
||||
} // namespace OOX
|
||||
|
||||
@ -225,7 +225,6 @@ namespace OOX
|
||||
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
// Читаем атрибуты
|
||||
WritingElement_ReadAttributes_Start(oReader)
|
||||
|
||||
WritingElement_ReadAttributes_Read_if (oReader, _T("maxLength") , m_oMaxLength)
|
||||
@ -279,7 +278,6 @@ namespace OOX
|
||||
return et_x_FormulaCF;
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring m_sText;
|
||||
};
|
||||
|
||||
|
||||
@ -51,6 +51,8 @@
|
||||
#include "../Table/Table.h"
|
||||
#include "../Comments/Comments.h"
|
||||
#include "../Ole/OleObjects.h"
|
||||
#include "../Controls/Controls.h"
|
||||
|
||||
#include "../../../../../DesktopEditor/common/String.h"
|
||||
|
||||
namespace OOX
|
||||
@ -60,12 +62,10 @@ namespace OOX
|
||||
//необработанные child:
|
||||
//<cellWatches>
|
||||
//<colBreaks>
|
||||
//<controls>
|
||||
//<customProperties>
|
||||
//<dataConsolidate>
|
||||
//<dataValidations>
|
||||
//<extLst>
|
||||
//<oleObjects>
|
||||
//<phoneticPr>
|
||||
//<protectedRanges>
|
||||
//<rowBreaks>
|
||||
@ -92,8 +92,6 @@ namespace OOX
|
||||
{
|
||||
ClearItems();
|
||||
}
|
||||
public:
|
||||
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. instead use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
@ -157,6 +155,8 @@ namespace OOX
|
||||
m_oLegacyDrawingHF = oReader;
|
||||
else if ( _T("oleObjects") == sName )
|
||||
m_oOleObjects = oReader;
|
||||
else if ( _T("controls") == sName )
|
||||
m_oControls = oReader;
|
||||
else if ( _T("headerFooter") == sName )
|
||||
m_oHeaderFooter = oReader;
|
||||
else if (_T("sheetPr") == sName)
|
||||
@ -379,6 +379,8 @@ namespace OOX
|
||||
m_oLegacyDrawingHF->toXML(sXml);
|
||||
if(m_oOleObjects.IsInit())
|
||||
m_oOleObjects->toXML(sXml);
|
||||
if (m_oControls.IsInit())
|
||||
m_oControls->toXML(sXml);
|
||||
if(m_oTableParts.IsInit())
|
||||
m_oTableParts->toXML(sXml);
|
||||
if(m_oExtLst.IsInit())
|
||||
@ -441,7 +443,6 @@ namespace OOX
|
||||
}
|
||||
m_arrConditionalFormatting.clear();
|
||||
}
|
||||
private:
|
||||
CPath m_oReadPath;
|
||||
|
||||
public:
|
||||
@ -460,6 +461,7 @@ namespace OOX
|
||||
nullable<OOX::Spreadsheet::CTableParts> m_oTableParts;
|
||||
nullable<OOX::Spreadsheet::CLegacyDrawingWorksheet> m_oLegacyDrawing;
|
||||
nullable<OOX::Spreadsheet::COleObjects> m_oOleObjects;
|
||||
nullable<OOX::Spreadsheet::CControls> m_oControls;
|
||||
std::map<std::wstring, CCommentItem*> m_mapComments;
|
||||
std::vector<OOX::Spreadsheet::CConditionalFormatting*> m_arrConditionalFormatting;
|
||||
nullable<OOX::Spreadsheet::CSheetPr> m_oSheetPr;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -674,12 +674,20 @@ public:
|
||||
|
||||
m_nLen = read_int2(pData, nCur, nLen);
|
||||
|
||||
m_pData = new BYTE[m_nLen];
|
||||
m_pDataCur = m_pData;
|
||||
if (nVersion < 10)
|
||||
{
|
||||
m_pData = new BYTE[m_nLen];
|
||||
m_pDataCur = m_pData;
|
||||
read_base64_2(pData, nCur, nLen);
|
||||
|
||||
read_base64_2(pData, nCur, nLen);
|
||||
|
||||
delete[]pData;
|
||||
delete[]pData;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nLen = nLen;
|
||||
m_pData = (BYTE*)pData;
|
||||
m_pDataCur = m_pData + m_nLen;
|
||||
}
|
||||
|
||||
return nVersion;
|
||||
}
|
||||
|
||||
@ -191,7 +191,8 @@ namespace BinXlsxRW
|
||||
PivotCache = 8,
|
||||
ExternalBook = 9,
|
||||
OleLink = 10,
|
||||
DdeLink = 11
|
||||
DdeLink = 11,
|
||||
VbaProject = 12
|
||||
};}
|
||||
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
|
||||
{
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/OfficeFileFormats.h"
|
||||
#include "../../Common/Base64.h"
|
||||
|
||||
@ -1520,6 +1522,14 @@ namespace BinXlsxRW
|
||||
WriteExternalReferences(workbook.m_oExternalReferences.get(), workbook);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
|
||||
smart_ptr<OOX::File> vbaProject = workbook.Get(OOX::FileTypes::VbaProject);
|
||||
if (vbaProject.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::VbaProject);
|
||||
WriteVbaProject (vbaProject.smart_dynamic_cast<OOX::VbaProject>());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
};
|
||||
void WriteWorkbookPr(const OOX::Spreadsheet::CWorkbookPr& workbookPr)
|
||||
{
|
||||
@ -1924,7 +1934,6 @@ namespace BinXlsxRW
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteDefinedName(const OOX::Spreadsheet::CDefinedName& definedName)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
@ -1960,7 +1969,19 @@ namespace BinXlsxRW
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerDefinedNameTypes::Comment);
|
||||
m_oBcw.m_oStream.WriteStringW(definedName.m_oComment.get2());
|
||||
}
|
||||
};
|
||||
}
|
||||
void WriteVbaProject(smart_ptr<OOX::VbaProject> & fileVbaProject)
|
||||
{
|
||||
std::wstring file_name = fileVbaProject->filename().GetFilename();
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
m_oBcw.m_oStream.WriteString1(0, file_name);
|
||||
m_oBcw.m_oStream.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
//... todooo write parsing vba project
|
||||
|
||||
//copy file bin
|
||||
fileVbaProject->copy_to(m_oBcw.m_oStream.m_pCommon->m_pImageManager->m_strDstMedia);
|
||||
}
|
||||
};
|
||||
class BinaryWorksheetTableWriter
|
||||
{
|
||||
@ -2959,7 +2980,7 @@ namespace BinXlsxRW
|
||||
bool bSetAnchor = false;
|
||||
if (pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oAnchor.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit())
|
||||
{
|
||||
const OOX::Spreadsheet::COleObjectAnchor& oAnchor = pOleObject->m_oObjectPr->m_oAnchor.get();
|
||||
const OOX::Spreadsheet::CExtAnchor& oAnchor = pOleObject->m_oObjectPr->m_oAnchor.get();
|
||||
|
||||
SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType;
|
||||
eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell);
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#include "../../Common/ATLDefine.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
|
||||
#include "../../DesktopEditor/common/Path.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
@ -1504,8 +1506,10 @@ namespace BinXlsxRW {
|
||||
{
|
||||
OOX::Spreadsheet::CWorkbook& m_oWorkbook;
|
||||
std::map<long, NSCommon::smart_ptr<OOX::File>>& m_mapPivotCacheDefinitions;
|
||||
const std::wstring& m_sDestinationDir;
|
||||
public:
|
||||
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions):Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions)
|
||||
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions, const std::wstring& sDestinationDir)
|
||||
: Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions), m_sDestinationDir(sDestinationDir)
|
||||
{
|
||||
}
|
||||
int Read()
|
||||
@ -1542,6 +1546,10 @@ namespace BinXlsxRW {
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadPivotCaches, this, poResult);
|
||||
m_oWorkbook.m_oPivotCachesXml->append(L"</pivotCaches>");
|
||||
}
|
||||
else if(c_oSerWorkbookTypes::VbaProject == type)
|
||||
{
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadVbaProject, this, poResult);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -2068,7 +2076,7 @@ namespace BinXlsxRW {
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int ReadPivotCache(BYTE type, long length, void* poResult)
|
||||
{
|
||||
PivotCachesTemp* pPivotCachesTemp = static_cast<PivotCachesTemp*>(poResult);
|
||||
@ -2090,13 +2098,36 @@ namespace BinXlsxRW {
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int ReadVbaProject(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSerWorkbookTypes::VbaProject == type)
|
||||
{
|
||||
std::wstring file_name = m_oBufferedStream.GetString3(length);
|
||||
|
||||
OOX::CPath inputPath = m_oBufferedStream.m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + file_name;
|
||||
OOX::CPath outputPath = m_sDestinationDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("vbaProject.bin");
|
||||
|
||||
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
|
||||
|
||||
smart_ptr<OOX::VbaProject> oFile;
|
||||
oFile->set_filename(outputPath);
|
||||
const OOX::RId oRId = m_oWorkbook.Add(oFile.smart_dynamic_cast<OOX::File>());
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
}
|
||||
};
|
||||
class BinaryCommentReader : public Binary_CommonReader<BinaryCommentReader>
|
||||
{
|
||||
OOX::Spreadsheet::CWorksheet* m_pCurWorksheet;
|
||||
public:
|
||||
BinaryCommentReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorksheet* pCurWorksheet):Binary_CommonReader(oBufferedStream),m_pCurWorksheet(pCurWorksheet)
|
||||
BinaryCommentReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorksheet* pCurWorksheet)
|
||||
: Binary_CommonReader(oBufferedStream), m_pCurWorksheet(pCurWorksheet)
|
||||
{
|
||||
}
|
||||
int Read(long length, void* poResult)
|
||||
@ -4414,7 +4445,7 @@ namespace BinXlsxRW {
|
||||
if(-1 != nWorkbookOffBits)
|
||||
{
|
||||
oBufferedStream.Seek(nWorkbookOffBits);
|
||||
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions).Read();
|
||||
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions, sOutDir).Read();
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user