Compare commits

..

25 Commits

Author SHA1 Message Date
1b91ee579c x2t binary - fix convert ole without vml drawing 2017-10-16 14:22:53 +03:00
337c92e522 OdsFormat - fix absolute anchor for ole 2017-10-16 12:22:30 +03:00
8fe1eb7525 XlsFormat - activeX, controls & ole embedded & links 2017-10-16 11:28:46 +03:00
1deb2a6905 Merge 2017-10-13 14:44:53 +03:00
69a787411c xml string as second command-line param(first - path to xml) 2017-10-13 13:51:27 +03:00
22f986295f . 2017-10-12 18:17:16 +03:00
86d2bde83b x2t version up 2017-10-12 12:01:44 +03:00
07041d60f6 . 2017-10-12 11:54:47 +03:00
a5466ab740 XlsFormatReader - external data (dde, workbook, ..) 2017-10-12 11:41:21 +03:00
dfd54ff53f _MSC_VER >= 1900 build 2017-10-11 16:30:37 +03:00
6ec7d77e19 speed logger 2017-10-09 15:21:16 +03:00
3813be21c7 --all-fonts-path param 2017-10-09 15:11:30 +03:00
356ccba104 fixed bug#35998 2017-10-06 14:09:56 +03:00
68c8c0cb29 Merge pull request #42 from ONLYOFFICE/feature/docbuilder
Feature/docbuilder
2017-10-06 11:57:57 +03:00
3044d1122a OdfFormatReader - fix pilot tables (groups & references) 2017-10-06 11:36:00 +03:00
fb00ba7ecb fix users file 2017-10-06 11:35:03 +03:00
ab0c5703a5 Added empty files 2017-10-06 11:04:59 +03:00
e22b63347f v8 (windows correct) 2017-10-05 18:13:52 +03:00
9dd115ec56 v5.0.1 2017-10-05 14:48:07 +03:00
438ba3aded v5.0.1 2017-10-05 14:46:28 +03:00
29b002ca80 Added docbuilder target 2017-10-04 14:56:03 +03:00
244d549cf8 --save-use-only-names mode 2017-10-03 11:07:01 +03:00
7a27150de6 OdfFormatReader - fix math after testing 2017-10-02 17:11:12 +03:00
2197fddb7b RtfFormatReader - fix ole 2017-09-29 19:29:05 +03:00
d31344d7d3 correct metafile bounds 2017-09-29 17:29:21 +03:00
164 changed files with 3094 additions and 1022 deletions

View File

@ -501,7 +501,7 @@ namespace DocFileFormat
facet.widen((char*)bytes, (char*)bytes + size, &result[0]);
for (long i=0; i < result.length(); i++)
for (size_t i=0; i < result.length(); i++)
{
STLCollection->push_back(result[i]);
}
@ -536,7 +536,7 @@ namespace DocFileFormat
delete [] pStrUtf16;
return GetSTLCollectionFromLocale(STLCollection, bytes,size);
}
for (long i=0; i < nLength; i++)
for (unsigned int i = 0; i < nLength; i++)
{
STLCollection->push_back(pStrUtf16[i]);
}
@ -566,7 +566,7 @@ namespace DocFileFormat
delete [] pStrUtf32;
return GetSTLCollectionFromLocale(STLCollection, bytes, size);
}
for (long i=0; i < nLength; i++)
for (unsigned int i = 0; i < nLength; i++)
{
STLCollection->push_back(pStrUtf32[i]);
}
@ -652,7 +652,7 @@ namespace DocFileFormat
NSUnicodeConverter::CUnicodeConverter oConverter;
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, size, sCodePage.c_str());
for (long i=0; i < unicode_string.size(); i++)
for (size_t i = 0; i < unicode_string.size(); i++)
{
STLCollection->push_back(unicode_string[i]);
}

View File

@ -154,7 +154,7 @@ namespace cpdoccore
if (val)
{
std::wstring tmp = *val;
XmlUtils::GetLower(tmp);
tmp = XmlUtils::GetLower(tmp);
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
}
else

View File

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

View File

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

View File

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

View File

