mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
18 Commits
v5.0.1.26
...
core-win-3
| Author | SHA1 | Date | |
|---|---|---|---|
| 470eddf2b1 | |||
| 3813be21c7 | |||
| 68c8c0cb29 | |||
| ab0c5703a5 | |||
| e22b63347f | |||
| 438ba3aded | |||
| 29b002ca80 | |||
| 244d549cf8 | |||
| 7a27150de6 | |||
| 2197fddb7b | |||
| d31344d7d3 | |||
| 8312cce2c3 | |||
| dc89e1d484 | |||
| ebdfb2f785 | |||
| ec2901bf48 | |||
| 5f0e6349cc | |||
| d586698025 | |||
| ad40f51dee |
@ -454,7 +454,7 @@ namespace formulasconvert {
|
||||
// boost::match_default | boost::format_all);
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
@ -477,6 +477,12 @@ namespace formulasconvert {
|
||||
}
|
||||
//todooo INDEX((A1:C6~A8:C11),2,2,2) - ???? - INDEX_emb.ods
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sz_workstr = workstr.length();
|
||||
if (workstr.substr(0, (std::min)((size_t)3, sz_workstr)) == L"of:")//sample_02neu_crashes.ods
|
||||
workstr = workstr.substr(3);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
@ -800,7 +800,7 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
|
||||
|
||||
if (page_layout_instance_)
|
||||
{
|
||||
page_layout_instance_->docx_convert_serialize(strm, *this);
|
||||
page_layout_instance_->docx_serialize(strm, *this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
namespace oox
|
||||
{
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts)
|
||||
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
|
||||
{
|
||||
graphRPR_ = graphic;
|
||||
|
||||
|
||||
@ -106,6 +106,8 @@ namespace oox {
|
||||
|
||||
std::wstring nsRPr_;
|
||||
bool graphRPR_;
|
||||
|
||||
bool is_need_e_;
|
||||
private:
|
||||
std::wstringstream math_stream_;
|
||||
std::wstringstream math_style_stream_;
|
||||
|
||||
@ -753,10 +753,10 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"spd",impl_->transition_.Speed.get());
|
||||
}
|
||||
if (impl_->transition_.Time)
|
||||
/* if (impl_->transition_.Time)
|
||||
{
|
||||
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
|
||||
}
|
||||
}*/
|
||||
if (impl_->transition_.PageTime)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
|
||||
|
||||
@ -281,6 +281,11 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"is-error")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsErrors";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"duplicate")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include"../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -80,6 +82,7 @@ public:
|
||||
bool repeat_item_labels = true;
|
||||
int type_groups = 0;
|
||||
int sort = 0;
|
||||
std::wstring source_groups;
|
||||
|
||||
std::vector<int> subtotals;
|
||||
|
||||
@ -143,9 +146,13 @@ public:
|
||||
bool data_on_row = false;
|
||||
}current_;
|
||||
|
||||
void sort_fields();
|
||||
|
||||
void serialize_view(std::wostream & strm);
|
||||
void serialize_cache(std::wostream & strm);
|
||||
|
||||
void serialize_type_field(CP_ATTR_NODE, _field & field);
|
||||
|
||||
private:
|
||||
bool clear_header_map(std::map<size_t, size_t> & map)
|
||||
{//отсев по секонд - нужны тока повторы
|
||||
@ -243,12 +250,27 @@ private:
|
||||
}
|
||||
connections_ += strm.str();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
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++)
|
||||
{
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() -1)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
if (current_.headers.empty()) return;
|
||||
@ -403,6 +425,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
CP_XML_ATTR(L"colPageCount", 1);
|
||||
}
|
||||
}
|
||||
std::map<std::wstring, bool> used_field_name;
|
||||
CP_XML_NODE(L"pivotFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields_count);
|
||||
@ -411,6 +434,11 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
|
||||
if (used_field_name.end() != used_field_name.find(current_.fields[i].name))
|
||||
continue;
|
||||
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true));
|
||||
|
||||
CP_XML_NODE(L"pivotField")
|
||||
{
|
||||
switch(current_.fields[i].type)
|
||||
@ -554,9 +582,90 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_type_field(CP_ATTR_NODE, _field & field)
|
||||
{
|
||||
_CP_OPT(bool) containsSemiMixedTypes;
|
||||
_CP_OPT(bool) containsMixedTypes;
|
||||
_CP_OPT(bool) containsNonDate;
|
||||
_CP_OPT(bool) containsDate;
|
||||
_CP_OPT(bool) containsString;
|
||||
_CP_OPT(bool) containsBlank;
|
||||
_CP_OPT(bool) containsNumber;
|
||||
_CP_OPT(bool) containsInteger;
|
||||
|
||||
if (field.bDate & field.bNumber/* ||
|
||||
field.bNumber & field.bString*/)
|
||||
{
|
||||
containsSemiMixedTypes = true;
|
||||
}
|
||||
else if (field.bDate & field.bString ||
|
||||
field.bNumber & field.bString ||
|
||||
field.bInteger & field.bString)
|
||||
{
|
||||
containsMixedTypes = true;
|
||||
|
||||
if (field.bInteger)
|
||||
{
|
||||
if (field.bNumber) field.bInteger = false;
|
||||
field.bNumber = true;
|
||||
}
|
||||
}
|
||||
else if (!field.bEmpty && !field.bString && !field.bBool)
|
||||
{
|
||||
containsSemiMixedTypes = false;
|
||||
}
|
||||
if (field.bDate &&
|
||||
!(field.bNumber || field.bInteger || field.bString || field.bEmpty ))
|
||||
{
|
||||
containsNonDate = false;
|
||||
}
|
||||
if (field.bDate)
|
||||
{
|
||||
containsDate = true;
|
||||
}
|
||||
if (!field.bString &&
|
||||
(field.bInteger || field.bDate || field.bNumber || field.bEmpty))
|
||||
{
|
||||
containsString = false;
|
||||
if (field.bInteger)
|
||||
{
|
||||
if (field.bNumber) field.bInteger = false;
|
||||
field.bNumber = true;
|
||||
}
|
||||
if (/*!field.bDate && */field.bEmpty)
|
||||
containsNonDate = false;
|
||||
}
|
||||
if (field.bEmpty)
|
||||
{
|
||||
containsBlank = true;
|
||||
}
|
||||
if (field.bNumber)
|
||||
{
|
||||
containsNumber = true;
|
||||
}
|
||||
if (field.bInteger && !field.bDate)
|
||||
{
|
||||
if (containsMixedTypes)
|
||||
{
|
||||
containsNumber = true;
|
||||
containsInteger = true;
|
||||
}
|
||||
else
|
||||
containsInteger = true;
|
||||
}
|
||||
|
||||
if (containsNonDate) CP_XML_ATTR(L"containsNonDate", *containsNonDate);
|
||||
if (containsSemiMixedTypes) CP_XML_ATTR(L"containsSemiMixedTypes", *containsSemiMixedTypes);
|
||||
if (containsString) CP_XML_ATTR(L"containsString", *containsString);
|
||||
if (containsBlank) CP_XML_ATTR(L"containsBlank", *containsBlank);
|
||||
if (containsMixedTypes) CP_XML_ATTR(L"containsMixedTypes", *containsMixedTypes);
|
||||
if (containsDate) CP_XML_ATTR(L"containsDate", *containsDate);
|
||||
if (containsNumber) CP_XML_ATTR(L"containsNumber", *containsNumber);
|
||||
if (containsInteger) CP_XML_ATTR(L"containsInteger", *containsInteger);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
std::map<std::wstring, bool> used_field_name;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
@ -611,16 +720,26 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
|
||||
if (used_field_name.end() != used_field_name.find(current_.fields[i].name))
|
||||
continue;
|
||||
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true));
|
||||
|
||||
CP_XML_NODE(L"cacheField")
|
||||
{
|
||||
CP_XML_ATTR(L"name", current_.fields[i].name);
|
||||
CP_XML_ATTR(L"numFmtId", 0);
|
||||
|
||||
if (!current_.fields[i].source_groups.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"databaseField", 0);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"sharedItems")
|
||||
{
|
||||
if (current_.fields[i].caches.empty() == false/* &&
|
||||
current_.fields[i].type != 2*/)
|
||||
{
|
||||
{
|
||||
if (current_.fields[i].type_groups == 0)
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
@ -630,48 +749,8 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
current_.fields[i].bDate = true;
|
||||
current_.fields[i].bString = false;
|
||||
}
|
||||
|
||||
if ((current_.fields[i].bDate & current_.fields[i].bNumber) ||
|
||||
(current_.fields[i].bNumber & current_.fields[i].bString))
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
|
||||
}
|
||||
else if (current_.fields[i].bDate & current_.fields[i].bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
}
|
||||
else if (!current_.fields[i].bEmpty && !current_.fields[i].bString && !current_.fields[i].bBool)
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
|
||||
}
|
||||
if (current_.fields[i].bDate &&
|
||||
!(current_.fields[i].bNumber || current_.fields[i].bInteger || current_.fields[i].bString || current_.fields[i].bEmpty ))
|
||||
{
|
||||
CP_XML_ATTR(L"containsNonDate", 0);
|
||||
}
|
||||
if (current_.fields[i].bDate) CP_XML_ATTR(L"containsDate", 1);
|
||||
if (!current_.fields[i].bString &&
|
||||
(current_.fields[i].bInteger || current_.fields[i].bDate || current_.fields[i].bNumber || current_.fields[i].bEmpty))
|
||||
{
|
||||
CP_XML_ATTR(L"containsString", 0);
|
||||
}
|
||||
if (current_.fields[i].bEmpty) CP_XML_ATTR(L"containsBlank", 1);
|
||||
|
||||
if (current_.fields[i].bNumber) CP_XML_ATTR(L"containsNumber", 1);
|
||||
|
||||
if (current_.fields[i].bInteger && !current_.fields[i].bDate)
|
||||
{
|
||||
if (current_.fields[i].bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
else if (!current_.fields[i].bNumber)
|
||||
{
|
||||
CP_XML_ATTR(L"containsNumber", 1);
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
}
|
||||
|
||||
serialize_type_field(CP_GET_XML_NODE(), current_.fields[i]);
|
||||
if ( current_.fields[i].type_groups == 0 )
|
||||
{
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
@ -691,7 +770,7 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"fieldGroup")
|
||||
{
|
||||
CP_XML_ATTR(L"base", i);
|
||||
CP_XML_ATTR(L"base", 0);
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
switch(current_.fields[i].type_groups)
|
||||
@ -823,6 +902,8 @@ int xlsx_pivots_context::end_table()
|
||||
std::wstringstream view_strm;
|
||||
std::wstringstream cache_strm;
|
||||
std::wstringstream rec_strm;
|
||||
|
||||
impl_->sort_fields();
|
||||
|
||||
impl_->serialize_view(view_strm);
|
||||
impl_->serialize_cache(cache_strm);
|
||||
@ -973,6 +1054,10 @@ void xlsx_pivots_context::set_field_groups(int type)
|
||||
{
|
||||
impl_->current_.fields.back().type_groups = type + 1;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_groups_source(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().source_groups = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_sort(int type)
|
||||
{
|
||||
impl_->current_.fields.back().sort = type + 1;
|
||||
@ -1002,15 +1087,16 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
_CP_OPT(double) dVal;
|
||||
if (pos >= 0)//финановый .. todooo общее правило бы...
|
||||
{
|
||||
value = value.substr(pos + 1);
|
||||
XmlUtils::replace_all(value, L",", L"");
|
||||
XmlUtils::replace_all(value, L" ", L"");
|
||||
XmlUtils::replace_all(value, L"\x00A0", L"");
|
||||
//value = value.substr(pos + 1);
|
||||
//XmlUtils::replace_all(value, L",", L"");
|
||||
//XmlUtils::replace_all(value, L" ", L"");
|
||||
//XmlUtils::replace_all(value, L"\x00A0", L"");
|
||||
}
|
||||
if (oox::IsNumber(value))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlUtils::replace_all(value, L",", L".");
|
||||
dVal = boost::lexical_cast<double>(value);
|
||||
}
|
||||
catch(...)
|
||||
@ -1021,7 +1107,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
node_name = L"n";
|
||||
|
||||
int iVal = *dVal;
|
||||
_INT64 iVal = *dVal;
|
||||
if (abs(iVal - *dVal) > 0.00001)
|
||||
{
|
||||
value = std::to_wstring(*dVal);
|
||||
|
||||
@ -60,6 +60,7 @@ public:
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
void set_field_groups (int type);
|
||||
void set_field_groups_source(std::wstring name);
|
||||
void set_repeat_item_labels(bool val);
|
||||
void end_field();
|
||||
|
||||
|
||||
@ -358,7 +358,18 @@ void xlsx_table_state::serialize_page_properties (std::wostream & strm)
|
||||
|
||||
page_layout->xlsx_serialize(strm, *context_);
|
||||
}
|
||||
void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
{
|
||||
if (tableBackground_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"picture")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", tableBackground_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
|
||||
@ -120,10 +120,12 @@ public:
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
|
||||
|
||||
void table_column_last_width(double w) { table_column_last_width_ = w; }
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
|
||||
void start_hyperlink ();
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
|
||||
void set_background (std::wstring rId) { tableBackground_ = rId; }
|
||||
|
||||
void serialize_conditionalFormatting (std::wostream & _Wostream);
|
||||
void serialize_table_format (std::wostream & _Wostream);
|
||||
@ -131,6 +133,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -154,6 +157,7 @@ private:
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
std::wstring table_style_;
|
||||
std::wstring table_row_style_;
|
||||
|
||||
@ -320,6 +320,10 @@ void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_page_properties(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_hyperlinks(_Wostream);
|
||||
|
||||
@ -90,6 +90,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace oox {
|
||||
|
||||
bool IsNumber(const std::wstring &value)
|
||||
{
|
||||
boost::wregex rule(L"\\-?^[0-9]*[.,]?[0-9]*$");
|
||||
boost::wregex rule(L"^\\-{0,1}[0-9]*[.,]{0,1}[0-9]*$");
|
||||
boost::match_results<std::wstring::const_iterator> results;
|
||||
|
||||
return boost::regex_search(value/*.begin(), value.end(), results*/, rule);
|
||||
|
||||
@ -475,9 +475,10 @@ void xlsx_conversion_context::end_table()
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", drawingName.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
get_table_context().serialize_background (current_sheet().drawing());
|
||||
|
||||
}
|
||||
if (!get_comments_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
@ -495,7 +496,6 @@ void xlsx_conversion_context::end_table()
|
||||
current_sheet().set_comments_link(commentsName.first, commentsName.second);
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
//background picture
|
||||
get_table_context().end_table();
|
||||
}
|
||||
|
||||
@ -547,7 +547,10 @@ int xlsx_conversion_context::current_table_row()
|
||||
|
||||
std::wstring xlsx_conversion_context::current_cell_address()
|
||||
{
|
||||
return oox::getCellAddress(current_table_column(), current_table_row());
|
||||
int col = current_table_column();
|
||||
int row = current_table_row();
|
||||
|
||||
return oox::getCellAddress(col < 0 ? 0 : col, row < 0 ? 0 : row); //under covered cell
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_office_spreadsheet(const odf_reader::office_element * elm)
|
||||
|
||||
@ -96,6 +96,7 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
bDPr = true;
|
||||
}
|
||||
|
||||
bool need_e_old = Context.is_need_e_, need_e = false;
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"<m:d>";
|
||||
@ -115,20 +116,31 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
Context.output_stream() << Context.math_style_stream().str();
|
||||
Context.output_stream() << L"</m:dPr>";
|
||||
Context.output_stream() << L"<m:e>";
|
||||
|
||||
need_e = true;
|
||||
}
|
||||
else need_e = Context.is_need_e_;
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
|
||||
for (int i = i_start; i < i_end ; i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
}
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
Context.output_stream() << L"</m:d>";
|
||||
}
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_mfrac::ns = L"math";
|
||||
@ -150,13 +162,23 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
Context.output_stream() << L"<m:f>";
|
||||
Context.output_stream() << L"<m:num>";
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
Context.output_stream() << L"</m:num>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
Context.output_stream() << L"<m:den>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
@ -164,6 +186,12 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
Context.output_stream() << L"</m:den>";
|
||||
|
||||
Context.output_stream() << L"</m:f>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_msqrt::ns = L"math";
|
||||
@ -192,6 +220,8 @@ void math_msqrt::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:deg/>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
@ -230,6 +260,9 @@ void math_mroot::oox_convert(oox::math_context & Context)
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:deg>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
@ -295,21 +328,23 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
Context.is_need_e_ = content_.size() > 1 ? true : need_e_old;
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"</m:e>";
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"</m:e>";
|
||||
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
//math_element->oox_convert(Context);
|
||||
@ -320,6 +355,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
Context.text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content().fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
{
|
||||
std::wstringstream & strm = Context.math_style_stream();
|
||||
strm.str( std::wstring() );
|
||||
|
||||
@ -71,11 +71,15 @@ void math_msub::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSub>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
|
||||
strm << L"<m:sub>";
|
||||
Context.is_need_e_ = false; //??
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:sub>";
|
||||
@ -109,6 +113,8 @@ void math_msup::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSup>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -142,6 +148,8 @@ void math_msubsup::oox_convert(oox::math_context & Context)
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
strm << L"<m:sSubSup>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
@ -328,6 +336,9 @@ void math_mover::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:limUpp>";
|
||||
strm << L"<m:limUppPr/>";
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -355,6 +366,13 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
{//2 elements
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
strm << L"<m:limLow>";
|
||||
strm << L"<m:limLowPr/>";
|
||||
@ -367,6 +385,12 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:lim>";
|
||||
strm << L"</m:limLow>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,23 +92,30 @@ void math_mtr::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:mr>";
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
strm << L"</m:e>";
|
||||
}
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
//Context.is_need_e_ = content_.size() > 1 ? true : false;
|
||||
Context.is_need_e_ = true;
|
||||
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// strm << L"</m:e>";
|
||||
}
|
||||
strm << L"</m:mr>";
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -151,6 +158,7 @@ void math_mtd::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
|
||||
@ -286,7 +286,7 @@ void math_mtext::oox_convert(oox::math_context & Context)
|
||||
if (text_)
|
||||
{
|
||||
Context.output_stream() << L"<m:r><m:rPr><m:nor/></m:rPr><m:t>";
|
||||
Context.output_stream() << *text_;
|
||||
Context.output_stream() << XmlUtils::EncodeXmlString(*text_);
|
||||
Context.output_stream() << L"</m:t></m:r>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conver
|
||||
props->xlsx_serialize(strm, Context);
|
||||
}
|
||||
|
||||
void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
void page_layout_instance::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
|
||||
const style_footer_style * footerStyle = dynamic_cast<style_footer_style *>(style_page_layout_->style_footer_style_.get());
|
||||
@ -357,7 +357,7 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
|
||||
|
||||
style_page_layout_properties * props = properties();
|
||||
if (props)
|
||||
props->docx_convert_serialize(strm, Context);
|
||||
props->docx_serialize(strm, Context);
|
||||
}
|
||||
void page_layout_instance::pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -193,9 +193,9 @@ public:
|
||||
const std::wstring & name() const;
|
||||
style_page_layout_properties * properties() const;
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
const style_page_layout * style_page_layout_;
|
||||
|
||||
|
||||
@ -40,9 +40,10 @@
|
||||
#include "serialize_elements.h"
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "../odf/calcs_styles.h"
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -215,8 +216,12 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
std::wstring ref = Context.current_cell_address();
|
||||
Context.get_comments_context().end_comment(ref,Context.current_table_column(), Context.current_table_row());
|
||||
int col = Context.current_table_column(); if (col < 0) col = 0;
|
||||
int row = Context.current_table_row(); if (row < 0) row = 0;
|
||||
|
||||
std::wstring ref = oox::getCellAddress(col, row);
|
||||
|
||||
Context.get_comments_context().end_comment(ref, col, row);
|
||||
}
|
||||
// officeooo:annotation
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -152,7 +152,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
{
|
||||
lastPageLayout->docx_convert_serialize(Context.output_stream(), Context);
|
||||
lastPageLayout->docx_serialize(Context.output_stream(), Context);
|
||||
//Context.remove_page_properties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -1254,7 +1254,6 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
|
||||
void style_page_layout_properties::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
|
||||
void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -1319,31 +1318,28 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elements_.style_background_image_)
|
||||
}
|
||||
if (elements_.style_background_image_)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
if (fill.bitmap)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
if (fill.bitmap)
|
||||
if ( fill.bitmap->rId.empty())
|
||||
{
|
||||
if ( fill.bitmap->rId.empty())
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
}
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"picture")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", fill.bitmap->rId );
|
||||
}
|
||||
}
|
||||
}
|
||||
Context.get_table_context().state()->set_background(fill.bitmap->rId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
void style_page_layout_properties::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
style_columns * columns = dynamic_cast<style_columns *>( elements_.style_columns_.get());
|
||||
|
||||
|
||||
@ -975,11 +975,12 @@ public:
|
||||
static const ElementType type = typeStylePageLayout;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_convert (oox::pptx_conversion_context & Context);
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context);
|
||||
|
||||
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
|
||||
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
|
||||
|
||||
@ -406,6 +406,10 @@ 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());
|
||||
|
||||
if (table_source_field_name_)
|
||||
Context.get_pivots_context().set_field_groups_source(*table_source_field_name_);
|
||||
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
|
||||
@ -174,7 +174,8 @@ namespace PPTX
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
BinDocxRW::CDocxSerializer* old_serial = pWriter->m_pMainDocument;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(pWriter, &oFontProcessor, &oDrawingConverter, NULL);
|
||||
|
||||
@ -189,6 +190,7 @@ namespace PPTX
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
pWriter->m_pMainDocument = old_serial;
|
||||
*pWriter->m_pTheme = old_theme;
|
||||
}
|
||||
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX ||
|
||||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
|
||||
@ -201,9 +203,10 @@ namespace PPTX
|
||||
DocWrapper::FontProcessor fp;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
|
||||
BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(fp);
|
||||
@ -215,7 +218,8 @@ namespace PPTX
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
}
|
||||
*pWriter->m_pTheme = old_theme;
|
||||
}
|
||||
//else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX)
|
||||
//{
|
||||
//}
|
||||
|
||||
@ -44,10 +44,67 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
|
||||
Ole1FormatReader ole1Reader(pData, nSize);
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
file.CloseFile();
|
||||
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 //conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(pData, nSize);
|
||||
file.CloseFile();
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
@ -817,8 +874,7 @@ bool RtfShadingRowCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRe
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter, RtfCharProperty * charProps, bool bLookOnBorder)
|
||||
{
|
||||
if (!charProps) return false;
|
||||
@ -1645,7 +1701,64 @@ bool RtfFieldInstReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
|
||||
return RtfParagraphPropDestination::ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
|
||||
}
|
||||
}
|
||||
bool RtfOleBinReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
|
||||
{
|
||||
if ( "objdata" == sCommand )
|
||||
return true;
|
||||
|
||||
if ( "bin" == sCommand ) // from RtfOleReader - conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
int nDataSize = 0;
|
||||
if ( hasParameter )
|
||||
nDataSize = parameter;
|
||||
|
||||
BYTE *pData = NULL;
|
||||
|
||||
oReader.m_oLex.ReadBytes( parameter, &pData );
|
||||
|
||||
m_arData.push_back(std::string((char*)pData, nDataSize));
|
||||
|
||||
RELEASEOBJECT(pData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void RtfOleBinReader::ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
|
||||
{
|
||||
m_arData.push_back(std::string(sText.begin(), sText.end()));
|
||||
}
|
||||
void RtfOleBinReader::GetData( BYTE** ppData, long& nSize)
|
||||
{
|
||||
nSize = 0;
|
||||
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];
|
||||
|
||||
for (size_t i = start; i < m_arData.size(); i++)
|
||||
{
|
||||
BYTE *buf = (BYTE*)m_arData[i].c_str();
|
||||
|
||||
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)
|
||||
{
|
||||
if ( "object" == sCommand )
|
||||
@ -1663,13 +1776,15 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
}
|
||||
else if ( "objdata" == sCommand )
|
||||
{
|
||||
std::wstring sOleData;
|
||||
TextReader oTextReader( sOleData, false );
|
||||
StartSubReader( oTextReader, oDocument, oReader );
|
||||
RtfOleBinReader oBinReader;
|
||||
|
||||
StartSubReader( oBinReader, oDocument, oReader );
|
||||
|
||||
BYTE *pData = NULL;
|
||||
long nSize = 0;
|
||||
RtfUtility::WriteDataToBinary( sOleData, &pData, nSize );
|
||||
|
||||
oBinReader.GetData(&pData, nSize );
|
||||
|
||||
if ( 0 != nSize && pData)
|
||||
{
|
||||
HRESULT hRes = S_FALSE;
|
||||
@ -1689,7 +1804,7 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
std::wstring sOleStorageName = Utils::CreateTempFile( oReader.m_sTempFolder );
|
||||
|
||||
IStorage* piMSStorage = NULL;
|
||||
if ( SUCCEEDED( StgCreateDocfile( sOleStorageName, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED/* | STGM_DELETEONRELEASE*/, NULL, &piMSStorage) ) )
|
||||
if ( SUCCEEDED( StgCreateDocfile( sOleStorageName.c_str(), STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED/* | STGM_DELETEONRELEASE*/, NULL, &piMSStorage) ) )
|
||||
{
|
||||
hRes = OleConvertOLESTREAMToIStorage( &oStream, piMSStorage, NULL );
|
||||
piMSStorage->Commit( STGC_DEFAULT );
|
||||
|
||||
@ -109,13 +109,13 @@ public:
|
||||
}
|
||||
};
|
||||
//class RtfOldList;
|
||||
class TextReader: public RtfAbstractReader
|
||||
class TextReader : public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
std::wstring& m_sName;
|
||||
bool m_bErease;
|
||||
bool m_bErease;
|
||||
public:
|
||||
TextReader( std::wstring& sName, bool bErease = true ):m_sName(sName),m_bErease(bErease)
|
||||
TextReader( std::wstring& sName, bool bErease = true ) : m_sName(sName), m_bErease(bErease)
|
||||
{
|
||||
}
|
||||
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
|
||||
@ -782,6 +782,20 @@ public:
|
||||
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter);
|
||||
};
|
||||
|
||||
class RtfOleBinReader : public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
std::vector<std::string>/*&*/ m_arData;
|
||||
public:
|
||||
RtfOleBinReader()
|
||||
{
|
||||
}
|
||||
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter);
|
||||
|
||||
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText);
|
||||
void GetData( BYTE** ppData, long& nSize);
|
||||
};
|
||||
|
||||
class RtfTrackerChangesReader: public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
|
||||
@ -300,26 +300,30 @@ public:
|
||||
|
||||
Ole1FormatReader(BYTE *pData, int Size)
|
||||
{
|
||||
NativeDataSize = 0;
|
||||
if (!pData || Size < 8) return;
|
||||
|
||||
CDataStream stream(pData, Size);
|
||||
|
||||
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;
|
||||
|
||||
@ -93,10 +93,14 @@ std::wstring RtfOle::RenderToOOX(RenderParameter oRenderParameter)
|
||||
|
||||
RenderParameter oNewRenderParameter = oRenderParameter;
|
||||
oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
|
||||
m_oResultPic->m_bIsOle = true;
|
||||
sResult += m_oResultPic->RenderToOOX(oNewRenderParameter);
|
||||
|
||||
oNewRenderParameter.nValue = m_oResultPic->m_nID;
|
||||
if (m_oResultPic)
|
||||
{
|
||||
m_oResultPic->m_bIsOle = true;
|
||||
sResult += m_oResultPic->RenderToOOX(oNewRenderParameter);
|
||||
|
||||
oNewRenderParameter.nValue = m_oResultPic->m_nID;
|
||||
}
|
||||
sResult += RenderToOOXOnlyOle(oNewRenderParameter);
|
||||
|
||||
sResult += L"</w:object>";
|
||||
|
||||
@ -617,21 +617,6 @@ public:
|
||||
file.CloseFile();
|
||||
|
||||
}
|
||||
static void WriteDataToBinary( std::wstring sData, BYTE** ppData, long& nSize)
|
||||
{
|
||||
wchar_t * buf = (wchar_t *)sData.c_str();
|
||||
int nLengthText = (int)sData.length();
|
||||
nSize = nLengthText/2;
|
||||
BYTE * buf2 = new BYTE[ nSize];
|
||||
(*ppData) = buf2;
|
||||
BYTE nByte=0;
|
||||
for (long i=0; i < nSize ; i++ )
|
||||
{
|
||||
nByte = ToByte(buf[ 2*i])<<4;
|
||||
nByte |= ToByte(buf[ 2*i+1]);
|
||||
buf2[i] = nByte;
|
||||
}
|
||||
}
|
||||
static std::wstring DecodeHex( std::wstring sText )
|
||||
{
|
||||
std::wstring sHexText;
|
||||
|
||||
@ -5,6 +5,9 @@ if exist "depot_tools" (
|
||||
echo "depot_tools already fetched"
|
||||
) else (
|
||||
call git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
CD depot_tools
|
||||
git reset --hard e29cf7cb78009c80b04ddeab04763e8d218937c2
|
||||
CD ../
|
||||
call powershell -File .\fix-depot_tools.ps1
|
||||
)
|
||||
|
||||
|
||||
@ -2771,8 +2771,16 @@ namespace OOX{
|
||||
if(_T("val") == wsName)
|
||||
{
|
||||
double* pNewElem = new double;
|
||||
std::wstring sVal = oReader.GetText();
|
||||
*pNewElem = _tstof(sVal.c_str());
|
||||
std::wstring sVal = oReader.GetText(); // Yp2bbamFbt1iHeX3WM0_.pptx - value = "-"
|
||||
*pNewElem = 0;
|
||||
try
|
||||
{
|
||||
*pNewElem = _tstof(sVal.c_str());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
|
||||
m_val = pNewElem;
|
||||
}
|
||||
WritingElement_ReadAttributes_End_No_NS( oReader )
|
||||
|
||||
BIN
Common/empty/docx.bin
Normal file
BIN
Common/empty/docx.bin
Normal file
Binary file not shown.
BIN
Common/empty/pptx.bin
Normal file
BIN
Common/empty/pptx.bin
Normal file
Binary file not shown.
BIN
Common/empty/xlsx.bin
Normal file
BIN
Common/empty/xlsx.bin
Normal file
Binary file not shown.
@ -56,6 +56,10 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
#include "../../Common/FileDownloader/FileDownloader.h"
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class CScopeWrapper
|
||||
{
|
||||
@ -542,6 +546,7 @@ namespace NSDoctRenderer
|
||||
std::wstring m_strFilePath;
|
||||
|
||||
std::wstring m_strAllFonts;
|
||||
bool m_bIsNotUseConfigAllFontsDir;
|
||||
|
||||
std::wstring m_sTmpFolder;
|
||||
std::wstring m_sFileDir;
|
||||
@ -558,6 +563,8 @@ namespace NSDoctRenderer
|
||||
|
||||
bool m_bIsCacheScript;
|
||||
|
||||
std::wstring m_sFolderForSaveOnlyUseNames;
|
||||
|
||||
std::string m_sGlobalVariable;
|
||||
bool m_bIsGlobalVariableUse;
|
||||
public:
|
||||
@ -579,6 +586,8 @@ namespace NSDoctRenderer
|
||||
|
||||
m_sGlobalVariable = "";
|
||||
m_bIsGlobalVariableUse = false;
|
||||
|
||||
m_bIsNotUseConfigAllFontsDir = false;
|
||||
}
|
||||
|
||||
void Init()
|
||||
@ -628,7 +637,7 @@ namespace NSDoctRenderer
|
||||
oNodes.GetAt(i, _node);
|
||||
std::wstring strFilePath = _node.GetText();
|
||||
|
||||
if (std::wstring::npos != strFilePath.find(L"AllFonts.js"))
|
||||
if (std::wstring::npos != strFilePath.find(L"AllFonts.js") && !m_bIsNotUseConfigAllFontsDir)
|
||||
{
|
||||
m_strAllFonts = strFilePath;
|
||||
|
||||
@ -851,6 +860,64 @@ namespace NSDoctRenderer
|
||||
#endif
|
||||
}
|
||||
|
||||
void MoveFileOpen(const std::wstring& from, const std::wstring& to)
|
||||
{
|
||||
#ifdef BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
int n1 = (int)from.find (L"www");
|
||||
int n2 = (int)from.find (L"http");
|
||||
int n3 = (int)from.find (L"ftp");
|
||||
int n4 = (int)from.find (L"https");
|
||||
|
||||
//если nI сранивать не с 0, то будут проблемы
|
||||
//потому что в инсталяции мы кладем файлы в /var/www...
|
||||
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
|
||||
{
|
||||
CFileDownloader oDownloader(from, false);
|
||||
oDownloader.SetFilePath(to);
|
||||
if (oDownloader.DownloadSync())
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUIDLER_OPEN_BASE64_ENABLED
|
||||
if (0 == from.find(L"data:"))
|
||||
{
|
||||
std::wstring::size_type findBase64 = from.find(L"base64,");
|
||||
if (std::wstring::npos != findBase64)
|
||||
{
|
||||
int nStartBase64 = (int)findBase64;
|
||||
if (50 > nStartBase64)
|
||||
{
|
||||
nStartBase64 += 7;
|
||||
const wchar_t* pStart = from.c_str() + nStartBase64;
|
||||
int nDataLen = (int)from.length() - nStartBase64;
|
||||
|
||||
std::string sBase64 = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(pStart, (LONG)nDataLen, false);
|
||||
|
||||
BYTE* pDataDst = NULL;
|
||||
int nDataDstLen = 0;
|
||||
if (NSFile::CBase64Converter::Decode(sBase64.c_str(), (int)sBase64.length(), pDataDst, nDataLen))
|
||||
{
|
||||
NSFile::CFileBinary oFileDst;
|
||||
if (oFileDst.CreateFileW(to))
|
||||
{
|
||||
oFileDst.WriteFile(pDataDst, (DWORD)nDataDstLen);
|
||||
oFileDst.CloseFile();
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
return;
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NSFile::CFileBinary::Copy(from, to);
|
||||
}
|
||||
|
||||
int OpenFile(const std::wstring& path, const std::wstring& params)
|
||||
{
|
||||
Init();
|
||||
@ -861,7 +928,7 @@ namespace NSDoctRenderer
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + NSCommon::GetFileExtention(path);
|
||||
NSFile::CFileBinary::Copy(path, sFileCopy);
|
||||
MoveFileOpen(path, sFileCopy);
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
if (!oChecker.isOfficeFile(path))
|
||||
@ -1054,7 +1121,16 @@ namespace NSDoctRenderer
|
||||
NSStringUtils::CStringBuilder oBuilder;
|
||||
|
||||
std::wstring _path = path;
|
||||
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
|
||||
if (!m_sFolderForSaveOnlyUseNames.empty())
|
||||
{
|
||||
_path = m_sFolderForSaveOnlyUseNames;
|
||||
wchar_t last = m_sFolderForSaveOnlyUseNames.c_str()[m_sFolderForSaveOnlyUseNames.length() - 1];
|
||||
if (last != '/' && last != '\\')
|
||||
_path += L"/";
|
||||
_path += NSCommon::GetFileName(path);
|
||||
}
|
||||
|
||||
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
|
||||
if ((sDstFileDir != _path) && !NSDirectory::Exists(sDstFileDir))
|
||||
NSDirectory::CreateDirectories(sDstFileDir);
|
||||
|
||||
@ -1642,6 +1718,13 @@ namespace NSDoctRenderer
|
||||
m_pInternal->m_oParams.m_sWorkDir = std::wstring(value);
|
||||
else if (sParam == "--cache-scripts")
|
||||
m_pInternal->m_bIsCacheScript = (std::wstring(value) == L"true");
|
||||
else if (sParam == "--save-use-only-names")
|
||||
m_pInternal->m_sFolderForSaveOnlyUseNames = std::wstring(value);
|
||||
else if (sParam == "--all-fonts-path")
|
||||
{
|
||||
m_pInternal->m_strAllFonts = std::wstring(value);
|
||||
m_pInternal->m_bIsNotUseConfigAllFontsDir = true;
|
||||
}
|
||||
else if (sParam == "--argument")
|
||||
{
|
||||
std::wstring sArg(value);
|
||||
|
||||
@ -44,3 +44,27 @@ unix {
|
||||
target.path = /usr/lib
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
# downloader
|
||||
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
|
||||
HEADERS += ../../Common/FileDownloader/FileDownloader.h
|
||||
core_windows {
|
||||
SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_win.cpp
|
||||
|
||||
LIBS += -lurlmon
|
||||
}
|
||||
core_linux {
|
||||
SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_curl.cpp
|
||||
|
||||
LIBS += -lcurl
|
||||
}
|
||||
core_mac {
|
||||
OBJECTIVE_SOURCES += \
|
||||
../../Common/FileDownloader/FileDownloader_mac.mm
|
||||
|
||||
LIBS += -framework AppKit
|
||||
}
|
||||
|
||||
@ -304,8 +304,10 @@ bool CImageFileFormatChecker::isSvmFile(BYTE* pBuffer,DWORD dwBytes)
|
||||
if (eFileType)return false;
|
||||
|
||||
if ( (6 <= dwBytes) &&(0x56 == pBuffer[0] && 0x43 == pBuffer[1] && 0x4c == pBuffer[2] && 0x4d == pBuffer[3]
|
||||
&& 0x54 == pBuffer[4] && 0x46 == pBuffer[5] && 0x01 == pBuffer[6] && 0x00 == pBuffer[7]
|
||||
&& 0x31 == pBuffer[8] && 0x00 == pBuffer[9] && 0x00 == pBuffer[10] && 0x00 == pBuffer[11]) )
|
||||
&& 0x54 == pBuffer[4] && 0x46 == pBuffer[5] /*&& 0x01 == pBuffer[6] && 0x00 == pBuffer[7]
|
||||
&& 0x31 == pBuffer[8]*/ && 0x00 == pBuffer[9] && 0x00 == pBuffer[10] && 0x00 == pBuffer[11]) )
|
||||
//0x02, 0x00, 0x32,
|
||||
//0x01,0x00, 0x031
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@ -217,6 +217,11 @@ namespace MetaFile
|
||||
double dX, dY, dW, dH;
|
||||
GetBounds(&dX, &dY, &dW, &dH);
|
||||
|
||||
if (dW < 0)
|
||||
dW = -dW;
|
||||
if (dH < 0)
|
||||
dH = -dH;
|
||||
|
||||
if (nWidth < 0) nWidth = dW;
|
||||
nHeight = (int)((double)nWidth * dH / dW);
|
||||
}
|
||||
|
||||
13
Makefile
13
Makefile
@ -43,9 +43,11 @@ endif
|
||||
TARGET := $(PLATFORM)_$(ARCHITECTURE)
|
||||
|
||||
LIBDIR := build/lib/$(TARGET)
|
||||
BINDIR := build/bin/$(TARGET)
|
||||
|
||||
ALLFONTSGEN := build/bin/AllFontsGen/$(TARGET)$(EXEC_EXT)
|
||||
X2T := build/bin/$(TARGET)/x2t$(EXEC_EXT)
|
||||
X2T := $(BINDIR)/x2t$(EXEC_EXT)
|
||||
DOCBUILDER := $(BINDIR)/docbuilder$(EXEC_EXT)
|
||||
HTMLFILEINTERNAL := $(LIBDIR)/HtmlFileInternal$(EXEC_EXT)
|
||||
XLSFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)XlsFormatLib$(LIB_EXT)
|
||||
ODFFILEWRITERLIB := $(LIBDIR)/$(LIB_PREFIX)OdfFileWriterLib$(LIB_EXT)
|
||||
@ -75,6 +77,7 @@ HUNSPELL := $(LIBDIR)/$(LIB_PREFIX)hunspell$(SHARED_EXT)
|
||||
|
||||
TARGETS += $(ALLFONTSGEN)
|
||||
TARGETS += $(X2T)
|
||||
TARGETS += $(DOCBUILDER)
|
||||
TARGETS += $(HTMLFILEINTERNAL)
|
||||
TARGETS += $(XLSFORMATLIB)
|
||||
TARGETS += $(ODFFILEWRITERLIB)
|
||||
@ -105,6 +108,7 @@ TARGETS += $(HUNSPELL)
|
||||
X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro)
|
||||
HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro)
|
||||
ALLFONTSGEN_PRO := $(abspath DesktopEditor/AllFontsGen/AllFontsGen.pro)
|
||||
DOCBUILDER_PRO := $(abspath ../core-ext/docbuilder/test_builder/docbuilder.pro)
|
||||
XLSFORMATLIB_PRO := $(abspath ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro)
|
||||
ODFFILEWRITERLIB_PRO := $(abspath ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro)
|
||||
ODFFILEREADERLIB_PRO := $(abspath ASCOfficeOdfFile/linux/OdfFileReaderLib.pro)
|
||||
@ -157,6 +161,7 @@ HUNSPELL_PRO := $(abspath DesktopEditor/hunspell-1.3.3/src/qt/hunspell.pro)
|
||||
QT_PROJ += X2T
|
||||
QT_PROJ += HTMLFILEINTERNAL
|
||||
QT_PROJ += ALLFONTSGEN
|
||||
QT_PROJ += DOCBUILDER
|
||||
QT_PROJ += XLSFORMATLIB
|
||||
QT_PROJ += ODFFILEWRITERLIB
|
||||
QT_PROJ += ODFFILEREADERLIB
|
||||
@ -214,6 +219,8 @@ ALLFONTSGEN_DEP += $(GRAPHICS)
|
||||
ALLFONTSGEN_DEP += $(OFFICEUTILS)
|
||||
ALLFONTSGEN_DEP += $(UNICODECONVERTER)
|
||||
|
||||
DOCBUILDER_DEP += $(DOCTRENDERER)
|
||||
|
||||
HTMLFILE_DEP += $(UNICODECONVERTER)
|
||||
|
||||
RTFFORMATLIB_DEP += $(UNICODECONVERTER)
|
||||
@ -271,7 +278,7 @@ bin: $(X2T) $(ALLFONTSGEN)
|
||||
|
||||
lib: $(PDFWRITER) $(DOCTRENDERER) $(HTMLRENDERER) $(PDFREADER) $(DJVUFILE) $(XPSFILE) $(HTMLFILE) $(UNICODECONVERTER)
|
||||
|
||||
ext: $(ASCDOCUMENTSCORE) $(HTMLFILEINTERNAL)
|
||||
ext: $(ASCDOCUMENTSCORE) $(HTMLFILEINTERNAL) $(DOCBUILDER)
|
||||
|
||||
$(foreach proj, $(QT_PROJ), $(eval $(call build_proj_tmpl, $(proj))))
|
||||
|
||||
@ -283,6 +290,8 @@ $(XPSFILE): $(XPSFILE_DEP)
|
||||
|
||||
$(ALLFONTSGEN): $(ALLFONTSGEN_DEP)
|
||||
|
||||
$(DOCBUILDER): $(DOCBUILDER_DEP)
|
||||
|
||||
$(HTMLFILE): $(HTMLFILE_DEP)
|
||||
|
||||
$(RTFFORMATLIB): $(RTFFORMATLIB_DEP)
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 2.4.481.0
|
||||
VERSION = 2.4.482.0
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
TARGET = x2t
|
||||
|
||||
Reference in New Issue
Block a user