Compare commits

..

13 Commits

84 changed files with 3056 additions and 1814 deletions

View File

@ -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);

View File

@ -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) );
@ -189,6 +196,14 @@ namespace formulasconvert {
return c1 + (c3.empty() ? L"" : (L":" + c3) );
}
}
else if (sz == 5 && !what[1].matched)
{
const std::wstring c1 = what[2].str();
const std::wstring c2 = what[3].str(); //sheet name 2
const std::wstring c3 = what[4].str();
return c1 + (c3.empty() ? L"" : (L":" + c3) );
}
return L"";
}
std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what)
@ -216,10 +231,10 @@ namespace formulasconvert {
void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName)
{
convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/*
[ $ Sheet2 . A1 : . B5 ]
[ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
*/
const std::wstring res = boost::regex_replace(
@ -235,7 +250,7 @@ namespace formulasconvert {
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace(
expr,
complexRef,
@ -551,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);
@ -582,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)
@ -590,34 +617,44 @@ namespace formulasconvert {
bool isFormula = impl_->check_formula(workstr);
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
impl_->replace_cells_range(workstr, withTableName);
impl_->replace_semicolons(workstr);
impl_->replace_vertical(workstr);
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
if (isFormula)
{
//могут быть частично заданы диапазоны
//todooo
workstr = impl_->convert(expr);
}
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
if (!isFormula)
else
{
workstr = L"\"" + workstr + L"\"";
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
impl_->replace_cells_range(workstr, withTableName);
impl_->replace_semicolons(workstr);
impl_->replace_vertical(workstr);
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
{
//могут быть частично заданы диапазоны
//todooo
}
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;
}

View File

@ -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_;
}

View File

@ -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_;
}
}
}

View File

@ -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_;

View File

@ -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);

View File

@ -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();

View File

@ -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));

View File

@ -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_; }

View File

@ -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";

View File

@ -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);
//-------------------------------------------------------------------------------------
}
}

View File

@ -32,8 +32,6 @@
#include "abstract_xml.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace odf_writer {

View File

@ -31,8 +31,6 @@
*/
#include "calcext_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -86,9 +84,9 @@ void calcext_conditional_formats::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -115,9 +113,9 @@ void calcext_conditional_format::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
BOOST_REVERSE_FOREACH(const office_element_ptr & item, content_)
for (size_t i = content_.size() - 1; i >= 0; i--)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -144,9 +142,9 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
{
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -170,9 +168,9 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -198,9 +196,9 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
{
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
@ -68,11 +67,11 @@ void draw_base::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void draw_base::serialize(std::wostream & _Wostream)
void draw_base::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
void draw_base::serialize_attlist(CP_ATTR_NODE)

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/regex.h>
@ -88,9 +87,9 @@ void draw_image::serialize(std::wostream & _Wostream)
if (office_binary_data_)office_binary_data_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -136,9 +135,9 @@ void draw_chart::serialize(std::wostream & _Wostream)
draw_chart_attlist_.serialize(CP_GET_XML_NODE());
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -167,9 +166,9 @@ void draw_g::serialize(std::wostream & _Wostream)
{
common_draw_attlists_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -430,16 +430,15 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, draw_equation_)
for (size_t i = 0; i < draw_equation_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_equation_[i]->serialize(CP_XML_STREAM());
}
BOOST_FOREACH(office_element_ptr & elm, draw_handle_)
for (size_t i = 0; i < draw_handle_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_handle_[i]->serialize(CP_XML_STREAM());
}
}
}
}

View File

@ -32,8 +32,6 @@
#include "list.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -80,9 +78,9 @@ void text_list_item::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -129,9 +127,9 @@ void text_list_header::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -34,7 +34,6 @@
#include "odf_rels.h"
#include <boost/regex.h>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <cpdoccore/xml/utils.h>
@ -85,11 +84,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
std::wstring output_path ;
BOOST_FOREACH(item const & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
if (elm.oox_ref == input_path)
if (items_[i].oox_ref == input_path)
{
output_path = elm.odf_ref;
output_path = items_[i].odf_ref;
break;
}
}
@ -110,12 +109,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
}
void _mediaitems::dump_rels(rels & Rels, std::wstring local_path)
{
size_t i = 0;
BOOST_FOREACH(item & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
Rels.add( relationship(
utils::media::get_rel_type(elm.type),
local_path + elm.odf_ref)
Rels.add( relationship(
utils::media::get_rel_type(items_[i].type),
local_path + items_[i].odf_ref)
);
}

View File

@ -33,7 +33,6 @@
#include "mediaitems_utils.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore {

View File

@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/xmlchar.h>
@ -67,13 +64,13 @@ void number_style_base::serialize(std::wostream & strm)
if (style_text_properties_)
style_text_properties_->serialize(strm);
BOOST_FOREACH(office_element_ptr & elm, style_map_)
{
elm->serialize(strm);
for (size_t i = 0; i < style_map_.size(); i++)
{
style_map_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(strm);
content_[i]->serialize(strm);
}
}
void number_style_base::serialize(CP_ATTR_NODE)
@ -166,9 +163,9 @@ void number_text::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -194,10 +191,10 @@ void number_embedded_text::serialize(std::wostream & strm)
{
CP_XML_ATTR_OPT(L"number:position", number_position_);
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}
}
@ -228,10 +225,10 @@ void number_number::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"number:min-integer-digits", number_min_integer_digits_);
CP_XML_ATTR_OPT(L"number:grouping", number_grouping_);
BOOST_FOREACH(office_element_ptr & elm, number_embedded_text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < number_embedded_text_.size(); i++)
{
number_embedded_text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -336,9 +333,9 @@ void number_text_content::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
#include <cpdoccore/xml/simple_xml_writer.h>
@ -92,9 +90,10 @@ namespace odf_writer
///////////////
void manifect_file::add_rels(rels & r)
{
BOOST_FOREACH(relationship & item, r.relationships())
std::vector<relationship> & rels = r.relationships();
for (size_t i = 0; i < rels.size(); i++)
{
rels_.add(item);
rels_.add(rels[i]);
}
}
manifect_file::manifect_file(std::wstring t)
@ -188,13 +187,14 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeMedia)
if (items[i].type == _mediaitems::typeMedia)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}
}
@ -212,15 +212,16 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Pictures";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeImage && item.oox_ref.length()>0)
if (items[i].type == _mediaitems::typeImage && items[i].oox_ref.length()>0)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
try
{
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}catch (...)
{
}
@ -289,13 +290,12 @@ namespace odf_writer
{
if (base_)base_->write(RootPath);
long count = 0;
BOOST_FOREACH(const element_ptr & item, objects_)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + item->local_path;
for (size_t i = 0; i < objects_.size(); i++)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + objects_[i]->local_path;
NSDirectory::CreateDirectory(path);
item->write(path);
objects_[i]->write(path);
}
if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>

