Compare commits

..

14 Commits

Author SHA1 Message Date
f764b034a1 . 2018-01-25 18:33:12 +03:00
73fe023460 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-25 18:26:55 +03:00
242af3c80e . 2018-01-25 18:26:14 +03:00
7756e4b8bd . 2018-01-25 18:17:46 +03:00
56a1d1f627 x2t -fix appVersion 2018-01-25 18:16:15 +03:00
11bd4ff61d . 2018-01-25 17:20:56 +03:00
93a06d7f86 . 2018-01-25 17:18:40 +03:00
76d2d429b7 x2t version 2.4.511 2018-01-25 17:07:43 +03:00
c6de37dbad . 2018-01-25 17:02:31 +03:00
d022e669f0 . 2018-01-25 15:57:17 +03:00
184e79bae1 . 2018-01-25 15:52:14 +03:00
e6581671c8 . 2018-01-25 15:27:06 +03:00
e0a1c688bf . 2018-01-24 19:28:04 +03:00
9e0b301179 write verion x2t to converted files 2018-01-24 18:25:23 +03:00
41 changed files with 2062 additions and 1182 deletions

View File

@ -71,7 +71,11 @@ namespace OpenXmlContentTypes
static const wchar_t* Bmp = L"image/bmp";
static const wchar_t* Pcz = L"image/x-pcz";
}
namespace DocPrContentTypes
{
static const wchar_t* App = L"application/vnd.openxmlformats-officedocument.extended-properties+xml";
static const wchar_t* Core = L"application/vnd.openxmlformats-package.core-properties+xml";
}
namespace WordprocessingMLContentTypes
{
// WordprocessingML content types
@ -137,7 +141,7 @@ namespace OpenXmlNamespaces
namespace OpenXmlRelationshipTypes
{
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";

View File

@ -64,6 +64,8 @@ namespace DocFileFormat
DocumentContentTypesFile._defaultTypes.insert( make_pair( L"xml", std::wstring( OpenXmlContentTypes::Xml ) ) );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId1"), OpenXmlRelationshipTypes::OfficeDocument, L"word/document.xml") );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId2"), OpenXmlRelationshipTypes::CoreProperties, L"docProps/core.xml") );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId3"), OpenXmlRelationshipTypes::ExtendedProperties, L"docProps/app.xml") );
}
@ -195,14 +197,18 @@ namespace DocFileFormat
delete storageOut;
return S_OK;
}
int OpenXmlPackage::RegisterDocument()
void OpenXmlPackage::RegisterDocPr()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
AddPart( L"docProps", L"app.xml", DocPrContentTypes::App, L"");
AddPart( L"docProps", L"core.xml", DocPrContentTypes::Core, L"");
}
int OpenXmlPackage::RegisterDocumentMacros()
void OpenXmlPackage::RegisterDocument()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
}
void OpenXmlPackage::RegisterDocumentMacros()
{
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
}
int OpenXmlPackage::RegisterVbaProject()
{

View File

@ -165,8 +165,9 @@ namespace DocFileFormat
HRESULT SaveOLEObject ( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
int RegisterDocument();
int RegisterDocumentMacros();
void RegisterDocPr();
void RegisterDocument();
void RegisterDocumentMacros();
int RegisterFontTable();
int RegisterNumbering();
int RegisterSettings();

View File

@ -35,6 +35,10 @@
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
namespace ImageHelper
{
struct __BITMAPINFOHEADER
@ -211,6 +215,37 @@ namespace DocFileFormat
{
RegisterDocument();
}
OOX::CContentTypes oContentTypes;
OOX::CPath pathDocProps = m_strOutputPath + FILE_SEPARATOR_STR + _T("docProps");
NSDirectory::CreateDirectory(pathDocProps.GetPath());
OOX::CPath DocProps = std::wstring(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore(NULL);
if (pCore)
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
delete pCore;
}
RegisterDocPr();
WritePackage();

View File

@ -298,8 +298,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.0"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);

View File

@ -40,6 +40,7 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
namespace cpdoccore {
namespace oox {
@ -284,8 +285,8 @@ void core_file::write(const std::wstring & RootPath)
L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" "
L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >";
//resStream << L"<dc:creator>ONLYOFFICE Online Editor</dc:creator>";
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE Online Editor</cp:lastModifiedBy>";
//resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
resStream << L"<cp:revision>1</cp:revision>";
resStream << L"</cp:coreProperties>";
@ -300,8 +301,12 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>OnlyOffice</Application>";
resStream << L"</Properties>";
resStream << L"<Application>ONLYOFFICE";
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
resStream << L"/" << std::wstring(s.begin(), s.end()) ;
#endif
resStream << L"</Application></Properties>";
simple_element elm(L"app.xml", resStream.str());
elm.write(RootPath);

View File

@ -717,6 +717,16 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
xlsx_text_context_.end_span2();
}
}
void xlsx_conversion_context::start_content_validation(const std::wstring & name, const std::wstring & ref)
{
}
void xlsx_conversion_context::set_content_validation_condition(const std::wstring & val)
{
}
void xlsx_conversion_context::end_content_validation()
{
}
void xlsx_conversion_context::add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view)
{//ващето в либре жесткая привязка что на одном листе тока одна сводная может быть ..
mapPivotsTableView_.insert(std::make_pair(sheet_name, index_table_view));

View File

@ -136,6 +136,10 @@ public:
void start_hyperlink (const std::wstring & styleName);
void end_hyperlink (std::wstring const & href);
void start_content_validation(const std::wstring & name, const std::wstring & ref);
void set_content_validation_condition(const std::wstring & val);
void end_content_validation();
//------------------------------------------------------------------------------------
void add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view);

View File

@ -80,7 +80,16 @@ void chart_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
void chart_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
if CP_CHECK_NAME(L"text", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else
CP_CREATE_ELEMENT(content_);
}
void chart_title_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{

View File

@ -60,7 +60,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
office_element_ptr_array content_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
};
@ -105,6 +108,10 @@ private:
public:
chart_chart_attlist attlist_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
};

View File

@ -233,6 +233,11 @@ enum ElementType
typeTableDatabaseRange,
typeTableSort,
typeTableSortBy,
typeTableCalculationSettings,
typeTableNullDate,
typeTableShapes,
typeTableContentValidation,
typeTableContentValidations,
typeTableFilter,
typeTableFilterAnd,
@ -411,9 +416,6 @@ enum ElementType
typeScriptEventListener,
typeTableCalculationSettings,
typeTableNullDate,
typeNumberNumberStyle,
typeNumberDataStyle,
typeNumberText,
@ -436,7 +438,6 @@ enum ElementType
typeNumberMinutes,
typeNumberSeconds,
typeNumberAmPm,
typeTableShapes,
typeChartChart,
typeChartTitle,

View File

@ -54,11 +54,25 @@ const wchar_t * office_presentation::name = L"presentation";
void office_presentation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"page")
{
CP_CREATE_ELEMENT(pages_);
}
else if CP_CHECK_NAME(L"table", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else if CP_CHECK_NAME(L"presentation", L"footer-decl")
{
CP_CREATE_ELEMENT(footer_decls_);
}
else if CP_CHECK_NAME(L"presentation", L"date-time-decl")
{
CP_CREATE_ELEMENT(date_time_decls_);
}
}

