Compare commits

..

31 Commits

Author SHA1 Message Date
fcede43d99 [android][xt2] fix for build 2018-11-08 12:07:06 +03:00
c37f011d6d OdfFormatWriter - convert externalLinks 2018-11-07 17:55:25 +03:00
52ec27a679 [android][xt2] fix for build 2018-11-07 16:39:13 +03:00
a687e49a6a [android][x2t] fix for build 2018-11-07 14:04:27 +03:00
4dddc6d9bc Merge remote-tracking branch 'origin/hotfix/v5.2.4' into develop 2018-11-06 19:18:30 +03:00
b6b79576a1 Update base.pri 2018-11-06 14:25:39 +03:00
1c1223b148 Fix misprint 2018-11-06 14:22:40 +03:00
9947f058a9 XlsFormat - fix bug #39541 2018-11-06 13:17:16 +03:00
54f55ad2ac Fix build without PRODUCT_VERSION env 2018-11-06 12:22:40 +03:00
e4edb9cca4 Fix current year substitution into copyright on windows 2018-11-02 18:18:18 +03:00
8bb23e9ce1 [ios][x2t] fix build 2018-11-02 17:45:12 +03:00
aacea2f015 Fix year in copyright on windows 2018-11-02 17:14:31 +03:00
1475b2fef9 Fix misprint 2018-11-02 16:31:01 +03:00
8e58975095 Add publisher name and version env param 2018-11-02 16:25:26 +03:00
04550f06ad Fix bug with metadata in UTF16 format 2018-11-02 15:20:36 +03:00
d2b6444730 Fix bug with metadata in UTF16 format 2018-11-02 15:19:11 +03:00
08738092c6 [ios][pe] events 2018-11-02 11:31:59 +03:00
8e220427eb Merge remote-tracking branch 'origin/hotfix/v5.2.4' into develop 2018-11-01 14:25:05 +03:00
962c31dc2a [x2t] To Revision: d12cc81745 2018-11-01 11:45:52 +03:00
d12cc81745 [x2t] Add app/core.xml to Editor.bin 2018-10-31 20:27:03 +03:00
988423f6e0 OdfFormatReader - write part tables
x2t version 2.4..554
2018-10-31 18:12:11 +03:00
2b096f0977 Wmf meta file - fix bug #39533 2018-10-31 18:03:19 +03:00
7c0962f834 Fix multi-thread build crash 2018-10-31 14:45:25 +03:00
17423cdcdb Merge pull request #123 from ONLYOFFICE/feature/qt_word
Feature/qt word
2018-10-30 19:05:23 +03:00
5dc512dc3b Merge pull request #122 from ONLYOFFICE/feature/Bug_builder
Fix builder bug
2018-10-30 19:03:48 +03:00
1393073694 Merge branch 'feature/fix2_v5.2.3' into hotfix/v5.2.4 2018-10-30 17:43:06 +03:00
7da761a009 Standart Tester epsilon for pixel diffs 2018-10-30 16:45:19 +03:00
626eb87203 v5.2.3 2018-10-30 12:58:37 +03:00
5b0dad3d99 Standart Tester bugs (+ gamma for stroke functionality) 2018-10-29 19:31:27 +03:00
9d3b7b91af Fix builder bug 2018-10-29 15:40:29 +03:00
866af012eb . 2018-10-19 17:55:39 +03:00
71 changed files with 1000 additions and 229 deletions

View File

@ -145,7 +145,8 @@ extern int g_nCurFormatVersion;
Endnotes = 11,
Background = 12,
VbaProject = 13,
App = 14
App = 15,
Core = 16
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{

View File

@ -36,6 +36,8 @@
#include "../DocWrapper/FontProcessor.h"
#include "../../Common/Base64.h"
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
#include "../../ASCOfficePPTXFile/PPTXFormat/App.h"
#include "../../ASCOfficePPTXFile/PPTXFormat/Core.h"
#include "../../XlsxSerializerCom/Reader/BinaryWriter.h"
#include "BinEquationWriter.h"
@ -7961,38 +7963,6 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
};
class BinaryAppTableWriter
{
BinaryCommonWriter m_oBcw;
ParamsWriter& m_oParamsWriter;
public:
BinaryAppTableWriter(ParamsWriter& oParamsWriter):
m_oBcw(oParamsWriter),m_oParamsWriter(oParamsWriter)
{
}
void Write(OOX::CApp& oApp)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteProperties(oApp);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void WriteProperties(OOX::CApp& oApp)
{
int nCurPos = 0;
if (oApp.m_sApplication.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::Application);
m_oBcw.m_oStream.WriteStringW3(oApp.m_sApplication.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oApp.m_sAppVersion.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::AppVersion);
m_oBcw.m_oStream.WriteStringW3(oApp.m_sAppVersion.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
};
class BinaryFileWriter
{
BinaryCommonWriter m_oBcw;
@ -8148,9 +8118,15 @@ namespace BinDocxRW
//Write App
if(NULL != oDocx.m_pApp)
{
BinDocxRW::BinaryAppTableWriter oBinaryAppWriter(m_oParamsWriter);
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::App);
oBinaryAppWriter.Write(*oDocx.m_pApp);
oDocx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}
if(NULL != oDocx.m_pCore)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Core);
oDocx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}

View File

