mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-05 18:31:47 +08:00
Compare commits
11 Commits
core-win-6
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| dfd54ff53f | |||
| 6ec7d77e19 | |||
| 356ccba104 | |||
| 3044d1122a | |||
| fb00ba7ecb | |||
| 9dd115ec56 | |||
| 34083d996b | |||
| 244d549cf8 | |||
| 7a27150de6 | |||
| 2197fddb7b | |||
| d31344d7d3 |
@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
namespace oox
|
||||
{
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts)
|
||||
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
|
||||
{
|
||||
graphRPR_ = graphic;
|
||||
|
||||
|
||||
@ -106,6 +106,8 @@ namespace oox {
|
||||
|
||||
std::wstring nsRPr_;
|
||||
bool graphRPR_;
|
||||
|
||||
bool is_need_e_;
|
||||
private:
|
||||
std::wstringstream math_stream_;
|
||||
std::wstringstream math_style_stream_;
|
||||
|
||||
@ -753,10 +753,10 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"spd",impl_->transition_.Speed.get());
|
||||
}
|
||||
if (impl_->transition_.Time)
|
||||
/* if (impl_->transition_.Time)
|
||||
{
|
||||
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
|
||||
}
|
||||
}*/
|
||||
if (impl_->transition_.PageTime)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
|
||||
|
||||
@ -70,9 +70,22 @@ public:
|
||||
std::wstring sVal;
|
||||
std::wstring sNode;
|
||||
};
|
||||
struct _reference
|
||||
{
|
||||
std::wstring name;
|
||||
int type = -1;
|
||||
std::wstring member_name;
|
||||
int member_type = -1;
|
||||
};
|
||||
struct _group
|
||||
{
|
||||
std::wstring name;
|
||||
std::vector<_field_value> caches;
|
||||
};
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
std::wstring display_name;
|
||||
int type = -1;
|
||||
int hierarchy = -1;
|
||||
int function = -1;
|
||||
@ -80,13 +93,20 @@ public:
|
||||
bool data_layout = false;
|
||||
bool show_empty = false;
|
||||
bool repeat_item_labels = true;
|
||||
int type_groups = 0;
|
||||
int sort = 0;
|
||||
std::wstring source_groups;
|
||||
|
||||
std::vector<int> subtotals;
|
||||
|
||||
std::vector<_field_value> caches;
|
||||
std::vector<_reference> references;
|
||||
int references_field = -1;
|
||||
bool used_in_referenes = false;
|
||||
|
||||
int type_groups = 0;
|
||||
int base_group = -1;
|
||||
std::wstring source_groups;
|
||||
std::vector<_group> groups;
|
||||
std::vector<int> groups_discrete;
|
||||
|
||||
bool bDataFieldEnabled = false;
|
||||
bool bString = false;
|
||||
@ -142,8 +162,10 @@ public:
|
||||
|
||||
bool identify_categories = false;
|
||||
bool drill_enabled = true;
|
||||
bool ignore_empty_rows = false;
|
||||
|
||||
bool data_on_row = false;
|
||||
bool in_group = false;
|
||||
}current_;
|
||||
|
||||
void sort_fields();
|
||||
@ -259,17 +281,162 @@ xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl
|
||||
}
|
||||
void xlsx_pivots_context::Impl::sort_fields()
|
||||
{
|
||||
for (size_t i = 0; i < current_.fields.size(); i++)
|
||||
size_t count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
{
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() -1)
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
{
|
||||
if (current_.fields[i].name.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
|
||||
bool bEmptyRowCache = false, bAddRepeateCol = false;
|
||||
bool bEmptyColCache = false, bAddRepeateRow = false;
|
||||
|
||||
int index_current = 0;
|
||||
for (size_t i = 0; i < current_.fields.size(); i++, index_current++)
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0 )
|
||||
{
|
||||
current_.fields[i].base_group = 0;
|
||||
|
||||
int index_group = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
if (current_.fields[k].type == 7) continue;
|
||||
if (current_.fields[k].name == current_.fields[i].source_groups && !current_.fields[i].source_groups.empty())
|
||||
{
|
||||
if (current_.fields[k].type_groups == 0)
|
||||
current_.fields[k].base_group = index_current; //опорный (если он и базовый - не писать)
|
||||
current_.fields[i].base_group = index_group;
|
||||
|
||||
for (size_t c = 0; !current_.fields[i].groups.empty() && c < current_.fields[k].caches.size(); c++)
|
||||
{
|
||||
for (size_t g = 0; g < current_.fields[i].groups.size(); g++)
|
||||
{
|
||||
for (size_t h = 0; h < current_.fields[i].groups[g].caches.size(); h++)
|
||||
{
|
||||
if (current_.fields[i].groups[g].caches[h].sVal == current_.fields[k].caches[c].sVal)
|
||||
current_.fields[i].groups_discrete.push_back(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
index_group++;
|
||||
}
|
||||
}
|
||||
if ( current_.fields[i].name.empty() &&
|
||||
!current_.fields[i].data_layout)
|
||||
continue;
|
||||
|
||||
switch(current_.fields[i].type)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.col_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
{
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyColCache = true;
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t j = 0; j < i/*current_.fields.size()*/; j++)
|
||||
{
|
||||
if ( current_.fields[j].name == current_.fields[i].name )
|
||||
{
|
||||
current_.fields[j].bDataFieldEnabled = true;
|
||||
index_field = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
if (current_.fields[i].caches.empty())
|
||||
{
|
||||
current_.fields[i].type = 7; //skip
|
||||
current_.fields_count--;
|
||||
index_current--;
|
||||
}
|
||||
|
||||
current_.fields[i].references_field = index_field;
|
||||
}
|
||||
|
||||
index_field = i;
|
||||
current_.fields[i].bDataFieldEnabled = true;
|
||||
current_.data_fields.push_back(index_field);
|
||||
}break;
|
||||
case 2: // hidden
|
||||
{
|
||||
}break;
|
||||
case 3: // page
|
||||
{
|
||||
current_.page_fields.push_back(i);
|
||||
}break;
|
||||
case 4: // row
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.row_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
current_.data_on_row = true;
|
||||
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyRowCache = true;
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
if (current_.fields[i].name.empty())
|
||||
{
|
||||
current_.fields.erase(current_.fields.begin() + i, current_.fields.begin() + i + 1);
|
||||
current_.fields_count--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (bAddRepeateCol || bEmptyColCache)
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if (bAddRepeateRow)
|
||||
current_.row_fields.push_back(-2);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
@ -468,22 +635,38 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
CP_XML_ATTR(L"defaultSubtotal", 0);
|
||||
|
||||
if (!current_.fields[i].caches.empty() && current_.fields[i].type != 2)
|
||||
if (current_.fields[i].type != 2)
|
||||
{
|
||||
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);
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!current_.fields[i].caches.empty())
|
||||
{
|
||||
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_;
|
||||
}
|
||||
}
|
||||
if (!current_.row_fields.empty())
|
||||
@ -537,35 +720,85 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
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", current_.data_fields[i]);
|
||||
//CP_XML_ATTR(L"baseItem", -1);
|
||||
//CP_XML_ATTR(L"name", L"");
|
||||
int ind_field_dirty = current_.data_fields[i];
|
||||
|
||||
int ind_field = current_.data_fields[i];
|
||||
if (ind_field >= 0 && ind_field < current_.fields.size())
|
||||
CP_XML_NODE(L"dataField")
|
||||
{
|
||||
int fld = 0, ind_fld = current_.fields[ind_field_dirty].references_field < 0 ? ind_field_dirty :
|
||||
current_.fields[ind_field_dirty].references_field;
|
||||
for (size_t k = 0; k < ind_fld; k++)
|
||||
{
|
||||
switch(current_.fields[ind_field].function)
|
||||
if (current_.fields[k].type != 7 ) fld++;
|
||||
}
|
||||
|
||||
CP_XML_ATTR(L"fld", fld);
|
||||
if (current_.fields[ind_field_dirty].references.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"baseField", fld);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t base_field = 0, base_item = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); break;
|
||||
if (current_.fields[k].type == 7 ) continue;
|
||||
|
||||
if (current_.fields[k].name == current_.fields[ind_field_dirty].references[0].name)
|
||||
{
|
||||
for (size_t j = 0; j < current_.fields[k].caches.size(); j++)
|
||||
{
|
||||
if (current_.fields[k].caches[j].sVal == current_.fields[ind_field_dirty].references[0].member_name)
|
||||
{
|
||||
base_item = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
base_field++;
|
||||
}
|
||||
CP_XML_ATTR(L"baseField", base_field);
|
||||
CP_XML_ATTR(L"baseItem", base_item);
|
||||
|
||||
switch(current_.fields[ind_field_dirty].references[0].type)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"showDataAs", L"difference"); break;
|
||||
case 2: CP_XML_ATTR(L"showDataAs", L"percent"); break;
|
||||
case 3: CP_XML_ATTR(L"showDataAs", L"percentDiff"); break;
|
||||
}
|
||||
}
|
||||
std::wstring name;
|
||||
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < current_.fields.size())
|
||||
{
|
||||
switch(current_.fields[ind_field_dirty].function)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); name = L"average "; break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); name = L"count "; break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); name = L"countNums "; break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); name = L"max "; break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); name = L"min "; break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); name = L"product "; break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); name = L"stdDev Dev "; break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); name = L"stdDevp "; break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); name = L"sum by "; break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); name = L"var "; break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); name = L"varp "; break;
|
||||
case 12:
|
||||
{
|
||||
CP_XML_ATTR(L"subtotal", current_.fields[current_.data_fields[i]].user_function);
|
||||
}break;
|
||||
default: break;
|
||||
}
|
||||
if (current_.fields[ind_field_dirty].display_name.empty())
|
||||
{
|
||||
name += current_.fields[ind_field_dirty].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = current_.fields[ind_field_dirty].display_name;
|
||||
}
|
||||
CP_XML_ATTR(L"name", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -708,6 +941,7 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
int index_current = 0;
|
||||
|
||||
if (current_.fields.empty() == false)
|
||||
{
|
||||
@ -744,11 +978,12 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (current_.fields[i].type_groups < 8)
|
||||
{//group by date
|
||||
current_.fields[i].bDate = true;
|
||||
current_.fields[i].bString = false;
|
||||
}
|
||||
//else group by fields
|
||||
|
||||
serialize_type_field(CP_GET_XML_NODE(), current_.fields[i]);
|
||||
if ( current_.fields[i].type_groups == 0 )
|
||||
@ -766,37 +1001,78 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( current_.fields[i].type_groups != 0 )
|
||||
if (current_.fields[i].base_group >= 0)
|
||||
{
|
||||
CP_XML_NODE(L"fieldGroup")
|
||||
{
|
||||
CP_XML_ATTR(L"base", 0);
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0)
|
||||
{
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"base", current_.fields[i].base_group);
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
CP_XML_ATTR(L"par", current_.fields[i].base_group);
|
||||
}
|
||||
if (current_.fields[i].type_groups > 0)
|
||||
{
|
||||
if (current_.fields[i].type_groups < 8)
|
||||
{
|
||||
CP_XML_NODE(current_.fields[i].caches[j].sNode)
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
}
|
||||
}
|
||||
if (!current_.fields[i].groups_discrete.empty())
|
||||
{
|
||||
CP_XML_NODE(L"discretePr")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups_discrete.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups_discrete.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups_discrete[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
{
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"s")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups[j].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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(current_.fields[i].caches[j].sNode)
|
||||
{
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,6 +1080,8 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index_current++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -940,6 +1218,10 @@ void xlsx_pivots_context::set_identify_categories(bool val)
|
||||
{
|
||||
impl_->current_.identify_categories = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_ignore_empty_rows(bool val)
|
||||
{
|
||||
impl_->current_.ignore_empty_rows = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_drill(bool val)
|
||||
{
|
||||
impl_->current_.drill_enabled = val;
|
||||
@ -955,75 +1237,86 @@ void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_display(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().display_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_type(int type, int hierarchy)
|
||||
{
|
||||
impl_->current_.fields.back().type = type;
|
||||
impl_->current_.fields.back().hierarchy = hierarchy;
|
||||
|
||||
if ( impl_->current_.fields.back().name.empty() &&
|
||||
!impl_->current_.fields.back().data_layout)
|
||||
return;
|
||||
//if ( impl_->current_.fields.back().name.empty() &&
|
||||
// !impl_->current_.fields.back().data_layout)
|
||||
// return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
impl_->current_.col_fields.push_back(-2);
|
||||
}
|
||||
else
|
||||
impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
impl_->current_.fields[i].type != 1)
|
||||
{
|
||||
impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
index_field = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
impl_->current_.fields.back().type = 7;
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
else
|
||||
{
|
||||
index_field = impl_->current_.fields.size() - 1;
|
||||
impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
}break;
|
||||
case 2: // hidden
|
||||
break;
|
||||
case 3: // page
|
||||
impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
case 4: // row
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
impl_->current_.data_on_row = true;
|
||||
//switch(type)
|
||||
//{
|
||||
// case 0: // column
|
||||
// {
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
// impl_->current_.col_fields.push_back(-2);
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// }break;
|
||||
// case 1: // data
|
||||
// {
|
||||
// int index_field = -1;
|
||||
//
|
||||
// for (size_t i = 0; i < impl_->current_.fields.size() - 1; i++)
|
||||
// {
|
||||
// if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
// (impl_->current_.fields[i].type != 1 || !impl_->current_.fields.back().references.empty()))
|
||||
// {
|
||||
// impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
// index_field = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (index_field >= 0)
|
||||
// {
|
||||
// impl_->current_.fields.back().type = 7; //skip
|
||||
// impl_->current_.fields_count--;
|
||||
//
|
||||
// if (!impl_->current_.fields.back().references.empty())
|
||||
// {
|
||||
// impl_->current_.fields.back().references_field = index_field;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
//
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
// }
|
||||
// impl_->current_.data_fields.push_back(index_field);
|
||||
// }break;
|
||||
// case 2: // hidden
|
||||
// break;
|
||||
// case 3: // page
|
||||
// impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
// case 4: // row
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// impl_->current_.data_on_row = true;
|
||||
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// !impl_->current_.identify_categories ))
|
||||
impl_->current_.row_fields.push_back(-2);
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// // !impl_->current_.identify_categories ))
|
||||
// impl_->current_.row_fields.push_back(-2);
|
||||
|
||||
}
|
||||
else
|
||||
impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_function(int type)
|
||||
{
|
||||
@ -1058,10 +1351,56 @@ void xlsx_pivots_context::set_field_groups_source(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().source_groups = name;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_group()
|
||||
{
|
||||
impl_->current_.in_group = true;
|
||||
Impl::_group group;
|
||||
impl_->current_.fields.back().groups.push_back(group);
|
||||
}
|
||||
void xlsx_pivots_context::set_field_group_name (std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::end_field_group()
|
||||
{
|
||||
impl_->current_.in_group = false;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_sort(int type)
|
||||
{
|
||||
impl_->current_.fields.back().sort = type + 1;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_reference()
|
||||
{
|
||||
Impl::_reference ref;
|
||||
impl_->current_.fields.back().references.push_back(ref);
|
||||
}
|
||||
void xlsx_pivots_context::end_field_reference()
|
||||
{
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().name = name;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == name)
|
||||
{
|
||||
impl_->current_.fields[i].used_in_referenes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_type (int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().type = type;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_type = type;
|
||||
}
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
if (index < 0)
|
||||
@ -1131,14 +1470,20 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
}
|
||||
}
|
||||
impl_->current_.fields.back().caches.push_back(Impl::_field_value(value, node_name));
|
||||
|
||||
if (impl_->current_.in_group)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().caches.push_back(impl_->current_.fields.back().caches.back());
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_pivots_context::end_field()
|
||||
{
|
||||
if (impl_->current_.fields.back().name.empty())
|
||||
{
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.fields.pop_back();
|
||||
}
|
||||
//if (impl_->current_.fields.back().name.empty())
|
||||
//{
|
||||
// impl_->current_.fields_count--;
|
||||
// impl_->current_.fields.pop_back();
|
||||
//}
|
||||
}
|
||||
void xlsx_pivots_context::set_source_range(std::wstring table_name, std::wstring ref)
|
||||
{
|
||||
|
||||
@ -51,6 +51,7 @@ public:
|
||||
|
||||
void start_field ();
|
||||
void set_field_name (std::wstring name);
|
||||
void set_field_display (std::wstring name);
|
||||
void set_field_type (int type, int hierarchy);
|
||||
void set_field_function (int type);
|
||||
void set_field_user_function (std::wstring f);
|
||||
@ -59,9 +60,22 @@ public:
|
||||
void set_field_show_empty (bool val);
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
void set_repeat_item_labels(bool val);
|
||||
|
||||
void set_field_groups (int type);
|
||||
void set_field_groups_source(std::wstring name);
|
||||
void set_repeat_item_labels(bool val);
|
||||
|
||||
void start_field_group();
|
||||
void set_field_group_name (std::wstring name);
|
||||
void end_field_group();
|
||||
|
||||
void start_field_reference();
|
||||
void set_field_ref_name(std::wstring name);
|
||||
void set_field_ref_type (int type);
|
||||
void set_field_ref_member_name(std::wstring name);
|
||||
void set_field_ref_member_type(int type);
|
||||
void end_field_reference();
|
||||
|
||||
void end_field();
|
||||
|
||||
int get_count();
|
||||
@ -73,6 +87,7 @@ public:
|
||||
void add_button_header(std::wstring ref);
|
||||
|
||||
void set_identify_categories(bool val);
|
||||
void set_ignore_empty_rows(bool val);
|
||||
void set_drill(bool val);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
@ -98,7 +113,6 @@ public:
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -96,6 +96,7 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
bDPr = true;
|
||||
}
|
||||
|
||||
bool need_e_old = Context.is_need_e_, need_e = false;
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"<m:d>";
|
||||
@ -115,20 +116,31 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
Context.output_stream() << Context.math_style_stream().str();
|
||||
Context.output_stream() << L"</m:dPr>";
|
||||
Context.output_stream() << L"<m:e>";
|
||||
|
||||
need_e = true;
|
||||
}
|
||||
else need_e = Context.is_need_e_;
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
|
||||
for (int i = i_start; i < i_end ; i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
}
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
Context.output_stream() << L"</m:d>";
|
||||
}
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_mfrac::ns = L"math";
|
||||
@ -150,13 +162,23 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
Context.output_stream() << L"<m:f>";
|
||||
Context.output_stream() << L"<m:num>";
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
Context.output_stream() << L"</m:num>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
Context.output_stream() << L"<m:den>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
@ -164,6 +186,12 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
Context.output_stream() << L"</m:den>";
|
||||
|
||||
Context.output_stream() << L"</m:f>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_msqrt::ns = L"math";
|
||||
@ -192,6 +220,8 @@ void math_msqrt::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:deg/>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
@ -230,6 +260,9 @@ void math_mroot::oox_convert(oox::math_context & Context)
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:deg>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
@ -295,21 +328,23 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
Context.is_need_e_ = content_.size() > 1 ? true : need_e_old;
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"</m:e>";
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"</m:e>";
|
||||
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
//math_element->oox_convert(Context);
|
||||
@ -320,6 +355,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
Context.text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content().fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
{
|
||||
std::wstringstream & strm = Context.math_style_stream();
|
||||
strm.str( std::wstring() );
|
||||
|
||||
@ -71,11 +71,15 @@ void math_msub::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSub>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
|
||||
strm << L"<m:sub>";
|
||||
Context.is_need_e_ = false; //??
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:sub>";
|
||||
@ -109,6 +113,8 @@ void math_msup::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSup>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -142,6 +148,8 @@ void math_msubsup::oox_convert(oox::math_context & Context)
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
strm << L"<m:sSubSup>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
@ -328,6 +336,9 @@ void math_mover::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:limUpp>";
|
||||
strm << L"<m:limUppPr/>";
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -355,6 +366,13 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
{//2 elements
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
strm << L"<m:limLow>";
|
||||
strm << L"<m:limLowPr/>";
|
||||
@ -367,6 +385,12 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:lim>";
|
||||
strm << L"</m:limLow>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,23 +92,30 @@ void math_mtr::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:mr>";
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
strm << L"</m:e>";
|
||||
}
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
//Context.is_need_e_ = content_.size() > 1 ? true : false;
|
||||
Context.is_need_e_ = true;
|
||||
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// strm << L"</m:e>";
|
||||
}
|
||||
strm << L"</m:mr>";
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -151,6 +158,7 @@ void math_mtd::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
|
||||
@ -286,7 +286,7 @@ void math_mtext::oox_convert(oox::math_context & Context)
|
||||
if (text_)
|
||||
{
|
||||
Context.output_stream() << L"<m:r><m:rPr><m:nor/></m:rPr><m:t>";
|
||||
Context.output_stream() << *text_;
|
||||
Context.output_stream() << XmlUtils::EncodeXmlString(*text_);
|
||||
Context.output_stream() << L"</m:t></m:r>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
switch (style_text_underline_style_->get_type())
|
||||
{
|
||||
case line_style::Solid:
|
||||
if (underlineBold) underline = L"thick";
|
||||
if (underlineBold) underline = L"heavy";
|
||||
else underline = L"sng";
|
||||
break;
|
||||
case line_style::Dotted:
|
||||
|
||||
@ -123,6 +123,9 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
if (table_identify_categories_)
|
||||
Context.get_pivots_context().set_identify_categories(table_identify_categories_->get());
|
||||
|
||||
if (table_ignore_empty_rows_)
|
||||
Context.get_pivots_context().set_ignore_empty_rows(table_ignore_empty_rows_->get());
|
||||
|
||||
if (table_drill_down_ondouble_click_)
|
||||
Context.get_pivots_context().set_drill(table_drill_down_ondouble_click_->get());
|
||||
|
||||
@ -155,6 +158,7 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
CP_APPLY_ATTR(L"loext:ignore-selected-page" , loext_ignore_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:selected-page" , table_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:is-data-layout-field" , table_is_data_layout_field_);
|
||||
CP_APPLY_ATTR(L"tableooo:display-name" , table_display_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -175,6 +179,9 @@ void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
|
||||
|
||||
if (table_display_name_)
|
||||
Context.get_pivots_context().set_field_display(*table_display_name_);
|
||||
|
||||
if (table_is_data_layout_field_)
|
||||
Context.get_pivots_context().set_field_data_layout(table_is_data_layout_field_->get());
|
||||
|
||||
@ -217,7 +224,24 @@ void table_data_pilot_field_reference::add_attributes( const xml::attributes_wc_
|
||||
|
||||
void table_data_pilot_field_reference::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
Context.get_pivots_context().start_field_reference();
|
||||
if (table_field_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_name(*table_field_name_);
|
||||
}
|
||||
if (table_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_type(table_type_->get_type());
|
||||
}
|
||||
if (table_member_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_name(*table_member_name_);
|
||||
}
|
||||
if (table_member_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_type(table_member_type_->get_type());
|
||||
}
|
||||
Context.get_pivots_context().end_field_reference();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_database_source_table::ns = L"table";
|
||||
@ -405,6 +429,8 @@ void table_data_pilot_groups::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
{
|
||||
if (table_grouped_by_)
|
||||
Context.get_pivots_context().set_field_groups(table_grouped_by_->get_type());
|
||||
else
|
||||
Context.get_pivots_context().set_field_groups(7);
|
||||
|
||||
if (table_source_field_name_)
|
||||
Context.get_pivots_context().set_field_groups_source(*table_source_field_name_);
|
||||
@ -429,10 +455,16 @@ void table_data_pilot_group::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void table_data_pilot_group::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
Context.get_pivots_context().start_field_group();
|
||||
|
||||
if (table_name_)
|
||||
Context.get_pivots_context().set_field_group_name (*table_name_);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.get_pivots_context().end_field_group();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_members::ns = L"table";
|
||||
@ -470,12 +502,12 @@ const wchar_t * table_data_pilot_group_member::name = L"data-pilot-group-member"
|
||||
|
||||
void table_data_pilot_group_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_group_member::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""));
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_subtotals::ns = L"table";
|
||||
|
||||
@ -130,6 +130,7 @@ public:
|
||||
_CP_OPT(odf_types::Bool) loext_ignore_selected_page_;
|
||||
_CP_OPT(std::wstring) table_selected_page_;
|
||||
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
|
||||
_CP_OPT(std::wstring) table_display_name_;
|
||||
|
||||
office_element_ptr reference_;
|
||||
office_element_ptr level_;
|
||||
|
||||
@ -44,17 +44,67 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
|
||||
Ole1FormatReader ole1Reader(pData, nSize);
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sOle2Name);
|
||||
if (ole1Reader.NativeDataSize > 0)//conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
file.WriteFile(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
if (ole1Reader.NativeDataSize > 0)
|
||||
{
|
||||
POLE::Storage * storageOut = new POLE::Storage(sOle2Name.c_str());
|
||||
if ( (storageOut) && (storageOut->open(true, true)))
|
||||
{
|
||||
_UINT32 tmp = 0;
|
||||
std::string name = ole1Reader.Header.ClassName.val;
|
||||
_UINT32 name_size = name.length() + 1;
|
||||
//Ole
|
||||
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream3(storageOut, "\001Ole", true, 20);
|
||||
oStream3.write(dataOleInfo, 20);
|
||||
oStream3.flush();
|
||||
//CompObj
|
||||
BYTE dataCompObjHeader[28] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0a,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
|
||||
POLE::Stream oStream1(storageOut, "\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
oStream1.write(dataCompObjHeader, 28);
|
||||
|
||||
oStream1.write((BYTE*)&name_size, 4);
|
||||
oStream1.write((BYTE*)name.c_str(), name_size);
|
||||
|
||||
//oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
//oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
tmp = 0x71B239F4;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeMarker
|
||||
|
||||
tmp = 0;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeUserType
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeClipboardFormat
|
||||
oStream1.write((BYTE*)&tmp, 4); //
|
||||
oStream1.flush();
|
||||
|
||||
//ObjInfo
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x04,0x00};
|
||||
POLE::Stream oStream2(storageOut, "\003ObjInfo", true, 6);
|
||||
oStream2.write(dataObjInfo, 6);
|
||||
oStream2.flush();
|
||||
//Ole10Native
|
||||
POLE::Stream streamData(storageOut, "\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
streamData.write((BYTE*)&ole1Reader.NativeDataSize, 4);
|
||||
streamData.write(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
streamData.flush();
|
||||
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
}
|
||||
}
|
||||
else
|
||||
else //conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(pData, nSize);
|
||||
file.CloseFile();
|
||||
}
|
||||
file.CloseFile();
|
||||
return S_FALSE;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
@ -1679,20 +1729,35 @@ void RtfOleBinReader::ExecuteText(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
void RtfOleBinReader::GetData( BYTE** ppData, long& nSize)
|
||||
{
|
||||
nSize = 0;
|
||||
for (size_t i = 0; i < m_arData.size(); i++)
|
||||
size_t pos = 0, start = 0, nSizeRead = 0;
|
||||
|
||||
if (m_arData.size() > 1)
|
||||
{
|
||||
nSizeRead = *((short*)m_arData[0].c_str());
|
||||
start = 1; // first content all size
|
||||
}
|
||||
for (size_t i = start; i < m_arData.size(); i++)
|
||||
{
|
||||
nSize += m_arData[i].length();
|
||||
}
|
||||
|
||||
(*ppData) = new BYTE[ nSize];
|
||||
|
||||
int pos = 0;
|
||||
for (size_t i = 0; i < m_arData.size(); i++)
|
||||
for (size_t i = start; i < m_arData.size(); i++)
|
||||
{
|
||||
memcpy((*ppData) + pos, m_arData[i].c_str(), m_arData[i].length());
|
||||
BYTE *buf = (BYTE*)m_arData[i].c_str();
|
||||
|
||||
pos += m_arData[i].length();
|
||||
for (size_t j = 0; j < m_arData[i].length(); j += 2)
|
||||
{
|
||||
BYTE nByte = 0;
|
||||
|
||||
nByte = RtfUtility::ToByte(buf[ j ]) << 4;
|
||||
nByte |= RtfUtility::ToByte(buf[ j + 1]);
|
||||
|
||||
(*ppData)[pos++] = nByte;
|
||||
}
|
||||
}
|
||||
nSize = pos;
|
||||
}
|
||||
bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
|
||||
{
|
||||
@ -1725,7 +1790,7 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
HRESULT hRes = S_FALSE;
|
||||
|
||||
//конвертация Ole1 в Ole2
|
||||
#if 0 //defined(_WIN32) || defined(_WIN64)
|
||||
#if 0//defined(_WIN32) || defined(_WIN64)
|
||||
RtfOle1ToOle2Stream oStream;
|
||||
|
||||
oStream.lpstbl = new OLESTREAMVTBL();
|
||||
|
||||
@ -307,20 +307,23 @@ public:
|
||||
|
||||
stream >> Header.OLEVersion >> Header.FormatID;
|
||||
|
||||
if (Header.OLEVersion & 0x00000500)
|
||||
if (Header.FormatID == 2)
|
||||
{
|
||||
stream >> Header.ClassName;
|
||||
}
|
||||
stream >> Header.Width >> Header.Height;
|
||||
|
||||
stream >> NativeDataSize;
|
||||
if (Header.OLEVersion & 0x00000500)
|
||||
{
|
||||
stream >> Header.ClassName;
|
||||
}
|
||||
stream >> Header.Width >> Header.Height;
|
||||
|
||||
NativeData = stream.GetCurPtr();
|
||||
stream.Skip(NativeDataSize);
|
||||
stream >> NativeDataSize;
|
||||
|
||||
NativeData = stream.GetCurPtr();
|
||||
stream.Skip(NativeDataSize);
|
||||
|
||||
int sz = stream.CanRead();
|
||||
int sz = stream.CanRead();
|
||||
|
||||
/// далее графическое представление
|
||||
/// далее графическое представление
|
||||
}
|
||||
|
||||
}
|
||||
ObjectHeader Header;
|
||||
|
||||
@ -108,37 +108,37 @@ BaseObjectPtr SERIESDATA::clone()
|
||||
// SERIESDATA = Dimensions 3(SIIndex *(Number / BoolErr / Blank / Label))
|
||||
const bool SERIESDATA::loadContent(BinProcessor& proc)
|
||||
{
|
||||
if(!proc.optional<Dimensions>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elements_.size() > 0)
|
||||
bool result = false;
|
||||
if(proc.optional<Dimensions>())
|
||||
{
|
||||
m_Dimensions = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
int count = proc.repeated<Parenthesis_SERIESDATA_1>(3, 3);
|
||||
|
||||
int count1= elements_.size();
|
||||
while(count1 > 0)
|
||||
if (count > 0)
|
||||
{
|
||||
if ("SIIndex" == elements_.front()->getClassName())
|
||||
result = true;
|
||||
|
||||
int count1= elements_.size();
|
||||
while(count1 > 0)
|
||||
{
|
||||
m_arSIIndex.push_back(elements_.front()); count--;
|
||||
if ("SIIndex" == elements_.front()->getClassName())
|
||||
{
|
||||
m_arSIIndex.push_back(elements_.front()); count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIIndex * si_in = dynamic_cast<SIIndex *>(m_arSIIndex.back().get());
|
||||
if (si_in)
|
||||
si_in->m_arData.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front(); count1--;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIIndex * si_in = dynamic_cast<SIIndex *>(m_arSIIndex.back().get());
|
||||
if (si_in)
|
||||
si_in->m_arData.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front(); count1--;
|
||||
}
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -1237,6 +1237,7 @@
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
|
||||
@ -63,7 +63,9 @@
|
||||
#include <sys/utime.h>
|
||||
#include <winsock2.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
typedef __int64 INT64;
|
||||
|
||||
@ -68,7 +68,9 @@
|
||||
#include <sys/utime.h>
|
||||
#include <winsock2.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
typedef __int64 INT64;
|
||||
|
||||
@ -113,7 +113,9 @@ static dcr_stream_ops dcr_stream_fileops = {
|
||||
#include <sys/utime.h>
|
||||
#include <winsock2.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
typedef __int64 INT64;
|
||||
|
||||
@ -56,6 +56,10 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
#include "../../Common/FileDownloader/FileDownloader.h"
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class CScopeWrapper
|
||||
{
|
||||
@ -558,6 +562,8 @@ namespace NSDoctRenderer
|
||||
|
||||
bool m_bIsCacheScript;
|
||||
|
||||
std::wstring m_sFolderForSaveOnlyUseNames;
|
||||
|
||||
std::string m_sGlobalVariable;
|
||||
bool m_bIsGlobalVariableUse;
|
||||
public:
|
||||
@ -851,6 +857,64 @@ namespace NSDoctRenderer
|
||||
#endif
|
||||
}
|
||||
|
||||
void MoveFileOpen(const std::wstring& from, const std::wstring& to)
|
||||
{
|
||||
#ifdef BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
int n1 = (int)from.find (L"www");
|
||||
int n2 = (int)from.find (L"http");
|
||||
int n3 = (int)from.find (L"ftp");
|
||||
int n4 = (int)from.find (L"https");
|
||||
|
||||
//если nI сранивать не с 0, то будут проблемы
|
||||
//потому что в инсталяции мы кладем файлы в /var/www...
|
||||
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
|
||||
{
|
||||
CFileDownloader oDownloader(from, false);
|
||||
oDownloader.SetFilePath(to);
|
||||
if (oDownloader.DownloadSync())
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUIDLER_OPEN_BASE64_ENABLED
|
||||
if (0 == from.find(L"data:"))
|
||||
{
|
||||
std::wstring::size_type findBase64 = from.find(L"base64,");
|
||||
if (std::wstring::npos != findBase64)
|
||||
{
|
||||
int nStartBase64 = (int)findBase64;
|
||||
if (50 > nStartBase64)
|
||||
{
|
||||
nStartBase64 += 7;
|
||||
const wchar_t* pStart = from.c_str() + nStartBase64;
|
||||
int nDataLen = (int)from.length() - nStartBase64;
|
||||
|
||||
std::string sBase64 = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(pStart, (LONG)nDataLen, false);
|
||||
|
||||
BYTE* pDataDst = NULL;
|
||||
int nDataDstLen = 0;
|
||||
if (NSFile::CBase64Converter::Decode(sBase64.c_str(), (int)sBase64.length(), pDataDst, nDataLen))
|
||||
{
|
||||
NSFile::CFileBinary oFileDst;
|
||||
if (oFileDst.CreateFileW(to))
|
||||
{
|
||||
oFileDst.WriteFile(pDataDst, (DWORD)nDataDstLen);
|
||||
oFileDst.CloseFile();
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
return;
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NSFile::CFileBinary::Copy(from, to);
|
||||
}
|
||||
|
||||
int OpenFile(const std::wstring& path, const std::wstring& params)
|
||||
{
|
||||
Init();
|
||||
@ -861,7 +925,7 @@ namespace NSDoctRenderer
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + NSCommon::GetFileExtention(path);
|
||||
NSFile::CFileBinary::Copy(path, sFileCopy);
|
||||
MoveFileOpen(path, sFileCopy);
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
if (!oChecker.isOfficeFile(path))
|
||||
@ -1054,7 +1118,16 @@ namespace NSDoctRenderer
|
||||
NSStringUtils::CStringBuilder oBuilder;
|
||||
|
||||
std::wstring _path = path;
|
||||
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
|
||||
if (!m_sFolderForSaveOnlyUseNames.empty())
|
||||
{
|
||||
_path = m_sFolderForSaveOnlyUseNames;
|
||||
wchar_t last = m_sFolderForSaveOnlyUseNames.c_str()[m_sFolderForSaveOnlyUseNames.length() - 1];
|
||||
if (last != '/' && last != '\\')
|
||||
_path += L"/";
|
||||
_path += NSCommon::GetFileName(path);
|
||||
}
|
||||
|
||||
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
|
||||
if ((sDstFileDir != _path) && !NSDirectory::Exists(sDstFileDir))
|
||||
NSDirectory::CreateDirectories(sDstFileDir);
|
||||
|
||||
@ -1642,6 +1715,8 @@ namespace NSDoctRenderer
|
||||
m_pInternal->m_oParams.m_sWorkDir = std::wstring(value);
|
||||
else if (sParam == "--cache-scripts")
|
||||
m_pInternal->m_bIsCacheScript = (std::wstring(value) == L"true");
|
||||
else if (sParam == "--save-use-only-names")
|
||||
m_pInternal->m_sFolderForSaveOnlyUseNames = std::wstring(value);
|
||||
else if (sParam == "--argument")
|
||||
{
|
||||
std::wstring sArg(value);
|
||||
|
||||
@ -599,6 +599,8 @@ namespace NSDoctRenderer
|
||||
|
||||
bool ExecuteScript(const std::string& strScript, const std::wstring& sCachePath, std::wstring& strError, std::wstring& strReturnParams)
|
||||
{
|
||||
LOGGER_SPEED_START
|
||||
|
||||
bool bIsBreak = false;
|
||||
v8::Isolate* isolate = CV8Worker::getInitializer()->CreateNew();
|
||||
if (true)
|
||||
@ -619,6 +621,8 @@ namespace NSDoctRenderer
|
||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, strScript.c_str());
|
||||
v8::Local<v8::Script> script;
|
||||
|
||||
LOGGER_SPEED_LAP("pre_compile")
|
||||
|
||||
CCacheDataScript oCachedScript(sCachePath);
|
||||
if (sCachePath.empty())
|
||||
script = v8::Script::Compile(source);
|
||||
@ -627,6 +631,8 @@ namespace NSDoctRenderer
|
||||
script = oCachedScript.Compile(context, source);
|
||||
}
|
||||
|
||||
LOGGER_SPEED_LAP("compile")
|
||||
|
||||
// COMPILE
|
||||
if (try_catch.HasCaught())
|
||||
{
|
||||
@ -658,6 +664,8 @@ namespace NSDoctRenderer
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER_SPEED_LAP("run")
|
||||
|
||||
if (!bIsBreak && m_oParams.m_bIsRetina)
|
||||
{
|
||||
v8::Local<v8::String> sourceParams = v8::String::NewFromUtf8(isolate,
|
||||
@ -761,6 +769,8 @@ namespace NSDoctRenderer
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER_SPEED_LAP("open")
|
||||
|
||||
// CHANGES
|
||||
if (!bIsBreak)
|
||||
{
|
||||
@ -823,6 +833,8 @@ namespace NSDoctRenderer
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER_SPEED_LAP("changes")
|
||||
|
||||
bool bIsMailMerge = false;
|
||||
if (!m_oParams.m_strMailMergeDatabasePath.empty() &&
|
||||
m_oParams.m_nMailMergeIndexEnd >= m_oParams.m_nMailMergeIndexStart &&
|
||||
@ -997,6 +1009,8 @@ namespace NSDoctRenderer
|
||||
{
|
||||
bIsBreak = Doct_renderer_SaveFile(&m_oParams, pNative, isolate, global_js, args, try_catch, strError);
|
||||
}
|
||||
|
||||
LOGGER_SPEED_LAP("save")
|
||||
}
|
||||
|
||||
isolate->Dispose();
|
||||
|
||||
@ -44,3 +44,27 @@ unix {
|
||||
target.path = /usr/lib
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
# downloader
|
||||
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
|
||||
HEADERS += ../../Common/FileDownloader/FileDownloader.h
|
||||
core_windows {
|
||||
SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_win.cpp
|
||||
|
||||
LIBS += -lurlmon
|
||||
}
|
||||
core_linux {
|
||||
SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_curl.cpp
|
||||
|
||||
LIBS += -lcurl
|
||||
}
|
||||
core_mac {
|
||||
OBJECTIVE_SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_mac.mm
|
||||
|
||||
LIBS += -framework AppKit
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ enum {
|
||||
/*------------------------------------------------------------------------*
|
||||
* snprintf() renamed in MSVC *
|
||||
*------------------------------------------------------------------------*/
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
@ -217,6 +217,11 @@ namespace MetaFile
|
||||
double dX, dY, dW, dH;
|
||||
GetBounds(&dX, &dY, &dW, &dH);
|
||||
|
||||
if (dW < 0)
|
||||
dW = -dW;
|
||||
if (dH < 0)
|
||||
dH = -dH;
|
||||
|
||||
if (nWidth < 0) nWidth = dW;
|
||||
nHeight = (int)((double)nWidth * dH / dW);
|
||||
}
|
||||
|
||||
@ -129,7 +129,9 @@ int isnan (double d) {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define mkdir(p,m) _mkdir(p)
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#if _MSC_VER < 1500
|
||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
#endif
|
||||
|
||||
@ -127,7 +127,9 @@ static int isnan (double d) {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define mkdir(p,m) _mkdir(p)
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#if _MSC_VER < 1500
|
||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
#endif
|
||||
|
||||
@ -43,7 +43,9 @@ char *strerror(int errnum);
|
||||
Macro'ed inexistant funtion names
|
||||
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
#define perror(_t) MessageBox(NULL, _T("_t"), _T("Error/Warning"), MB_OK)
|
||||
|
||||
|
||||
@ -391,10 +391,11 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
|
||||
nargs[0] = sXmlA.c_str();
|
||||
nargs[1] = NULL;
|
||||
|
||||
const char* nenv[3];
|
||||
const char* nenv[4];
|
||||
nenv[0] = sLibraryDir.c_str();
|
||||
nenv[1] = "DISPLAY=:0";
|
||||
nenv[2] = NULL;
|
||||
nenv[1] = "LD_PRELOAD=./libcef.so";
|
||||
nenv[2] = "DISPLAY=:0";
|
||||
nenv[3] = NULL;
|
||||
|
||||
execve(sProgramm.c_str(),
|
||||
(char * const *)nargs,
|
||||
@ -411,10 +412,11 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
|
||||
nargs[4] = sXmlA.c_str();
|
||||
nargs[5] = NULL;
|
||||
|
||||
const char* nenv[3];
|
||||
const char* nenv[4];
|
||||
nenv[0] = sLibraryDir.c_str();
|
||||
nenv[1] = NULL;//"DISPLAY=:99";
|
||||
nenv[2] = NULL;
|
||||
nenv[1] = "LD_PRELOAD=./libcef.so";
|
||||
nenv[2] = NULL;//"DISPLAY=:99";
|
||||
nenv[3] = NULL;
|
||||
|
||||
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
Reference in New Issue
Block a user