View File

@ -62,10 +62,13 @@ private:
public:
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
office_element_ptr_array pages_;
office_element_ptr_array pages_;
};

View File

@ -63,6 +63,10 @@ void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstrin
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else
CP_CREATE_ELEMENT(content_);
}

View File

@ -62,12 +62,12 @@ public:
office_element_ptr database_ranges_;
office_element_ptr data_pilot_tables_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
// table:calculation-settings
// table:consolidation
// table:content-validations
// table:dde-links
// table:label-ranges

View File

@ -101,6 +101,10 @@ void office_text::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else if (is_text_content(Ns, Name))
{
CP_CREATE_ELEMENT(content_);

View File

@ -67,7 +67,9 @@ private:
// TODO: table-decls
office_element_ptr tracked_changes_;
office_element_ptr_array content_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions

View File

@ -728,6 +728,82 @@ void table_shapes::add_child_element( xml::sax * Reader, const std::wstring & Ns
CP_CREATE_ELEMENT(content_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:content-validations
const wchar_t * table_content_validations::ns = L"table";
const wchar_t * table_content_validations::name = L"content-validations";
void table_content_validations::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
void table_content_validations::pptx_convert(oox::pptx_conversion_context & Context)
{
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
}
void table_content_validations::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
void table_content_validations::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:content-validation
const wchar_t * table_content_validation::ns = L"table";
const wchar_t * table_content_validation::name = L"content-validation";
void table_content_validation::docx_convert(oox::docx_conversion_context & Context)
{
//for (size_t i = 0 ; i < content_.size(); i++)
//{
// content_[i]->docx_convert(Context);
// }
}
void table_content_validation::pptx_convert(oox::pptx_conversion_context & Context)
{
//for (size_t i = 0 ; i < content_.size(); i++)
//{
// content_[i]->pptx_convert(Context);
// }
}
void table_content_validation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_content_validation(table_name_.get_value_or(L""), table_base_cell_address_.get_value_or(L""));
Context.set_content_validation_condition(table_condition_.get_value_or(L""));
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
Context.end_content_validation();
}
void table_content_validation::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:name", table_name_);
CP_APPLY_ATTR(L"table:condition", table_condition_);
CP_APPLY_ATTR(L"table:display-list", table_display_list_);
CP_APPLY_ATTR(L"table:allowempty-cell", table_allowempty_cell_);
CP_APPLY_ATTR(L"table:base-cell-address", table_base_cell_address_);
}
void table_content_validation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
}

View File

@ -653,6 +653,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_table);
//table:content-shapes
class table_shapes : public office_element_impl<table_shapes>
{
public:
@ -676,5 +677,57 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(table_shapes);
//table:content-validations
class table_content_validations : public office_element_impl<table_content_validations>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableContentValidations;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_content_validations);
//table:content-validation
class table_content_validation : public office_element_impl<table_content_validation>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableContentValidation;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
_CP_OPT(std::wstring) table_name_;
_CP_OPT(odf_types::Bool) table_allowempty_cell_;
_CP_OPT(std::wstring) table_display_list_;
_CP_OPT(std::wstring) table_condition_;
_CP_OPT(std::wstring) table_base_cell_address_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_content_validation);
}
}

