mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-17 05:16:04 +08:00
Compare commits
21 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fbcc3832f | |||
| 97b4311e95 | |||
| 228b3a52e9 | |||
| 2f2236646d | |||
| 30603d0561 | |||
| 933af771b7 | |||
| c04a537d69 | |||
| e49d78db47 | |||
| 99ec420ee5 | |||
| f764b034a1 | |||
| 73fe023460 | |||
| 242af3c80e | |||
| 7756e4b8bd | |||
| 56a1d1f627 | |||
| 11bd4ff61d | |||
| 93a06d7f86 | |||
| 76d2d429b7 | |||
| c6de37dbad | |||
| d022e669f0 | |||
| 184e79bae1 | |||
| e6581671c8 |
@ -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";
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -7449,6 +7449,8 @@ public:
|
||||
{
|
||||
PPTX::Logic::CNvPr pNonVisualDrawingProps(L"wp");
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
|
||||
|
||||
pNonVisualDrawingProps.id = pDrawingProperty->m_nDocPr;
|
||||
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML2(L"wp:docPr");
|
||||
}
|
||||
else
|
||||
|
||||
@ -298,7 +298,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -288,6 +288,7 @@ SOURCES += \
|
||||
../src/docx/xlsx_table_state.cpp \
|
||||
../src/docx/xlsx_textcontext.cpp \
|
||||
../src/docx/xlsx_pivots_context.cpp \
|
||||
../src/docx/xlsx_data_validation.cpp \
|
||||
../src/docx/xlsx_utils.cpp \
|
||||
../src/docx/xlsx_xf.cpp
|
||||
}
|
||||
@ -551,6 +552,7 @@ HEADERS += \
|
||||
../src/docx/xlsx_table_position.h \
|
||||
../src/docx/xlsx_table_state.h \
|
||||
../src/docx/xlsx_textcontext.h \
|
||||
../src/docx/xlsx_data_validation.h \
|
||||
../src/docx/xlsx_utils.h \
|
||||
../src/docx/xlsx_xf.h \
|
||||
../include/logging.h \
|
||||
|
||||
@ -101,3 +101,4 @@
|
||||
#include "../src/docx/xlsx_utils.cpp"
|
||||
#include "../src/docx/xlsx_xf.cpp"
|
||||
#include "../src/docx/xlsx_pivots_context.cpp"
|
||||
#include "../src/docx/xlsx_data_validation.cpp""
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
int priority = 1;
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
for (int i = 0 ; i < conditionalFormattings_.size(); i++)
|
||||
for (size_t i = 0 ; i < conditionalFormattings_.size(); i++)
|
||||
{
|
||||
conditionalFormatting & c = conditionalFormattings_[i];
|
||||
|
||||
@ -126,7 +126,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", c.ref);
|
||||
|
||||
for (int j = 0 ; j < c.rules.size(); j++)
|
||||
for (size_t j = 0 ; j < c.rules.size(); j++)
|
||||
{
|
||||
if (c.rules[j].type < 1 || c.rules[j].type > 5) continue;
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
if (c.rules[j].minLength) CP_XML_ATTR(L"minLength", *c.rules[j].minLength);
|
||||
if (c.rules[j].maxLength) CP_XML_ATTR(L"maxLength", *c.rules[j].maxLength);
|
||||
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -189,11 +189,11 @@ public:
|
||||
CP_XML_ATTR(L"type", L"colorScale");
|
||||
CP_XML_NODE(L"colorScale")
|
||||
{
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
for (int k = 0; k < c.rules[j].color.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].color.size(); k++)
|
||||
{
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
@ -209,7 +209,7 @@ public:
|
||||
{
|
||||
if (c.rules[j].showValue) CP_XML_ATTR(L"showValue", *c.rules[j].showValue);
|
||||
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
212
ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp
Normal file
212
ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp
Normal file
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* 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 "xlsx_data_validation.h"
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <cpdoccore/CPSharedPtr.h>
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidation
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
|
||||
|
||||
std::wstring ref;
|
||||
std::wstring activate_ref;
|
||||
std::wstring type;
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
bool showErrorMessage;
|
||||
bool showInputMessage;
|
||||
bool showDropDown;
|
||||
bool allowBlank;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
class xlsx_dataValidations_context::Impl
|
||||
{
|
||||
public:
|
||||
|
||||
void serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (mapActivateDataValidations.empty()) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"dataValidations")
|
||||
{
|
||||
CP_XML_ATTR(L"count", mapActivateDataValidations.size());
|
||||
|
||||
for (std::map<std::wstring, xlsx_dataValidation_ptr>::iterator it = mapActivateDataValidations.begin();
|
||||
it != mapActivateDataValidations.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"dataValidation")
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", it->second->activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
|
||||
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
|
||||
if (!it->second->formula1.empty())
|
||||
{
|
||||
CP_XML_NODE(L"formula1")
|
||||
{
|
||||
CP_XML_STREAM() << it->second->formula1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!it->second->formula2.empty())
|
||||
{
|
||||
CP_XML_NODE(L"formula2")
|
||||
{
|
||||
CP_XML_STREAM() << it->second->formula2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mapActivateDataValidations.clear();
|
||||
}
|
||||
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapDataValidations; //for all tables
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapActivateDataValidations; //in current table
|
||||
};
|
||||
|
||||
xlsx_dataValidations_context::xlsx_dataValidations_context() :
|
||||
impl_(new xlsx_dataValidations_context::Impl())
|
||||
{}
|
||||
|
||||
xlsx_dataValidations_context::~xlsx_dataValidations_context()
|
||||
{
|
||||
}
|
||||
void xlsx_dataValidations_context::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, const std::wstring & ref)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
|
||||
if (pFindActivate != impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
pFindActivate->second->activate_ref += L" " + ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind != impl_->mapDataValidations.end())
|
||||
{
|
||||
pFind->second->activate_ref = ref;
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showInputMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
{
|
||||
pFind->second->type = L"list";
|
||||
val = f.substr(24 + pos, f.size() - 25 - pos);
|
||||
|
||||
if ( val.substr(0, 1) == L"\"")
|
||||
{
|
||||
XmlUtils::replace_all(val, L"\"", L"");
|
||||
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
|
||||
if ( std::wstring::npos != val.find(L";") )//convert formula replacing ; on ,
|
||||
{
|
||||
pFind->second->formula1 = L"\"" + pFind->second->formula1 + L"\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
61
ASCOfficeOdfFile/src/docx/xlsx_data_validation.h
Normal file
61
ASCOfficeOdfFile/src/docx/xlsx_data_validation.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/CPScopedPtr.h>
|
||||
#include <string>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidations_context
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidations_context();
|
||||
~xlsx_dataValidations_context();
|
||||
|
||||
void add(const std::wstring & name, const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
|
||||
void activate(const std::wstring & name, const std::wstring & ref);
|
||||
|
||||
void serialize(std::wostream & _Wostream);
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@ -54,6 +54,8 @@ public:
|
||||
std::wstringstream sort_;
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
|
||||
@ -138,7 +140,14 @@ std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::picture_background()
|
||||
{
|
||||
return impl_->picture_background_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -178,6 +187,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_STREAM() << impl_->conditionalFormatting_.str();
|
||||
|
||||
CP_XML_STREAM() << impl_->dataValidations_.str();
|
||||
if (!impl_->hyperlinks_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"hyperlinks")
|
||||
@ -207,6 +217,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@ public:
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
|
||||
xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
|
||||
xlsx_comments_context & get_comments_context() { return xlsx_comments_context_; }
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() { return xlsx_conditionalFormatting_context_;}
|
||||
|
||||
void table_column_last_width(double w) { table_column_last_width_ = w; }
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
|
||||
@ -324,6 +324,10 @@ void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_data_validation(std::wostream & _Wostream)
|
||||
{
|
||||
return xlsx_conversion_context_->get_dataValidations_context().serialize(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_hyperlinks(_Wostream);
|
||||
|
||||
@ -91,6 +91,7 @@ public:
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -49,13 +49,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
void removeCharsFromString( std::wstring &str, std::wstring charsToRemove )
|
||||
{
|
||||
for ( unsigned int i = 0; i < charsToRemove.length(); ++i )
|
||||
{
|
||||
str.erase( std::remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
|
||||
}
|
||||
}
|
||||
|
||||
class xlsx_text_context::Impl: boost::noncopyable
|
||||
{
|
||||
|
||||
@ -437,6 +437,7 @@ void xlsx_conversion_context::end_table()
|
||||
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());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "xlsx_defined_names.h"
|
||||
#include "xlsx_table_metrics.h"
|
||||
#include "xlsx_pivots_context.h"
|
||||
#include "xlsx_data_validation.h"
|
||||
#include "oox_chart_context.h"
|
||||
|
||||
#include "mediaitems.h"
|
||||
@ -179,6 +180,7 @@ public:
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
@ -212,6 +214,7 @@ private:
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -41,9 +41,10 @@ std::wostream & operator << (std::wostream & _Wostream, const chart_data_label_n
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case chart_data_label_number::none: _Wostream << L"none"; break;
|
||||
case chart_data_label_number::value: _Wostream << L"value"; break;
|
||||
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
|
||||
case chart_data_label_number::none: _Wostream << L"none"; break;
|
||||
case chart_data_label_number::value: _Wostream << L"value"; break;
|
||||
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
|
||||
case chart_data_label_number::value_and_percentage: _Wostream << L"value-and-percentage"; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -59,9 +60,10 @@ chart_data_label_number chart_data_label_number::parse(const std::wstring & Str)
|
||||
return chart_data_label_number( value );
|
||||
else if (tmp == L"percentage")
|
||||
return chart_data_label_number( percentage );
|
||||
else
|
||||
else if (tmp == L"value-and-percentage")
|
||||
return chart_data_label_number( value_and_percentage );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_data_label_number( none );
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,8 @@ public:
|
||||
{
|
||||
none,
|
||||
value,
|
||||
percentage
|
||||
percentage,
|
||||
value_and_percentage
|
||||
};
|
||||
|
||||
chart_data_label_number() {}
|
||||
|
||||
@ -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 )
|
||||
{
|
||||
|
||||
@ -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_;
|
||||
};
|
||||
|
||||
|
||||
@ -233,6 +233,14 @@ enum ElementType
|
||||
typeTableDatabaseRange,
|
||||
typeTableSort,
|
||||
typeTableSortBy,
|
||||
typeTableCalculationSettings,
|
||||
typeTableNullDate,
|
||||
typeTableShapes,
|
||||
typeTableContentValidation,
|
||||
typeTableContentValidations,
|
||||
typeTableHelpMassage,
|
||||
typeTableErrorMassage,
|
||||
typeTableErrorMacro,
|
||||
|
||||
typeTableFilter,
|
||||
typeTableFilterAnd,
|
||||
@ -411,9 +419,6 @@ enum ElementType
|
||||
|
||||
typeScriptEventListener,
|
||||
|
||||
typeTableCalculationSettings,
|
||||
typeTableNullDate,
|
||||
|
||||
typeNumberNumberStyle,
|
||||
typeNumberDataStyle,
|
||||
typeNumberText,
|
||||
@ -436,7 +441,6 @@ enum ElementType
|
||||
typeNumberMinutes,
|
||||
typeNumberSeconds,
|
||||
typeNumberAmPm,
|
||||
typeTableShapes,
|
||||
|
||||
typeChartChart,
|
||||
typeChartTitle,
|
||||
|
||||
@ -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_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -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_);
|
||||
}
|
||||
@ -88,6 +92,9 @@ void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (database_ranges_)
|
||||
database_ranges_->xlsx_convert(Context);
|
||||
|
||||
if (content_validations_)
|
||||
content_validations_->xlsx_convert(Context);
|
||||
|
||||
if (data_pilot_tables_)
|
||||
data_pilot_tables_->xlsx_convert(Context);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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_);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -53,7 +53,7 @@ namespace odf_reader {
|
||||
|
||||
void removeCharsFromString( std::wstring &str, std::wstring charsToRemove )
|
||||
{
|
||||
for ( unsigned int i = 0; i < charsToRemove.length(); ++i )
|
||||
for ( size_t i = 0; i < charsToRemove.length(); ++i )
|
||||
{
|
||||
str.erase( std::remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
|
||||
}
|
||||
@ -292,14 +292,14 @@ void text_format_properties_content::pptx_convert_as_list(oox::pptx_conversion_c
|
||||
w_font = font->name();
|
||||
|
||||
//'Arial' глючит
|
||||
removeCharsFromString(w_font, _T("'"));
|
||||
removeCharsFromString(w_font, L"'");
|
||||
}
|
||||
|
||||
if (w_font.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"a:buFont")
|
||||
{
|
||||
removeCharsFromString(w_font, _T("'"));
|
||||
removeCharsFromString(w_font, L"'");
|
||||
CP_XML_ATTR(L"typeface", w_font);
|
||||
if ((style_font_charset_))
|
||||
{
|
||||
|
||||
@ -728,7 +728,61 @@ 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::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::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_);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:content-validation
|
||||
const wchar_t * table_error_message::ns = L"table";
|
||||
const wchar_t * table_error_message::name = L"error-message";
|
||||
|
||||
void table_error_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:title", table_title_);
|
||||
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
}
|
||||
void table_error_message::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_help_message::ns = L"table";
|
||||
const wchar_t * table_help_message::name = L"help-message";
|
||||
|
||||
void table_help_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:title", table_title_);
|
||||
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
}
|
||||
void table_help_message::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,105 @@ 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 xlsx_convert(oox::xlsx_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 xlsx_convert(oox::xlsx_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);
|
||||
|
||||
//table:error-message
|
||||
class table_error_message : public office_element_impl<table_error_message>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableErrorMassage;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_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_title_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(std::wstring) table_message_type_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_error_message);
|
||||
|
||||
//table:help-message
|
||||
class table_help_message : public office_element_impl<table_help_message>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableHelpMassage;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_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_title_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(std::wstring) table_message_type_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_help_message);
|
||||
|
||||
//table:error-macro
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -837,15 +839,20 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
|
||||
if (skip_next_cell)break;
|
||||
|
||||
// пустые ячейки пропускаем.
|
||||
|
||||
// пустые ячейки пропускаем.
|
||||
if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible))
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
std::wstring ref = oox::getCellAddress(Context.current_table_column(), Context.current_table_row());
|
||||
if (attlist_.table_content_validation_name_)
|
||||
{
|
||||
Context.get_dataValidations_context().activate(*attlist_.table_content_validation_name_, ref);
|
||||
}
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"c")
|
||||
{
|
||||
CP_XML_ATTR(L"r", oox::getCellAddress(Context.current_table_column(), Context.current_table_row()));
|
||||
CP_XML_ATTR(L"r", ref);
|
||||
CP_XML_ATTR(L"t", oox::cellType2Str(t_val));
|
||||
CP_XML_ATTR(L"s", xfId_last_set);
|
||||
|
||||
@ -887,6 +894,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
|
||||
}
|
||||
|
||||
}
|
||||
if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
|
||||
{
|
||||
@ -1179,5 +1187,38 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
}
|
||||
}
|
||||
|
||||
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_validation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
std::wstring name = table_name_.get_value_or(L"");
|
||||
|
||||
Context.get_dataValidations_context().add(name, table_base_cell_address_.get_value_or(L""));
|
||||
Context.get_dataValidations_context().add_formula(name, table_condition_.get_value_or(L""));
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_error_msg(name, true);
|
||||
}
|
||||
else if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_help_msg(name, true);
|
||||
}
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
void table_error_message::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
void table_help_message::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,6 +642,14 @@
|
||||
RelativePath="..\src\docx\xlsx_conditionalFormatting.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_data_validation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_data_validation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_defined_names.cpp"
|
||||
>
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -1280,6 +1280,14 @@ namespace NSBinPptxRW
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::WritePresentationComments(int nComment)
|
||||
{
|
||||
std::wstring strRels = L"<Relationship Id=\"rId" + std::to_wstring( m_lNextRelsID++ ) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\" Target=\"comments/comment" +
|
||||
std::to_wstring(nComment) + L".xml\"/>";
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject, bool bIsJsaProject)
|
||||
{
|
||||
if (bIsNotesMaster)
|
||||
|
||||
@ -424,6 +424,7 @@ namespace NSBinPptxRW
|
||||
void WriteThemes (int nCount);
|
||||
void WriteSlides (int nCount);
|
||||
void WriteSlideComments (int nComment);
|
||||
void WritePresentationComments (int nComment);
|
||||
int WriteChart (int nChartNumber, _INT32 lDocType);
|
||||
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
|
||||
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
#include "Converter.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
|
||||
#include "DefaultNotesMaster.h"
|
||||
#include "DefaultNotesTheme.h"
|
||||
@ -823,6 +822,24 @@ namespace NSBinPptxRW
|
||||
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
|
||||
++nCurrentRels;
|
||||
}
|
||||
if (m_oPresentation.comments.is_init())
|
||||
{
|
||||
m_oReader.m_pRels->WritePresentationComments(nComment);
|
||||
OOX::CPath pathFolderCommentDir = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("comments");
|
||||
if (1 == nComment)
|
||||
{
|
||||
NSDirectory::CreateDirectory (pathFolderCommentDir.GetPath());
|
||||
}
|
||||
std::wstring strCommentFile = L"comment" + std::to_wstring(nComment) + L".xml";
|
||||
|
||||
oXmlWriter.ClearNoAttack();
|
||||
m_oPresentation.comments->toXmlWriter(&oXmlWriter);
|
||||
|
||||
OOX::CPath pathComment = pathFolderCommentDir + FILE_SEPARATOR_STR + strCommentFile;
|
||||
oXmlWriter.SaveToFile(pathComment.GetPath());
|
||||
|
||||
++nComment;
|
||||
}
|
||||
|
||||
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
|
||||
m_oReader.m_pRels->CloseRels();
|
||||
@ -1012,11 +1029,12 @@ namespace NSBinPptxRW
|
||||
{
|
||||
m_oApp.TotalTime = 0;
|
||||
m_oApp.Words = 0;
|
||||
m_oApp.Application = L"OnlyOffice";
|
||||
std::wstring sApplication = L"ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
m_oApp.AppVersion = std::wstring(s.begin(), s.end());
|
||||
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();
|
||||
@ -1058,7 +1076,6 @@ namespace NSBinPptxRW
|
||||
m_oApp.LinksUpToDate = false;
|
||||
m_oApp.SharedDoc = false;
|
||||
m_oApp.HyperlinksChanged = false;
|
||||
m_oApp.AppVersion = _T("3.0000");
|
||||
}
|
||||
void CreateDefaultCore()
|
||||
{
|
||||
|
||||
@ -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>();
|
||||
|
||||
@ -85,6 +85,7 @@ namespace PPTX
|
||||
{
|
||||
_presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>();
|
||||
}
|
||||
_presentation->comments = _presentation->Get(OOX::Presentation::FileTypes::SlideComments).smart_dynamic_cast<PPTX::Comments>();
|
||||
}
|
||||
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
|
||||
|
||||
@ -385,7 +385,7 @@ namespace PPTX
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
@ -440,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();
|
||||
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "Logic/ClrMap.h"
|
||||
#include "Logic/ExtP.h"
|
||||
#include "Theme/ClrScheme.h"
|
||||
#include "Comments.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
@ -235,6 +236,7 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
pWriter->WriteRecord2(9, m_pJsaProject);
|
||||
pWriter->WriteRecord2(10, comments);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
@ -362,6 +364,11 @@ namespace PPTX
|
||||
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
}break;
|
||||
case 10:
|
||||
{
|
||||
comments = new PPTX::Comments(OOX::File::m_pMainDocument);
|
||||
comments->fromPPTY(pReader);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
@ -479,6 +486,7 @@ namespace PPTX
|
||||
bool m_bMacroEnabled;
|
||||
smart_ptr<OOX::VbaProject> m_pVbaProject;
|
||||
smart_ptr<OOX::JsaProject> m_pJsaProject;
|
||||
smart_ptr<PPTX::Comments> comments;
|
||||
|
||||
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;}
|
||||
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;}
|
||||
|
||||
@ -147,7 +147,7 @@ bool OOXWriter::SaveByItemEnd()
|
||||
|
||||
if (m_poDocPropsApp)
|
||||
{
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" );
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"ONLYOFFICE" );
|
||||
#if defined(INTVER)
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( VALUE2STR(INTVER) );
|
||||
#endif
|
||||
|
||||
@ -218,7 +218,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -231,6 +231,7 @@ HEADERS += docxformatlib.h \
|
||||
../Source/XlsxFormat/SimpleTypes_Spreadsheet.h \
|
||||
../Source/XlsxFormat/Workbook.h \
|
||||
../Source/XlsxFormat/WritingElement.h \
|
||||
../Source/DocxFormat/WorkbookComments.h \
|
||||
../Source/XlsxFormat/Xlsx.h \
|
||||
../Source/XML/Utils.h \
|
||||
../Source/XML/XmlSimple.h \
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -39,9 +39,6 @@
|
||||
#include "../Common/SimpleTypes_Word.h"
|
||||
#include "../Common/SimpleTypes_Shared.h"
|
||||
|
||||
#define VALUE_TO_STRING(x) #x
|
||||
#define VALUE2STR(x) VALUE_TO_STRING(x)
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class CApp : public OOX::File
|
||||
@ -195,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() )
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "Workbook/Workbook.h"
|
||||
#include "Worksheets/Worksheet.h"
|
||||
#include "CalcChain/CalcChain.h"
|
||||
#include "WorkbookComments.h"
|
||||
|
||||
#include "Table/Table.h"
|
||||
#include "ExternalLinks/ExternalLinks.h"
|
||||
@ -90,6 +91,8 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CChartSpace( pMain, oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == OOX::FileTypes::ExternalLinkPath)
|
||||
return smart_ptr<OOX::File>(new ExternalLinkPath( pMain, oRelation.Target()));
|
||||
else if ( oRelation.Type() == FileTypes::WorkbookComments)
|
||||
return smart_ptr<OOX::File>(new WorkbookComments( pMain, oRootPath, oFileName));
|
||||
//common
|
||||
//else if ( oRelation.Type() == OOX::FileTypes::VmlDrawing )
|
||||
// return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
|
||||
@ -184,6 +187,8 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::ActiveX_bin)
|
||||
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::WorkbookComments)
|
||||
return smart_ptr<OOX::File>(new WorkbookComments( pMain, oRootPath, oFileName));
|
||||
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile(pMain) );
|
||||
}
|
||||
|
||||
@ -97,6 +97,11 @@ namespace OOX
|
||||
const FileType PivotCacheRecords(L"", L"pivotCacheRecords.xml",
|
||||
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords"), true, true);
|
||||
|
||||
//onlyoffice workbook comments
|
||||
const FileType WorkbookComments(L"", L"workbookComments.bin",
|
||||
_T(""),
|
||||
_T("http://schemas.onlyoffice.com/workbookComments"));
|
||||
|
||||
|
||||
} // namespace FileTypes
|
||||
|
||||
89
Common/DocxFormat/Source/XlsxFormat/WorkbookComments.h
Normal file
89
Common/DocxFormat/Source/XlsxFormat/WorkbookComments.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_ONLY_WORKBOOK_COMMENTS_INCLUDE_H_
|
||||
#define OOX_ONLY_WORKBOOK_COMMENTS_INCLUDE_H_
|
||||
|
||||
#include "CommonInclude.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class WorkbookComments : public OOX::File, public IFileContainer
|
||||
{
|
||||
public:
|
||||
WorkbookComments(OOX::Document* pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
}
|
||||
WorkbookComments(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
|
||||
{
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
virtual ~WorkbookComments()
|
||||
{
|
||||
}
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
CPath oRootPath;
|
||||
read(oRootPath, oPath);
|
||||
}
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_oReadPath = oPath;
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
}
|
||||
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
}
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return Spreadsheet::FileTypes::WorkbookComments;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
CPath m_oReadPath;
|
||||
};
|
||||
}
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_ONLY_WORKBOOK_COMMENTS_INCLUDE_H_
|
||||
@ -118,7 +118,7 @@ bool OOX::Spreadsheet::CXlsx::Write(const CPath& oDirPath, OOX::CContentTypes &o
|
||||
//CApp
|
||||
OOX::CApp* pApp = new OOX::CApp(this);
|
||||
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
VERSION = 2.4.510.0
|
||||
VERSION = 2.4.511.0
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
# CONFIGURATION
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -249,7 +249,7 @@ namespace NSStringUtils
|
||||
|
||||
public:
|
||||
|
||||
inline void SetText(const std::wstring& bsText)
|
||||
inline void SetText(const std::wstring& bsText)
|
||||
{
|
||||
ClearNoAttack();
|
||||
WriteString(bsText);
|
||||
@ -261,6 +261,11 @@ namespace NSStringUtils
|
||||
}
|
||||
}
|
||||
|
||||
inline void operator+=(const std::wstring& oTemp)
|
||||
{
|
||||
WriteString(oTemp.c_str(), oTemp.length());
|
||||
}
|
||||
|
||||
inline void WriteStringNoSafe(const wchar_t* pString, size_t nLen)
|
||||
{
|
||||
memcpy(m_pDataCur, pString, nLen * sizeof(wchar_t));
|
||||
|
||||
@ -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 );
|
||||
}
|
||||
//
|
||||
|
||||
@ -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
|
||||
|
||||
@ -152,6 +152,177 @@ namespace NSCommon
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CSymbolSimpleChecker : public CApplicationFontsSymbolsChecker
|
||||
{
|
||||
public:
|
||||
int m_nMaxSymbols;
|
||||
int* m_pSymbols;
|
||||
int m_nPriority;
|
||||
|
||||
public:
|
||||
CSymbolSimpleChecker()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Check(const int& nCode, const unsigned int& nIndex)
|
||||
{
|
||||
if (nCode > m_nMaxSymbols)
|
||||
return;
|
||||
|
||||
if (m_pSymbols[nCode] == 0)
|
||||
m_pSymbols[nCode] = m_nPriority;
|
||||
else if (m_pSymbols[nCode] > m_nPriority)
|
||||
m_pSymbols[nCode] = m_nPriority;
|
||||
}
|
||||
|
||||
~CSymbolSimpleChecker()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class CSymbolSimpleChecker2 : public CApplicationFontsSymbolsChecker
|
||||
{
|
||||
public:
|
||||
int m_nMaxSymbols;
|
||||
int* m_pSymbols;
|
||||
int m_nPriority;
|
||||
|
||||
int m_nStyle;
|
||||
BYTE* m_pTmpSymbols;
|
||||
int m_nMin;
|
||||
int m_nMax;
|
||||
|
||||
public:
|
||||
CSymbolSimpleChecker2(int* pSymbols, int nMax)
|
||||
{
|
||||
m_pSymbols = pSymbols;
|
||||
m_nMaxSymbols = nMax;
|
||||
|
||||
m_pTmpSymbols = new BYTE[m_nMaxSymbols + 1];
|
||||
memset(m_pTmpSymbols, 0, (m_nMaxSymbols + 1) * sizeof(BYTE));
|
||||
|
||||
m_nMin = m_nMaxSymbols + 1;
|
||||
m_nMax = -1;
|
||||
|
||||
m_nStyle = 0;
|
||||
}
|
||||
|
||||
void Apply1(int nMask)
|
||||
{
|
||||
BYTE* tmp = m_pTmpSymbols + m_nMin;
|
||||
for (int i = m_nMin; i <= m_nMax; ++i, ++tmp)
|
||||
{
|
||||
if (nMask == *tmp)
|
||||
{
|
||||
if (m_pSymbols[i] == 0)
|
||||
m_pSymbols[i] = m_nPriority;
|
||||
else if (m_pSymbols[i] > m_nPriority)
|
||||
m_pSymbols[i] = m_nPriority;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_nMax >= m_nMin)
|
||||
memset(m_pTmpSymbols, 0, (m_nMax - m_nMin) * sizeof(BYTE));
|
||||
|
||||
m_nMin = m_nMaxSymbols + 1;
|
||||
m_nMax = -1;
|
||||
}
|
||||
|
||||
void Apply2(int nMask, int nSumPriority)
|
||||
{
|
||||
int nSmallRangeLen = 10;
|
||||
int nSmallRangeLenCJK = 30;
|
||||
|
||||
BYTE* tmp = m_pTmpSymbols + m_nMin;
|
||||
BYTE* tmpLast = m_pTmpSymbols + m_nMax + 1;
|
||||
BYTE* tmpFirst = NULL;
|
||||
int* pSymbols = NULL;
|
||||
int* pSymbolsLast = NULL;
|
||||
int nPriority = 0;
|
||||
int nFirstOffset = 0;
|
||||
|
||||
while (tmp < tmpLast)
|
||||
{
|
||||
if (nMask != *tmp)
|
||||
{
|
||||
++tmp;
|
||||
continue;
|
||||
}
|
||||
|
||||
tmpFirst = tmp;
|
||||
int nCount = 1;
|
||||
++tmp;
|
||||
|
||||
while (nMask == *tmp && tmp < tmpLast)
|
||||
{
|
||||
++tmp;
|
||||
nCount++;
|
||||
}
|
||||
|
||||
nFirstOffset = (int)(tmpFirst - m_pTmpSymbols);
|
||||
|
||||
pSymbols = m_pSymbols + nFirstOffset;
|
||||
pSymbolsLast = pSymbols + nCount + 1;
|
||||
|
||||
if (nFirstOffset > 0x4DFF && nFirstOffset < 0x9FFF)
|
||||
nPriority = (nCount > nSmallRangeLenCJK) ? m_nPriority : (m_nPriority + nSumPriority);
|
||||
else
|
||||
nPriority = (nCount > nSmallRangeLen) ? m_nPriority : (m_nPriority + nSumPriority);
|
||||
|
||||
while (pSymbols < pSymbolsLast)
|
||||
{
|
||||
if (*pSymbols == 0)
|
||||
*pSymbols = nPriority;
|
||||
else if (*pSymbols > nPriority)
|
||||
*pSymbols = nPriority;
|
||||
|
||||
++pSymbols;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_nMax >= m_nMin)
|
||||
memset(m_pTmpSymbols, 0, (m_nMax - m_nMin) * sizeof(BYTE));
|
||||
|
||||
m_nMin = m_nMaxSymbols + 1;
|
||||
m_nMax = -1;
|
||||
}
|
||||
|
||||
virtual void Check(const int& nCode, const unsigned int& nIndex)
|
||||
{
|
||||
if (nCode > m_nMax)
|
||||
m_nMax = nCode;
|
||||
if (nCode < m_nMin)
|
||||
m_nMin = nCode;
|
||||
m_pTmpSymbols[nCode] |= m_nStyle;
|
||||
}
|
||||
|
||||
~CSymbolSimpleChecker2()
|
||||
{
|
||||
RELEASEARRAYOBJECTS(m_pTmpSymbols);
|
||||
}
|
||||
};
|
||||
|
||||
class CFontPriority
|
||||
{
|
||||
public:
|
||||
std::wstring name;
|
||||
int priority;
|
||||
|
||||
CFontPriority()
|
||||
{
|
||||
priority = 0;
|
||||
}
|
||||
|
||||
static bool Compare(const CFontPriority& p1, const CFontPriority& p2)
|
||||
{
|
||||
if (p1.priority != p2.priority)
|
||||
return (p1.priority < p2.priority) ? true : false;
|
||||
|
||||
return (p1.name < p2.name) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
static void SaveAllFontsJS(CApplicationFonts& applicationFonts, std::wstring strFile, std::wstring strFolderThumbnails, std::wstring strFontSelectionBin)
|
||||
{
|
||||
@ -474,30 +645,286 @@ namespace NSCommon
|
||||
delete [] pMassFiles;
|
||||
}
|
||||
|
||||
oWriterJS.WriteString(L"window[\"__fonts_infos\"] = [\n");
|
||||
|
||||
oWriterJS += L"window[\"__fonts_infos\"] = [\n";
|
||||
|
||||
std::map<std::wstring, int> mapFontIndexes;
|
||||
for (int index = 0; index < nCountFonts; ++index)
|
||||
{
|
||||
std::map<std::wstring, CFontInfoJS>::iterator pPair = mapFonts.find(arrFonts[index]);
|
||||
|
||||
char buffer[1000];
|
||||
sprintf(buffer, "\",%d,%d,%d,%d,%d,%d,%d,%d]", pPair->second.m_lIndexR, pPair->second.m_lFaceIndexR,
|
||||
pPair->second.m_lIndexI, pPair->second.m_lFaceIndexI,
|
||||
pPair->second.m_lIndexB, pPair->second.m_lFaceIndexB,
|
||||
pPair->second.m_lIndexBI, pPair->second.m_lFaceIndexBI);
|
||||
|
||||
std::string sBuffer(buffer);
|
||||
|
||||
oWriterJS.WriteString(L"[\"");
|
||||
oWriterJS.WriteString(pPair->second.m_sName);
|
||||
oWriterJS.WriteString(NSFile::CUtf8Converter::GetUnicodeFromCharPtr(sBuffer));
|
||||
|
||||
mapFontIndexes.insert(std::pair<std::wstring, int>(arrFonts[index], index));
|
||||
|
||||
oWriterJS += L"[\"";
|
||||
oWriterJS += pPair->second.m_sName;
|
||||
|
||||
oWriterJS.AddSize(120);
|
||||
oWriterJS.AddCharNoCheck('\"');
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lIndexR);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lFaceIndexR);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lIndexI);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lFaceIndexI);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lIndexB);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lFaceIndexB);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lIndexBI);
|
||||
oWriterJS.AddCharNoCheck(',');
|
||||
oWriterJS.AddIntNoCheck(pPair->second.m_lFaceIndexBI);
|
||||
|
||||
if (index != (nCountFonts - 1))
|
||||
oWriterJS.WriteString(L",\n");
|
||||
oWriterJS += (L"],\n");
|
||||
else
|
||||
oWriterJS.WriteString(L"\n");
|
||||
oWriterJS += (L"]\n");
|
||||
}
|
||||
oWriterJS += (L"];\n\n");
|
||||
|
||||
if (true)
|
||||
{
|
||||
//DWORD dwTime = NSTimers::GetTickCount();
|
||||
|
||||
int nMaxSymbol = 0x10FFFF;
|
||||
int* arSymbolsAll = new int[nMaxSymbol + 1];
|
||||
memset(arSymbolsAll, 0, (nMaxSymbol + 1) * sizeof(int));
|
||||
|
||||
CSymbolSimpleChecker2 oAllChecker(arSymbolsAll, nMaxSymbol);
|
||||
|
||||
std::map<std::wstring, int> mapFontsPriorityStandard;
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Arial", 1));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Times New Roman", 2));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Tahoma", 3));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Cambria", 4));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Calibri", 5));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Verdana", 6));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Georgia", 7));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Open Sans", 8));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Sans", 9));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Helvetica", 10));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nimbus Sans L", 11));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"DejaVu Sans", 12));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Serif", 13));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Trebuchet MS", 14));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Courier New", 15));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Carlito", 16));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Segoe UI", 17));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Gothic", 18));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimSun", 19));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nirmala UI", 20));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Batang", 21));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Mincho", 22));
|
||||
|
||||
CApplicationFontsSymbols oApplicationChecker;
|
||||
|
||||
std::vector<CFontPriority> arrFontsPriority;
|
||||
std::map<std::wstring, int> mapFontsPriority;
|
||||
for (int index = 0; index < nCountFonts; ++index)
|
||||
{
|
||||
std::map<std::wstring, CFontInfoJS>::iterator pPair = mapFonts.find(arrFonts[index]);
|
||||
CFontInfoJS& info = pPair->second;
|
||||
|
||||
std::map<std::wstring, int>::iterator find = mapFontsPriorityStandard.find(arrFonts[index]);
|
||||
|
||||
if (find != mapFontsPriorityStandard.end())
|
||||
{
|
||||
CFontPriority f;
|
||||
f.name = arrFonts[index];
|
||||
f.priority = find->second;
|
||||
arrFontsPriority.push_back(f);
|
||||
continue;
|
||||
}
|
||||
|
||||
int nSize = 0;
|
||||
if (-1 != info.m_lIndexR)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(mapFontFiles2[info.m_lIndexR]))
|
||||
{
|
||||
int nTmp = oFile.GetFileSize();
|
||||
if (nTmp > nSize)
|
||||
nSize = nTmp;
|
||||
}
|
||||
}
|
||||
if (-1 != info.m_lIndexB)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(mapFontFiles2[info.m_lIndexB]))
|
||||
{
|
||||
int nTmp = oFile.GetFileSize();
|
||||
if (nTmp > nSize)
|
||||
nSize = nTmp;
|
||||
}
|
||||
}
|
||||
if (-1 != info.m_lIndexI)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(mapFontFiles2[info.m_lIndexI]))
|
||||
{
|
||||
int nTmp = oFile.GetFileSize();
|
||||
if (nTmp > nSize)
|
||||
nSize = nTmp;
|
||||
}
|
||||
}
|
||||
if (-1 != info.m_lIndexBI)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(mapFontFiles2[info.m_lIndexBI]))
|
||||
{
|
||||
int nTmp = oFile.GetFileSize();
|
||||
if (nTmp > nSize)
|
||||
nSize = nTmp;
|
||||
}
|
||||
}
|
||||
|
||||
CFontPriority f;
|
||||
f.name = arrFonts[index];
|
||||
f.priority = nSize;
|
||||
arrFontsPriority.push_back(f);
|
||||
}
|
||||
|
||||
std::sort(arrFontsPriority.begin(), arrFontsPriority.end(), CFontPriority::Compare);
|
||||
|
||||
int nIndexPriority = 1;
|
||||
for (std::vector<CFontPriority>::iterator i = arrFontsPriority.begin(); i != arrFontsPriority.end(); i++)
|
||||
{
|
||||
CFontPriority& o = *i;
|
||||
mapFontsPriority.insert(std::pair<std::wstring, int>(o.name, nIndexPriority));
|
||||
nIndexPriority++;
|
||||
}
|
||||
|
||||
int nSumPriority = (int)(arrFontsPriority.size() + 1);
|
||||
|
||||
bool bIsSmallRangesDetect = true;
|
||||
for (int index = 0; index < nCountFonts; ++index)
|
||||
{
|
||||
std::map<std::wstring, CFontInfoJS>::iterator pPair = mapFonts.find(arrFonts[index]);
|
||||
CFontInfoJS& info = pPair->second;
|
||||
|
||||
int nPriority = mapFontsPriority.find(arrFonts[index])->second;
|
||||
oAllChecker.m_nPriority = nPriority;
|
||||
|
||||
int nCounterFonts = 0;
|
||||
if (-1 != info.m_lIndexR)
|
||||
nCounterFonts++;
|
||||
if (-1 != info.m_lIndexB)
|
||||
nCounterFonts++;
|
||||
if (-1 != info.m_lIndexI)
|
||||
nCounterFonts++;
|
||||
if (-1 != info.m_lIndexBI)
|
||||
nCounterFonts++;
|
||||
|
||||
if (1 == nCounterFonts && !bIsSmallRangesDetect)
|
||||
{
|
||||
std::wstring sPathC = L"";
|
||||
int nFaceIndexC = 0;
|
||||
if (-1 != info.m_lIndexR)
|
||||
{
|
||||
sPathC = mapFontFiles2[info.m_lIndexR];
|
||||
nFaceIndexC = info.m_lFaceIndexR;
|
||||
}
|
||||
else if (-1 != info.m_lIndexB)
|
||||
{
|
||||
sPathC = mapFontFiles2[info.m_lIndexB];
|
||||
nFaceIndexC = info.m_lFaceIndexB;
|
||||
}
|
||||
else if (-1 != info.m_lIndexI)
|
||||
{
|
||||
sPathC = mapFontFiles2[info.m_lIndexI];
|
||||
nFaceIndexC = info.m_lFaceIndexI;
|
||||
}
|
||||
else if (-1 != info.m_lIndexBI)
|
||||
{
|
||||
sPathC = mapFontFiles2[info.m_lIndexBI];
|
||||
nFaceIndexC = info.m_lFaceIndexBI;
|
||||
}
|
||||
|
||||
CSymbolSimpleChecker checker;
|
||||
checker.m_nMaxSymbols = nMaxSymbol;
|
||||
checker.m_pSymbols = arSymbolsAll;
|
||||
checker.m_nPriority = nPriority;
|
||||
oApplicationChecker.CheckSymbols(sPathC, nFaceIndexC, &checker);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nMask = 0;
|
||||
if (-1 != info.m_lIndexR)
|
||||
{
|
||||
oAllChecker.m_nStyle = 1;
|
||||
nMask |= 1;
|
||||
oApplicationChecker.CheckSymbols(mapFontFiles2[info.m_lIndexR], info.m_lFaceIndexR, &oAllChecker);
|
||||
}
|
||||
if (-1 != info.m_lIndexB)
|
||||
{
|
||||
oAllChecker.m_nStyle = 2;
|
||||
nMask |= 2;
|
||||
oApplicationChecker.CheckSymbols(mapFontFiles2[info.m_lIndexB], info.m_lFaceIndexB, &oAllChecker);
|
||||
}
|
||||
if (-1 != info.m_lIndexI)
|
||||
{
|
||||
oAllChecker.m_nStyle = 4;
|
||||
nMask |= 4;
|
||||
oApplicationChecker.CheckSymbols(mapFontFiles2[info.m_lIndexI], info.m_lFaceIndexI, &oAllChecker);
|
||||
}
|
||||
if (-1 != info.m_lIndexBI)
|
||||
{
|
||||
oAllChecker.m_nStyle = 8;
|
||||
nMask |= 8;
|
||||
oApplicationChecker.CheckSymbols(mapFontFiles2[info.m_lIndexBI], info.m_lFaceIndexBI, &oAllChecker);
|
||||
}
|
||||
|
||||
if (bIsSmallRangesDetect)
|
||||
oAllChecker.Apply2(nMask, nSumPriority);
|
||||
else
|
||||
oAllChecker.Apply1(nMask);
|
||||
}
|
||||
}
|
||||
|
||||
//dwTime = NSTimers::GetTickCount() - dwTime;
|
||||
|
||||
oWriterJS += L"window[\"__fonts_ranges\"] = [\n";
|
||||
|
||||
int nFontPriority = 0;
|
||||
int nFontPriorityStart = 0;
|
||||
int nTopBorder = nMaxSymbol + 1;
|
||||
for (int i = 0; i < nTopBorder; ++i)
|
||||
{
|
||||
int nFontPriorityTestSym = arSymbolsAll[i];
|
||||
int nFontPriorityTest = (nFontPriorityTestSym > nSumPriority) ? (nFontPriorityTestSym - nSumPriority) : nFontPriorityTestSym;
|
||||
|
||||
if (nFontPriority == nFontPriorityTest)
|
||||
continue;
|
||||
|
||||
if (nFontPriority != 0)
|
||||
{
|
||||
oWriterJS.AddInt(nFontPriorityStart);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
oWriterJS.AddInt(i - 1);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
oWriterJS.AddInt(mapFontIndexes.find(arrFontsPriority[nFontPriority - 1].name)->second);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
}
|
||||
nFontPriority = nFontPriorityTest;
|
||||
nFontPriorityStart = i;
|
||||
}
|
||||
|
||||
if (nFontPriority != 0)
|
||||
{
|
||||
oWriterJS.AddInt(nFontPriorityStart);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
oWriterJS.AddInt(nMaxSymbol - 1);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
oWriterJS.AddInt(mapFontIndexes.find(arrFontsPriority[nFontPriority - 1].name)->second);
|
||||
oWriterJS.AddCharSafe(',');
|
||||
}
|
||||
|
||||
oWriterJS.SetCurSize(oWriterJS.GetCurSize() - 1);
|
||||
|
||||
oWriterJS += (L"];\n\n");
|
||||
|
||||
delete[] arSymbolsAll;
|
||||
}
|
||||
oWriterJS.WriteString(L"];\n\n");
|
||||
|
||||
if (true)
|
||||
{
|
||||
|
||||
@ -158,7 +158,6 @@
|
||||
17A764F11B0F39370046BC0B /* textops.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D61B0F39370046BC0B /* textops.cpp */; };
|
||||
17A764F31B0F39370046BC0B /* tiffio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D71B0F39370046BC0B /* tiffio.cpp */; };
|
||||
17A764F51B0F39370046BC0B /* tiffiostub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D81B0F39370046BC0B /* tiffiostub.cpp */; };
|
||||
17A764F91B0F39370046BC0B /* viewfiles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DA1B0F39370046BC0B /* viewfiles.cpp */; };
|
||||
17A764FB1B0F39370046BC0B /* warper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DB1B0F39370046BC0B /* warper.cpp */; };
|
||||
17A764FD1B0F39370046BC0B /* watershed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DC1B0F39370046BC0B /* watershed.cpp */; };
|
||||
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DE1B0F39370046BC0B /* webpio.cpp */; };
|
||||
@ -394,7 +393,6 @@
|
||||
17A763D61B0F39370046BC0B /* textops.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = textops.cpp; sourceTree = "<group>"; };
|
||||
17A763D71B0F39370046BC0B /* tiffio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tiffio.cpp; sourceTree = "<group>"; };
|
||||
17A763D81B0F39370046BC0B /* tiffiostub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tiffiostub.cpp; sourceTree = "<group>"; };
|
||||
17A763DA1B0F39370046BC0B /* viewfiles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = viewfiles.cpp; sourceTree = "<group>"; };
|
||||
17A763DB1B0F39370046BC0B /* warper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = warper.cpp; sourceTree = "<group>"; };
|
||||
17A763DC1B0F39370046BC0B /* watershed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = watershed.cpp; sourceTree = "<group>"; };
|
||||
17A763DD1B0F39370046BC0B /* watershed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = watershed.h; sourceTree = "<group>"; };
|
||||
@ -730,7 +728,6 @@
|
||||
17A763D61B0F39370046BC0B /* textops.cpp */,
|
||||
17A763D71B0F39370046BC0B /* tiffio.cpp */,
|
||||
17A763D81B0F39370046BC0B /* tiffiostub.cpp */,
|
||||
17A763DA1B0F39370046BC0B /* viewfiles.cpp */,
|
||||
17A763DB1B0F39370046BC0B /* warper.cpp */,
|
||||
17A763DC1B0F39370046BC0B /* watershed.cpp */,
|
||||
17A763DD1B0F39370046BC0B /* watershed.h */,
|
||||
@ -903,7 +900,6 @@
|
||||
17A7649B1B0F39370046BC0B /* pixcomp.cpp in Sources */,
|
||||
17A764171B0F39370046BC0B /* colorcontent.cpp in Sources */,
|
||||
17A764671B0F39370046BC0B /* jpegiostub.cpp in Sources */,
|
||||
17A764F91B0F39370046BC0B /* viewfiles.cpp in Sources */,
|
||||
17A764AD1B0F39370046BC0B /* psio1stub.cpp in Sources */,
|
||||
17A764CD1B0F39370046BC0B /* rotateamlow.cpp in Sources */,
|
||||
17A763F31B0F39370046BC0B /* bbuffer.cpp in Sources */,
|
||||
|
||||
@ -193,7 +193,8 @@ namespace BinXlsxRW
|
||||
OleLink = 10,
|
||||
DdeLink = 11,
|
||||
VbaProject = 12,
|
||||
JsaProject = 13
|
||||
JsaProject = 13,
|
||||
Comments = 14
|
||||
};}
|
||||
namespace c_oSerWorkbookVbaProjectTypes{enum c_oSerWorkbookVbaProjectTypes
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#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/OfficeFileFormats.h"
|
||||
#include "../../Common/Base64.h"
|
||||
|
||||
@ -1550,6 +1551,20 @@ namespace BinXlsxRW
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
//Workbook Comments
|
||||
smart_ptr<OOX::File> fileWorkbookComments = workbook.Get(OOX::Spreadsheet::FileTypes::WorkbookComments);
|
||||
if (fileWorkbookComments.IsInit() && OOX::Spreadsheet::FileTypes::WorkbookComments == fileWorkbookComments->type())
|
||||
{
|
||||
smart_ptr<OOX::Spreadsheet::WorkbookComments> workbookComments = fileWorkbookComments.smart_dynamic_cast<OOX::Spreadsheet::WorkbookComments>();
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if(NSFile::CFileBinary::ReadAllBytes(workbookComments->m_oReadPath.GetPath(), &pData, nBytesCount))
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::Comments);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteWorkbookPr(const OOX::Spreadsheet::CWorkbookPr& workbookPr)
|
||||
{
|
||||
|
||||
@ -64,6 +64,7 @@
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/WorkbookComments.h"
|
||||
|
||||
namespace BinXlsxRW
|
||||
{
|
||||
@ -1592,6 +1593,22 @@ namespace BinXlsxRW
|
||||
m_oWorkbook.Add(oFileJsaProjectFile);
|
||||
m_pOfficeDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(oJsaProject.GetExtention(false));
|
||||
}
|
||||
else if(c_oSerWorkbookTypes::Comments == type)
|
||||
{
|
||||
BYTE* pData = m_oBufferedStream.GetPointer(length);
|
||||
OOX::CPath oWorkbookComments = OOX::Spreadsheet::FileTypes::WorkbookComments.DefaultFileName();
|
||||
std::wstring filePath = m_sDestinationDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + oWorkbookComments.GetPath();
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath);
|
||||
oFile.WriteFile(pData, length);
|
||||
oFile.CloseFile();
|
||||
|
||||
smart_ptr<OOX::Spreadsheet::WorkbookComments> oFileWorkbookComments(new OOX::Spreadsheet::WorkbookComments(NULL));
|
||||
smart_ptr<OOX::File> oFileWorkbookCommentsFile = oFileWorkbookComments.smart_dynamic_cast<OOX::File>();
|
||||
m_oWorkbook.Add(oFileWorkbookCommentsFile);
|
||||
m_pOfficeDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(oWorkbookComments.GetExtention(false));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user