@ -214,16 +214,19 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
replace_vertical(workstr);
replace_semicolons(workstr);
std::wstring res1 = boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
&oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
std::vector<std::wstring> distance;
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
boost::algorithm::split(distance, res1, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
for (size_t i = 0; i < distance.size(); i++)
{
std::wstring &d = distance[i];
oox_replace_tmp(d);
replace_cells_range(d);
oox_replace_tmp_back(d);
@ -645,8 +648,6 @@ std::wstring oox2odf_converter::get_table_name()
{
return impl_->table_name_;
}
std::wstring oox2odf_converter::convert_ref(std::wstring const & expr)
{
std::wstring workstr = expr;

View File

@ -52,6 +52,7 @@ public:
std::wstringstream hyperlinks_;
std::wstringstream comments_;
std::wstringstream sort_;
std::wstringstream tableParts_;
std::wstringstream autofilter_;
std::wstringstream conditionalFormatting_;
std::wstringstream picture_background_;
@ -99,16 +100,18 @@ std::wostream & xlsx_xml_worksheet::sheetFormat()
{
return impl_->sheetFormat_;
}
std::wostream & xlsx_xml_worksheet::sheetData()
{
return impl_->sheetData_;
}
std::wostream & xlsx_xml_worksheet::mergeCells()
{
return impl_->mergeCells_;
}
std::wostream & xlsx_xml_worksheet::tableParts()
{
return impl_->tableParts_;
}
std::wostream & xlsx_xml_worksheet::conditionalFormatting()
{
return impl_->conditionalFormatting_;
@ -208,6 +211,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
if (!impl_->commentsId_.empty())
{
CP_XML_NODE(L"legacyDrawing")

View File

@ -60,6 +60,7 @@ public:
std::wostream & drawing();
std::wostream & comments();
std::wostream & autofilter();
std::wostream & tableParts();
std::wostream & conditionalFormatting();
std::wostream & picture_background();
std::wostream & dataValidations();

View File

@ -244,6 +244,10 @@ void xl_files::write(const std::wstring & RootPath)
{
charts_files_.set_main_document(get_main_document());
charts_files_.write(path);
}
{
table_part_files_.set_main_document(get_main_document());
table_part_files_.write(path);
}
if (drawings_)
{
@ -322,6 +326,10 @@ void xl_files::add_pivot_table(pivot_table_content_ptr pivot_table)
{
pivot_table_files_.add_pivot_table(pivot_table);
}
void xl_files::add_table_part(const std::wstring &content)
{
table_part_files_.add_table_part(content);
}
void xl_files::add_jsaProject(const std::string &content)
{
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
@ -418,20 +426,42 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
}
}
//------------------------------------------------------------------------------------------------------
void xl_table_part_files::add_table_part(const std::wstring & table_part)
{
table_parts_.push_back(table_part);
}
void xl_table_part_files::write(const std::wstring & RootPath)
{
if (table_parts_.empty()) return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"tables";
NSDirectory::CreateDirectory(path.c_str());
for (size_t i = 0; i < table_parts_.size(); i++)
{
const std::wstring fileName = std::wstring(L"table") + std::to_wstring(i + 1) + L".xml";
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
contentTypes->add_override(std::wstring(L"/xl/tables/") + fileName, kWSConType);
package::simple_element(fileName, table_parts_[i]).write(path);
}
}
//------------------------------------------------------------------------------------------------------
void xl_charts_files::add_chart(chart_content_ptr chart)
{
charts_.push_back(chart);
}
void xl_charts_files::write(const std::wstring & RootPath)
{
if (charts_.empty()) return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
NSDirectory::CreateDirectory(path.c_str());
size_t count = 0;
for (size_t i = 0; i < charts_.size(); i++)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();

View File

@ -131,7 +131,17 @@ public:
};
class xl_table_part_files : public element
{
public:
xl_table_part_files(){}
void add_table_part(const std::wstring & table_part);
virtual void write(const std::wstring & RootPath);
std::vector<std::wstring> table_parts_;
};
class xl_charts_files : public element
{
public:
@ -244,6 +254,7 @@ public:
void add_pivot_table (pivot_table_content_ptr table);
void add_jsaProject (const std::string &content);
void add_control_props (simple_element_ptr Element);
void add_table_part (const std::wstring &content);
private:
rels_files rels_files_;
@ -252,7 +263,8 @@ private:
xl_pivot_cache_files pivot_cache_files_;
xl_pivot_table_files pivot_table_files_;
xl_control_props_files control_props_files_;
xl_table_part_files table_part_files_;
element_ptr theme_;
element_ptr workbook_;

View File

@ -53,6 +53,29 @@ typedef _CP_PTR(xlsx_table_state) xlsx_table_state_ptr;
class xlsx_data_range;
typedef _CP_PTR(xlsx_data_range) xlsx_data_range_ptr;
class xlsx_data_range_values;
typedef _CP_PTR(xlsx_data_range_values) xlsx_data_range_values_ptr;
class xlsx_data_range_values
{
public:
xlsx_data_range_values(size_t row, size_t col1, size_t col2) : row_header(row), start_column(col1), end_column(col2) {}
size_t row_header;
size_t start_column;
size_t end_column;
std::vector<std::wstring> values;
void set_value(size_t col, size_t row, const std::wstring& value)
{
while (col - start_column + 1 > values.size())
values.push_back(L"");
values[col - start_column] = value;
}
bool in_range(size_t col, size_t row) {return (row_header == row && (col >= start_column && col <= end_column));}
};
class xlsx_data_range
{

View File

@ -66,11 +66,11 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
ref = convert.convert_named_ref(ref);
std::wstring ref1, ref2;
int pos = ref.find(L":");
size_t pos = ref.find(L":");
std::wstring xlsx_table_name;
if (pos >= 0)
if (pos != std::wstring::npos)
{
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
xlsx_data_ranges_.back()->table_name = tableName;
@ -90,13 +90,15 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
size_t col, row;
size_t col1, col2, row1, row2;
getCellAddressInv(ref1, col, row);
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col,row);
getCellAddressInv(ref1, col1, row1);
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
getCellAddressInv(ref2, col, row);
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col,row);
getCellAddressInv(ref2, col2, row2);
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
xlsx_data_ranges_values_.push_back(xlsx_data_range_values_ptr(new xlsx_data_range_values(row1, col1, col2)));
}
if (!xlsx_table_name.empty())
@ -128,6 +130,28 @@ void xlsx_table_context::end_database_range()
{
}
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
{
size_t col = state()->current_column();
size_t row = state()->current_row();
xlsx_data_ranges_values_[index]->set_value(col, row, value);
}
int xlsx_table_context::in_database_range()
{
int col = state()->current_column();
int row = state()->current_row();
for (size_t i = 0; i < xlsx_data_ranges_values_.size(); i++)
{
if (xlsx_data_ranges_values_[i]->in_range(col, row))
{
return (int)i;
}
}
return -1;
}
void xlsx_table_context::add_database_sort(int field_number, int order)
{
xlsx_data_ranges_.back()->bySort.push_back(std::pair<int, bool>(field_number, order == 1 ? false : true ));
@ -258,6 +282,72 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
}
}
void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels & Rels)
{
if (xlsx_data_ranges_.empty()) return;
std::pair<std::multimap<std::wstring, int>::iterator, std::multimap<std::wstring, int>::iterator> range;
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
size_t id = xlsx_conversion_context_->get_table_parts_size() + 1;
std::wstring rId = L"tprtId" + std::to_wstring(id);
std::wstring ref = L"../tables/table" + std::to_wstring(id) + L".xml";
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"tablePart")
{
CP_XML_ATTR(L"r:id", rId);
}
}
Rels.add( relationship(rId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", ref));
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"table")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"id", id);
CP_XML_ATTR(L"name", xlsx_data_ranges_[it->second]->table_name);
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->table_name);
CP_XML_ATTR(L"ref", xlsx_data_ranges_[it->second]->ref);
CP_XML_ATTR(L"totalsRowShown", 0);
xlsx_data_ranges_[it->second]->serialize_autofilter(CP_XML_STREAM());
xlsx_data_ranges_[it->second]->serialize_sort(CP_XML_STREAM());
CP_XML_NODE(L"tableColumns")
{
CP_XML_ATTR(L"count", xlsx_data_ranges_[it->second]->cell_end.first -
xlsx_data_ranges_[it->second]->cell_start.first + 1);
for (int id = 0, i = xlsx_data_ranges_[it->second]->cell_start.first; i <= xlsx_data_ranges_[it->second]->cell_end.first; i++, id++)
{
CP_XML_NODE(L"tableColumn")
{
CP_XML_ATTR(L"id", id + 1);
CP_XML_ATTR(L"name", xlsx_data_ranges_values_[it->second]->values[id]);
}
}
}
CP_XML_NODE(L"tableStyleInfo")
{
CP_XML_ATTR(L"showFirstColumn", 0);
CP_XML_ATTR(L"showLastColumn", 0);
CP_XML_ATTR(L"showRowStripes", 1);
CP_XML_ATTR(L"showColumnStripes", 0);
}
}
}
xlsx_conversion_context_->add_table_part(strm.str());
}
}
void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
{
if (xlsx_data_ranges_.empty()) return;

View File

@ -82,6 +82,7 @@ public:
unsigned int columns_count();
void serialize_tableParts (std::wostream & _Wostream, rels & Rels);
void serialize_sort (std::wostream & _Wostream);
void serialize_autofilter (std::wostream & _Wostream);
void serialize_merge_cells (std::wostream & _Wostream);
@ -119,15 +120,17 @@ public:
void add_database_sort (int field_number, int order);
void end_database_range();
int in_database_range();
void set_database_range_value(int index, const std::wstring& value);
private:
xlsx_conversion_context *xlsx_conversion_context_;
xlsx_text_context &xlsx_text_context_;
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
std::vector<xlsx_data_range_values_ptr> xlsx_data_ranges_values_;
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
};

View File

@ -71,7 +71,7 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
math_context_ (odf_document_->odf_context().fontContainer(), true),
xlsx_style_ (this),
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
default_style_ ( (std::numeric_limits<size_t>::max)() ),
mediaitems_ (odf_document_->get_folder()),
xlsx_drawing_context_handle_(mediaitems_)
@ -201,6 +201,10 @@ void xlsx_conversion_context::end_document()
output_document_->get_xl_files().add_charts(content);
}
for (size_t i = 0; i < table_parts_.size(); i++)
{
output_document_->get_xl_files().add_table_part(table_parts_[i]);
}
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
{
@ -436,8 +440,9 @@ void xlsx_conversion_context::end_table()
get_table_context().serialize_table_format (current_sheet().sheetFormat());
get_table_context().serialize_page_properties (current_sheet().page_properties());
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
get_table_context().serialize_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort());
get_table_context().serialize_tableParts (current_sheet().tableParts(), current_sheet().sheet_rels());
//get_table_context().serialize_autofilter (current_sheet().autofilter());
//get_table_context().serialize_sort (current_sheet().sort());
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
get_table_context().serialize_data_validation (current_sheet().dataValidations());

View File

@ -160,6 +160,9 @@ public:
void add_jsaProject (const std::string &content);
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
void add_table_part(const std::wstring & table) {table_parts_.push_back(table);}
size_t get_table_parts_size() {return table_parts_.size();}
//------------------------------------------------------------------------------------
odf_reader::odf_document * root()
@ -206,7 +209,8 @@ private:
std::vector<xlsx_xml_worksheet_ptr> sheets_;
std::vector<oox_chart_context_ptr> charts_;
std::vector<std::wstring> table_parts_;
std::wstringstream defaultOutput_;
std::pair<float,float> maxDigitSize_;
num_format_context num_format_context_;

View File

@ -874,14 +874,14 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
int type = attlists_.rel_size_.style_rel_width_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing->pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
drawing->pctWidth = (int)attlists_.rel_size_.style_rel_width_->get_percent().get_value();
}
if (attlists_.rel_size_.style_rel_height_ )
{
int type = attlists_.rel_size_.style_rel_height_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing->pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
drawing->pctHeight = (int)attlists_.rel_size_.style_rel_height_->get_percent().get_value();
}
}

View File

@ -69,9 +69,23 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
for (size_t i = 0 ; i < elements_.size(); i++)
{
elements_[i]->xlsx_convert(Context);
}
}
const int sharedStrId = Context.get_table_context().end_cell_content();
int index = Context.get_table_context().in_database_range();
if (index >= 0)
{
std::wstringstream strm;
for (size_t i = 0 ; i < elements_.size(); i++)
{
elements_[i]->text_to_stream(strm);
}
Context.get_table_context().set_database_range_value(index, strm.str());
}
return sharedStrId;
}

View File

@ -125,7 +125,7 @@ void process_paragraph_index(const paragraph_attrs & Attr, oox::docx_conversion_
std::wostream & paragraph::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(content_);
_Wostream << L"\n";
//_Wostream << L"\n";
return _Wostream;
}

View File

@ -585,7 +585,13 @@ void ods_conversion_context::end_drawings()
{
current_table().drawing_context()->clear();
}
void ods_conversion_context::add_external_reference(const std::wstring & ref)
{
ods_external_state external;
external.ref = ref;
externals_.push_back(external);
}
double ods_conversion_context::convert_symbol_width(double val)
{
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;

View File

@ -53,6 +53,11 @@ struct _font_metrix
double approx_symbol_size;//in pt
};
struct ods_external_state
{
std::wstring ref;
};
class ods_conversion_context : public odf_conversion_context
{
public:
@ -85,6 +90,8 @@ public:
void add_text_content(const std::wstring & text);
void end_cell_text();
void add_external_reference(const std::wstring & ref);
void add_merge_cells(const std::wstring & ref);
void add_hyperlink(std::wstring & ref, std::wstring & link, std::wstring & display);
@ -120,16 +127,13 @@ public:
void start_table_view(int view_id);
void end_table_view();
std::vector<ods_external_state> externals_;
private:
_font_metrix font_metrix_;
ods_table_context table_context_;
odf_text_context* current_text_context_;
office_spreadsheet* root_spreadsheet_;
};