View File

@ -803,11 +803,13 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
if ( content_.elements_.size() > 0 ||
!formula.empty() ||
if ( content_.elements_.size() > 0 || attlist_.table_content_validation_name_ || !formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
( t_val == oox::XlsxCellType::b && bool_val) ||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val))
{
is_data_visible = true;
}
if (attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
@ -887,6 +889,10 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
}
if (attlist_.table_content_validation_name_)
{
}
}
if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
{

View File

@ -151,13 +151,17 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0");
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart");
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_NODE(L"office:meta")
{
CP_XML_NODE(L"meta:generator")
{
CP_XML_STREAM() << L"ONLYOFFICE Online Editor";
CP_XML_STREAM() << L"ONLYOFFICE";
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
CP_XML_STREAM() << L"/" << std::wstring (s.begin(), s.end() );
#endif
}
CP_XML_NODE(L"meta:initial-creator");
CP_XML_NODE(L"meta:creation-date");

View File

@ -37,6 +37,7 @@
#include "../../../ASCOfficePPTXFile/Editor/DefaultNotesTheme.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../../ASCOfficeXlsFile2/source/Common/simple_xml_writer.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../Reader/PPTDocumentInfo.h"
@ -60,8 +61,6 @@ namespace NSPresentationEditor
static std::wstring g_string_core = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\
<dc:title>Slide 1</dc:title>\
<dc:creator>OnlyOffice</dc:creator>\
<cp:lastModifiedBy>OnlyOffice</cp:lastModifiedBy>\
<cp:revision>1</cp:revision>\
</cp:coreProperties>");
}
@ -278,60 +277,127 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
{
std::wstring str1 = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">\
<TotalTime>0</TotalTime>\
<Words>0</Words>\
<Application>OnlyOffice</Application>\
<PresentationFormat>On-screen Show (4:3)</PresentationFormat>\
<Paragraphs>0</Paragraphs>");
std::wstringstream strm;
oFile.WriteStringUTF8(str1);
oFile.WriteStringUTF8(L"<Slides>" + std::to_wstring(m_pDocument->m_arSlides.size()) + L"</Slides>");
oFile.WriteStringUTF8(L"<Notes>" + std::to_wstring(m_pDocument->m_arNotes.size()) + L"</Notes>");
oFile.WriteStringUTF8(L"<HiddenSlides>0</HiddenSlides>\
<MMClips>2</MMClips>\
<ScaleCrop>false</ScaleCrop>\
<HeadingPairs>\
<vt:vector size=\"4\" baseType=\"variant\">");
int nCountThemes = (int)m_pDocument->m_arThemes.size();
int nCountSlides = (int)m_pDocument->m_arSlides.size();
std::wstring strThemes = L"<vt:variant><vt:lpstr>Theme</vt:lpstr></vt:variant><vt:variant><vt:i4>" +std::to_wstring(nCountThemes) +
L"</vt:i4></vt:variant>";
std::wstring strSlides = L"<vt:variant><vt:lpstr>Slide Titles</vt:lpstr></vt:variant><vt:variant><vt:i4>" +
std::to_wstring(nCountSlides) + L"</vt:i4></vt:variant></vt:vector></HeadingPairs>";
std::wstring strTitles = L"<TitlesOfParts><vt:vector size=\"" + std::to_wstring(nCountSlides + nCountThemes) + L"\" baseType=\"lpstr\">";
oFile.WriteStringUTF8(strThemes + strSlides + strTitles);
std::wstring strMemory = _T("");
for (int i = 1; i <= nCountThemes; ++i)
CP_XML_WRITER(strm)
{
strMemory += L"<vt:lpstr>Theme " + std::to_wstring(i) + L"</vt:lpstr>";
CP_XML_NODE(L"Properties")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypess");
}
CP_XML_NODE(L"Application")
{
CP_XML_STREAM() << 0;
}
#if defined(INTVER)
CP_XML_NODE(L"AppVersion")
{
std::string s = VALUE2STR(INTVER);
CP_XML_STREAM() << std::wstring(s.begin(), s.end());
}
#endif
CP_XML_NODE(L"TotalTime")
{
CP_XML_STREAM() << 0;
}
CP_XML_NODE(L"Words")
{
CP_XML_STREAM() << 0;
}
CP_XML_NODE(L"PresentationFormat")
{
CP_XML_STREAM() << L"On-screen Show (4:3)";
}
CP_XML_NODE(L"Paragraphs")
{
CP_XML_STREAM() << 0;
}
CP_XML_NODE(L"Slides")
{
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
}
CP_XML_NODE(L"Notes")
{
CP_XML_STREAM() << m_pDocument->m_arNotes.size();
}
CP_XML_NODE(L"HiddenSlides")
{
CP_XML_STREAM() << 0;
}
CP_XML_NODE(L"MMClips")
{
CP_XML_STREAM() << 2;
}
CP_XML_NODE(L"ScaleCrop")
{
CP_XML_STREAM() << L"false";
}
CP_XML_NODE(L"HeadingPairs")
{
CP_XML_NODE(L"vt:vector")
{
CP_XML_ATTR(L"size", 4);
CP_XML_ATTR(L"baseType", L"variant");
CP_XML_NODE(L"vt:variant")
{
CP_XML_ATTR(L"vt:lpstr", L"Theme");
}
CP_XML_NODE(L"vt:variant")
{
CP_XML_ATTR(L"vt:i4", m_pDocument->m_arThemes.size());
}
CP_XML_NODE(L"vt:variant")
{
CP_XML_ATTR(L"vt:lpstr", L"Slide Titles");
}
CP_XML_NODE(L"vt:variant")
{
CP_XML_ATTR(L"vt:i4", m_pDocument->m_arSlides.size());
}
}
}
CP_XML_NODE(L"TitlesOfParts")
{
CP_XML_NODE(L"vt:vector")
{
CP_XML_ATTR(L"size", m_pDocument->m_arSlides.size() + m_pDocument->m_arThemes.size());
CP_XML_ATTR(L"baseType", L"lpstr");
for (size_t i = 1; i <= m_pDocument->m_arThemes.size(); ++i)
{
CP_XML_NODE(L"vt:lpstr")
{
CP_XML_STREAM() << L"Theme " << i;
}
}
for (size_t i = 1; i <= m_pDocument->m_arSlides.size(); ++i)
{
CP_XML_NODE(L"vt:lpstr")
{
CP_XML_STREAM() << L"Slide " << i;
}
}
}
}
CP_XML_NODE(L"Company");
CP_XML_NODE(L"LinksUpToDate")
{
CP_XML_STREAM() << L"false";
}
CP_XML_NODE(L"SharedDoc")
{
CP_XML_STREAM() << L"false";
}
CP_XML_NODE(L"HyperlinksChanged")
{
CP_XML_STREAM() << L"false";
}
}
for (int i = 1; i <= nCountSlides; ++i)
{
strMemory += L"<vt:lpstr>Slide " + std::to_wstring(i) + L"</vt:lpstr>";
}
std::wstring str5 = _T("</vt:vector>\
</TitlesOfParts>\
<Company></Company>\
<LinksUpToDate>false</LinksUpToDate>\
<SharedDoc>false</SharedDoc>\
<HyperlinksChanged>false</HyperlinksChanged>\
<AppVersion>4.4000</AppVersion>\
</Properties>");
strMemory += str5;
oFile.WriteStringUTF8(strMemory);
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
oFile.WriteStringUTF8(strm.str());
}
void NSPresentationEditor::CPPTXWriter::WritePresInfo()