View File

@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
@ -134,16 +132,15 @@ void odf_conversion_context::end_document()
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
for (size_t i = 0; i < object.content_styles.size(); i++)
{
elm->serialize(content_root_->styles());
object.content_styles[i]->serialize(content_root_->styles());
}
package::content_simple_ptr content_style_ = package::content_simple::create();
BOOST_FOREACH(const office_element_ptr & elm, object.styles)
for (size_t i = 0; i < object.styles.size(); i++)
{// мастер-пейджы, заданные заливки (градиенты, битмапы), дефолтные стили, колонтитулы, разметки, заметки,...
elm->serialize(content_style_->content());
object.styles[i]->serialize(content_style_->content());
}
package::content_simple_ptr content_settings_ = package::content_simple::create();
object.settings->serialize(content_settings_->content());

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_page_layout_context.h"

View File

@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include "odf_rels.h"
#include <cpdoccore/xml/attributes.h>
@ -54,11 +51,11 @@ void relationship::serialize(std::wostream & _Wostream)
}
}
void rels::serialize(std::wostream & _Wostream)
void rels::serialize(std::wostream & strm)
{
BOOST_FOREACH(relationship & r, relationship_)
for (size_t i = 0; i < relationship_.size(); i++)
{
r.serialize(_Wostream);
relationship_[i].serialize(strm);
}
}

View File