@ -55,8 +55,8 @@ public:
void add_format(std::wstring const & condition, std::wstring const & format)
{
std::wstring c = condition;
XmlUtils::GetLower(c);
std::wstring c = XmlUtils::GetLower(condition);
XmlUtils::replace_all( c, L" ", L"");
XmlUtils::replace_all( c, L"\t", L"");

View File

@ -576,11 +576,31 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
}
void xlsx_drawing_context::process_object(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
{
std::wstring ref;
bool isMediaInternal = true;
if (drawing.type_anchor == 2) // absolute
{
//пересчет нужен для оле
xlsx_table_position from, to;
process_position_properties (obj, table_metrics, from, to);
drawing.from_.type = xlsx_drawing_position::from;
drawing.from_.position.col = from.col;
drawing.from_.position.colOff = static_cast<size_t>(odf_types::length(from.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.from_.position.row = from.row;
drawing.from_.position.rowOff = static_cast<size_t>(odf_types::length(from.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.type = xlsx_drawing_position::to;
drawing.to_.position.col = to.col;
drawing.to_.position.colOff = static_cast<size_t>(odf_types::length(to.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.position.row = to.row;
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
}
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_;
@ -602,7 +622,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
{
xlsx_drawings_ptr xlsx_drawings_child(xlsx_drawings::create(true));
process_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
process_group_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
std::wstringstream strm;
@ -620,9 +640,9 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
}
void xlsx_drawing_context::process_objects(xlsx_table_metrics & table_metrics)
{
process_objects(impl_->objects_, table_metrics, impl_->get_drawings());
process_group_objects(impl_->objects_, table_metrics, impl_->get_drawings());
}
void xlsx_drawing_context::process_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
{
for (size_t i = 0 ; i < objects.size(); i++)
{
@ -661,7 +681,7 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
case typeMsObject:
case typeOleObject:
process_object ( obj, drawing, xlsx_drawings_); break;
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
}
}
}

View File

@ -133,13 +133,13 @@ private:
class Impl;
_CP_PTR(Impl) impl_;
void process_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_group (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_group_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_image (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_chart (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_shape (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_common_properties (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics);

View File

@ -65,7 +65,7 @@ public:
if (sheet_rel)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
if (xlsx_sheet_rels_[i].rid == rid && xlsx_sheet_rels_[i].ref == ref)
present = true;
@ -75,7 +75,7 @@ public:
}
else
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true;
@ -89,7 +89,7 @@ public:
{
if (inGroup)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_drawings_[i].serialize(strm);
}
@ -114,7 +114,7 @@ public:
}
void serialize_objects(std::wostream & strm)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
@ -129,7 +129,7 @@ public:
void dump_rels_drawing(rels & Rels)
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].type == typeImage ||
xlsx_drawing_rels_[i].type == typeMedia ||
@ -146,7 +146,7 @@ public:
}
void dump_rels_sheet(rels & Rels)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
Rels.add(relationship( xlsx_sheet_rels_[i].rid,
mediaitems::get_rel_type(xlsx_sheet_rels_[i].type),

View File

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

View File

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

View File

@ -46,8 +46,7 @@ std::wostream & operator << (std::wostream & _Wostream, const Bool & _Val)
}
Bool Bool::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
XmlUtils::GetLower(tmp);
std::wstring tmp = XmlUtils::GetLower(Str);
if (tmp == L"0" || tmp == L"false") return Bool(false);
else return Bool(true);

View File

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

View File

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

View File

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

View File

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

View File

@ -104,8 +104,7 @@ void styles_container::add_style( const std::wstring & Name,
map_[n] = pos;
// TODO: как правильно??
std::wstring lName = Name;
XmlUtils::GetLower(lName);
std::wstring lName = XmlUtils::GetLower(Name);
//if ( boost::algorithm::contains(lName, L"internet_20_link") )
if (lName == L"internet_20_link")///???????????????
hyperlink_style_pos_ = pos;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -514,49 +514,31 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
return L"#REF";
}
//
const std::wstring xti2sheets(const unsigned short ixti, std::vector<std::wstring>& xti_parsed)
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix)
{
if(ixti >= 0 && static_cast<unsigned short>(ixti) < xti_parsed.size())
{
return xti_parsed[ixti];
}
return L"#REF!";
}
//
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names)
{
if(-1 == itabFirst)
if(-1 == tabFirst)
{
return L"#REF";
}
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
static boost::wregex test_sheet_name(L"[\\s)(\\':.-]+");
static boost::wregex test_sheet_name(L"[\\s)(\\'&:-]+"); //.??? 6442946.xls
std::wstring sheet_first = prefix + tab2sheet_name(tabFirst, names);
std::wstring sheet_first = tab2sheet_name(itabFirst, sheets_names);
if(!boost::regex_search(sheet_first.begin(), sheet_first.end(), correct_sheet_name))
{
if(boost::regex_search(sheet_first.begin(), sheet_first.end(), test_sheet_name))
{
sheet_first = boost::algorithm::replace_all_copy(sheet_first, L"'", L"''");
sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
sheet_first = std::wstring(L"'") + sheet_first + std::wstring(L"'");
}
}
else
{
//todooo найти хоть один файл где в апострофах уже есть внутренний не экранированный апостроф
//static boost::wregex test_sheet_name1(L"[\']+");
//if(boost::regex_search(sheet_first.begin() + 1, sheet_first.end() - 1, test_sheet_name1))
//{
// sheet_first = boost::algorithm::replace_all_copy(sheet_first.begin()+1, sheet_first.end() - 1 , L"'", L"''");
// sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
//}
}
std::wstring sheet_last;
if (itabLast != itabFirst)
if (tabLast != tabFirst)
{
sheet_last = tab2sheet_name(itabLast, sheets_names);
sheet_last = prefix + tab2sheet_name(tabLast, names);
if(!boost::regex_search(sheet_last.begin(), sheet_last.end(), correct_sheet_name))
{
@ -572,20 +554,6 @@ const std::wstring xti_indexes2sheet_name(const short itabFirst, const short ita
return sheet_first + sheet_last;
}
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref)
{
std::wstring sheets_prefix = xti2sheets(ixti, xti_parsed);
if(L"#REF!" == sheets_prefix)
{
return sheets_prefix;
}
else if (!sheets_prefix.empty()) sheets_prefix += L"!";
else if (sheets_prefix.empty() && full_ref) sheets_prefix += L"#REF!";
return sheets_prefix + cell_ref;
}
} //namespace XMLSTUFF

View File

@ -95,13 +95,7 @@ namespace STR
namespace XMLSTUFF
{;
// Makes a new tag and append it to parent (no attributes set)
//BiffStructurePtr createElement(const std::wstring & tag_name, BiffStructurePtr & parent);
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref = false);
//const unsigned short sheetsnames2ixti(const std::wstring str, MSXML2::IXMLDOMDocumentPtr doc);
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names);
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix = L"");
}

View File

@ -245,7 +245,7 @@ const bool CFRecord::isEOF() const
{
if(rdPtr > size_)
{
throw;// EXCEPT::LE::WrongFormatInterpretation(__FUNCTION__);
true;//throw;
}
return rdPtr >= size_;
}

View File

@ -77,6 +77,8 @@ private:
std::map<std::string, CFStreamPtr> streams;
ReadWriteMode rwMode;
};
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
} // namespace XLS

View File

@ -32,14 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/BookExt_Conditional11.h>
#include <Logic/Biff_structures/BookExt_Conditional12.h>
#include "../Biff_structures/BookExt_Conditional11.h"
#include "../Biff_structures/BookExt_Conditional12.h"
namespace XLS
{
// Logical representation of BookExt record in BIFF8
class BookExt: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(BookExt)
@ -49,13 +47,11 @@ public:
~BookExt();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeBookExt;
static const ElementType type = typeBookExt;
//-----------------------------
_UINT32 cb;
bool fDontAutoRecover;

View File

@ -31,7 +31,6 @@
*/
#include "CRN.h"
#include <Logic/Biff_structures/SerAr.h>
namespace XLS
{
@ -40,12 +39,10 @@ CRN::CRN()
{
}
CRN::~CRN()
{
}
BaseObjectPtr CRN::clone()
{
return BaseObjectPtr(new CRN(*this));
@ -55,10 +52,12 @@ BaseObjectPtr CRN::clone()
void CRN::readFields(CFRecord& record)
{
record >> colLast >> colFirst >> row;
for(int i = 0; i < colLast - colFirst + 1; ++i)
{
unsigned char rec_type;
record >> rec_type;
SerArPtr ser(SerAr::createSerAr(rec_type));
record >> *ser;
crnOper.push_back(ser);

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/SerAr.h>
#include "../Biff_structures/SerAr.h"
namespace XLS
{
// Logical representation of CRN record in BIFF8
class CRN: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CRN)
@ -48,18 +46,16 @@ public:
~CRN();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeCRN;
static const ElementType type = typeCRN;
//-----------------------------
unsigned char colLast;
unsigned char colFirst;
_UINT16 row;
BiffStructurePtrVector crnOper;
};
} // namespace XLS

View File

@ -53,7 +53,10 @@ BaseObjectPtr CodeName::clone()
void CodeName::readFields(CFRecord& record)
{
XLUnicodeString codeName;
record >> codeName;
value = codeName.value();
}
} // namespace XLS

View File

@ -37,8 +37,6 @@
namespace XLS
{
// Logical representation of CodeName record in BIFF8
class CodeName: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CodeName)
@ -49,14 +47,11 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeCodeName;
//-----------------------------
XLUnicodeString codeName;
static const ElementType type = typeCodeName;
std::wstring value;
};
} // namespace XLS

View File

@ -35,8 +35,8 @@
namespace XLS
{
ExternName::ExternName(const unsigned short supporting_link_type)
: supbook_cch(supporting_link_type), cf(0)
ExternName::ExternName(const unsigned short supporting_link_type, bool bOle)
: supbook_cch(supporting_link_type), cf(-1), bOleVirtualPath(bOle)
{
}
@ -70,53 +70,40 @@ void ExternName::readFields(CFRecord& record)
}
else
{
if(fOle && !fOleLink) // DDE data item
if(fOle && !fOleLink)
{
body = BiffStructurePtr(new ExternDdeLinkNoOper);
}
if(!fOle && fOleLink) // DDE data item
if(!fOle && fOleLink)
{
body = BiffStructurePtr(new ExternOleDdeLink);
}
// Nu i kak ya dolzhen opredelit', DDE eto ili OLE?!!!
// V Mikrosofte vse ebanutye - pust' sami parsyat, debily
if(!fOle && !fOleLink)
{
body = BiffStructurePtr(new ExternDocName);
}
// This fills in the gaps between AddinUdfs if the body is not AddinUdf. The simplest way to maintain indexing from my point of view.
}
body->load(record);
if(0x3A01 != supbook_cch)
{
std::wstring name;
if(!fOle && !fOleLink)
{
ExternDocName* n = dynamic_cast<ExternDocName*>(body.get());
if (n->ixals > 0)
if (bOleVirtualPath)
{
//from SupBook
body = BiffStructurePtr(new ExternOleDdeLink);
}
else
{
name = n->nameDefinition.getAssembledFormula();
if (name.empty())
name = n->extName.value();
body = BiffStructurePtr(new ExternDocName);
}
}
if(fOle && !fOleLink) // DDE data item
{
ExternDdeLinkNoOper* n = dynamic_cast<ExternDdeLinkNoOper*>(body.get());
name = n->linkName.value();
}
if(!fOle && fOleLink)
{
ExternOleDdeLink* n = dynamic_cast<ExternOleDdeLink*>(body.get());
name = n->linkName.value();
}
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
}
body->load(record);
//cache
switch(cf)
{
case 0: // is text
break;
case 5: //csv (,)
case 6: //Microsoft Symbolic Link (SYLK).
case 8: //biff8
case 44: //unicode text
case 63: //biff12
break;
}
}

View File

@ -48,11 +48,10 @@ class ExternName: public BiffRecord
BIFF_RECORD_DEFINE_TYPE_INFO(ExternName)
BASE_OBJECT_DEFINE_CLASS_NAME(ExternName)
public:
ExternName(const unsigned short supporting_link_type);
ExternName(const unsigned short supporting_link_type, bool bOle);
~ExternName();
BaseObjectPtr clone();
void readFields(CFRecord& record);
@ -64,24 +63,13 @@ public:
bool fWantPict;
bool fOle;
bool fOleLink;
_UINT16 cf;
short cf;
bool fIcon;
BiffStructurePtr body;
//-----------------------------
_UINT16 supbook_cch;
//if(0x3A01 == supbook_cch)
//{
// if(!body)
// {
// body = BiffStructurePtr(new AddinUdf);
// }
//}
//else
//{
//}
_UINT16 supbook_cch;
bool bOleVirtualPath;
};
typedef boost::shared_ptr<ExternName> ExternNamePtr;