View File

@ -36,7 +36,6 @@
#include "DefaultNotesMaster.h"
#include "DefaultNotesTheme.h"
namespace NSBinPptxRW
{
class CPPTXWriter
@ -1012,8 +1011,13 @@ namespace NSBinPptxRW
{
m_oApp.TotalTime = 0;
m_oApp.Words = 0;
m_oApp.Application = _T("OnlyOffice");
m_oApp.PresentationFormat = _T("On-screen Show (4:3)");
std::wstring sApplication = L"ONLYOFFICE";
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
sApplication += L"/" + std::wstring(s.begin(), s.end());
#endif
m_oApp.Application = sApplication;
m_oApp.PresentationFormat = L"On-screen Show (4:3)";
m_oApp.Paragraphs = 0;
m_oApp.Slides = (int)m_arSlides.size();
m_oApp.Notes = (int)m_arSlides.size();
@ -1054,7 +1058,6 @@ namespace NSBinPptxRW
m_oApp.LinksUpToDate = false;
m_oApp.SharedDoc = false;
m_oApp.HyperlinksChanged = false;
m_oApp.AppVersion = _T("3.0000");
}
void CreateDefaultCore()
{

View File

@ -178,9 +178,11 @@ namespace PPTX
void FileContainer::write(OOX::CRels& rels, const OOX::CPath& curdir, const OOX::CPath& directory, OOX::CContentTypes& content) const
{
std::map<std::wstring, size_t> mNamePair;
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
{
smart_ptr<OOX::File> pFile = pPair->second;
smart_ptr<OOX::File> pFile = pPair->second;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
@ -217,6 +219,7 @@ namespace PPTX
OOX::CSystemUtility::CreateDirectories(directory / defdir);
pFile->write(directory / defdir / name, directory, content);
rels.Registration(pPair->first, pFile->type(), defdir / name);
}
}
@ -229,9 +232,9 @@ namespace PPTX
void FileContainer::WrittenSetFalse()
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for (size_t i = 0; i < m_arContainer.size(); i++)
{
smart_ptr<OOX::File> pFile = pPair->second;
smart_ptr<OOX::File> &pFile = m_arContainer[i];
smart_ptr<PPTX::WrapperFile> pWrapFile = pFile.smart_dynamic_cast<PPTX::WrapperFile>();
smart_ptr<PPTX::FileContainer> pWrapCont = pFile.smart_dynamic_cast<PPTX::FileContainer>();

View File

@ -385,8 +385,10 @@ namespace PPTX
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.0"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
@ -438,9 +440,10 @@ namespace PPTX
std::wstring sXmlOptions, sMediaPath, sEmbedPath;
BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath);
std::map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
boost::unordered_map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
oXlsx.m_mapEnumeratedGlobal.clear();

View File

@ -147,9 +147,10 @@ bool OOXWriter::SaveByItemEnd()
if (m_poDocPropsApp)
{
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" );
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( L"5.0" );
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"ONLYOFFICE" );
#if defined(INTVER)
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( VALUE2STR(INTVER) );
#endif
((OOX::CApp*)m_poDocPropsApp)->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", pathDocProps.GetDirectory(), oContentTypes);
m_oRels.AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml" );

View File

@ -218,8 +218,10 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.07"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);

View File

@ -37,6 +37,7 @@
#include <boost/make_shared.hpp>
#include "../../../ASCOfficeOdfFile/include/cpdoccore/utf8cpp/utf8.h"
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "external_items.h"
#include "../../../DesktopEditor/common/File.h"
@ -235,8 +236,8 @@ void core_file::write(const std::wstring & RootPath)
L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" "
L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >";
resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
//resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
resStream << L"<cp:revision>1</cp:revision>";
resStream << L"</cp:coreProperties>";
@ -251,8 +252,12 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>ONLYOFFICE Editor</Application>";
resStream << L"</Properties>";
resStream << L"<Application>ONLYOFFICE";
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
resStream << L"/" << std::wstring(s.begin(), s.end());
#endif
resStream << L"</Application></Properties>";
simple_element elm(L"app.xml", resStream.str());
elm.write(RootPath);

View File

@ -42,6 +42,9 @@
#define _T(x) __T(x)
#define __T(x) L##x
#define VALUE_TO_STRING(x) #x
#define VALUE2STR(x) VALUE_TO_STRING(x)
#if defined(_WIN32) || defined (_WIN64)
#include <TCHAR.H>
// windows-stype separator for paths i.e. 'c:\home\documents\file.ext'

View File

@ -192,15 +192,20 @@ namespace OOX
{
sXml += _T("<Application>");
sXml += m_sApplication.get();
if ( m_sAppVersion.IsInit() )
{
sXml += L"/";
sXml += m_sAppVersion.get();
}
sXml += _T("</Application>");
}
if ( m_sAppVersion.IsInit() )
{
sXml += _T("<AppVersion>");
sXml += m_sAppVersion.get();
sXml += _T("</AppVersion>");
}
//if ( m_sAppVersion.IsInit() ) - only for ms editors versions
//{
// sXml += _T("<AppVersion>");
// sXml += m_sAppVersion.get(); // error in ms editors - "2.4.510.0"
// sXml += _T("</AppVersion>");
//}
if ( m_nCharacters.IsInit() )
{
@ -416,7 +421,11 @@ namespace OOX
{
m_sAppVersion = sVal;
}
void SetDocSecurity(int nVal)
void SetAppVersion(const std::string& sVal)
{
m_sAppVersion = std::wstring(sVal.begin(), sVal.end());
}
void SetDocSecurity(int nVal)
{
m_nDocSecurity = nVal;
}

View File

@ -48,7 +48,7 @@
namespace OOX
{
std::map<std::wstring, size_t> IFileContainer::m_mapEnumeratedGlobal;
boost::unordered_map<std::wstring, size_t> IFileContainer::m_mapEnumeratedGlobal;
UnknowTypeFile IFileContainer::Unknown(NULL);
@ -99,9 +99,10 @@ namespace OOX
}
void IFileContainer::Write(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent) const
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
{
smart_ptr<OOX::File> pFile = pPair->second;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
@ -114,7 +115,7 @@ namespace OOX
if(false == pFile->m_sOutputFilename.empty())
oName.SetName(pFile->m_sOutputFilename, false);
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
if(m_mNoWriteContainer.end() == itFind)
{
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
@ -124,13 +125,13 @@ namespace OOX
{
oDefDir = itFind->second;
}
if(true != pFile->m_bDoNotAddRels)
{
if (oDefDir.GetPath().length() > 0)//todooo перенести в CPath
oRels.Registration( pPair->first, pFile->type(), oDefDir / oName );
else
oRels.Registration( pPair->first, pFile->type(), oName );
}
if(true != pFile->m_bDoNotAddRels)
{
if (oDefDir.GetPath().length() > 0)//todooo перенести в CPath
oRels.Registration( pPair->first, pFile->type(), oDefDir / oName );
else
oRels.Registration( pPair->first, pFile->type(), oName );
}
}
else
{
@ -144,9 +145,10 @@ namespace OOX
{
std::map<std::wstring, size_t> mNamepair;
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
smart_ptr<OOX::File> pFile = it->second;
smart_ptr<OOX::File> &pFile = m_arContainer[i];
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
@ -167,7 +169,8 @@ namespace OOX
OOX::CSystemUtility::CreateDirectories( oPath / oDefDir );
smart_ptr<OOX::IFileBuilder> pFileBuilder = it->second.smart_dynamic_cast<OOX::IFileBuilder>();
smart_ptr<OOX::IFileBuilder> pFileBuilder = pFile.smart_dynamic_cast<OOX::IFileBuilder>();
if ( pFileBuilder.is_init() )
pFileBuilder->Commit( oPath / oDefDir / oName );
}
@ -187,9 +190,10 @@ namespace OOX
{
std::map<std::wstring, size_t> mNamepair;
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
{
smart_ptr<OOX::File> pFile = it->second;
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
{
smart_ptr<OOX::File> pFile = pPair->second;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
@ -205,7 +209,7 @@ namespace OOX
else
oName = oName + pNamePair->first;
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(it->first);
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
if(m_mNoWriteContainer.end() == itFind)
{
@ -225,22 +229,22 @@ namespace OOX
oDefDir = itFind->second;
}
oRels.Registration( it->first, pFile->type(), oDefDir / oName );
oRels.Registration( pPair->first, pFile->type(), oDefDir / oName );
}
else
{
oRels.Registration( it->first, pExt );
oRels.Registration( pPair->first, pExt );
}
}
}
void IFileContainer::ExtractPictures (const OOX::CPath& oPath) const
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
smart_ptr<OOX::File> pFile = it->second;
smart_ptr<OOX::File> pFile = m_arContainer[i];
smart_ptr<Image> pImage = pFile.smart_dynamic_cast<Image>();
smart_ptr<Image> pImage = pFile.smart_dynamic_cast<Image>();
if ( pImage.is_init() )
{
pImage->copy_to( oPath );
@ -257,9 +261,11 @@ namespace OOX
}
const bool IFileContainer::IsExist(const FileType& oType) const
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
if (oType == it->second->type())
smart_ptr<OOX::File> pFile = m_arContainer[i];
if (oType == pFile->type())
return true;
}
@ -267,8 +273,8 @@ namespace OOX
}
const bool IFileContainer::IsExist(const RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.find(rId.get());
return (it != m_mContainer.end());
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mapContainer.find(rId.get());
return (pFind != m_mapContainer.end());
}
template<typename T>
@ -279,7 +285,7 @@ namespace OOX
}
std::wstring IFileContainer::IsExistHyperlink(smart_ptr<OOX::HyperLink>& pHyperLink)
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for ( boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
{
if(OOX::FileTypes::HyperLink == pPair->second->type())
{
@ -292,9 +298,9 @@ namespace OOX
}
const bool IFileContainer::IsExternal(const OOX::RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mContainer.find(rId.get());
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mapContainer.find(rId.get());
if (pFind != m_mContainer.end())
if (pFind != m_mapContainer.end())
{
smart_ptr<OOX::Media> mediaFile = pFind->second.smart_dynamic_cast<OOX::Media>();
@ -312,10 +318,11 @@ namespace OOX
smart_ptr<OOX::File> IFileContainer::Get(const FileType& oType)
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
if (oType == it->second->type())
return it->second;
smart_ptr<OOX::File> &pFile = m_arContainer[i];
if (oType == pFile->type())
return pFile;
}
return smart_ptr<OOX::File>(new UnknowTypeFile( Unknown ));
@ -323,10 +330,12 @@ namespace OOX
void IFileContainer::Get(const FileType& oType, std::vector<smart_ptr<OOX::File>> & files)
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
if ( oType == pPair->second->type() )
files.push_back(pPair->second);
smart_ptr<OOX::File> &pFile = m_arContainer[i];
if ( oType == pFile->type() )
files.push_back(pFile);
}
}
const RId IFileContainer::Add(smart_ptr<OOX::File>& pFile)
@ -347,13 +356,13 @@ namespace OOX
if(true == bEnumeratedGlobal)
{
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find (pFile->type().OverrideType());
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find (pFile->type().OverrideType());
if (pNamePair != m_mapEnumeratedGlobal.end())
nIndex = pNamePair->second;
}
else
{
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapAddNamePair.find (pFile->type().OverrideType());
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapAddNamePair.find (pFile->type().OverrideType());
if (pNamePair != m_mapAddNamePair.end())
nIndex = pNamePair->second;
}
@ -384,7 +393,9 @@ namespace OOX
}
m_lMaxRid = (std::max)( m_lMaxRid, rId.getNumber() );
m_mContainer [rId.get()] = pFile;
m_arContainer.push_back(pFile);
m_mapContainer [rId.get()] = pFile;
}
const RId IFileContainer::AddNoWrite(const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir)
@ -397,26 +408,29 @@ namespace OOX
void IFileContainer::AddNoWrite (const OOX::RId& rId, const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir)
{
m_lMaxRid = (std::max)( m_lMaxRid, rId.getNumber() );
m_mContainer [rId.get()] = pFile;
m_arContainer.push_back(pFile);
m_mapContainer [rId.get()] = pFile;
m_mNoWriteContainer[rId.get()] = oDefDir;
}
smart_ptr<OOX::File> IFileContainer::Find(const FileType& oType) const
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
for (size_t i = 0; i < m_arContainer.size(); ++i)
{
if ( oType == pPair->second->type() )
return pPair->second;
if ( oType == m_arContainer[i]->type() )
return m_arContainer[i];
}
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
smart_ptr<OOX::File> IFileContainer::Find(const OOX::RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.find(rId.get());
if ( pPair != m_mContainer.end())
return pPair->second;
if ( pPair != m_mapContainer.end())
return pPair->second;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
@ -429,9 +443,9 @@ namespace OOX
}
smart_ptr<OOX::File> IFileContainer::operator [](const OOX::RId rId)
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if ( pPair != m_mContainer.end())
return pPair->second;
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mapContainer.find(rId.get());
if ( pFind != m_mapContainer.end())
return pFind->second;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile(m_pMainDocument) );
}
@ -451,7 +465,7 @@ namespace OOX
}
int IFileContainer::GetGlobalNumberByType(const std::wstring& sOverrideType)
{
std::map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find( sOverrideType );
boost::unordered_map<std::wstring, size_t>::const_iterator pNamePair = m_mapEnumeratedGlobal.find( sOverrideType );
int nRes = 0;
if(pNamePair != m_mapEnumeratedGlobal.end())
nRes = pNamePair->second;

View File

@ -60,14 +60,16 @@ namespace OOX
IFileContainer(OOX::Document* pMain);
virtual ~IFileContainer();
bool m_bSpreadsheets;
static std::map<std::wstring, size_t> m_mapEnumeratedGlobal;
OOX::Document* m_pMainDocument;
smart_ptr<OOX::CRels> m_pCurRels;
bool m_bSpreadsheets;
static boost::unordered_map<std::wstring, size_t> m_mapEnumeratedGlobal;
OOX::Document* m_pMainDocument;
smart_ptr<OOX::CRels> m_pCurRels;
protected:
std::map<std::wstring, smart_ptr<OOX::File>> m_mContainer;
std::map<std::wstring, std::wstring> m_mNoWriteContainer;
size_t m_lMaxRid;
std::vector<smart_ptr<OOX::File>> m_arContainer;
boost::unordered_map<std::wstring, smart_ptr<OOX::File>> m_mapContainer;
boost::unordered_map<std::wstring, std::wstring> m_mNoWriteContainer;
size_t m_lMaxRid;
void Read (const OOX::CRels& oRels, const OOX::CPath& oRootPath, const CPath& oPath);
void Write (const OOX::CPath& oFileName, const CPath& oDir, OOX::CContentTypes& oContent) const;
@ -84,10 +86,10 @@ namespace OOX
template<class TypeOut>
smart_ptr<TypeOut> Get (const RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pFind = m_mapContainer.find(rId.get());
if (pFind == m_mapContainer.end ())
return smart_ptr<TypeOut>();
return pPair->second.smart_dynamic_cast<TypeOut>();
return pFind->second.smart_dynamic_cast<TypeOut>();
}
template<typename T>
@ -120,9 +122,9 @@ namespace OOX
protected:
static UnknowTypeFile Unknown;
private:
std::map<std::wstring, size_t> m_mapAddNamePair;
boost::unordered_map<std::wstring, size_t> m_mapAddNamePair;
const RId GetMaxRId();
const RId GetMaxRId();
};
} // namespace OOX