View File

@ -68,6 +68,10 @@ void ods_table_context::start_table_part(std::wstring name, std::wstring ref)
formulasconvert::oox2odf_converter formulas_converter;
if (std::wstring::npos == ref.find(L"!") )
{
ref = table_state_list_.back().office_table_name_ + L"!" + ref;
}
std::wstring odf_range = formulas_converter.convert_named_ref(ref);
XmlUtils::replace_all( odf_range, L"[", L"");
XmlUtils::replace_all( odf_range, L"]", L"");

View File

@ -610,7 +610,7 @@ void ods_table_state::add_definded_expression(office_element_ptr & elm)
{
if (!table_defined_expressions_)
{
create_element(L"table", L"named-expressions",table_defined_expressions_,context_);
create_element(L"table", L"named-expressions", table_defined_expressions_, context_);
office_table_->add_child_element(table_defined_expressions_);
}
if (!table_defined_expressions_)return;
@ -630,7 +630,7 @@ void ods_table_state::start_comment(int col, int row, std::wstring & author)
ods_comment_state state;
state.row=row; state.col =col; state.author = author;
create_element(L"office", L"annotation",state.elm,context_);
create_element(L"office", L"annotation", state.elm, context_);
comments_.push_back(state);
}
@ -661,7 +661,7 @@ void ods_table_state::end_comment(odf_text_context *text_context)
if (comments_.back().author.length() > 0 && comments_.back().elm)
{
office_element_ptr dc_elm;
create_element(L"dc", L"creator",dc_elm,context_);
create_element(L"dc", L"creator", dc_elm, context_);
if (dc_elm)
{
dc_elm->add_text(comments_.back().author);
@ -799,19 +799,52 @@ void ods_table_state::set_cell_spanned(int spanned_cols, int spanned_rows)
}
void ods_table_state::set_cell_formula(std::wstring & formula)
{
if (formula.length() < 1)return;
if (formula.empty())return;
//test external link
{
boost::wregex re(L"([\[]\\d+\[\]])+");
bool bExternal = true;
boost::wregex re(L"([\[]\\d+[\]])+");
while(bExternal)
{
boost::wsmatch result;
bool b = boost::regex_search(formula, result, re);
if (b) return; //todoooo
bExternal = boost::regex_search(formula, result, re);
if (!bExternal) break;
ods_conversion_context* ods_context = dynamic_cast<ods_conversion_context*>(context_);
std::wstring refExternal = result[1].str();
int idExternal = XmlUtils::GetInteger(refExternal.substr(1, refExternal.length() - 1)) - 1;
while(idExternal >= 0 && idExternal < ods_context->externals_.size())
{
size_t pos = formula.find(refExternal);
if (pos == std::wstring::npos)
break;
std::wstring new_formula;
if (pos > 0 && formula[pos - 1] == L'\'')
{
new_formula = formula.substr(0, pos - 1);
new_formula += L"'EXTERNALREF" + ods_context->externals_[idExternal].ref + L"'#";
new_formula += L"'";
}
else
{
new_formula = formula.substr(0, pos);
new_formula += L"'EXTERNALREF" + ods_context->externals_[idExternal].ref + L"'#";
}
pos += refExternal.length();
new_formula += formula.substr(pos, formula.length() - pos);
formula = new_formula;
}
}
std::wstring odfFormula = formulas_converter_table.convert_formula(formula);
XmlUtils::replace_all(odfFormula, L"EXTERNALREF", L"file://");//снятие экранирования
if (std::wstring::npos != odfFormula.find(L"["))
{
for (size_t i = 0; i < table_parts_.size(); i++)
@ -1338,7 +1371,7 @@ void ods_table_state::end_conditional_formats()
void ods_table_state::start_conditional_format(std::wstring ref)
{
office_element_ptr elm;
create_element(L"calcext", L"conditional-format",elm,context_);
create_element(L"calcext", L"conditional-format", elm, context_);
current_level_.back()->add_child_element(elm);
current_level_.push_back(elm);
@ -1363,13 +1396,13 @@ void ods_table_state::start_conditional_rule(int rule_type)
{
office_element_ptr elm;
if (rule_type == 3) create_element(L"calcext", L"color-scale",elm,context_);
else if (rule_type == 7)create_element(L"calcext", L"data-bar",elm,context_);
else if (rule_type ==10)create_element(L"calcext", L"icon-set",elm,context_);
else if (rule_type ==14)create_element(L"calcext", L"date-is",elm,context_);
if (rule_type == 3) create_element(L"calcext", L"color-scale", elm, context_);
else if (rule_type == 7)create_element(L"calcext", L"data-bar", elm ,context_);
else if (rule_type ==10)create_element(L"calcext", L"icon-set", elm, context_);
else if (rule_type ==14)create_element(L"calcext", L"date-is", elm, context_);
else
{
create_element(L"calcext", L"condition",elm,context_);
create_element(L"calcext", L"condition", elm, context_);
calcext_condition* condition = dynamic_cast<calcext_condition*> (elm.get());
if (condition)

View File

@ -163,11 +163,35 @@ void XlsxConverter::convert_sheets()
{
if (!ods_context) return;
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->m_pWorkbook;
OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->m_pWorkbook;
if (!Workbook) return;
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*> &mapWorksheets = xlsx_document->m_mapWorksheets;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(Workbook);
if(Workbook->m_oExternalReferences.IsInit())
{
for (size_t i = 0; i < Workbook->m_oExternalReferences->m_arrItems.size(); i++)
{
OOX::Spreadsheet::CExternalReference *externalRef = dynamic_cast<OOX::Spreadsheet::CExternalReference*>(Workbook->m_oExternalReferences->m_arrItems[i]);
if((externalRef) && (externalRef->m_oRid.IsInit()))
{
smart_ptr<OOX::File> file = find_file_by_id(externalRef->m_oRid->GetValue());
smart_ptr<OOX::External> fileExternal = file.smart_dynamic_cast<OOX::External>();
if (fileExternal.IsInit())
{
ods_context->add_external_reference(fileExternal->Uri().GetPath());
}
else
{
smart_ptr<OOX::Spreadsheet::CExternalLink> externalLink = file.smart_dynamic_cast<OOX::Spreadsheet::CExternalLink>();
convert(externalLink.operator->());
}
}
}
}
if(Workbook->m_oBookViews.IsInit())
{
for (size_t i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++)
@ -729,9 +753,32 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
ods_context->end_cell_text();
ods_context->current_table().set_cell_text( ods_context->text_context());
}
void XlsxConverter::convert(OOX::Spreadsheet::CExternalLink *oox_external_link)
{
if (!oox_external_link) return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_external_link);
if (oox_external_link->m_oExternalBook.IsInit())
{
if (oox_external_link->m_oExternalBook->m_oRid.IsInit())
{
smart_ptr<OOX::File> file = find_file_by_id(oox_external_link->m_oExternalBook->m_oRid->GetValue());
smart_ptr<OOX::External> fileExternal = file.smart_dynamic_cast<OOX::External>();
if (fileExternal.IsInit())
{
ods_context->add_external_reference(fileExternal->Uri().GetPath());
}
}
}
xlsx_current_container = old_container;
}
void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
{
if (oox_unknown == NULL)return;
if (!oox_unknown)return;
switch(oox_unknown->getType())
{
@ -1064,12 +1111,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
if (!oox_sheet_views)return;
for (unsigned long i =0; i < oox_sheet_views->m_arrItems.size(); i++)
for (size_t i =0; i < oox_sheet_views->m_arrItems.size(); i++)
{
OOX::Spreadsheet::CSheetView *sheet_view = oox_sheet_views->m_arrItems[i];
if (!sheet_view) continue;
int view_id = sheet_view->m_oWorkbookViewId->GetValue();
int view_id = sheet_view->m_oWorkbookViewId.IsInit() ? sheet_view->m_oWorkbookViewId->GetValue() : -1;
if (view_id < 0) continue;
ods_context->start_table_view( view_id );

View File

@ -93,6 +93,7 @@ namespace OOX
class CHeaderFooter;
class CSparklineGroups;
class CAltTextTable;
class CExternalLink;
}
}
@ -177,6 +178,7 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CPageSetup *oox_page);
void convert(OOX::Spreadsheet::CPageMargins *oox_page);
void convert(OOX::Spreadsheet::CWorkbookView *oox_book_views);
void convert(OOX::Spreadsheet::CExternalLink *oox_external_link);
void convert(OOX::Spreadsheet::CFont *font, odf_writer::style_text_properties *text_properties);
void convert(OOX::Spreadsheet::CBorder *border, odf_writer::style_table_cell_properties *cell_properties);

View File

@ -34,6 +34,13 @@
#include <vector>
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <gdiplus.h>
@ -43,13 +50,6 @@
#include "../../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../../ASCOfficeOdfFile/src/docx/measuredigits.h"
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
namespace _graphics_utils_
{
bool GetResolution(const wchar_t* fileName, double & Width, double &Height) //pt

View File

@ -613,7 +613,12 @@ namespace NSBinPptxRW
AVSINLINE void WriteAttribute(const std::wstring& strName, const nullable_sizet& value)
{
if (value.IsInit())
WriteAttribute(strName, *value);
#ifdef __ANDROID__
WriteAttribute(strName, (int)(*value));
#else
WriteAttribute(strName, *value);
#endif
}
AVSINLINE void WriteAttribute(const std::wstring& strName, const nullable_double& value)
{

View File

@ -91,11 +91,11 @@ namespace PPTX
XmlMacroLoadArray(oNodeVector2, _T("vt:variant"), TitlesOfParts, Logic::PartTitle);
}
XmlMacroReadAttributeBase(oNode, L"Company", Company);
XmlMacroReadAttributeBase(oNode, L"LinksUpToDate", LinksUpToDate);
XmlMacroReadAttributeBase(oNode, L"SharedDoc", SharedDoc);
XmlMacroReadAttributeBase(oNode, L"HyperlinksChanged", HyperlinksChanged);
XmlMacroReadAttributeBase(oNode, L"AppVersion", AppVersion);
XmlMacroReadNodeValueBase(oNode, L"Company", Company);
XmlMacroReadNodeValueBase(oNode, L"LinksUpToDate", LinksUpToDate);
XmlMacroReadNodeValueBase(oNode, L"SharedDoc", SharedDoc);
XmlMacroReadNodeValueBase(oNode, L"HyperlinksChanged", HyperlinksChanged);
XmlMacroReadNodeValueBase(oNode, L"AppVersion", AppVersion);
//Characters = document.Root.element("Characters").text();
//CharactersWithSpaces = document.Root.element("CharactersWithSpaces").text();

View File

@ -62,11 +62,11 @@ namespace PPTX
oNode.FromXmlFile(filename.m_strFilename);
XmlMacroReadNodeValueBase(oNode, _T("dc:title"), title);
XmlMacroReadAttributeBase(oNode, _T("dc:creator"), creator);
XmlMacroReadAttributeBase(oNode, _T("cp:lastModifiedBy"), lastModifiedBy);
XmlMacroReadAttributeBase(oNode, _T("cp:revision"), revision);
XmlMacroReadAttributeBase(oNode, _T("dcterms:modified"), modified);
XmlMacroReadAttributeBase(oNode, _T("dcterms:created"), created);
XmlMacroReadNodeValueBase(oNode, _T("dc:creator"), creator);
XmlMacroReadNodeValueBase(oNode, _T("cp:lastModifiedBy"), lastModifiedBy);
XmlMacroReadNodeValueBase(oNode, _T("cp:revision"), revision);
XmlMacroReadNodeValueBase(oNode, _T("dcterms:modified"), modified);
XmlMacroReadNodeValueBase(oNode, _T("dcterms:created"), created);
// created = PPTX::DateTime::Parse(document.Root.element("created").text().ToString());
// modified = PPTX::DateTime::Parse(document.Root.element("modified").text().ToString());

View File

@ -70,7 +70,7 @@ HRESULT convert_single(std::wstring srcFileName)
std::wstring dstPath;
bool bMacros = true;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"2222", L"C:\\Windows\\Fonts", L"C:\\Windows\\Temp", NULL, bMacros);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", L"C:\\Windows\\Temp", NULL, bMacros);
if (bMacros)
{

View File

@ -708,7 +708,7 @@ NAMESPACE_END
// ***************** Miscellaneous ********************
// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) && !(defined(_IOS) || defined(__ANDROID__))
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(_IOS) && !defined(__ANDROID__)
#define CRYPTOPP_BOOL_ALIGN16 1
#else
#define CRYPTOPP_BOOL_ALIGN16 0

View File

@ -56,6 +56,8 @@ SOURCES += \
../Source/XlsxFormat/Xlsx.cpp \
../Source/XlsxFormat/Worksheets/Worksheet.cpp \
../Source/XlsxFormat/Worksheets/SheetData.cpp \
../Source/DocxFormat/App.cpp \
../Source/DocxFormat/Core.cpp \
../Source/DocxFormat/FileFactory.cpp \
../Source/DocxFormat/IFileContainer.cpp \
../Source/XlsxFormat/FileFactory_Spreadsheet.cpp \

View File

@ -51,6 +51,8 @@
#include "../Source/DocxFormat/Media/VbaProject.cpp"
#include "../Source/DocxFormat/Media/JsaProject.cpp"
#include "../Source/DocxFormat/Docx.cpp"
#include "../Source/DocxFormat/App.cpp"
#include "../Source/DocxFormat/Core.cpp"
#include "../Source/DocxFormat/FileFactory.cpp"
#include "../Source/DocxFormat/IFileContainer.cpp"
#include "../Source/DocxFormat/Drawing/DrawingExt.cpp"

View File

@ -223,6 +223,8 @@
8A404FCA2089FF7E00F2D5CF /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FC92089FF7E00F2D5CF /* Base64.cpp */; };
8A404FCC2089FFE700F2D5CF /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FCB2089FFE700F2D5CF /* Directory.cpp */; };
8A404FCE208A001E00F2D5CF /* Path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FCD208A001D00F2D5CF /* Path.cpp */; };
8AECC18F218C991900DEE19A /* App.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AECC18E218C991900DEE19A /* App.cpp */; };
8AECC191218C992900DEE19A /* Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AECC190218C992900DEE19A /* Core.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -450,6 +452,8 @@
8A404FC92089FF7E00F2D5CF /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Base64.cpp; path = ../../../../DesktopEditor/common/Base64.cpp; sourceTree = "<group>"; };
8A404FCB2089FFE700F2D5CF /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Directory.cpp; path = ../../../../DesktopEditor/common/Directory.cpp; sourceTree = "<group>"; };
8A404FCD208A001D00F2D5CF /* Path.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Path.cpp; path = ../../../../DesktopEditor/common/Path.cpp; sourceTree = "<group>"; };
8AECC18E218C991900DEE19A /* App.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = App.cpp; sourceTree = "<group>"; };
8AECC190218C992900DEE19A /* Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Core.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -570,10 +574,12 @@
isa = PBXGroup;
children = (
17E6A01E1AC4262700F28F8B /* App.h */,
8AECC18E218C991900DEE19A /* App.cpp */,
17E6A01F1AC4262700F28F8B /* Bibliography.h */,
17E6A0201AC4262700F28F8B /* Comments.h */,
17E6A0211AC4262700F28F8B /* ContentTypes.h */,
17E6A0221AC4262700F28F8B /* Core.h */,
8AECC190218C992900DEE19A /* Core.cpp */,
17E6A0231AC4262700F28F8B /* CustomXml.h */,
17E6A0241AC4262700F28F8B /* Diagram */,
17E6A0261AC4262700F28F8B /* Document.h */,
@ -1173,6 +1179,7 @@
17C1FB9B1ACC4250006B99B3 /* Annotations.cpp in Sources */,
17C1FB9C1ACC4250006B99B3 /* FileFactory.cpp in Sources */,
17C1FB9D1ACC4250006B99B3 /* DateTime.cpp in Sources */,
8AECC191218C992900DEE19A /* Core.cpp in Sources */,
17C1FB9E1ACC4250006B99B3 /* Align.cpp in Sources */,
17C1FB9F1ACC4250006B99B3 /* Index.cpp in Sources */,
17C1FBA01ACC4250006B99B3 /* TxtFile.cpp in Sources */,
@ -1190,6 +1197,7 @@
17C1FBAC1ACC4250006B99B3 /* AlternateContent.cpp in Sources */,
17C1FBAD1ACC4250006B99B3 /* SmartTag.cpp in Sources */,
17C1FBAE1ACC4250006B99B3 /* oMath.cpp in Sources */,
8AECC18F218C991900DEE19A /* App.cpp in Sources */,
69E6AC892031AC3500795D9D /* SheetData.cpp in Sources */,
17C1FBAF1ACC4250006B99B3 /* ChartSerialize.cpp in Sources */,
17C1FBB11ACC4250006B99B3 /* Position.cpp in Sources */,

View File

@ -5428,6 +5428,14 @@
RelativePath="..\Source\DocxFormat\File.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\App.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Core.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\FileFactory.cpp"
>

View File

@ -2008,6 +2008,14 @@
RelativePath="..\Source\DocxFormat\File.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\App.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Core.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\FileFactory.cpp"
>

View File

@ -558,6 +558,14 @@
<ClCompile Include="..\Source\DocxFormat\Docx.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="..\Source\DocxFormat\App.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="..\Source\DocxFormat\Core.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="..\Source\DocxFormat\FileFactory.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>

View File

@ -811,6 +811,8 @@
<Filter>VectorML</Filter>
</ClCompile>
<ClCompile Include="..\Source\DocxFormat\Docx.cpp" />
<ClCompile Include="..\Source\DocxFormat\App.cpp" />
<ClCompile Include="..\Source\DocxFormat\Core.cpp" />
<ClCompile Include="..\Source\DocxFormat\FileFactory.cpp" />
<ClCompile Include="..\Source\DocxFormat\IFileContainer.cpp" />
</ItemGroup>

View File

@ -0,0 +1,92 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "App.h"
#include "../XlsxFormat/Xlsx.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/App.h"
namespace OOX
{
CApp::CApp(OOX::Document* pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pApp = this;
OOX::Spreadsheet::CXlsx* xlsx = dynamic_cast<OOX::Spreadsheet::CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pApp = this;
}
CApp::CApp(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pApp = this;
OOX::Spreadsheet::CXlsx* xlsx = dynamic_cast<OOX::Spreadsheet::CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pApp = this;
read( oPath );
}
PPTX::App* CApp::ToPptxApp()
{
PPTX::App* res = new PPTX::App(NULL);
if(m_sTemplate.IsInit())
res->Template = m_sTemplate.get();
if(m_nTotalTime.IsInit())
res->TotalTime = m_nTotalTime.get();
if(m_nWords.IsInit())
res->Words = m_nWords.get();
if(m_sApplication.IsInit())
res->Application = m_sApplication.get();
if(m_sPresentationForm.IsInit())
res->PresentationFormat = m_sPresentationForm.get();
if(m_nParagraphs.IsInit())
res->Paragraphs = m_nParagraphs.get();
if(m_nSlides.IsInit())
res->Slides = m_nSlides.get();
if(m_nNotes.IsInit())
res->Notes = m_nNotes.get();
if(m_nHiddenSlides.IsInit())
res->HiddenSlides = m_nHiddenSlides.get();
if(m_nMMClips.IsInit())
res->MMClips = m_nMMClips.get();
if(m_bScaleCrop.IsInit())
res->ScaleCrop = m_bScaleCrop.get();
if(m_sCompany.IsInit())
res->Company = m_sCompany.get();
if(m_bLinksUpToDate.IsInit())
res->LinksUpToDate = m_bLinksUpToDate.get();
if(m_bSharedDoc.IsInit())
res->SharedDoc = m_bSharedDoc.get();
if(m_bHyperlinksChanged.IsInit())
res->HyperlinksChanged = m_bHyperlinksChanged.get();
if(m_sAppVersion.IsInit())
res->AppVersion = m_sAppVersion.get();
return res;
}
} // namespace OOX

View File

@ -40,23 +40,17 @@
#include "../Common/SimpleTypes_Shared.h"
#include "../../../../DesktopEditor/common/SystemUtils.h"
namespace PPTX
{
class App;
}
namespace OOX
{
class CApp : public OOX::File
{
public:
CApp(OOX::Document* pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pApp = this;
}
CApp(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pApp = this;
read( oPath );
}
CApp(OOX::Document* pMain);
CApp(OOX::Document* pMain, const CPath& oPath);
virtual ~CApp()
{
}
@ -465,6 +459,8 @@ namespace OOX
{
m_bHyperlinksChanged = bVal;
}
PPTX::App* ToPptxApp();
// TO DO: DigSig
// HeadingPairs
// HLinks

View File

@ -0,0 +1,72 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "Core.h"
#include "../XlsxFormat/Xlsx.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Core.h"
namespace OOX
{
CCore::CCore(OOX::Document* pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pCore = this;
OOX::Spreadsheet::CXlsx* xlsx = dynamic_cast<OOX::Spreadsheet::CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pCore = this;
}
CCore::CCore(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pCore = this;
OOX::Spreadsheet::CXlsx* xlsx = dynamic_cast<OOX::Spreadsheet::CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pCore = this;
read( oPath );
}
PPTX::Core* CCore::ToPptxCore()
{
PPTX::Core* res = new PPTX::Core(NULL);
if (m_sTitle.IsInit())
res->title = m_sTitle.get();
if (m_sCreator.IsInit())
res->creator = m_sCreator.get();
if (m_sLastModifiedBy.IsInit())
res->lastModifiedBy = m_sLastModifiedBy.get();
if (m_sRevision.IsInit())
res->revision = m_sRevision.get();
if (m_sCreated.IsInit())
res->created = m_sCreated.get();
if (m_sModified.IsInit())
res->modified = m_sModified.get();
return res;
}
} // namespace OOX

View File

@ -37,23 +37,17 @@
#include "File.h"
#include "../Base/Nullable.h"
namespace PPTX
{
class Core;
}
namespace OOX
{
class CCore : public OOX::File
{
public:
CCore(OOX::Document* pMain) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pCore = this;
}
CCore(OOX::Document* pMain, const CPath& oPath) : OOX::File(pMain)
{
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
if (docx) docx->m_pCore = this;
read( oPath );
}
CCore(OOX::Document* pMain);
CCore(OOX::Document* pMain, const CPath& oPath);
virtual ~CCore()
{
}
@ -254,6 +248,7 @@ namespace OOX
{
m_sLastModifiedBy = sVal;
}
PPTX::Core* ToPptxCore();
nullable<std::wstring> m_sCategory;
nullable<std::wstring> m_sContentStatus;

View File

@ -42,6 +42,9 @@
namespace OOX
{
class CApp;
class CCore;
namespace Spreadsheet
{
class CWorksheet;
@ -85,6 +88,9 @@ namespace OOX
}
smart_ptr<PPTX::Theme> m_pTheme;
CApp* m_pApp;
CCore* m_pCore;
CWorkbook* m_pWorkbook;
CSharedStrings* m_pSharedStrings;
CStyles* m_pStyles;
@ -102,6 +108,9 @@ namespace OOX
{
m_bSpreadsheets = true;
m_pApp = NULL;
m_pCore = NULL;
m_pWorkbook = NULL;
m_pSharedStrings = NULL;
m_pStyles = NULL;

View File

@ -1,9 +1,31 @@
VERSION = $$cat(version.txt)
PRODUCT_VERSION = $$(PRODUCT_VERSION)
BUILD_NUMBER = $$(BUILD_NUMBER)
!isEmpty(PRODUCT_VERSION){
!isEmpty(BUILD_NUMBER){
VERSION = $$PRODUCT_VERSION.$$BUILD_NUMBER
}
}
DEFINES += INTVER=$$VERSION
QMAKE_TARGET_COMPANY = $$cat(copyright.txt)
QMAKE_TARGET_COPYRIGHT = $$cat(copyright.txt) (c) 2018
PUBLISHER_NAME = $$(PUBLISHER_NAME)
isEmpty(PUBLISHER_NAME){
PUBLISHER_NAME = $$cat(copyright.txt)
}
win32 {
CURRENT_YEAR = $$system("echo %Date:~6,4%")
}
!win32 {
CURRENT_YEAR = $$system(date +%Y)
}
QMAKE_TARGET_COMPANY = $$PUBLISHER_NAME
QMAKE_TARGET_COPYRIGHT = Copyright (C) $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved
# CONFIGURATION
CONFIG(debug, debug|release) {
@ -17,6 +39,16 @@ win32 {
CONFIG += core_windows
}
DST_ARCH=$$QMAKE_TARGET.arch
isEqual(QT_MAJOR_VERSION, 5) {
DST_ARCH=$$QT_ARCH
# QT_ARCH uses 'i386' instead of 'x86',
# so map that value back to what we expect.
equals(DST_ARCH, i386) {
DST_ARCH=x86
}
}
win32:contains(QMAKE_TARGET.arch, x86_64): {
CONFIG += core_win_64
}
@ -34,6 +66,11 @@ linux-g++:!contains(QMAKE_HOST.arch, x86_64): {
message("linux-32")
CONFIG += core_linux_32
}
linux-g++:contains(DST_ARCH, arm): {
message("arm")
CONFIG += core_linux_arm
DEFINES += LINUX_ARM
}
}
linux-g++-64 {
@ -93,6 +130,9 @@ core_linux_64 {
core_mac_64 {
CORE_BUILDS_PLATFORM_PREFIX = mac_64
}
core_linux_arm {
CORE_BUILDS_PLATFORM_PREFIX = arm
}
core_debug {
CORE_BUILDS_CONFIGURATION_PREFIX = debug

View File

@ -1 +1 @@
2.4.553.0
2.4.554.0

View File

@ -784,4 +784,6 @@
#define ASC_MENU_EVENT_TYPE_SET_PASSWORD 22001
#define ASC_MENU_EVENT_TYPE_SET_TRANSLATIONS 22002
#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_

View File

@ -146,7 +146,7 @@ private:
#else
#include <stdlib.h>
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
#include <new>
#endif

View File

@ -1194,6 +1194,8 @@ public:
std::wstring sPrW = NSFile::GetProcessPath();
std::string sPrA = U_TO_UTF8(sPrW);
m_pAllocator = NULL;
#ifndef V8_OS_XP
v8::V8::InitializeICUDefaultLocation(sPrA.c_str());
v8::V8::InitializeExternalStartupData(sPrA.c_str());
@ -1213,7 +1215,8 @@ public:
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
delete m_platform;
delete m_pAllocator;
if (m_pAllocator)
delete m_pAllocator;
}
v8::ArrayBuffer::Allocator* getAllocator()

View File

@ -575,7 +575,7 @@ namespace Aggplus
return DrawPath(pPen, &oPath);
}
Status CGraphics::DrawPath(NSStructures::CPen* pPen, CGraphicsPath* pPath)
Status CGraphics::DrawPath(NSStructures::CPen* pPen, CGraphicsPath* pPath, const double& gamma)
{
if (NULL == pPen || NULL == pPath)
return InvalidParameter;
@ -725,8 +725,14 @@ namespace Aggplus
m_rasterizer.get_rasterizer().filling_rule(agg::fill_non_zero);
if (gamma >= 0)
m_rasterizer.get_rasterizer().gamma(agg::gamma_threshold(gamma));
DoFillPath(&oBrush);
if (gamma >= 0)
m_rasterizer.gamma(1.0);
if (m_bIntegerGrid)
RELEASEOBJECT(pAffine);

View File

@ -359,7 +359,7 @@ public:
Status DrawLines(NSStructures::CPen* pPen, double* pPoints, LONG lCount);
Status DrawRectangle(NSStructures::CPen* pPen, double x, double y, double width, double height);
Status DrawEllipse(NSStructures::CPen* pPen, double x, double y, double width, double height);
Status DrawPath(NSStructures::CPen* pPen, CGraphicsPath* pPath);
Status DrawPath(NSStructures::CPen* pPen, CGraphicsPath* pPath, const double& gamma = -1);
Status DrawPathNoTransform(NSStructures::CPen* pPen, CGraphicsPath* pPath);
// заливка

View File

@ -175,6 +175,8 @@ CGraphicsRenderer::CGraphicsRenderer() : NSGraphics::IGraphicsRenderer()
m_dGlobalAlpha = 1.0;
m_bGlobalAlphaEnabled = false;
m_dGammaStroke = -1;
}
CGraphicsRenderer::~CGraphicsRenderer()
{
@ -943,7 +945,7 @@ HRESULT CGraphicsRenderer::DrawPath(const LONG& nType)
if (bIsStroke)
{
m_pRenderer->DrawPath(&m_oPen, m_pPath);
m_pRenderer->DrawPath(&m_oPen, m_pPath, m_dGammaStroke);
}
return S_OK;
@ -1324,6 +1326,11 @@ void CGraphicsRenderer::AddRect(const double& x, const double& y, const double&
m_pPath->CloseFigure();
}
void CGraphicsRenderer::SetGammaStroke(double value)
{
m_dGammaStroke = value;
}
// SAVE/RESTORE section
class CGraphicsRenderer_State : public IGraphicsRenderer_State
{

View File

@ -90,6 +90,8 @@ private:
double m_dGlobalAlpha;
bool m_bGlobalAlphaEnabled;
double m_dGammaStroke;
std::vector<IGraphicsRenderer_State*> m_arStates;
public:
@ -278,6 +280,8 @@ public:
m_oInstalledFont.Name = L"";
}
void SetGammaStroke(double value);
protected:
void _SetFont();
void ApplyTransform(const double& d1, const double& d2, const double& d3, const double& d4, const double& d5, const double& d6);

View File

@ -179,10 +179,10 @@ namespace MetaFile
};
struct TWmfRect
{
short Left;
short Top;
short Right;
short Bottom;
unsigned short Left;
unsigned short Top;
unsigned short Right;
unsigned short Bottom;
};
struct TWmfPlaceable
{

View File

@ -40,6 +40,7 @@
#include "../include/HTMLRenderer3.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../include/ASCSVGWriter.h"
@ -60,7 +61,16 @@ int main(int argc, char *argv[])
#endif
NSFonts::IApplicationFonts* pFonts = NSFonts::NSApplication::Create();
pFonts->Initialize();
if (true)
{
pFonts->Initialize();
}
else
{
std::vector<std::wstring> arFiles = pFonts->GetSetupFontFiles();
NSDirectory::GetFiles2(L"D:\\GIT\\core-fonts", arFiles, true);
pFonts->InitializeFromArrayFiles(arFiles);
}
#ifdef METAFILE_TEST

View File

@ -3,6 +3,8 @@ PRODUCT_VERSION ?= 0.0.0
BUILD_NUMBER ?= 0
PACKAGE_NAME := $(PRODUCT_NAME)
PUBLISHER_NAME ?= Ascensio System SIA
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),x86_64)
ARCHITECTURE := 64
@ -288,7 +290,12 @@ $(PDFREADER): $(PDFREADER_DEP)
$(PDFWRITER): $(PDFWRITER_DEP)
%.build/Makefile: %.pro
mkdir -p $(dir $@) && cd $(dir $@) && qmake -r $<
mkdir -p $(dir $@) && \
cd $(dir $@) && \
PUBLISHER_NAME="$(PUBLISHER_NAME)" \
PRODUCT_VERSION=$(PRODUCT_VERSION) \
BUILD_NUMBER=$(BUILD_NUMBER) \
qmake -r $<
$(ARCHIVE) :
$(AR) $@ $(ARTIFACTS)

View File

@ -586,7 +586,7 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(verifierInputKey.ptr, verifierInputKey.size);
rc4Decryption.SetKey(verifierInputKey.ptr, cryptData.keySize);
}
//--------------------------------------------
_buf decryptedVerifierHashInputBytes;
@ -596,7 +596,7 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
//--------------------------------------------
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(verifierHashKey.ptr, verifierHashKey.size);
rc4Decryption.SetKey(verifierHashKey.ptr, cryptData.keySize);
}
_buf decryptedVerifierHashBytes;
DecryptCipher(verifierHashKey, pSalt, pEncVerValue, decryptedVerifierHashBytes, cryptData.cipherAlgorithm);
@ -609,7 +609,7 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(verifierKey.ptr, verifierKey.size);
rc4Decryption.SetKey(verifierKey.ptr, cryptData.keySize);
}
//--------------------------------------------
_buf decryptedVerifierHashInputBytes;
@ -673,7 +673,7 @@ void ECMADecryptor::Decrypt(char* data , const size_t size, const unsigned long
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm, block_index);
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
rc4Decryption.SetKey(hashKey.ptr, cryptData.keySize);
}
const long offset = nCurrPos % block_size;
@ -764,7 +764,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(agileKey.ptr, agileKey.size);
rc4Decryption.SetKey(agileKey.ptr, cryptData.keySize);
}
_buf pDecryptedKey;
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
@ -775,7 +775,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(pDecryptedKey.ptr, pDecryptedKey.size);
rc4Decryption.SetKey(pDecryptedKey.ptr, cryptData.keySize);
}
while (pos < size)
{
@ -801,7 +801,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
rc4Decryption.SetKey(hashKey.ptr, cryptData.keySize);
}
_buf pInp(data_inp, size, false);
@ -860,7 +860,7 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(agileKey.ptr, agileKey.size);
rc4Encryption.SetKey(agileKey.ptr, cryptData.keySize);
}
_buf pKeyValue;
EncryptCipher( agileKey, pSalt, pDecryptedKey, pKeyValue, cryptData.cipherAlgorithm);
@ -871,7 +871,7 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(verifierInputKey.ptr, verifierInputKey.size);
rc4Encryption.SetKey(verifierInputKey.ptr, cryptData.keySize);
}
_buf pEncVerInput;
EncryptCipher( verifierInputKey, pSalt, decryptedVerifierHashInputBytes, pEncVerInput, cryptData.cipherAlgorithm);
@ -882,7 +882,7 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(verifierHashKey.ptr, verifierHashKey.size);
rc4Encryption.SetKey(verifierHashKey.ptr, cryptData.keySize);
}
else if (decryptedVerifierHashBytes.size % PADDING_SIZE != 0)
{
@ -903,7 +903,7 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(verifierKey.ptr, verifierKey.size);
rc4Encryption.SetKey(verifierKey.ptr, cryptData.keySize);
}
_buf decryptedVerInput(seed_verify.data(), seed_verify.size());
@ -955,7 +955,7 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(agileKey.ptr, agileKey.size);
rc4Encryption.SetKey(agileKey.ptr, cryptData.keySize);
}
_buf secretKey;
@ -981,7 +981,7 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(secretKey.ptr, secretKey.size);
rc4Encryption.SetKey(secretKey.ptr, cryptData.keySize);
}
if (pSaltHmac.size % PADDING_SIZE != 0)
{
@ -1033,14 +1033,14 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(agileKey.ptr, agileKey.size);
rc4Decryption.SetKey(agileKey.ptr, cryptData.keySize);
}
_buf pDecryptedKey;
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Encryption.SetKey(pDecryptedKey.ptr, agileKey.size);
rc4Encryption.SetKey(pDecryptedKey.ptr, cryptData.keySize);
}
//-------------------------------------------------------------------------------------------------
_buf iv(cryptData.blockSize, true);
@ -1094,8 +1094,8 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
{
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
rc4Encryption.SetKey(hashKey.ptr, hashKey.size);
rc4Decryption.SetKey(hashKey.ptr, cryptData.keySize);
rc4Encryption.SetKey(hashKey.ptr, cryptData.keySize);
}
_buf pInp(data_inp, size, false);