View File

@ -58,14 +58,14 @@ void ExternSheet::readFields(CFRecord& record)
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
{
unsigned char type;
//record.skipNunBytes(record.getDataSize() - record.getRdPtr());
ShortXLAnsiString stName;
record >> type >> stName;
std::wstring name = stName.value();
//int type = stName.value().substr(0, 1).c_str()[0];
if (!name.empty())
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
name = stName.value();
//int type = stName.value().substr(0, 1).c_str()[0];
//if (!name.empty())
// record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
}
else

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/XTI.h>
#include "../Biff_structures/XTI.h"
namespace XLS
{
// Logical representation of ExternSheet record in BIFF8
class ExternSheet: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ExternSheet)
@ -48,15 +46,15 @@ public:
~ExternSheet();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeExternSheet;
static const ElementType type = typeExternSheet;
//-----------------------------
ForwardOnlyParam<_UINT16> cXTI;
BiffStructurePtrVector rgXTI;
_UINT16 cXTI;
BiffStructurePtrVector rgXTI;
//------------------------------------------------
std::wstring name; //biff5
};
} // namespace XLS

View File

@ -67,8 +67,12 @@ void MsoDrawing::readFields()
rgChildRec.rh_own.recLen = stored_record->getDataSize();
rgChildRec.loadFields(*stored_record);
if (stored_record->getRdPtr() < stored_record->getDataSize())
{
int g = 0;
}
}
isReading = true;
}
@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record)
record >> rgChildRec;
isReading = true;
if (record.getRdPtr() < record.getDataSize())
{
int g = 0;
}
}

View File

@ -52,7 +52,7 @@ BaseObjectPtr ObProj::clone()
void ObProj::readFields(CFRecord& record)
{
// the tag doesn't contain data
//vba present in file .. выше .. по наличию собствено стороджа
}
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of ObProj record in BIFF8
class ObProj: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ObProj)
@ -47,13 +45,10 @@ public:
~ObProj();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeObProj;
};
} // namespace XLS

View File