@ -40,7 +40,6 @@
#include "style_paragraph_properties.h"
#include <boost/foreach.hpp>
#include <iostream>
namespace cpdoccore {
@ -56,10 +55,10 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
{
if (result == NULL)return;
BOOST_REVERSE_FOREACH(style_paragraph_properties* v, parProps)
for (size_t i = parProps.size() - 1; i >= 0; i--)
{
if (v)
result->apply_from(v->content_);
if (parProps[i])
result->apply_from(parProps[i]->content_);
}
}
@ -93,7 +92,7 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
{
std::wstring odf_name = oox_name;
if (odf_name.length() <1)odf_name = find_free_name(family);
if (odf_name.empty()) odf_name = find_free_name(family);
office_element_ptr elm;
create_element(L"style", L"style", elm, odf_context_);

View File

@ -32,8 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_conversion_context.h"

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <iostream>

View File

@ -37,7 +37,6 @@
#include "ods_conversion_context.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
@ -139,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;
@ -183,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;

View File

@ -32,8 +32,6 @@
#include "office_annotation.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -159,9 +157,9 @@ void office_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -210,9 +208,9 @@ void officeooo_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_body.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -33,10 +33,7 @@
#include "office_chart.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
@ -61,9 +58,9 @@ void office_chart::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -101,9 +98,9 @@ void chart_chart::serialize(std::wostream & _Wostream)
{
chart_chart_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -271,9 +268,9 @@ void chart_plot_area::serialize(std::wostream & _Wostream)
{
chart_plot_area_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -349,9 +346,9 @@ void chart_axis::serialize(std::wostream & _Wostream)
{
chart_axis_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -427,9 +424,9 @@ void chart_series::serialize(std::wostream & _Wostream)
{
chart_series_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -56,9 +54,9 @@ void office_settings::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -88,9 +86,9 @@ void settings_config_item_set::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -145,9 +143,9 @@ void settings_config_item_map_indexed::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -174,9 +172,9 @@ void settings_config_item_map_named::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -203,9 +201,9 @@ void settings_config_item_map_entry::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -63,9 +61,9 @@ void office_spreadsheet::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,10 +32,7 @@
#include "office_text.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {

View File

@ -35,7 +35,6 @@
#include <ostream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
@ -250,9 +249,9 @@ void text_span::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
if (parElement) parElement->serialize(CP_XML_STREAM());
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -547,9 +546,9 @@ void text_placeholder::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -585,12 +584,12 @@ void text_page_number::serialize(std::wostream & _Wostream)
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"text:page-adjust",text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page",text_select_page_);
CP_XML_ATTR_OPT(L"text:page-adjust", text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page", text_select_page_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -625,9 +624,9 @@ void text_page_count::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -662,9 +661,9 @@ void text_date::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -701,9 +700,9 @@ void text_time::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
CP_XML_ATTR_OPT(L"text:time-value", text_time_value_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -740,9 +739,9 @@ void text_file_name::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -776,9 +775,9 @@ void text_sequence::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -823,9 +822,9 @@ void text_sheet_name::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"

View File

@ -38,9 +38,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <boost/foreach.hpp>
#include "borderstyle.h"
namespace cpdoccore {
@ -85,9 +82,9 @@ void style_tab_stops::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, style_tab_stops_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < style_tab_stops_.size(); i++)
{
style_tab_stops_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
@ -91,9 +90,9 @@ void style_columns::serialize(std::wostream & strm)
if(style_column_sep_) style_column_sep_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, style_column_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < style_column_.size(); i++)
{
style_column_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -37,7 +37,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
@ -543,18 +542,18 @@ void styles::add_child_element( const office_element_ptr & child, odf_conversion
}
void styles::serialize(std::wostream & strm)//content from different element
{
BOOST_FOREACH(office_element_ptr & elm, number_styles_)
{
elm->serialize(strm);
for (size_t i = 0; i < number_styles_.size(); i++)
{
number_styles_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, style_style_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, text_list_style_)
{
elm->serialize(strm);
for (size_t i = 0; i < style_style_.size(); i++)
{
style_style_[i]->serialize(strm);
}
for (size_t i = 0; i < text_list_style_.size(); i++)
{
text_list_style_[i]->serialize(strm);
}
}
void templates::create_child_element( const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
@ -576,10 +575,10 @@ void templates::add_child_element( const office_element_ptr & child)
}
void templates::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, table_templates_)
{
elm->serialize(strm);
}
for (size_t i = 0; i < table_templates_.size(); i++)
{
table_templates_[i]->serialize(strm);
}
}
void draw_styles::create_child_element(const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
@ -632,29 +631,29 @@ void draw_styles::add_child_element( const office_element_ptr & child, odf_conve
void draw_styles::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, draw_fill_image_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_fill_image_.size(); i++)
{
draw_fill_image_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_hatch_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_hatch_.size(); i++)
{
draw_hatch_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_gradient_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_opacity_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_marker_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_gradient_.size(); i++)
{
draw_gradient_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_stroke_dash_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_opacity_.size(); i++)
{
draw_opacity_[i]->serialize(strm);
}
for (size_t i = 0; i < draw_marker_.size(); i++)
{
draw_marker_[i]->serialize(strm);
}
for (size_t i = 0; i < draw_stroke_dash_.size(); i++)
{
draw_stroke_dash_[i]->serialize(strm);
}
}
// office:automatic-styles
@ -696,11 +695,10 @@ void office_automatic_styles::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr elm, style_page_layout_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < style_page_layout_.size(); i++)
{
style_page_layout_[i]->serialize(CP_XML_STREAM());
}
styles_.serialize(CP_XML_STREAM());
}
}
@ -762,11 +760,10 @@ void office_master_styles::serialize(std::wostream & strm)
if (draw_layer_set_)
draw_layer_set_->serialize(CP_XML_STREAM());
BOOST_FOREACH(office_element_ptr elm, style_master_page_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < style_master_page_.size(); i++)
{
style_master_page_[i]->serialize(CP_XML_STREAM());
}
if (style_handout_master_)
style_handout_master_->serialize(CP_XML_STREAM());

View File

@ -33,7 +33,6 @@
#include "table.h"
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -272,7 +271,7 @@ void table_table_columns::create_child_element(const std::wstring & Ns, const st
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -284,7 +283,7 @@ void table_table_columns::add_child_element( const office_element_ptr & child_el
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_columns::serialize(std::wostream & _Wostream)
{
@ -292,9 +291,9 @@ void table_table_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -309,7 +308,7 @@ void table_table_header_columns::create_child_element( const std::wstring & Ns,
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -321,7 +320,7 @@ void table_table_header_columns::add_child_element( const office_element_ptr & c
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_columns::serialize(std::wostream & _Wostream)
{
@ -329,9 +328,9 @@ void table_table_header_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -347,7 +346,7 @@ void table_columns::create_child_element( const std::wstring & Ns, const std::ws
}
else if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_column_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
not_applicable_element(L"table-columns", Ns, Name);
@ -367,15 +366,15 @@ void table_columns::add_child_element( const office_element_ptr & child_element)
table_table_columns_ = child_element;
}
else if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_columns::serialize(std::wostream & _Wostream)
void table_columns::serialize(std::wostream & strm)
{
if (table_table_columns_) table_table_columns_->serialize(_Wostream);
if (table_table_columns_) table_table_columns_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-columns-no-group
@ -521,11 +520,11 @@ void table_columns_and_groups::add_child_element( const office_element_ptr & chi
not_applicable_element(L"table-columns-and-groups", L"", L"");
}
}
void table_columns_and_groups::serialize(std::wostream & _Wostream)
void table_columns_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-table-cell-content
@ -539,11 +538,11 @@ void table_table_cell_content::add_child_element( const office_element_ptr & chi
{
text_content_.push_back(child_element);
}
void table_table_cell_content::serialize(std::wostream & _Wostream)
void table_table_cell_content::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
for (size_t i = 0; i < text_content_.size(); i++)
{
if (elm) elm->serialize(_Wostream);
text_content_[i]->serialize(strm);
}
}
// table:table-cell
@ -635,9 +634,9 @@ void table_table_row::serialize(std::wostream & _Wostream)
{
table_table_row_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -650,21 +649,21 @@ const wchar_t * table_table_rows::name = L"table-rows";
void table_table_rows::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
void table_table_rows::add_child_element( const office_element_ptr & child_element)
{
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_rows::serialize(std::wostream & _Wostream)
void table_table_rows::serialize(std::wostream & strm)
{
CP_XML_WRITER(_Wostream)
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(strm);
}
}
}
@ -679,7 +678,7 @@ void table_table_header_rows::create_child_element( const std::wstring & Ns, con
{
if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -691,7 +690,7 @@ void table_table_header_rows::add_child_element( const office_element_ptr & chil
ElementType type = child_element->get_type();
if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_rows::serialize(std::wostream & _Wostream)
{
@ -699,9 +698,9 @@ void table_table_header_rows::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -716,7 +715,7 @@ void table_rows::create_child_element(const std::wstring & Ns, const std::wstrin
}
else if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_row_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
{
@ -733,16 +732,16 @@ void table_rows::add_child_element( const office_element_ptr & child_element)
table_table_rows_ = child_element;
else if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_rows::serialize(std::wostream & _Wostream)
void table_rows::serialize(std::wostream & strm)
{
if (table_table_rows_)
table_table_rows_->serialize(_Wostream);
table_table_rows_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-rows-no-group
@ -851,11 +850,11 @@ void table_rows_and_groups::add_child_element( const office_element_ptr & child_
content_.push_back(elm);
}
}
void table_rows_and_groups::serialize(std::wostream & _Wostream)
void table_rows_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table:table-row-group
@ -911,9 +910,9 @@ void table_shapes::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -186,8 +186,8 @@ public:
virtual void serialize(std::wostream & _Wostream);
public:
office_element_ptr table_table_columns_;
office_element_ptr_array table_table_column_;
office_element_ptr table_table_columns_;
office_element_ptr_array content_;
};
@ -296,7 +296,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
@ -318,7 +318,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
@ -472,7 +472,7 @@ public:
{
}
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
@ -494,7 +494,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
@ -509,7 +509,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr table_table_rows_;
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};

View File

@ -32,10 +32,7 @@
#include "text_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"
@ -76,11 +73,11 @@ void paragraph::add_text(const std::wstring & Text)
office_element_ptr elm = text_text::create(Text) ;
paragraph_content_.push_back( elm );
}
void paragraph::serialize(std::wostream & _Wostream)
void paragraph::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
{
elm->serialize(_Wostream);
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(strm);
}
}
void paragraph::serialize_attr(CP_ATTR_NODE)
@ -95,11 +92,10 @@ void paragraph_attrs::serialize(CP_ATTR_NODE)
std::wstring text_class_names_all;
BOOST_FOREACH(const std::wstring & elm, text_class_names_)
{
text_class_names_all = elm + std::wstring(L" ");
}
for (size_t i = 0; i < text_class_names_.size(); i++)
{
text_class_names_all = text_class_names_[i] + std::wstring(L" ");
}
if (!text_class_names_all.empty())
CP_XML_ATTR(L"text:class-names", text_class_names_all);
}
@ -186,9 +182,9 @@ void text_list::serialize(std::wostream & _Wostream)
if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & listItem, text_list_items_)
for (size_t i = 0; i < text_list_items_.size(); i++)
{
listItem->serialize(CP_XML_STREAM());
text_list_items_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,8 +36,6 @@
#include "../utils.h"
#include <boost/lexical_cast.hpp>
#include "XlsxConverter.h"
#include "DocxConverter.h"
#include "PptxConverter.h"

View File

@ -39,9 +39,6 @@
#include "VmlShapeTypes2Oox.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "../OdfFormat/odt_conversion_context.h"
#include "../OdfFormat/odf_text_context.h"
@ -187,7 +184,7 @@ void DocxConverter::convert_document()
int last_section_start = 0;
//считаем количесво секций и запоминаем их свойства ..
for (long i = 0; i < document->m_arrItems.size(); i++)
for (size_t i = 0; i < document->m_arrItems.size(); i++)
{
if (document->m_arrItems[i] == NULL) continue;
@ -199,18 +196,18 @@ void DocxConverter::convert_document()
{
if (para->m_oParagraphProperty->m_oSectPr.IsInit() )
{
sections.push_back(_section(para->m_oParagraphProperty->m_oSectPr.GetPointer(), last_section_start, i + 1));
last_section_start = i + 1;
sections.push_back(_section(para->m_oParagraphProperty->m_oSectPr.GetPointer(), last_section_start, (int)i + 1));
last_section_start = (int)i + 1;
}
}
}
}
sections.push_back(_section(document->m_oSectPr.GetPointer(), last_section_start, document->m_arrItems.size(), true));
sections.push_back(_section(document->m_oSectPr.GetPointer(), last_section_start, (int)document->m_arrItems.size(), true));
//----------------------------------------------------------------------------------------------------------
odt_context->text_context()->clear_params();
for (int sect = 0; sect < sections.size(); sect++)
for (size_t sect = 0; sect < sections.size(); sect++)
{
current_section_properties = &sections[sect];
@ -522,7 +519,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{//rapcomnat12.docx - стр 185
bool empty_para = true;
for (unsigned int nIndex = 0; empty_para && nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
for (size_t nIndex = 0; empty_para && nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
{
switch(oox_paragraph->m_arrItems[nIndex]->getType())
{
@ -546,7 +543,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
}
//---------------------------------------------------------------------------------------------------------------------
for (unsigned int nIndex = 0; nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
for (size_t nIndex = 0; nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
{
//те элементы которые тока для Paragraph - здесь - остальные в общей куче
switch(oox_paragraph->m_arrItems[nIndex]->getType())
@ -573,7 +570,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
//---------------------------------------------------------------------------------------------------------------------
//std::sort(id_change_properties.begin(), id_change_properties.end());
for (int i = 0; i < id_change_properties.size(); i++)
for (size_t i = 0; i < id_change_properties.size(); i++)
{
odt_context->end_change(id_change_properties[i].second, id_change_properties[i].first);
}
@ -584,7 +581,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
//хм разобраться а нужен ли он ... частенько бывает в неправильном месте!!! - A GRUBU.docx
//https://forums.asp.net/t/1951556.aspx?Facing+problem+finding+out+page+end+in+Ms+Word+Open+XML+SDK+Asp+net+c+We+can+t+get+a+lastRenderedPageBreak
////test for break - 2 first element ЭТОТ элемент НУЖНО вытащить отдельно !!!
//for(unsigned int i = 0; i < (std::min) ( (size_t)2, oox_run->m_arrItems.size()); ++i)
//for(size_t i = 0; i < (std::min) ( (size_t)2, oox_run->m_arrItems.size()); ++i)
//{
// if (oox_run->m_arrItems[i]->getType() == OOX::et_w_lastRenderedPageBreak)
// {
@ -608,7 +605,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
odt_context->start_run(styled);
for(unsigned int i = 0; i < oox_run->m_arrItems.size(); ++i)
for(size_t i = 0; i < oox_run->m_arrItems.size(); ++i)
{
//те элементы которые тока для Run - здесь - остальные в общей куче
switch(oox_run->m_arrItems[i]->getType())
@ -778,7 +775,7 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
if (oox_fld->m_sInstr.IsInit())
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
for (unsigned int i=0; i< oox_fld->m_arrItems.size(); i++)
for (size_t i=0; i< oox_fld->m_arrItems.size(); i++)
{
convert(oox_fld->m_arrItems[i]);
}
@ -815,7 +812,7 @@ void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
bool start_change = odt_context->start_change(id, 1, author, userId, date);
for (unsigned int i=0; i< oox_ins->m_arrItems.size(); i++)
for (size_t i=0; i< oox_ins->m_arrItems.size(); i++)
{
convert(oox_ins->m_arrItems[i]);
}
@ -1019,7 +1016,7 @@ void DocxConverter::convert(OOX::Logic::CDel *oox_del)
std::wstring date = oox_del->m_oDate.IsInit() ? oox_del->m_oDate->GetValue() : L"";
bool res_change = odt_context->start_change(id, 2, author, userId, date);
for (unsigned int i=0; i< oox_del->m_arrItems.size(); i++)
for (size_t i=0; i< oox_del->m_arrItems.size(); i++)
{
convert(oox_del->m_arrItems[i]);
}
@ -1030,7 +1027,7 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag)
{
if (oox_tag == NULL) return;
for (unsigned int i=0; i< oox_tag->m_arrItems.size(); i++)
for (size_t i=0; i< oox_tag->m_arrItems.size(); i++)
{
convert(oox_tag->m_arrItems[i]);
}
@ -1250,7 +1247,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
if (oox_paragraph_pr->m_oTabs.IsInit())
{
paragraph_properties->add_child_element(odf_context()->start_tabs());
for (unsigned int i = 0; i < oox_paragraph_pr->m_oTabs->m_arrTabs.size(); i++)
for (size_t i = 0; i < oox_paragraph_pr->m_oTabs->m_arrTabs.size(); i++)
{
if (oox_paragraph_pr->m_oTabs->m_arrTabs[i] == NULL) continue;
@ -1279,14 +1276,14 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
if (other->m_arrFooterReference.size() > 0)
{
for (unsigned int i =0 ; i < props->m_arrFooterReference.size() ; i++)
for (size_t i =0 ; i < props->m_arrFooterReference.size() ; i++)
{
if (props->m_arrFooterReference[i]) delete props->m_arrFooterReference[i];
props->m_arrFooterReference[i] = NULL;
}
props->m_arrFooterReference.clear();
for (unsigned int i =0 ; i < other->m_arrFooterReference.size() ; i++)
for (size_t i =0 ; i < other->m_arrFooterReference.size() ; i++)
{
ComplexTypes::Word::CHdrFtrRef* ref = new ComplexTypes::Word::CHdrFtrRef();
@ -1299,14 +1296,14 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
}
if (other->m_arrHeaderReference.size() > 0)
{
for (unsigned int i =0 ; i < props->m_arrHeaderReference.size() ; i++)
for (size_t i =0 ; i < props->m_arrHeaderReference.size() ; i++)
{
if (props->m_arrHeaderReference[i]) delete props->m_arrHeaderReference[i];
props->m_arrHeaderReference[i] = NULL;
}
props->m_arrHeaderReference.clear();
for (unsigned int i =0 ; i < other->m_arrHeaderReference.size() ; i++)
for (size_t i =0 ; i < other->m_arrHeaderReference.size() ; i++)
{
ComplexTypes::Word::CHdrFtrRef* ref = new ComplexTypes::Word::CHdrFtrRef();
@ -1501,7 +1498,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
std::vector<int> types;
for (unsigned int i = 0; i < s->m_arrHeaderReference.size(); i++)
for (size_t i = 0; i < s->m_arrHeaderReference.size(); i++)
{
if (s->m_arrHeaderReference[i] == NULL) continue;
@ -1529,7 +1526,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
if (!add_odd_even_pages_header && present_odd_even_pages) odt_context->add_empty_header(1);
if (!add_default_header && (present_odd_even_pages || present_title_page)) odt_context->add_empty_header(0);
for (unsigned int i=0; i< s->m_arrFooterReference.size(); i++)
for (size_t i=0; i< s->m_arrFooterReference.size(); i++)
{
if (s->m_arrFooterReference[i] == NULL) continue;
@ -1607,7 +1604,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
std::vector<std::pair<double,double>> width_space;
for (unsigned int i =0; i< oox_section_pr->m_oCols->m_arrColumns.size(); i++)
for (size_t i =0; i< oox_section_pr->m_oCols->m_arrColumns.size(); i++)
{
if (oox_section_pr->m_oCols->m_arrColumns[i] == NULL) continue;
double space = default_space_pt;
@ -1620,7 +1617,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
width_space.push_back(std::pair<double,double>(w, space));
}
//for (unsigned int i= oox_section_pr->m_oCols->m_arrColumns.size(); i< num_columns; i ++)
//for (size_t i= oox_section_pr->m_oCols->m_arrColumns.size(); i< num_columns; i ++)
//{
// width_space.push_back(std::pair<double,double>(-1, default_space_pt));
//}
@ -2262,13 +2259,13 @@ void DocxConverter::convert(OOX::Logic::CAlternateContent *oox_alt_content)
{
if (oox_alt_content == NULL)return;
for(unsigned int i = 0; i < oox_alt_content->m_arrChoiceItems.size(); ++i) // правильный выбор
for(size_t i = 0; i < oox_alt_content->m_arrChoiceItems.size(); ++i) // правильный выбор
{
convert(oox_alt_content->m_arrChoiceItems[i]);
}
if (oox_alt_content->m_arrChoiceItems.size() > 0) return; //чтоб не было дубляжа
for(unsigned int i = 0; i < oox_alt_content->m_arrFallbackItems.size(); ++i) // альтернативный
for(size_t i = 0; i < oox_alt_content->m_arrFallbackItems.size(); ++i) // альтернативный
// todooo нужно сверять по инддексно что нормально сконвертилось ... или делать ВСЕ по choice ( это правильнее)
{
convert(oox_alt_content->m_arrFallbackItems[i]);
@ -2458,7 +2455,7 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
}
if (!bSet)
{
int pos = oox_pic->m_oShape->m_sType->find(_T("#_x0000_t"));
int pos = (int)oox_pic->m_oShape->m_sType->find(_T("#_x0000_t"));
if (pos >= 0)
{
sptType = (SimpleTypes::Vml::SptType)_wtoi(oox_pic->m_oShape->m_sType->substr(pos + 9, oox_pic->m_oShape->m_sType->length() - pos - 9).c_str());
@ -2823,13 +2820,13 @@ void DocxConverter::convert_lists_styles()
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(lists_styles);
//базовые
for (unsigned int i=0; i < lists_styles->m_arrAbstractNum.size(); i++)
for (size_t i=0; i < lists_styles->m_arrAbstractNum.size(); i++)
{
convert(lists_styles->m_arrAbstractNum[i]);
}
//используемые в документе, используют базовые + могут поменяться - Override
for (unsigned int i=0; i < lists_styles->m_arrNum.size(); i++)
for (size_t i=0; i < lists_styles->m_arrNum.size(); i++)
{
if (lists_styles->m_arrNum[i] == NULL) continue;
@ -2864,7 +2861,7 @@ void DocxConverter::convert_styles()
convert(docx_styles->m_oDocDefaults.GetPointer());
for (unsigned int i=0; i< docx_styles->m_arrStyle.size(); i++)
for (size_t i=0; i< docx_styles->m_arrStyle.size(); i++)
{
if (docx_styles->m_arrStyle[i] == NULL) continue;
@ -2902,7 +2899,7 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
odt_context->start_hyperlink(ref);
for (unsigned int i=0; i< oox_hyperlink->m_arrItems.size(); i++)
for (size_t i=0; i< oox_hyperlink->m_arrItems.size(); i++)
{
convert(oox_hyperlink->m_arrItems[i]);
}
@ -2911,7 +2908,7 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
else
{//ссылка внутри дока
//anchor todooo
for (unsigned int i=0; i< oox_hyperlink->m_arrItems.size(); i++)
for (size_t i=0; i< oox_hyperlink->m_arrItems.size(); i++)
{
convert(oox_hyperlink->m_arrItems[i]);
}
@ -3017,7 +3014,7 @@ void DocxConverter::convert(OOX::Numbering::CAbstractNum* oox_num_style)
//nullable<ComplexTypes::Word::std::wstring_ > m_oStyleLink;
//nullable<ComplexTypes::Word::CLongHexNumber > m_oTmpl;
for (unsigned int i=0; i < oox_num_style->m_arrLvl.size(); i++)
for (size_t i=0; i < oox_num_style->m_arrLvl.size(); i++)
{
convert(oox_num_style->m_arrLvl[i]);
}
@ -3153,7 +3150,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
int id = oox_num_lvl->m_oLvlPicBulletId->m_oVal->GetValue();
OOX::CNumbering * lists_styles = docx_document->GetNumbering();
for (unsigned int i = 0; (lists_styles) && (i< lists_styles->m_arrNumPicBullet.size()); i++)
for (size_t i = 0; (lists_styles) && (i< lists_styles->m_arrNumPicBullet.size()); i++)
{
if ((lists_styles->m_arrNumPicBullet[i]) && (lists_styles->m_arrNumPicBullet[i]->m_oNumPicBulletId.GetValue() == id))
{
@ -3245,7 +3242,7 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
// convert(oox_style->m_oTrPr.GetPointer(), table_row_properties);
//}
//отдельные
for (unsigned int i = 0 ; i <oox_style->m_arrTblStylePr.size() ; i++)
for (size_t i = 0 ; i <oox_style->m_arrTblStylePr.size() ; i++)
{
if (oox_style->m_arrTblStylePr[i] == NULL) continue;
@ -3437,7 +3434,7 @@ void DocxConverter::convert_comment(int oox_comm_id)
OOX::CComments * docx_comments = docx_document->GetComments();
if (!docx_comments)return;
for (unsigned int comm = 0 ; comm < docx_comments->m_arrComments.size(); comm++)
for (size_t comm = 0 ; comm < docx_comments->m_arrComments.size(); comm++)
{
OOX::CComment* oox_comment = docx_comments->m_arrComments[comm];
@ -3452,7 +3449,7 @@ void DocxConverter::convert_comment(int oox_comm_id)
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
for (unsigned int i = 0; i <oox_comment->m_arrItems.size(); i++)
for (size_t i = 0; i <oox_comment->m_arrItems.size(); i++)
{
convert(oox_comment->m_arrItems[i]);
}
@ -3468,7 +3465,7 @@ void DocxConverter::convert_footnote(int oox_ref_id)
odt_context->start_note(oox_ref_id, 1);
for (unsigned int n = 0 ; n < footnotes->m_arrFootnote.size(); n++)
for (size_t n = 0 ; n < footnotes->m_arrFootnote.size(); n++)
{
OOX::CFtnEdn* oox_note = footnotes->m_arrFootnote[n];
@ -3479,7 +3476,7 @@ void DocxConverter::convert_footnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (unsigned int i = 0; i < oox_note->m_arrItems.size(); i++)
for (size_t i = 0; i < oox_note->m_arrItems.size(); i++)
{
convert(oox_note->m_arrItems[i]);
}
@ -3496,7 +3493,7 @@ void DocxConverter::convert_endnote(int oox_ref_id)
odt_context->start_note(oox_ref_id, 2);
for (unsigned int n = 0 ; n < endnotes->m_arrEndnote.size(); n++)
for (size_t n = 0 ; n < endnotes->m_arrEndnote.size(); n++)
{
OOX::CFtnEdn* oox_note = endnotes->m_arrEndnote[n];
@ -3507,7 +3504,7 @@ void DocxConverter::convert_endnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (unsigned int i = 0; i < oox_note->m_arrItems.size(); i++)
for (size_t i = 0; i < oox_note->m_arrItems.size(); i++)
{
convert(oox_note->m_arrItems[i]);
}
@ -3524,7 +3521,7 @@ void DocxConverter::convert_hdr_ftr (std::wstring sId)
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
for ( unsigned int nIndex = 0; nIndex < oox_hdr_ftr->m_arrItems.size(); nIndex++ )
for ( size_t nIndex = 0; nIndex < oox_hdr_ftr->m_arrItems.size(); nIndex++ )
{
convert(oox_hdr_ftr->m_arrItems[nIndex]);
}
@ -3695,7 +3692,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
odt_context->table_context()->set_table_inside_h(border_inside_h);
int count_rows = oox_table->m_nCountRow;
int count_columns = oox_table->m_oTblGrid.IsInit() ? oox_table->m_oTblGrid->m_arrGridCol.size() : 0;
int count_columns = oox_table->m_oTblGrid.IsInit() ? (int)oox_table->m_oTblGrid->m_arrGridCol.size() : 0;
odt_context->styles_context()->table_styles().set_current_dimension(count_columns, count_rows);
odt_context->table_context()->count_rows(count_rows);
@ -3703,7 +3700,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
convert(oox_table->m_oTblGrid.GetPointer());
//------ строки
for (unsigned int i =0 ; i < oox_table->m_arrItems.size(); i++)
for (size_t i =0 ; i < oox_table->m_arrItems.size(); i++)
{
switch(oox_table->m_arrItems[i]->getType())
{
@ -3753,7 +3750,7 @@ void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid)
odt_context->start_table_columns();
for (int i =0 ; i < oox_table_grid->m_arrGridCol.size(); i++)
for (size_t i =0 ; i < oox_table_grid->m_arrGridCol.size(); i++)
{
if (oox_table_grid->m_arrGridCol[i] == NULL) continue;
double width = -1;
@ -3819,7 +3816,7 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
convert(oox_table_row->m_oTableRowProperties);
for (unsigned int i =0 ; i < oox_table_row->m_arrItems.size(); i++)
for (size_t i =0 ; i < oox_table_row->m_arrItems.size(); i++)
{
switch(oox_table_row->m_arrItems[i]->getType())
{
@ -3879,7 +3876,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_oTableCellProperties->m_oGridSpan->m_oVal->GetValue());
}
for (unsigned int i =0 ; i < oox_table_cell->m_arrItems.size(); i++)
for (size_t i =0 ; i < oox_table_cell->m_arrItems.size(); i++)
{
switch(oox_table_cell->m_arrItems[i]->getType())
{
@ -4238,7 +4235,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
//если нет убрать, если да - добавить
if (border_inside_h)
{
int del_border = border_inside_h->find(L"none");
int del_border = (int)border_inside_h->find(L"none");
if (row != 1)
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ && del_border>=0)
@ -4258,7 +4255,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
}
if (border_inside_v)
{
int del_border = border_inside_v->find(L"none");
int del_border = (int)border_inside_v->find(L"none");
if (col != 1)
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ && del_border>=0)

View File

@ -33,7 +33,6 @@
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>

View File

@ -52,8 +52,6 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h"
#include <boost/lexical_cast.hpp>
#include "../OdfFormat/odp_conversion_context.h"
#include "../OdfFormat/odf_text_context.h"

View File

@ -33,7 +33,6 @@
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>

View File

@ -51,7 +51,7 @@ using namespace cpdoccore;
namespace Oox2Odf
{
XlsxConverter::XlsxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
const OOX::CPath oox_path(std::wstring(path.c_str()));
@ -166,7 +166,7 @@ void XlsxConverter::convert_sheets()
if(Workbook->m_oBookViews.IsInit())
{
for (unsigned int i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++)
for (size_t i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++)
{
convert(Workbook->m_oBookViews->m_arrItems[i]);
}
@ -198,7 +198,7 @@ void XlsxConverter::convert_sheets()
}
if (Workbook->m_oDefinedNames.IsInit())
{
for (unsigned int i = 0; i < Workbook->m_oDefinedNames->m_arrItems.size(); i++)
for (size_t i = 0; i < Workbook->m_oDefinedNames->m_arrItems.size(); i++)
{
convert(Workbook->m_oDefinedNames->m_arrItems[i]);
}
@ -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
@ -243,7 +245,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Предобработка
//гиперлинки
for (unsigned int hyp = 0; oox_sheet->m_oHyperlinks.IsInit() && hyp < oox_sheet->m_oHyperlinks->m_arrItems.size(); hyp++)
for (size_t hyp = 0; oox_sheet->m_oHyperlinks.IsInit() && hyp < oox_sheet->m_oHyperlinks->m_arrItems.size(); hyp++)
{
convert(oox_sheet->m_oHyperlinks->m_arrItems[hyp],oox_sheet);
}
@ -258,7 +260,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//колонки
ods_context->start_columns();
for (unsigned int col = 0 ; oox_sheet->m_oCols.IsInit() && col < oox_sheet->m_oCols->m_arrItems.size(); col++)
for (size_t col = 0 ; oox_sheet->m_oCols.IsInit() && col < oox_sheet->m_oCols->m_arrItems.size(); col++)
{
convert(oox_sheet->m_oCols->m_arrItems[col]);
}
@ -268,7 +270,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
if (oox_sheet->m_oSheetData.IsInit() )
{
ods_context->start_rows();
for (unsigned int row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
for (size_t row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
{
convert(oox_sheet->m_oSheetData->m_arrItems[row]);
@ -281,7 +283,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
}
//мержи
for (unsigned int mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
for (size_t mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
{
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
ods_context->add_merge_cells(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get());
@ -306,7 +308,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
if (oox_sheet->m_arrConditionalFormatting.size() >0)
{
ods_context->start_conditional_formats();
for (unsigned int fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++)
for (size_t fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++)
{
convert(oox_sheet->m_arrConditionalFormatting[fmt]);
}
@ -315,7 +317,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
//выносные части таблицы
if (oox_sheet->m_oTableParts.IsInit())
{
for (unsigned int i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
for (size_t i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
{
OOX::Spreadsheet::CTablePart *oox_table_part = oox_sheet->m_oTableParts->m_arrItems[i];
if (!oox_table_part)continue;
@ -421,7 +423,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
if (oox_comment->m_oText.IsInit())
{
for(unsigned int i = 0; i < oox_comment->m_oText->m_arrItems.size(); ++i)
for(size_t i = 0; i < oox_comment->m_oText->m_arrItems.size(); ++i)
{
convert(oox_comment->m_oText->m_arrItems[i]);
}
@ -501,7 +503,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row)
}else
ods_context->current_table().set_row_optimal_height(true);
for (unsigned int cell = 0 ; cell < oox_row->m_arrItems.size();cell++)
for (size_t cell = 0 ; cell < oox_row->m_arrItems.size();cell++)
{
convert(oox_row->m_arrItems[cell]);
}
@ -626,7 +628,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRun *oox_text_run)
convert(oox_text_run->m_oRPr.GetPointer());
ods_context->text_context()->start_span(oox_text_run->m_oRPr.GetPointer() ? true : false);
for(unsigned int i = 0; i < oox_text_run->m_arrItems.size(); ++i)
for(size_t i = 0; i < oox_text_run->m_arrItems.size(); ++i)
{
convert(oox_text_run->m_arrItems[i]);
}
@ -965,8 +967,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
if (ActiveCellX >= 0 && ActiveCellY >= 0)
{
ods_context->settings_context()->add_property(L"CursorPositionX", L"int", boost::lexical_cast<std::wstring>(ActiveCellX));
ods_context->settings_context()->add_property(L"CursorPositionY", L"int", boost::lexical_cast<std::wstring>(ActiveCellY));
ods_context->settings_context()->add_property(L"CursorPositionX", L"int", std::to_wstring(ActiveCellX));
ods_context->settings_context()->add_property(L"CursorPositionY", L"int", std::to_wstring(ActiveCellY));
}
}
if (selection->m_oSqref.IsInit())
@ -981,7 +983,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
if (sheet_view->m_oPane->m_oXSplit.IsInit())
{
std::wstring sVal = boost::lexical_cast<std::wstring>((int)sheet_view->m_oPane->m_oXSplit->GetValue());
std::wstring sVal = std::to_wstring((int)sheet_view->m_oPane->m_oXSplit->GetValue());
ods_context->settings_context()->add_property(L"HorizontalSplitMode", L"short", L"2");
ods_context->settings_context()->add_property(L"HorizontalSplitPosition", L"int", sVal);
@ -991,7 +993,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
}
if (sheet_view->m_oPane->m_oYSplit.IsInit())
{
std::wstring sVal = boost::lexical_cast<std::wstring>((int)sheet_view->m_oPane->m_oYSplit->GetValue());
std::wstring sVal = std::to_wstring((int)sheet_view->m_oPane->m_oYSplit->GetValue());
ods_context->settings_context()->add_property(L"VerticalSplitMode", L"short", L"2");
ods_context->settings_context()->add_property(L"VerticalSplitPosition", L"int", sVal);
ods_context->settings_context()->add_property(L"PositionTop", L"int", L"0");
@ -1198,31 +1200,31 @@ void XlsxConverter::convert_styles()
if (!xlsx_styles)return;
//todooo ?? стоит ли обращать на параметр Count ??
////////////форматы данных
for (unsigned int i = 0; xlsx_styles->m_oNumFmts.IsInit() && i < xlsx_styles->m_oNumFmts->m_arrItems.size(); i++)
for (size_t i = 0; xlsx_styles->m_oNumFmts.IsInit() && i < xlsx_styles->m_oNumFmts->m_arrItems.size(); i++)
{
convert(xlsx_styles->m_oNumFmts->m_arrItems[i]);
}
/////////////стили ячеек
for (unsigned int i = 0; xlsx_styles->m_oCellStyleXfs.IsInit() && i < xlsx_styles->m_oCellStyleXfs->m_arrItems.size(); i++)
for (size_t i = 0; xlsx_styles->m_oCellStyleXfs.IsInit() && i < xlsx_styles->m_oCellStyleXfs->m_arrItems.size(); i++)
{
//automatical, root - noname - они тока для named
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i, true, true);
}
for (unsigned int i = 0; xlsx_styles->m_oCellStyles.IsInit() && i < xlsx_styles->m_oCellStyles->m_arrItems.size(); i++)//styles.xml
for (size_t i = 0; xlsx_styles->m_oCellStyles.IsInit() && i < xlsx_styles->m_oCellStyles->m_arrItems.size(); i++)//styles.xml
{
//non automatical, root - named
convert(xlsx_styles->m_oCellStyles->m_arrItems[i]);
}
//кастомные стили ячеек
for (unsigned int i = 0; xlsx_styles->m_oCellXfs.IsInit() && i < xlsx_styles->m_oCellXfs->m_arrItems.size(); i++)
for (size_t i = 0; xlsx_styles->m_oCellXfs.IsInit() && i < xlsx_styles->m_oCellXfs->m_arrItems.size(); i++)
{
//automatical, non root
convert(xlsx_styles->m_oCellXfs->m_arrItems[i], i, true, false);
}
////////////стили условного форматирования
for (unsigned int i=0; xlsx_styles->m_oDxfs.IsInit() && i < xlsx_styles->m_oDxfs->m_arrItems.size(); i++)
for (size_t i=0; xlsx_styles->m_oDxfs.IsInit() && i < xlsx_styles->m_oDxfs->m_arrItems.size(); i++)
{
convert(xlsx_styles->m_oDxfs->m_arrItems[i], i);
}
@ -1338,10 +1340,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFill * fill, odf_writer::style_ta
{
}
if (fill->m_oPatternFill.IsInit())
{//solid, gradient
if (fill->m_oPatternFill->m_oPatternType.IsInit())
{}
{//solid, gradient, none
if (fill->m_oPatternFill->m_oFgColor.IsInit())
{
convert(fill->m_oPatternFill->m_oFgColor.GetPointer(),
@ -1351,7 +1350,37 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFill * fill, odf_writer::style_ta
{
convert(fill->m_oPatternFill->m_oBgColor.GetPointer(),
cell_properties->style_table_cell_properties_attlist_.common_background_color_attlist_.fo_background_color_);
}
}
else if (fill->m_oPatternFill->m_oPatternType.IsInit())
{
switch(fill->m_oPatternFill->m_oPatternType->GetValue())
{
case SimpleTypes::Spreadsheet::patterntypeNone:
cell_properties->style_table_cell_properties_attlist_.common_background_color_attlist_.fo_background_color_ =
odf_types::background_color::Transparent;
break;
case SimpleTypes::Spreadsheet::patterntypeDarkDown:
case SimpleTypes::Spreadsheet::patterntypeDarkGray:
case SimpleTypes::Spreadsheet::patterntypeDarkGrid:
case SimpleTypes::Spreadsheet::patterntypeDarkHorizontal:
case SimpleTypes::Spreadsheet::patterntypeDarkTrellis:
case SimpleTypes::Spreadsheet::patterntypeDarkUp:
case SimpleTypes::Spreadsheet::patterntypeDarkVertical:
case SimpleTypes::Spreadsheet::patterntypeGray0625:
case SimpleTypes::Spreadsheet::patterntypeGray125:
case SimpleTypes::Spreadsheet::patterntypeLightDown:
case SimpleTypes::Spreadsheet::patterntypeLightGray:
case SimpleTypes::Spreadsheet::patterntypeLightGrid:
case SimpleTypes::Spreadsheet::patterntypeLightHorizontal:
case SimpleTypes::Spreadsheet::patterntypeLightTrellis:
case SimpleTypes::Spreadsheet::patterntypeLightUp:
case SimpleTypes::Spreadsheet::patterntypeLightVertical:
case SimpleTypes::Spreadsheet::patterntypeMediumGray:
// todooo
break;
}
}
}
}
@ -1541,7 +1570,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstr
break;
}
}
else return;
else
{
border_style = L"none";
if (borderProp->m_oColor.IsInit())
return;
}
if (borderProp->m_oColor.IsInit())
{
@ -1549,8 +1583,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstr
convert(borderProp->m_oColor.GetPointer(), odf_color);
if (odf_color)
border_color = L" #" + odf_color->get_hex_value();
if (border_color.empty())border_color = L" #000000";
}
if (border_color.length()<1)border_color = L" #000000";
odf_border_prop = border_style + border_color;
}
@ -1800,14 +1835,26 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
}
//////////////
if (oox_anchor->m_oPos.IsInit())
{
}
if (oox_anchor->m_oExt.IsInit())
{
}
odf_context()->drawing_context()->start_drawing();
if (oox_anchor->m_oPos.IsInit())
{
_CP_OPT(double) x, y;
if (oox_anchor->m_oPos->m_oX.IsInit()) x = oox_anchor->m_oPos->m_oX->GetValue();
if (oox_anchor->m_oPos->m_oY.IsInit()) y = oox_anchor->m_oPos->m_oY->GetValue();
odf_context()->drawing_context()->set_position( x, y);
}
if (oox_anchor->m_oExt.IsInit())
{
_CP_OPT(double) width, height;
if (oox_anchor->m_oExt->m_oCx.IsInit()) width = oox_anchor->m_oExt->m_oCx->GetValue();
if (oox_anchor->m_oExt->m_oCy.IsInit()) height = oox_anchor->m_oExt->m_oCy->GetValue();
odf_context()->drawing_context()->set_size( width, height);
}
OoxConverter::convert(oox_anchor->m_oElement.GetPointer());
odf_context()->drawing_context()->end_drawing();
}
@ -1819,7 +1866,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
for (unsigned int dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
for (size_t dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
{
ods_context->start_drawings();
convert(oox_drawing->m_arrItems[dr]);
@ -1848,7 +1895,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_f
{
ods_context->current_table().start_conditional_format(oox_cond_fmt->m_oSqRef.get());
for (unsigned int i=0; i< oox_cond_fmt->m_arrItems.size(); i++)
for (size_t i=0; i< oox_cond_fmt->m_arrItems.size(); i++)
convert(oox_cond_fmt->m_arrItems[i]);//rule
ods_context->current_table().end_conditional_format();
@ -1871,7 +1918,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_co
if (oox_cond_rule->m_oOperator.IsInit())
ods_context->current_table().set_conditional_operator(oox_cond_rule->m_oOperator->GetValue());
for (unsigned int i=0; i< oox_cond_rule->m_arrItems.size(); i++)
for (size_t i=0; i< oox_cond_rule->m_arrItems.size(); i++)
convert(oox_cond_rule->m_arrItems[i]);
}
ods_context->current_table().end_conditional_rule();
@ -1888,14 +1935,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (unsigned int i=0; i< oox_cond_databar->m_arrItems.size(); i++)
for (size_t i=0; i< oox_cond_databar->m_arrItems.size(); i++)
convert(oox_cond_databar->m_arrItems[i]);
}
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
{
if (!oox_cond_colorscale)return;
for (unsigned int i=0; i< oox_cond_colorscale->m_arrItems.size(); i++)
for (size_t i=0; i< oox_cond_colorscale->m_arrItems.size(); i++)
{
if (!oox_cond_colorscale->m_arrItems[i])continue;
@ -1921,7 +1968,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CIconSet *oox_cond_iconset)
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (unsigned int i=0; i< oox_cond_iconset->m_arrItems.size(); i++)
for (size_t i=0; i< oox_cond_iconset->m_arrItems.size(); i++)
convert(oox_cond_iconset->m_arrItems[i]);
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox_cond_value)
@ -1970,7 +2017,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAutofilter *oox_filter)
}
ods_context->add_autofilter(ref);//target
//for (unsigned int i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo
//for (size_t i=0; i < oox_filter->m_arrItems.size(); i++)//set items todooo
//{
//}
}

View File

@ -32,7 +32,7 @@
#pragma once
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -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"/");

View File

@ -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"

View File

@ -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

View File

@ -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);

View File

@ -33,7 +33,7 @@ cd "$SCRIPTPATH/v8"
if [[ "$platform" == *"linux"* ]]
then
CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native GYPFLAGS=-Dclang=0
CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native -j $(grep -c ^processor /proc/cpuinfo) GYPFLAGS=-Dclang=0
cp "./out/native/obj.target/tools/gyp/libv8_base.a" "./../$platform$arch/"
cp "./out/native/obj.target/tools/gyp/libv8_libbase.a" "./../$platform$arch/"

View File

@ -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>

View File

@ -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"

View File

@ -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() );
}

View File

@ -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"));

View File

@ -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

View File

@ -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());

View File

@ -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()

View File

@ -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 )
}

View 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_

View File

@ -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
{

View 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_

View File

@ -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,

View 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_

View File

@ -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() );
}

View File

@ -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);

View File

@ -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

View File

@ -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;
};

View File

@ -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

View File

@ -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;
}

View File

@ -191,7 +191,8 @@ namespace BinXlsxRW
PivotCache = 8,
ExternalBook = 9,
OleLink = 10,
DdeLink = 11
DdeLink = 11,
VbaProject = 12
};}
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
{

View File

@ -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);

View File

@ -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;
}