View File

@ -108,7 +108,7 @@ namespace PdfWriter
if (eType <= InfoModaDate)
return;
Add(sName, new CStringObject(sValue));
Add(sName, new CStringObject(sValue, true));
}
const char* CInfoDict::GetInfo(EInfoType eType)
{
@ -216,4 +216,4 @@ namespace PdfWriter
{
return m_oDate;
}
}
}

View File

@ -137,10 +137,11 @@ namespace PdfWriter
//----------------------------------------------------------------------------------------
// CStringObject
//----------------------------------------------------------------------------------------
CStringObject::CStringObject(const char* sValue)
CStringObject::CStringObject(const char* sValue, bool isUTF16)
{
m_pValue = NULL;
m_unLen = 0;
m_bUTF16 = isUTF16;
Set(sValue);
}
CStringObject::~CStringObject()

View File

@ -232,7 +232,7 @@ namespace PdfWriter
class CStringObject : public CObjectBase
{
public:
CStringObject(const char* sValue);
CStringObject(const char* sValue, bool isUTF16 = false);
virtual ~CStringObject();
void Set(const char* sValue);
const BYTE* GetString() const
@ -246,11 +246,16 @@ namespace PdfWriter
EObjectType GetType() const
{
return object_type_STRING;
}
}
bool IsUTF16() const
{
return m_bUTF16;
}
private:
BYTE* m_pValue;
unsigned int m_unLen;
bool m_bUTF16;
};
class CBinaryObject : public CObjectBase
{

View File

@ -38,6 +38,7 @@
#include <sstream>
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../UnicodeConverter/UnicodeConverter.h"
#define DEFLATE_BUF_SIZ ((int)(STREAM_BUF_SIZ * 1.1) + 13)
@ -281,7 +282,7 @@ namespace PdfWriter
Write((BYTE*)sTmpChar, StrLen(sTmpChar, -1));
}
void CStream::WriteEscapeText(const BYTE* sText, unsigned int unLen)
void CStream::WriteEscapeText(const BYTE* sText, unsigned int unLen, bool isUTF16)
{
if (!unLen || !sText)
return;
@ -294,6 +295,21 @@ namespace PdfWriter
unsigned long nRet = 0;
sBuf[nIndex++] = '(';
if (isUTF16)
{
std::string sUtf8((char*)sText, unLen);
std::wstring sUnicode = UTF8_TO_U(sUtf8);
NSUnicodeConverter::CUnicodeConverter oConverter;
std::string sUtf16BE = oConverter.fromUnicode(sUnicode, "UTF-16BE");
unLen = (unsigned int)sUtf16BE.length();
sTxt = (BYTE*)sUtf16BE.c_str();
sBuf[nIndex++] = 0xFE;
sBuf[nIndex++] = 0xFF;
}
for (int nCounter = 0; nCounter < unLen; nCounter++)
{
BYTE nChar = (BYTE)*sTxt++;
@ -324,7 +340,7 @@ namespace PdfWriter
sBuf[nIndex++] = ')';
Write((BYTE*)sBuf, nIndex);
}
}
void CStream::WriteBinary(const BYTE* pData, unsigned int unLen, CEncrypt* pEncrypt)
{
char sBuf[TEXT_DEFAULT_LEN];
@ -508,8 +524,8 @@ namespace PdfWriter
WriteChar('>');
}
else
{
WriteEscapeText(pString->GetString(), pString->GetLength());
{
WriteEscapeText(pString->GetString(), pString->GetLength(), pString->IsUTF16());
}
}
void CStream::Write(CBinaryObject* pBinary, CEncrypt* pEncrypt)