@ -57,9 +57,9 @@
#define OBJ_Label 0x000E
#define OBJ_DialogBox 0x000F
#define OBJ_SpinControl 0x0010
#define OBJ_Scrollbar 0x0011
#define OBJ_List 0x0012
#define OBJ_GroupBox 0x0013
#define OBJ_Scrollbar 0x0011
#define OBJ_DropdownList 0x0014
#define OBJ_Note 0x0019
@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone()
void Obj::readFields(CFRecord& record)
{
record >> cmo;
size_t rdPtr = record.getRdPtr();
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{
@ -88,62 +87,74 @@ void Obj::readFields(CFRecord& record)
{
record.skipNunBytes(6); // Skip FtGmo (obsolete)
}
if(OBJ_Picture == cmo.ot)
if( OBJ_Picture == cmo.ot)
{
record >> pictFormat;
record >> pictFlags;
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(16); // Skip FtCbls (obsolete)
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(10); // Skip FtRbo (obsolete)
}
if(0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
record >> sbs;
}
if(0x19 == cmo.ot)
if( OBJ_Note == cmo.ot)
{
record >> nts;
}
//if(false) // TODO: Find out the condition
//{
// macro.load(record);
//}
if(0x0B == cmo.ot || 0x0C == cmo.ot || 0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot /*|| 0x14 == cmo.ot*/)
macro.load(record);
if( OBJ_Picture == cmo.ot)
{
pictFmla.load(record, pictFlags);
}
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot ||
OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot /*|| OBJ_DropdownList == cmo.ot*/)
{
linkFmla.load(record);
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
checkBox.load(record);
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
radioButton.load(record);
}
if(0x0D == cmo.ot)
if( OBJ_EditBox == cmo.ot)
{
edit.load(record);
}
if(0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
list.load(record, cmo.ot);
}
if(0x13 == cmo.ot)
if( OBJ_GroupBox == cmo.ot)
{
gbo.load(record);
}
if(0x12 != cmo.ot && 0x14 != cmo.ot)
}
if( OBJ_List != cmo.ot && OBJ_DropdownList != cmo.ot)
{
record.skipNunBytes(4); // reserved
}
//------------------------------------------------------------------------------------------------------
if (continue_records.size() > 0)
{
std::list<CFRecordPtr>& recs = continue_records[rt_Continue];

View File

@ -32,27 +32,25 @@
#pragma once
#include "BiffRecordContinued.h"
#include "MsoDrawing.h"
#include <Logic/Biff_structures/FtCmo.h>
#include <Logic/Biff_structures/FtCf.h>
#include <Logic/Biff_structures/FtPioGrbit.h>
#include <Logic/Biff_structures/FtSbs.h>
#include <Logic/Biff_structures/FtNts.h>
#include <Logic/Biff_structures/FtMacro.h>
#include <Logic/Biff_structures/FtPictFmla.h>
#include <Logic/Biff_structures/ObjLinkFmla.h>
#include <Logic/Biff_structures/FtCblsData.h>
#include <Logic/Biff_structures/FtRboData.h>
#include <Logic/Biff_structures/FtEdoData.h>
#include <Logic/Biff_structures/FtLbsData.h>
#include <Logic/Biff_structures/FtGboData.h>
#include <Logic/Biff_records/MsoDrawing.h>
#include "../Biff_structures/FtCmo.h"
#include "../Biff_structures/FtCf.h"
#include "../Biff_structures/FtPioGrbit.h"
#include "../Biff_structures/FtSbs.h"
#include "../Biff_structures/FtNts.h"
#include "../Biff_structures/FtMacro.h"
#include "../Biff_structures/FtPictFmla.h"
#include "../Biff_structures/ObjLinkFmla.h"
#include "../Biff_structures/FtCblsData.h"
#include "../Biff_structures/FtRboData.h"
#include "../Biff_structures/FtEdoData.h"
#include "../Biff_structures/FtLbsData.h"
#include "../Biff_structures/FtGboData.h"
namespace XLS
{
// Logical representation of Obj record in BIFF8
class Obj : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Obj)
@ -65,11 +63,10 @@ public:
~Obj();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeObj;
static const ElementType type = typeObj;
//-----------------------------
FtCmo cmo;
@ -104,8 +101,6 @@ public:
_UINT16 flag;
_UINT16 flag2;
}old_version;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ Pls::Pls()
{
}
Pls::~Pls()
{
}
BaseObjectPtr Pls::clone()
{
return BaseObjectPtr(new Pls());
@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record)
}
int size = record.getDataSize() - 2;
const char* data = record.getData() + 2;
const BYTE* data = (BYTE*)record.getData() + 2;
boost::shared_array<char> buffer(new char[size]);
boost::shared_array<BYTE> buffer(new BYTE[size]);
memcpy(buffer.get(), data, size);
bin_data_id = -1;
@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record)
GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
if (globla_info)
{
globla_info->bin_data.push_back(std::pair<boost::shared_array<char>, size_t>(buffer, size));
globla_info->bin_data.push_back(std::pair<boost::shared_array<BYTE>, size_t>(buffer, size));
bin_data_id = globla_info->bin_data.size() - 1;
}

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecordContinued.h>
#include "BiffRecordContinued.h"
#if !defined(_WIN32) && !defined(_WIN64)
@ -109,9 +109,7 @@
namespace XLS
{
// Logical representation of Pls record in BIFF8
class Pls : public BiffRecordContinued
class Pls : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Pls)
BASE_OBJECT_DEFINE_CLASS_NAME(Pls)

View File

@ -32,14 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/RkRec.h>
#include <Logic/Biff_structures/Cell.h>
#include "../Biff_structures/RkRec.h"
#include "../Biff_structures/Cell.h"
namespace XLS
{
// Logical representation of RK record in BIFF8
class RK: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(RK)
@ -49,7 +47,6 @@ public:
~RK();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -32,13 +32,10 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/SheetId.h>
#include "../Biff_structures/SheetId.h"
namespace XLS
{
// Logical representation of RRTabId record in BIFF8
class RRTabId: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(RRTabId)
@ -48,7 +45,6 @@ public:
~RRTabId();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of RecalcId record in BIFF8
class RecalcId: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(RecalcId)
@ -47,16 +45,12 @@ public:
~RecalcId();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeRecalcId;
//-----------------------------
_UINT32 dwBuild;
};
} // namespace XLS

View File