View File

@ -52,7 +52,8 @@ namespace OOX
m_bSpreadsheets = true;
CXlsx* xlsx = dynamic_cast<CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pSharedStrings = this;
if ((xlsx) && (!xlsx->m_pSharedStrings))
xlsx->m_pSharedStrings = this;
}
CSharedStrings(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
@ -60,7 +61,8 @@ namespace OOX
m_bSpreadsheets = true;
CXlsx* xlsx = dynamic_cast<CXlsx*>(File::m_pMainDocument);
if (xlsx) xlsx->m_pSharedStrings = this;
if ((xlsx) && (!xlsx->m_pSharedStrings))
xlsx->m_pSharedStrings = this;
read( oRootPath, oPath );
}

View File

@ -71,7 +71,7 @@ namespace OOX
m_bSpreadsheets = true;
CXlsx* xlsx = dynamic_cast<CXlsx*>(File::m_pMainDocument);
if (xlsx)
if ((xlsx) && (!xlsx->m_pWorkbook))
{
xlsx->m_pWorkbook = this;
}
@ -82,7 +82,7 @@ namespace OOX
m_bSpreadsheets = true;
CXlsx* xlsx = dynamic_cast<CXlsx*>(File::m_pMainDocument);
if (xlsx)
if ((xlsx) && (!xlsx->m_pWorkbook))
{
xlsx->m_pWorkbook = this;
}