View File

@ -116,7 +116,7 @@ namespace PdfWriter
void WriteReal (float fValue);
void WriteReal (double dValue);
void WriteEscapeName(const char* sValue);
void WriteEscapeText(const BYTE* sText, unsigned int unLen);
void WriteEscapeText(const BYTE* sText, unsigned int unLen, bool isUTF16 = false);
void WriteBinary(const BYTE* pData, unsigned int unLen, CEncrypt* pEncrypt);
void WriteStream(CStream* pStream, unsigned int unFilter, CEncrypt* pEncrypt);

View File

@ -76,8 +76,13 @@ public:
for (std::vector<std::wstring>::iterator iter = arFiles.begin(); iter != arFiles.end(); iter++)
{
std::wstring sExt = NSFile::GetFileExtention(*iter);
if (sExt == L"docx" || sExt == L"pptx" || sExt == L"xlsx")
if (sExt == L"docx" || sExt == L"doc" || sExt == L"odt" || sExt == L"rtf" ||
sExt == L"pptx" || sExt == L"ppt" || sExt == L"odp" ||
sExt == L"xlsx" || sExt == L"xls" || sExt == L"ods")
{
m_files.push_back(*iter);
}
}
m_nCount = (int)m_files.size();
}
@ -236,6 +241,7 @@ public:
CConverter(CInternalWorker* pWorker) : NSThreads::CBaseThread()
{
m_pInternal = pWorker;
m_format = -1;
}
virtual ~CConverter()
{
@ -244,16 +250,24 @@ public:
virtual DWORD ThreadProc()
{
COfficeFileFormatChecker oChecker;
if (!oChecker.isOfficeFile(m_file))
bool bIsOfficeFile = true;
if (true)
{
CTemporaryCS oCS(&m_pInternal->m_oCS_OfficeUtils);
COfficeFileFormatChecker oChecker;
bIsOfficeFile = oChecker.isOfficeFile(m_file);
if (bIsOfficeFile)
m_format = oChecker.nFileType;
}
if (!bIsOfficeFile)
{
m_bRunThread = FALSE;
m_pInternal->OnConvertFile(this, -1);
return 0;
}
m_format = oChecker.nFileType;
#if 0
std::map<int, bool>::iterator find = m_pInternal->m_formats.find(m_format);
if ((find == m_pInternal->m_formats.end()) || (find->second == false))
@ -397,35 +411,120 @@ public:
sizeMemory = nW_I * nH_I;
for (size_t pix = 0; pix < sizeMemory; ++pix)
int nEpsilonEps = 3;
int nEpsilonNatural = 5;
int nDivExist = 0;
for (int indexPixH = 0; indexPixH < nH_I; indexPixH++)
{
if (pDataI[0] != pDataO[0] || pDataI[1] != pDataO[1] || pDataI[2] != pDataO[2])
for (int indexPixW = 0; indexPixW < nW_I; indexPixW++)
{
if (pDataO[0] == 0x00 && pDataO[1] == 0x00 && pDataO[2] == 0xFF)
if (pDataI[0] != pDataO[0] || pDataI[1] != pDataO[1] || pDataI[2] != pDataO[2])
{
pDataO[0] = 0xFF;
pDataO[1] = 0x00;
pDataO[2] = 0x00;
}
else
{
pDataO[0] = 0x00;
pDataO[1] = 0x00;
pDataO[2] = 0xFF;
// test epsilon natural
if ((abs(pDataI[0] - pDataO[0]) < nEpsilonNatural) &&
(abs(pDataI[1] - pDataO[1]) < nEpsilonNatural) &&
(abs(pDataI[2] - pDataO[2]) < nEpsilonNatural))
{
pDataI += 4;
pDataO += 4;
continue;
}
// test epsilon left, right, top, bottom
int nEpsUp = nEpsilonEps;
if (indexPixH > 0)
{
BYTE* pByteI = frameI.get_Data() + 4 * (indexPixH - 1) * nW_I + 4 * indexPixW;
if ((abs(pByteI[0] - pDataO[0]) < nEpsilonEps) &&
(abs(pByteI[1] - pDataO[1]) < nEpsilonEps) &&
(abs(pByteI[2] - pDataO[2]) < nEpsilonEps))
{
nEpsUp = nEpsilonEps - 1;
}
}
int nEpsDown = nEpsilonEps;
if (indexPixH < (nH_I - 1))
{
BYTE* pByteI = frameI.get_Data() + 4 * (indexPixH + 1) * nW_I + 4 * indexPixW;
if ((abs(pByteI[0] - pDataO[0]) < nEpsilonEps) &&
(abs(pByteI[1] - pDataO[1]) < nEpsilonEps) &&
(abs(pByteI[2] - pDataO[2]) < nEpsilonEps))
{
nEpsDown = nEpsilonEps - 1;
}
}
int nEpsLeft = nEpsilonEps;
if (indexPixW > 0)
{
BYTE* pByteI = pDataI - 4;
if ((abs(pByteI[0] - pDataO[0]) < nEpsilonEps) &&
(abs(pByteI[1] - pDataO[1]) < nEpsilonEps) &&
(abs(pByteI[2] - pDataO[2]) < nEpsilonEps))
{
nEpsLeft = nEpsilonEps - 1;
}
}
int nEpsRight = nEpsilonEps;
if (indexPixW < (nW_I - 1))
{
BYTE* pByteI = pDataI + 4;
if ((abs(pByteI[0] - pDataO[0]) < nEpsilonEps) &&
(abs(pByteI[1] - pDataO[1]) < nEpsilonEps) &&
(abs(pByteI[2] - pDataO[2]) < nEpsilonEps))
{
nEpsRight = nEpsilonEps - 1;
}
}
if ((nEpsLeft < nEpsilonEps) ||
(nEpsRight < nEpsilonEps) ||
(nEpsUp < nEpsilonEps) ||
(nEpsDown < nEpsilonEps))
{
pDataI += 4;
pDataO += 4;
continue;
}
++nDivExist;
if (pDataO[0] == 0x00 && pDataO[1] == 0x00 && pDataO[2] == 0xFF)
{
pDataO[0] = 0xFF;
pDataO[1] = 0x00;
pDataO[2] = 0x00;
}
else
{
pDataO[0] = 0x00;
pDataO[1] = 0x00;
pDataO[2] = 0xFF;
}
}
pDataI += 4;
pDataO += 4;
}
pDataI += 4;
pDataO += 4;
}
if (!NSDirectory::Exists(strDiffsMain))
NSDirectory::CreateDirectory(strDiffsMain);
if (!NSDirectory::Exists(strDiffs))
NSDirectory::CreateDirectory(strDiffs);
if (nDivExist > 7)
{
if (!NSDirectory::Exists(strDiffsMain))
NSDirectory::CreateDirectory(strDiffsMain);
if (!NSDirectory::Exists(strDiffs))
NSDirectory::CreateDirectory(strDiffs);
frameO.SaveFile(sPageDiff, 4);
frameO.SaveFile(sPageDiff, 4);
std::cout << "file (diffs) : " << U_TO_UTF8(sPageDiff) << std::endl;
std::cout << "file (diffs) : " << U_TO_UTF8(sPageDiff) << std::endl;
}
}
}