@ -35,7 +35,7 @@
namespace XLS
{
SupBook::SupBook()
SupBook::SupBook() : bOleLink(false), bSimple(false), bPath(false)
{
}
@ -55,22 +55,133 @@ void SupBook::readFields(CFRecord& record)
record >> ctab >> cch;
if(0x0001 <= cch && 0x00ff >= cch)
{
virtPath.setSize(cch);
record >> virtPath;
//virtPath.EscapeUrlW(); //todooo проверить спец символы !!!
//if(virtPath.isConformToVirtPath() && !virtPath.isConformToOleLink())
XLUnicodeStringNoCch temp;
temp.setSize(cch);
record >> temp;
origin = temp.value();
while(!record.isEOF())
{
record >> rgst;
XLUnicodeString temp2;
record >> temp2;
rgst.push_back(temp2.value());
}
}
//virt-path = volume / unc-volume / rel-volume / transfer-protocol / startup / alt-startup / library / simple-file-path / ole-link
//ole-link = path-string %x0003 path-string
//simple-file-path = [%x0001]
//file-path startup = %x0001 %x0006 file-path
//alt-startup = %x0001 %x0007 file-path
//library = %x0001 %x0008 file-path
//transfer-protocol = %x0001 %x0005 count transfer-path
//transfer-path = transfer-base-path / "[" transfer-base-path "]" sheet-name
//transfer-base-path = transfer-type "://" file-path
//transfer-type = "ftp" / "http" / "https"
//rel-volume = %x0001 %x0002 file-path
//...
bool bFilePathType = false;
if (!origin.empty())
{
std::wstring sTmp = origin;
while(true)
{
int pos = sTmp.find(L"\x0001");
if (pos >= 0)
{
if (bSimple)
{
bFilePathType = true;
bPath = true; //xls_result.xls
}
else bSimple = true; //file name or file path
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0002");
if (pos >= 0)
{
if (bSimple)
bPath = true;
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0003");
if (pos >= 0)
{
if (bPath)
{
if (bFilePathType)
{
virtPath.back() += L"file:///" + sTmp.substr(0, 1) + L":\\" + sTmp.substr(1, pos - 1);
bFilePathType = false;
}
else
virtPath.back() += L"/" + sTmp.substr(0, pos);
}
else
{
bOleLink = true;
virtPath.push_back(sTmp.substr(0, pos));
}
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0004");
if (pos >= 0)
{
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0005");
if (pos >= 0)
{
virtPath.push_back(sTmp.substr(0, pos));
//skip http size
sTmp = sTmp.substr(pos + 2);
continue;
}
pos = sTmp.find(L"\x0006");
if (pos >= 0)
{
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0007");
if (pos >= 0)
{
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0008");
if (pos >= 0)
{
virtPath.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
break;
}
if (bPath)
{
virtPath.back() += L"/" + sTmp;
}
else
{
virtPath.push_back(sTmp);
}
}
}
const unsigned short SupBook::getSupportingLinkType() const
{
return cch;
}
} // namespace XLS

View File

@ -37,8 +37,6 @@
namespace XLS
{
// Logical representation of SupBook record in BIFF8
class SupBook: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(SupBook)
@ -47,22 +45,23 @@ public:
SupBook();
~SupBook();
const unsigned short getSupportingLinkType() const;
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeSupBook;
_UINT16 ctab;
_UINT16 cch;
std::wstring origin;
std::vector<std::wstring> rgst;
//-----------------------------
_UINT16 ctab;
_UINT16 cch;
XLUnicodeStringNoCch virtPath;
XLUnicodeString rgst;
std::vector<std::wstring> virtPath;
bool bOleLink;
bool bSimple;
bool bPath;
};
typedef boost::shared_ptr<SupBook> SupBookPtr;

View File

@ -31,7 +31,7 @@
*/
#include "Sync.h"
#include <Logic/Biff_structures/CellRef.h>
#include "../Biff_structures/CellRef.h"
namespace XLS
{

View File

@ -35,9 +35,6 @@
namespace XLS
{
// Logical representation of UsesELFs record in BIFF8
class UsesELFs: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(UsesELFs)
@ -47,15 +44,12 @@ public:
~UsesELFs();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeUsesELFs;
static const ElementType type = typeUsesELFs;
//-----------------------------
Boolean<unsigned short> useselfs;
};
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of XCT record in BIFF8
class XCT: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(XCT)
@ -50,9 +48,8 @@ public:
void readFields(CFRecord& record);
static const ElementType type = typeXCT;
static const ElementType type = typeXCT;
//-----------------------------
_UINT16 ccrn;
_UINT16 itab;
bool itab_exist;

View File

@ -46,7 +46,6 @@ void AddinUdf::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
record >> udfName;
record.getGlobalWorkbookInfo()->AddinUdfs.push_back(udfName);
unsigned short cb;
record >> cb;

View File

@ -32,7 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{
@ -47,8 +47,7 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeAddinUdf;
static const ElementType type = typeAddinUdf;
ShortXLUnicodeString udfName;
};

View File

@ -33,7 +33,7 @@
#include "BiffStructure.h"
#include "CellRef.h"
#include <Logic/Biff_structures/BitMarkedStructs.h>
#include "BitMarkedStructs.h"
namespace XLS
{
@ -51,7 +51,6 @@ public:
virtual void load(CFRecord& record);
const CellRef getLocation() const;
static const ElementType type = typeCell;

View File

@ -32,7 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{
@ -47,7 +47,6 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeExternDdeLinkNoOper;
ShortXLUnicodeString linkName;

View File

@ -48,6 +48,7 @@ void ExternDocName::load(CFRecord& record)
record >> ixals;
record.skipNunBytes(2); // reserved
record >> extName;
nameDefinition.load(record);
}

View File

@ -31,9 +31,8 @@
*/
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/ExtNameParsedFormula.h>
#include <Logic/Biff_structures/BiffString.h>
#include "ExtNameParsedFormula.h"
#include "BiffString.h"
namespace XLS
{
@ -50,7 +49,6 @@ public:
virtual void load(CFRecord& record);
unsigned short ixals;
ShortXLUnicodeString extName;
ExtNameParsedFormula nameDefinition;

View File

@ -32,8 +32,8 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/MOper.h>
#include <Logic/Biff_structures/BiffString.h>
#include "MOper.h"
#include "BiffString.h"
namespace XLS
{
@ -48,7 +48,6 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeExternOleDdeLink;
_UINT32 lStgName;

View File

@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtCblsData::clone()
{
return BiffStructurePtr(new FtCblsData(*this));
}
void FtCblsData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000a && cb != 0x000c)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> fChecked >> accel;
record.skipNunBytes(2); // reserved

View File

@ -42,16 +42,20 @@ class FtCblsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtCblsData)
public:
FtCblsData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtCblsData;
static const ElementType type = typeFtCblsData;
virtual void load(CFRecord& record);
unsigned short fChecked;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -46,8 +46,7 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeFtCmo;
static const ElementType type = typeFtCmo;
unsigned short ot;
unsigned short id;
@ -60,7 +59,6 @@ public:
bool fUIObj;
bool fRecalcObj;
bool fRecalcObjAlways;
};
} // namespace XLS

View File

@ -36,16 +36,22 @@
namespace XLS
{
BiffStructurePtr FtEdoData::clone()
{
return BiffStructurePtr(new FtEdoData(*this));
}
void FtEdoData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0010 && cb != 0x0008)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> ivtEdit >> fMultiLine >> fVScroll >> id;
}

View File

@ -43,17 +43,21 @@ class FtEdoData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtEdoData)
public:
FtEdoData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtEdoData;
static const ElementType type = typeFtEdoData;
virtual void load(CFRecord& record);
unsigned short ivtEdit;
Boolean<unsigned short> fMultiLine;
unsigned short fVScroll;
unsigned short id;
bool fExist;
};
} // namespace XLS

View File

@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtGboData::clone()
{
return BiffStructurePtr(new FtGboData(*this));
@ -44,7 +43,15 @@ BiffStructurePtr FtGboData::clone()
void FtGboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000F && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> accel;
record.skipNunBytes(2); // reserved

View File

@ -43,15 +43,19 @@ class FtGboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtGboData)
public:
FtGboData() : fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record);
static const ElementType type = typeFtGboData;
static const ElementType type = typeFtGboData;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -36,12 +36,6 @@
namespace XLS
{
FtLbsData::FtLbsData()
: fmla(false)
{
}
BiffStructurePtr FtLbsData::clone()
{
return BiffStructurePtr(new FtLbsData(*this));
@ -49,19 +43,27 @@ BiffStructurePtr FtLbsData::clone()
void FtLbsData::load(CFRecord& record, const unsigned short ot)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0013)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
fmla.load(record);
unsigned short flags;
record >> cLines >> iSel >> flags >> idEdit;
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
wListSelType = GETBITS(flags, 4, 5);
lct = GETBITS(flags, 8, 15);
lct = GETBITS(flags, 8, 15);
if(0x0014 == ot)
{

View File

@ -46,10 +46,12 @@ class FtLbsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtLbsData)
public:
FtLbsData();
FtLbsData() : fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtLbsData;
static const ElementType type = typeFtLbsData;
virtual void load(CFRecord& record, const unsigned short ot);
@ -72,6 +74,7 @@ public:
std::vector<XLUnicodeString> rgLines;
std::vector<Boolean<unsigned char>> bsels;
bool fExist;
};
} // namespace XLS