View File

@ -118,8 +118,11 @@ bool OOX::Spreadsheet::CXlsx::Write(const CPath& oDirPath, OOX::CContentTypes &o
//CApp
OOX::CApp* pApp = new OOX::CApp(this);
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.0"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
@ -455,4 +458,4 @@ void OOX::Spreadsheet::CXlsx::PrepareWorksheet(CWorksheet* pWorksheet)
}
}
}
}
}

View File

@ -1,3 +1,6 @@
VERSION = 2.4.511.0
DEFINES += INTVER=$$VERSION
# CONFIGURATION
CONFIG(debug, debug|release) {
CONFIG += core_debug

File diff suppressed because it is too large Load Diff

View File

@ -1909,3 +1909,90 @@ void CApplicationFonts::InitFromReg()
}
#endif
// Symbols
class CApplicationFontsSymbols_Private
{
public:
FT_Library m_library;
FT_Parameter* m_params;
BYTE* m_pData;
CApplicationFontsSymbols_Private()
{
m_library = NULL;
m_pData = NULL;
m_params = NULL;
if (FT_Init_FreeType(&m_library))
return;
m_params = (FT_Parameter *)::malloc( sizeof(FT_Parameter) * 4 );
m_params[0].tag = FT_MAKE_TAG( 'i', 'g', 'p', 'f' );
m_params[0].data = NULL;
m_params[1].tag = FT_MAKE_TAG( 'i', 'g', 'p', 's' );
m_params[1].data = NULL;
m_params[2].tag = FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY;
m_params[2].data = NULL;
m_params[3].tag = FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY;
m_params[3].data = NULL;
int nSize = 100000000;
m_pData = new BYTE[nSize];
}
~CApplicationFontsSymbols_Private()
{
RELEASEARRAYOBJECTS(m_pData);
if (m_params)
::free( m_params );
if (m_library)
FT_Done_FreeType(m_library);
}
};
CApplicationFontsSymbols::CApplicationFontsSymbols()
{
m_internal = new CApplicationFontsSymbols_Private();
}
CApplicationFontsSymbols::~CApplicationFontsSymbols()
{
RELEASEOBJECT(m_internal);
}
void CApplicationFontsSymbols::CheckSymbols(const std::wstring& sFile, const int& nFaceIndex, CApplicationFontsSymbolsChecker* pChecker)
{
CFontStream oStream;
if (!oStream.CreateFromFile(sFile, m_internal->m_pData))
return;;
FT_Open_Args oOpenArgs;
oOpenArgs.flags = FT_OPEN_MEMORY | FT_OPEN_PARAMS;
oOpenArgs.memory_base = oStream.m_pData;
oOpenArgs.memory_size = oStream.m_lSize;
oOpenArgs.num_params = 4;
oOpenArgs.params = m_internal->m_params;
FT_Face pFace = NULL;
if (FT_Open_Face(m_internal->m_library, &oOpenArgs, nFaceIndex, &pFace))
return;
for (int nCharMap = 0; nCharMap < pFace->num_charmaps; nCharMap++)
{
FT_Set_Charmap(pFace, pFace->charmaps[nCharMap]);
FT_UInt indexG;
FT_ULong character = FT_Get_First_Char(pFace, &indexG);
while (indexG)
{
pChecker->Check((int)character, indexG);
character = FT_Get_Next_Char(pFace, character, &indexG);
}
}
FT_Done_Face( pFace );
}
//