View File

@ -1,6 +1,6 @@
#ifndef X2T_VERSION_H
#define X2T_VERSION_H
#define X2T_VERSION "2.4.547.0"
#define X2T_VERSION "2.4.554.0"
#endif

View File

@ -9,9 +9,11 @@ keystore-release.properties
/build
/captures
/gradle
/android-ndk*
/extra-builds/native/libs
/extra-builds/native/toolchain
/extra-builds/native/src/iconv
.zip
.gradle
.idea
.DS_Store

View File

@ -1,3 +1,11 @@
# README #
New android Documents app...
Android x2t app example.
For run app you must:
1) Download all 3party libraries from folder ../core/Common/3dParty
2) Once! Run gradle task preBuildTask().
That task download last NDK 17c with deprecated GCC.
Build all 3d party dependencies with that NDK
3) Build app

View File

@ -10,11 +10,14 @@ apply from: "$rootProject.projectDir/extra-builds/gradle/common.gradle"
// Common native libs path
def TOOLCHAIN_VERSION = 4.9
def HOST_PLATFORM = "linux-x86_64"
def PATH_NDK = getBackSlash(android.ndkDirectory.path)
def NDK_VERSION = "android-ndk-r17c"
def HOST_PLATFORM = getHostName()
def PATH_NDK = "${project.rootDir.path}/${NDK_VERSION}"
def PATH_TOOLCHAIN = "$PATH_NDK/toolchains/\$1/prebuilt/$HOST_PLATFORM/bin"
def PATH_STANDALONE_SCRIPT = "$PATH_NDK/build/tools"
def PATH_3PARTY = "$project.ext.SRC_CORE/Common/3dParty"
def NDK_URL = "https://dl.google.com/android/repository/${NDK_VERSION}-${HOST_PLATFORM}.zip"
def NDK_DOWNLOAD = "${PATH_NDK}.zip"
// Keys for constant
def MASK_LIB = 'lib*.*'
@ -302,6 +305,34 @@ task unpackingLibs(type: Copy) {
}
}
/*
* Download NDK ver.17c with deprecated support of GCC
* */
task downloadNdk() {
doLast {
if (!file(PATH_NDK).exists()) {
if (!file(NDK_DOWNLOAD).exists()) {
download {
println "\nDownload NDK..."
src NDK_URL
dest NDK_DOWNLOAD
overwrite false
onlyIfModified true
quiet false
}
}
copy {
println "\nUnpack NDK..."
eachFile { println it.file }
from zipTree(NDK_DOWNLOAD)
into project.rootDir.path
}
}
}
}
/*
* https://wiki.openssl.org/index.php/Android
* Success for: OpenSSL 1.1.1-pre10-dev
@ -353,7 +384,7 @@ task buildOpenSsl() {
environment "PATH", PATH
commandLine "./Configure", "--prefix=$OPENSSL_LIBS_INSTALL", "--openssldir=$OPENSSL_LIBS_INSTALL", \
"android-" + value.TCN, "-D__ANDROID_API__=$project.ext.SDK_MIN", \
"no-shared", "no-ssl2", "no-ssl3", "no-comp", "no-hw", "no-engine"
"no-shared", "no-ssl3", "no-comp", "no-hw", "no-engine"
}
// Clean build files
@ -878,15 +909,13 @@ task buildBoost() {
/*
* Add here pre build tasks
* */
task build3dPArty() {
buildOpenSsl.execute()
buildCurl.execute()
buildIconv.execute()
buildIcu.execute()
buildBoost.execute()
task preBuildTask() {
doLast {
downloadNdk.execute()
buildOpenSsl.execute()
buildCurl.execute()
buildIconv.execute()
buildIcu.execute()
buildBoost.execute()
}
}
/*
* Add task for run before build
* */
preBuild.dependsOn build3dPArty

View File

@ -9,7 +9,6 @@ set(CMAKE_VERBOSE_MAKEFILE on)
# Set global definition
add_definitions(
-D__ANDROID__
-D_LINUX
)
# Add checks arguments here

View File

@ -162,7 +162,8 @@ target_include_directories(${LIB_NAME_CRYPTOPP} PUBLIC ${CRYPTOPP_DIR})
# Set target definition
target_compile_definitions(${LIB_NAME_CRYPTOPP}
PRIVATE
PUBLIC
_LINUX
UNICODE
CRYPTOPPLIB_LIBRARY
CRYPTOPP_DISABLE_ASM

View File

@ -12,39 +12,39 @@ if (NOT DEFINED LIB_NAME_OFFICE_UTILS)
message(FATAL_ERROR "You must set library name in \"LIB_NAME_OFFICE_UTILS\"!")
endif()
# Zlib name
set(ZLIB_NAME zlib-1.2.11)
# Library source .h .cpp
file(GLOB OFFICE_UTILS_CPP
${OFFICE_UTILS_DIR}src/*.cpp
${OFFICE_UTILS_DIR}src/zlib-1.2.3/*.c
${OFFICE_UTILS_DIR}src/zlib-1.2.3/contrib/minizip/*.c
${OFFICE_UTILS_DIR}src/${ZLIB_NAME}/*.c
${OFFICE_UTILS_DIR}src/${ZLIB_NAME}/contrib/minizip/*.c
)
# Exclude sources
list(REMOVE_ITEM OFFICE_UTILS_CPP
${OFFICE_UTILS_DIR}src/zlib-1.2.3/contrib/minizip/iowin32.c
${OFFICE_UTILS_DIR}src/${ZLIB_NAME}/contrib/minizip/iowin32.c
)
# Set targer as static library
add_library(${LIB_NAME_OFFICE_UTILS} STATIC ${OFFICE_UTILS_CPP})
# Add dependency library
#target_link_libraries(${LIB_NAME_OFFICE_UTILS}
# PRIVATE
# ${LIB_NAME_EDITOR_COMMON}
#)
# Add include files .h
target_include_directories(${LIB_NAME_OFFICE_UTILS}
PUBLIC
${OFFICE_UTILS_DIR}
${OFFICE_UTILS_DIR}zlib-1.2.3/
${OFFICE_UTILS_DIR}${ZLIB_NAME}/
PRIVATE
${OFFICE_UTILS_DIR}zlib-1.2.3/contrib/minizip/
${OFFICE_UTILS_DIR}${ZLIB_NAME}/contrib/minizip/
)
# Set target definition
target_compile_definitions(${LIB_NAME_OFFICE_UTILS}
PRIVATE
_LINUX
USE_FILE32API
NOCRYPT
NOUNCRYPT
BUILD_ZLIB_AS_SOURCES
)

View File

@ -102,4 +102,10 @@ target_compile_options(${LIB_NAME_FONT_ENGINE}
PUBLIC
-Wno-register
-Wno-c++11-narrowing
)
# Set target definition
target_compile_definitions(${LIB_NAME_FONT_ENGINE}
PRIVATE
_LINUX
)

View File

@ -40,6 +40,7 @@ target_include_directories(${LIB_NAME_PDF_WRITER}
# Set target definition
target_compile_definitions(${LIB_NAME_PDF_WRITER}
PRIVATE
_LINUX
PDFWRITER_USE_DYNAMIC_LIBRARY
)

View File

@ -102,6 +102,37 @@ def getDirNameExt(String path) {
return countFolders == 1? nameFolder : ''
}
def getHostNameExt() {
final String value = System.getProperty("os.name").toLowerCase();
println "System: ${value}"
if (value.contains("linux")) {
return ("linux");
} else if (value.contains("mac os x") || value.contains("darwin") || value.contains("osx")) {
return ("darwin");
} else if (value.contains("windows")) {
return ("windows");
}
throw new GradleException("UNKNOWN SYSTEM FOR ANDROID NDK: ${value}!")
}
def getHostArchExt() {
final String value = System.getProperty("os.arch");
println "Architecture: ${value}"
if ("x86" == value) {
return value
} else if ("amd64" == value || "x86_64" == value) {
return "x86_64"
}
throw new GradleException("UNKNOWN ARCHITECTRE FOR ANDROID NDK: ${value}!")
}
def getHostNameFullExt() {
return "${getHostNameExt()}-${getHostArchExt()}"
}
/*
* Add methods/values here for export
@ -141,5 +172,6 @@ ext {
isFolderNotEmpty = this.&isFolderNotEmptyCheck
getBackSlash = this.&getBackSlashExt
getDirName = this.&getDirNameExt
getHostName = this.&getHostNameFullExt
}

View File

@ -690,7 +690,7 @@
</File>
</Filter>
<Filter
Name="111"
Name="libs"
>
<File
RelativePath="..\..\..\build\lib\win_32\DEBUG\DjVuFile.lib"

View File

@ -79,7 +79,9 @@ namespace BinXlsxRW
Styles = 2,
Workbook = 3,
Worksheets = 4,
CalcChain = 5
CalcChain = 5,
App = 6,
Core = 7
};}
namespace c_oSerStylesTypes{enum c_oSerStylesTypes

View File

@ -48,6 +48,8 @@
#include "../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h"
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
#include "../../ASCOfficePPTXFile/PPTXFormat/App.h"
#include "../../ASCOfficePPTXFile/PPTXFormat/Core.h"
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
@ -55,6 +57,8 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/WorkbookComments.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
namespace BinXlsxRW
{
@ -4874,6 +4878,20 @@ namespace BinXlsxRW
if( (oXlsx.m_pStyles) && oXlsx.m_pStyles->m_oColors.IsInit() && oXlsx.m_pStyles->m_oColors->m_oIndexedColors.IsInit())
pIndexedColors = oXlsx.m_pStyles->m_oColors->m_oIndexedColors.operator ->();
if(oXlsx.m_pApp)
{
nCurPos = this->WriteTableStart(c_oSerTableTypes::App);
oXlsx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}
if(oXlsx.m_pCore)
{
nCurPos = this->WriteTableStart(c_oSerTableTypes::Core);
oXlsx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}
if(oXlsx.m_pSharedStrings)
{
nCurPos = WriteTableStart(c_oSerTableTypes::SharedStrings);