View File

@ -36,9 +36,7 @@
namespace XLS
{
FtMacro::FtMacro()
: fmla(false)
FtMacro::FtMacro() : fmla(false), fExist(false)
{
}
@ -48,14 +46,18 @@ BiffStructurePtr FtMacro::clone()
}
void FtMacro::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
short ft;
record >> ft;
if (ft != 0x0004)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}
} // namespace XLS

View File

@ -50,8 +50,8 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtNts::clone()
{
return BiffStructurePtr(new FtNts(*this));
}
void FtNts::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000d && cb != 0x0016)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
_GUID_ guid_num;
record >> guid_num >> fSharedNote;

View File

@ -43,15 +43,19 @@ class FtNts : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtNts)
public:
FtNts() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtNts;
static const ElementType type = typeFtNts;
virtual void load(CFRecord& record);
std::wstring guid;
Boolean<unsigned short> fSharedNote;
bool fExist;
};
} // namespace XLS

View File

@ -36,18 +36,11 @@
namespace XLS
{
FtPictFmla::FtPictFmla()
: fmla(true)
{
}
BiffStructurePtr FtPictFmla::clone()
{
return BiffStructurePtr(new FtPictFmla(*this));
}
void FtPictFmla::load(CFRecord& record, int linkSize)
{
bool bLinked = false;
@ -74,11 +67,8 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
record >> nNameIdx;
record.skipNunBytes(12);
//const ExtName* pExtName = GetOldRoot().pExtNameBuff->GetNameByIndex( nRefIdx, nNameIdx );
// if( pExtName && pExtName->IsOLE() )
// mnStorageId = pExtName->nStorageId;
}
else if( nToken == 2)//XclTokenArrayHelper::GetTokenId( EXC_TOKID_TBL, EXC_TOKCLASS_NONE ) )
else if( nToken == 2)
{
bEmbedded = true;
@ -103,7 +93,17 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record.skipNunBytes(4); // reserved
short ft, size;
record >> ft; // must be
if (ft != 0x0009)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
record >> size;
if (size < 1) return;
fmla.load(record);
@ -111,12 +111,11 @@ void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record >> lPosInCtlStm;
}
record >> lPosInCtlStm;
if(pictFlags.fPrstm)
{
record >> cbBufInCtlStm;
}
if(pictFlags.fPrstm)
if(pictFlags.fCtl)
{
key.load(record);
}

View File

@ -45,20 +45,25 @@ class FtPictFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPictFmla)
public:
FtPictFmla();
BiffStructurePtr clone();
FtPictFmla() : fmla(true), cbBufInCtlStm(0xffffffff), lPosInCtlStm(0xffffffff), fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record){}
//biff5
virtual void load(CFRecord& record, int linkSize);
//biff8
virtual void load(CFRecord& record, FtPioGrbit& pictFlags);
static const ElementType type = typeFtPictFmla;
virtual void load(CFRecord& record){}
ObjFmla fmla;
_UINT32 lPosInCtlStm;
_UINT32 cbBufInCtlStm;
PictFmlaKey key;
PictFmlaKey key;
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -44,28 +44,28 @@ BiffStructurePtr FtPioGrbit::clone()
void FtPioGrbit::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft;
record >> cb;
record >> ft >> cb;
if (record.getDataSize() == record.getRdPtr())
if ( ft != 0x0008 || cb != 2)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
unsigned short flags;
record >> flags;
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fDefaultSize = GETBIT(flags, 8);
fAutoLoad = GETBIT(flags, 9);
fAutoLoad = GETBIT(flags, 9);
}

View File

@ -42,13 +42,15 @@ class FtPioGrbit : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPioGrbit)
public:
FtPioGrbit() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtPioGrbit;
virtual void load(CFRecord& record);
bool fAutoPict;
bool fDde;
bool fPrintCalc;
@ -58,6 +60,8 @@ public:
bool fCamera;
bool fDefaultSize;
bool fAutoLoad;
bool fExist;
};
} // namespace XLS

View File

@ -45,7 +45,15 @@ BiffStructurePtr FtRboData::clone()
void FtRboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000b && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> idRadNext >> fFirstBtn;
}

View File

@ -43,15 +43,19 @@ class FtRboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtRboData)
public:
FtRboData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtRboData;
static const ElementType type = typeFtRboData;
virtual void load(CFRecord& record);
unsigned short idRadNext;
Boolean<unsigned short> fFirstBtn;
bool fExist;
};
} // namespace XLS

View File

@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtSbs::clone()
{
return BiffStructurePtr(new FtSbs(*this));
@ -44,10 +43,15 @@ BiffStructurePtr FtSbs::clone()
void FtSbs::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
record >> ft;
record >> cb;
if ( ft != 0x000c && cb != 0x0014)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record.skipNunBytes(4); // unused1
@ -55,10 +59,10 @@ void FtSbs::load(CFRecord& record)
record >> iVal >> iMin >> iMax >> dInc >> dPage >> fHoriz >> dxScroll >> flags;
fDraw = GETBIT(flags, 0);
fDraw = GETBIT(flags, 0);
fDrawSliderOnly = GETBIT(flags, 1);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
}

View File