View File

@ -288,4 +288,24 @@ public:
CFontManager* GenerateFontManager();
};
class CApplicationFontsSymbolsChecker
{
public:
virtual void Check(const int& nCode, const unsigned int& nIndex) = 0;
};
class CApplicationFontsSymbols_Private;
class CApplicationFontsSymbols
{
private:
CApplicationFontsSymbols_Private* m_internal;
public:
CApplicationFontsSymbols();
~CApplicationFontsSymbols();
public:
void CheckSymbols(const std::wstring& sFile, const int& nFaceIndex, CApplicationFontsSymbolsChecker* pChecker);
};
#endif

View File

@ -7,9 +7,6 @@
QT -= core
QT -= gui
VERSION = 2.4.510.0
DEFINES += INTVER=$$VERSION
TARGET = x2t
CORE_ROOT_DIR = $$PWD/../../..
PWD_ROOT_DIR = $$PWD

View File

@ -4490,7 +4490,6 @@ namespace BinXlsxRW
oXlsx.m_pTheme = oSaveParams.pTheme;
}
OOX::Spreadsheet::CSharedStrings* pSharedStrings = NULL;
if(-1 != nSharedStringsOffBits)
{
oBufferedStream.Seek(nSharedStringsOffBits);
@ -4526,7 +4525,7 @@ namespace BinXlsxRW
break;
case c_oSerTableTypes::Worksheets:
{
res = BinaryWorksheetsTableReader(oBufferedStream, *oXlsx.m_pWorkbook, pSharedStrings, oXlsx.m_arWorksheets, oXlsx.m_mapWorksheets, mapMedia, sOutDir, sMediaDir, oSaveParams, pOfficeDrawingConverter, m_mapPivotCacheDefinitions).Read();
res = BinaryWorksheetsTableReader(oBufferedStream, *oXlsx.m_pWorkbook, oXlsx.m_pSharedStrings, oXlsx.m_arWorksheets, oXlsx.m_mapWorksheets, mapMedia, sOutDir, sMediaDir, oSaveParams, pOfficeDrawingConverter, m_mapPivotCacheDefinitions).Read();
}
break;
}