@ -43,16 +43,15 @@ class FtSbs : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtSbs)
public:
FtSbs() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtSbs;
static const ElementType type = typeFtSbs;
virtual void load(CFRecord& record);
unsigned short ft;
unsigned short cb;
short iVal;
short iMin;
short iMax;
@ -65,6 +64,8 @@ public:
bool fDrawSliderOnly;
bool fTrackElevator;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -32,11 +32,11 @@
#include "MOper.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace XLS
{
BiffStructurePtr MOper::clone()
{
return BiffStructurePtr(new MOper(*this));
@ -45,16 +45,52 @@ BiffStructurePtr MOper::clone()
void MOper::load(CFRecord& record)
{
record >> colLast >> rowLast;
for(int i = 0; i < (colLast + 1) * (rowLast + 1); ++i)
{
unsigned char rec_type;
record >> rec_type;
SerArPtr ser(SerAr::createSerAr(rec_type));
record >> *ser;
extOper.push_back(ser);
}
}
int MOper::serialize(std::wostream & strm)
{
if (extOper.empty()) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"values")
{
for(size_t i = 0; i < extOper.size(); ++i)
{
CP_XML_NODE(L"value")
{
switch(extOper[i]->fixed_type)
{
case SerAr::typeSerNil: CP_XML_ATTR(L"t", L"nil"); break;
case SerAr::typeSerNum: CP_XML_ATTR(L"t", L"n"); break;
case SerAr::typeSerStr: CP_XML_ATTR(L"t", L"str"); break;
case SerAr::typeSerBool: CP_XML_ATTR(L"t", L"b"); break;
case SerAr::typeSerErr: CP_XML_ATTR(L"t", L"e"); break;
}
CP_XML_NODE(L"val")
{
if (extOper[i]->fixed_type == SerAr::typeSerStr)
{
CP_XML_ATTR(L"xml:space", L"preserve");
}
CP_XML_STREAM() << extOper[i]->toString();
}
}
}
}
}
return 0;
}
} // namespace XLS

View File

@ -32,8 +32,8 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/SerAr.h>
#include <Logic/Biff_structures/BitMarkedStructs.h>
#include "SerAr.h"
#include "BitMarkedStructs.h"
namespace XLS
{
@ -49,7 +49,7 @@ public:
static const ElementType type = typeMOper;
virtual void load(CFRecord& record);
int serialize(std::wostream & strm);
ColunByteU colLast;
RwU rowLast;

View File

@ -126,7 +126,8 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
// m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container);
// child_records.erase(child_records.begin() + i,child_records.begin() + i + 1);
// }break;
default:
break;
}
}

View File

@ -49,6 +49,8 @@ void OfficeArtRecord::load(XLS::CFRecord& record)
record >> rh_own;
loadFields(record);
//Log::warning(STR::int2str(rh_own.recType, 16));
}

View File

@ -37,8 +37,7 @@ namespace XLS
{
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla)
: is_part_of_FtPictFmla_(is_part_of_FtPictFmla)
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla) : is_part_of_FtPictFmla_(is_part_of_FtPictFmla), bFmlaExist(false), bInfoExist(false)
{
}
@ -47,7 +46,6 @@ BiffStructurePtr ObjFmla::clone()
return BiffStructurePtr(new ObjFmla(*this));
}
void ObjFmla::load(CFRecord& record)
{
unsigned short cbFmla;
@ -56,15 +54,17 @@ void ObjFmla::load(CFRecord& record)
if(0 != cbFmla)
{
bFmlaExist = true;
fmla.load(record);
if(is_part_of_FtPictFmla_ && fmla.HasPtgTbl())
{
record >> embedInfo;
bInfoExist = true;
}
}
size_t data_size = record.getRdPtr() - start_ptr;
size_t padding_size = cbFmla - data_size;
if(0 != padding_size && (record.getRdPtr() + padding_size) <= record.getDataSize())

View File

@ -47,17 +47,18 @@ public:
ObjFmla(const bool is_part_of_FtPictFmla);
BiffStructurePtr clone();
static const ElementType type = typeObjFmla;
static const ElementType type = typeObjFmla;
virtual void load(CFRecord& record);
ObjectParsedFormula fmla;
bool is_part_of_FtPictFmla_;
bool fmla_found;
PictFmlaEmbedInfo embedInfo;
bool bFmlaExist;
bool bInfoExist;
PictFmlaEmbedInfo embedInfo;
private:
bool is_part_of_FtPictFmla_;
};
} // namespace XLS

View File

@ -35,13 +35,6 @@
namespace XLS
{
ObjLinkFmla::ObjLinkFmla()
: fmla(false)
{
}
BiffStructurePtr ObjLinkFmla::clone()
{
return BiffStructurePtr(new ObjLinkFmla(*this));
@ -49,8 +42,15 @@ BiffStructurePtr ObjLinkFmla::clone()
void ObjLinkFmla::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
unsigned short ft;
record >> ft;
if ( ft != 0x0014)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}

View File

@ -43,7 +43,9 @@ class ObjLinkFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(ObjLinkFmla)
public:
ObjLinkFmla();
ObjLinkFmla(): fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeObjLinkFmla;
@ -51,6 +53,7 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -45,8 +45,6 @@ public:
ObjectParsedFormula();
BiffStructurePtr clone();
virtual void load(CFRecord& record);
};
} // namespace XLS

View File

@ -32,7 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{
@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record);
XLUnicodeStringNoCch strClass;
};

View File

@ -36,9 +36,7 @@
namespace XLS
{
PictFmlaKey::PictFmlaKey()
: fmlaLinkedCell(false), fmlaListFillRange(false)
PictFmlaKey::PictFmlaKey() : fmlaLinkedCell(false), fmlaListFillRange(false)
{
}
@ -49,10 +47,16 @@ BiffStructurePtr PictFmlaKey::clone()
void PictFmlaKey::load(CFRecord& record)
{
_UINT32 cbKey;
record >> cbKey;
record.skipNunBytes(cbKey); // ActiveX license key is here
if (cbKey > 0)
{
char *buf = new char[cbKey];
memcpy(buf, record.getCurData<char>(), cbKey);
keyBuf = std::string(buf, cbKey);
record.skipNunBytes(cbKey);
delete []buf;
}
fmlaLinkedCell.load(record);
fmlaListFillRange.load(record);

View File

@ -47,13 +47,15 @@ public:
PictFmlaKey();
BiffStructurePtr clone();
static const ElementType type = typePictFmlaKey;
static const ElementType type = typePictFmlaKey;
virtual void load(CFRecord& record);
_UINT32 cbKey;
std::string keyBuf; // ActiveX license key
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
};
} // namespace XLS

View File

@ -111,6 +111,7 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
if (global_info->Version < 0x0600)
{
ixti = ixals;
if (ixals == 0xffff)
{
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
@ -118,14 +119,14 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
ptg_stack.push(prefix + range_ref);
}
else
{//external !!
ptg_stack.push(XMLSTUFF::make3dRef(ixals, range_ref, global_info->xti_parsed, full_ref));
}
}
else
if (ixti != 0xffff)
{
ptg_stack.push(XMLSTUFF::make3dRef(ixti, range_ref, global_info->xti_parsed, full_ref));
std::wstring link = global_info->arXti[ixti].link;
if (!link.empty() && !range_ref.empty())
link += L"!";
ptg_stack.push(link + range_ref); // full_ref ???
}
}

View File

@ -46,9 +46,10 @@ BiffStructurePtr PtgAreaErr3d::clone()
void PtgAreaErr3d::loadFields(CFRecord& record)
{
global_info = record.getGlobalWorkbookInfo();
record >> ixti;
record.skipNunBytes(8); // unused
global_info = record.getGlobalWorkbookInfo();
}
@ -62,9 +63,11 @@ void PtgAreaErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, boo
extra_data.pop();
return;
}
ptg_stack.push(XMLSTUFF::make3dRef(ixti, L"#REF!", global_info->xti_parsed));
std::wstring link = global_info->arXti[ixti].link;
if (!link.empty())
link += L"!";
ptg_stack.push(link + L"#REF!"); // full_ref ???
}

View File

@ -79,6 +79,7 @@ void PtgNameX::loadFields(CFRecord& record)
void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref)
{
RevNamePtr tab_id;
if(!extra_data.empty() && (tab_id = boost::dynamic_pointer_cast<RevName>(extra_data.front())))
{
Log::error("PtgNameX struct for revisions is not assemble.");
@ -87,39 +88,32 @@ void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
return;
}
std::wstring _Name;
if(nameindex > 0 && nameindex <= global_info->AddinUdfs.size() && !(_Name = global_info->AddinUdfs[nameindex - 1]).empty())
if(ixti >= 0 && ixti < global_info->arXti.size())
{
ptg_stack.push(_Name);
}
else if(ixti > 0 && ixti <= global_info->xti_parsed.size())
{
std::wstring sheet = global_info->xti_parsed[ixti-1];
std::wstring link = global_info->arXti[ixti].link;
std::wstring name;
if (!sheet.empty()) sheet += L"!";
if (nameindex > 0 && nameindex <= global_info->arDefineNames.size())
if (global_info->arXti[ixti].pNames && nameindex > 0)
{
_Name = global_info->arDefineNames[nameindex - 1];
name = global_info->arXti[ixti].pNames->at(nameindex - 1);
}
if (sheet.empty() && _Name.empty() && nameindex <= global_info->arExternalNames.size() && nameindex > 0)
if (!link.empty() && !name.empty())
{
_Name = global_info->arExternalNames[nameindex - 1];
ptg_stack.push(link + L"!" + name);
}
ptg_stack.push(sheet + _Name);
else if (!name.empty())
{
ptg_stack.push(name);
}
else
ptg_stack.push(link);
}
else
{
Log::warning("PtgNameX structure is not assemble.");
//ptg_stack.push(L"#UNDEFINED_EXTERN_NAME(" + STR::int2wstr(nameindex) + L")!");
ptg_stack.push(L""); // This would let us to continue without an error
ptg_stack.push(L"");
}
// Example of result: "[1]!range"
// in the formula window it looks like: "'D:\Projects\AVSWorksheetConverter\bin\InFiles\Blank2003_range.xls'!range"
}

View File

@ -106,6 +106,7 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
if (global_info->Version < 0x0600)
{
ixti = ixals;
if (ixals == 0xffff)
{
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
@ -113,15 +114,14 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
ptg_stack.push(prefix + cell_ref);
}
else
{
ptg_stack.push(XMLSTUFF::make3dRef(ixals, cell_ref, global_info->xti_parsed, full_ref)); // from External !
}
}
else
if (ixti != 0xffff)
{
cell_ref = XMLSTUFF::make3dRef(ixti, cell_ref, global_info->xti_parsed, full_ref);
ptg_stack.push(cell_ref);
std::wstring link = global_info->arXti[ixti].link;
if (!link.empty() && !cell_ref.empty())
link += L"!";
ptg_stack.push(link + cell_ref); // full_ref ???
}
}

View File

@ -57,9 +57,10 @@ BiffStructurePtr PtgRefErr3d::clone()
void PtgRefErr3d::loadFields(CFRecord& record)
{
global_info = record.getGlobalWorkbookInfo();
record >> ixti;
record.skipNunBytes(4); // unused
global_info = record.getGlobalWorkbookInfo();
}
@ -75,7 +76,14 @@ void PtgRefErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool
return;
}
ptg_stack.push(XMLSTUFF::make3dRef(ixti, L"#REF!", global_info->xti_parsed));
if (ixti != 0xffff)
{
std::wstring link = global_info->arXti[ixti].link;
if (!link.empty())
link += L"!";
ptg_stack.push(link + L"#REF!"); // full_ref ???
}
}

View File

@ -36,9 +36,7 @@
namespace XLS
{
PtgTbl::PtgTbl()
: Ptg(fixed_id)
PtgTbl::PtgTbl() : Ptg(fixed_id)
{
}
@ -59,7 +57,11 @@ void PtgTbl::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full
{
// The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line.
ptg_stack.push(L"");
//CellRef ref(row, col, true, true);
//ptg_stack.push(ref.toString());
}

View File

@ -56,7 +56,7 @@ public:
virtual const std::wstring toString() const = 0;
static const ElementType type = typeSerAr;
static const ElementType type = typeSerAr;
SerType fixed_type;
};

View File

@ -32,7 +32,7 @@
#pragma once
#include "SerAr.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{

View File

@ -31,6 +31,10 @@
*/
#include "XTI.h"
#include "../GlobalsSubstream.h"
#include "../Biff_unions/SUPBOOK.h"
#include "../Biff_records/SupBook.h"
#include <Binary/CFRecord.h>
namespace XLS
@ -48,17 +52,6 @@ void XTI::load(CFRecord& record)
return;
record >> iSupBook >> itabFirst >> itabLast;
if (itabFirst < 0 && itabLast < 0)
{
record.getGlobalWorkbookInfo()->xti_parsed.push_back(L"");
}
else
{
std::wstring name = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, record.getGlobalWorkbookInfo()->sheets_names);
if (name == L"#REF") name += L"!";
record.getGlobalWorkbookInfo()->xti_parsed.push_back( name );
}
}

View File

@ -48,7 +48,6 @@ public:
virtual void load(CFRecord& record);
unsigned short iSupBook;
short itabFirst;
short itabLast;

Some files were not shown because too many files have changed in this diff Show More