Compare commits

..

30 Commits

Author SHA1 Message Date
97b4311e95 . 2018-01-26 19:18:41 +03:00
228b3a52e9 . 2018-01-26 17:55:04 +03:00
2f2236646d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - data validation (type dropdown list)
  no squares
  fix previous commit
  font by symbol table
2018-01-26 17:08:57 +03:00
30603d0561 build fixed 2018-01-26 17:08:51 +03:00
933af771b7 OdfFormatReader - data validation (type dropdown list) 2018-01-26 14:45:24 +03:00
c04a537d69 no squares 2018-01-26 13:55:24 +03:00
e49d78db47 fix previous commit 2018-01-26 11:39:56 +03:00
99ec420ee5 font by symbol table 2018-01-26 11:36:19 +03:00
f764b034a1 . 2018-01-25 18:33:12 +03:00
73fe023460 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-25 18:26:55 +03:00
242af3c80e . 2018-01-25 18:26:14 +03:00
7756e4b8bd . 2018-01-25 18:17:46 +03:00
56a1d1f627 x2t -fix appVersion 2018-01-25 18:16:15 +03:00
11bd4ff61d . 2018-01-25 17:20:56 +03:00
93a06d7f86 . 2018-01-25 17:18:40 +03:00
76d2d429b7 x2t version 2.4.511 2018-01-25 17:07:43 +03:00
c6de37dbad . 2018-01-25 17:02:31 +03:00
d022e669f0 . 2018-01-25 15:57:17 +03:00
184e79bae1 . 2018-01-25 15:52:14 +03:00
e6581671c8 . 2018-01-25 15:27:06 +03:00
e0a1c688bf . 2018-01-24 19:28:04 +03:00
9e0b301179 write verion x2t to converted files 2018-01-24 18:25:23 +03:00
8680fb2e0e . 2018-01-24 15:45:10 +03:00
c7c605a970 fix bug #31327
convert script text in toggle property in simple text
2018-01-23 19:34:07 +03:00
23d648d92d fix bug #36409 2018-01-23 16:53:40 +03:00
b098c98dbb x2t version 2.4.510 2018-01-23 16:23:09 +03:00
b88726beaf fix bug #36514 2018-01-23 14:09:55 +03:00
b2d3e5e194 . 2018-01-22 19:21:57 +03:00
a8315efae0 . 2018-01-22 18:26:40 +03:00
3781cf6774 . 2018-01-22 17:45:21 +03:00
76 changed files with 3388 additions and 1762 deletions

View File

@ -69,8 +69,13 @@ namespace OpenXmlContentTypes
static const wchar_t* Tiff = L"image/tiff";
static const wchar_t* Wmf = L"image/x-wmf";
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
@ -136,7 +141,7 @@ namespace OpenXmlNamespaces
namespace OpenXmlRelationshipTypes
{
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";

View File

@ -110,6 +110,11 @@ namespace DocFileFormat
unused2 = Reader->ReadByte();
unused3 = Reader->ReadByte();
if (btMacOS != btWin32)
{
btWin32 = btMacOS = (Global::BlipType)this->Instance;
}
if (BodySize > 0x24)
{
Blip = RecordFactory::ReadRecord(Reader, 0);

View File

@ -192,14 +192,14 @@ public:
{
if (!bIsCompressed)
{
m_pMetaFile = pCompress;
m_lMetaFileSize = lUncompressSize;
m_pMetaFile = new BYTE[lCompressSize];
m_lMetaFileSize = lCompressSize;
memcpy(m_pMetaFile, pCompress, lCompressSize);
}
else
{
ULONG lSize = lUncompressSize;
m_pMetaFile = new BYTE[lUncompressSize];
//bool bRes = NSZLib::Decompress(pCompress, (ULONG)lCompressSize, m_pMetaFile, lSize);
HRESULT res = S_OK;
COfficeUtils* pOfficeUtils = new COfficeUtils(NULL);
@ -340,6 +340,8 @@ typedef enum _BlipCompression
if (typeCode == 0xf01b)
{
oMetaFile.m_sExtension = L".wmf";
WmfPlaceableFileHeader oWmfHeader = {};
oMetaHeader.ToWMFHeader(&oWmfHeader);
@ -349,24 +351,12 @@ typedef enum _BlipCompression
oMetaFile.SetHeader(pMetaHeader, lLenHeader);
}
if (typeCode == 0xf01c)
{
oMetaFile.m_sExtension = L".pcz";
//decompress???
}
oMetaFile.SetData(m_pvBits, oMetaHeader.cbSave, oMetaHeader.cbSize, 0 == oMetaHeader.compression);
//if (pos < sz)
//{
// NSFile::CFileBinary oFile;
// if (oFile.CreateFile(L"d:\\blop.dat"))
// {
// BYTE * d = Reader->ReadBytes( sz - pos, true );
// if (d)
// {
// oFile.WriteFile (d, sz - pos);
// delete []d;
// oFile.CloseFile();
// }
// }
//}
}
virtual ~MetafilePictBlip()

View File

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

View File

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

View File

@ -500,6 +500,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(oBlipEntry->Blip);
if (metaBlip)
@ -567,6 +568,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(L".wmf");
case Global::msoblipPICT:
return std::wstring(L".pcz");
default:
return std::wstring(L".png");
}
@ -601,6 +605,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(OpenXmlContentTypes::Wmf);
case Global::msoblipPICT:
return std::wstring(OpenXmlContentTypes::Pcz);
case Global::msoblipDIB:
return std::wstring(OpenXmlContentTypes::Bmp);

View File

@ -1287,6 +1287,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
//it's a meta image
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(RecordFactory::ReadRecord(&reader, 0));
@ -1373,6 +1374,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring( L".wmf" );
case Global::msoblipPICT:
return std::wstring( L".pcz" );
default:
return std::wstring( L".png" );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View 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);
}
}
}
}
}

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,8 @@ public:
{
none,
value,
percentage
percentage,
value_and_percentage
};
chart_data_label_number() {}

View File

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

View File

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

View File

@ -233,6 +233,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,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -653,6 +653,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_table);
//table:content-shapes
class table_shapes : public office_element_impl<table_shapes>
{
public:
@ -676,5 +677,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
}
}

View File

@ -803,11 +803,13 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
if ( content_.elements_.size() > 0 ||
!formula.empty() ||
if ( content_.elements_.size() > 0 || attlist_.table_content_validation_name_ || !formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
( t_val == oox::XlsxCellType::b && bool_val) ||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val))
{
is_data_visible = true;
}
if (attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
@ -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)
{
}
}
}

View File

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

View File

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

View File

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

View File

@ -247,7 +247,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
else if ((pCF->FontProperties.is_init()) && (!pCF->FontProperties->strFontName.empty()))
{
oWriter.WriteString(L"<a:latin typeface=\"" + pCF->FontProperties->strFontName + L"\"/>");
}
}
if (pCF->FontPropertiesEA.is_init())
{
oWriter.WriteString(L"<a:ea typeface=\"" + pCF->FontPropertiesEA->strFontName + L"\"/>");
@ -1172,13 +1172,11 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
if (0 == pCF->Typeface.get())
{
std::wstring strProp = _T("<a:latin typeface=\"+mj-lt\"/>");
m_oWriter.WriteString(strProp);
m_oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
}
else
{
std::wstring strProp = _T("<a:latin typeface=\"+mn-lt\"/>");
m_oWriter.WriteString(strProp);
m_oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
}
}
else if (pCF->FontProperties.is_init())

View File

@ -1002,11 +1002,12 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
CElementPtr pElement = oArrayShapes[nShape]->GetElement(&m_oExMedia, pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight,
pTheme, pLayout, pThemeWrapper, pSlideWrapper, pSlide);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pElement)
{
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor && !bMasterBackGround)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
pShape->SetupProperties(pSlide, pTheme, pLayout);
@ -1019,6 +1020,9 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
}else
AddAnimation ( dwSlideID, pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight, pElement );
if (NULL != pShape)
pShape->SetupProperties(pSlide, pTheme, pLayout);
if (pElement->m_bHaveAnchor)
{
pSlide->m_arElements.push_back(pElement);

View File

@ -803,11 +803,11 @@ HRESULT CElementProps::GetProperty(LONG lId, ASC_VARIANT* pProp)
if (NULL == pProp)
return S_FALSE;
std::map<LONG, ASC_VARIANT>::iterator pPair = m_Properties.find(lId);
if (m_Properties.end() == pPair)
std::map<LONG, ASC_VARIANT>::iterator pFind = m_Properties.find(lId);
if (m_Properties.end() == pFind)
return S_FALSE;
bool bIsSupportProp = CopyProperty(*pProp, pPair->second);
bool bIsSupportProp = CopyProperty(*pProp, pFind->second);
if (!bIsSupportProp)
{
@ -965,7 +965,7 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
strXml += L">";
strXml += (std::wstring)bsXml;
strXml += bsXml;
strXml += L"</main>";
@ -1540,9 +1540,10 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
pPicture->oleObject.reset(pOle);
pOle = NULL;
}
if (pElem)
m_pBinaryWriter->WriteRecord1(1, *pElem);
}
if (pElem)
m_pBinaryWriter->WriteRecord1(1, *pElem);
RELEASEOBJECT(pElem)
RELEASEOBJECT(pOle)
}
@ -1838,10 +1839,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
{
strType = strType.substr(1);
std::map<std::wstring, CShapePtr>::iterator pPair = m_mapShapeTypes.find(strType);
if (m_mapShapeTypes.end() != pPair)
std::map<std::wstring, CShapePtr>::iterator pFind = m_mapShapeTypes.find(strType);
if (m_mapShapeTypes.end() != pFind)
{
CBaseShapePtr base_shape_type = pPair->second->getBaseShape();
CBaseShapePtr base_shape_type = pFind->second->getBaseShape();
CPPTShape* ppt_shape_type = dynamic_cast<CPPTShape*>(base_shape_type.get());
pPPTShape = new CPPTShape();
@ -2111,16 +2112,16 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
std::wstring strStyle = oNodeP.GetAttribute(L"style");
PPTX::CCSS oCSSParser;
oCSSParser.LoadFromString2(strStyle);
std::map<std::wstring, std::wstring>::iterator pPair = oCSSParser.m_mapSettings.find(L"font-family");
if (pPair != oCSSParser.m_mapSettings.end())
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"font-family");
if (pFind != oCSSParser.m_mapSettings.end())
{
sFont = pPair->second;
sFont = pFind->second;
XmlUtils::replace_all(sFont, L"\"", L"");
}
pPair = oCSSParser.m_mapSettings.find(L"font-size");
if (pPair != oCSSParser.m_mapSettings.end())
pFind = oCSSParser.m_mapSettings.find(L"font-size");
if (pFind != oCSSParser.m_mapSettings.end())
{
nFontSize = _wtoi(pPair->second.c_str()) * 2;
nFontSize = _wtoi(pFind->second.c_str()) * 2;
}
nullable_string sFitPath;
@ -2572,21 +2573,21 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
if (oCSSParser.m_mapSettings.size() > 0)
{
std::map<std::wstring, std::wstring>::iterator pPair = oCSSParser.m_mapSettings.find(L"layout-flow");
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"layout-flow");
if (pPair != oCSSParser.m_mapSettings.end())
if (pFind != oCSSParser.m_mapSettings.end())
{
if (pPair->second == L"vertical")
if (pFind->second == L"vertical")
{
pShape->oTextBoxBodyPr->vert = new PPTX::Limit::TextVerticalType();
pShape->oTextBoxBodyPr->vert->set(L"vert");
}
}
pPair = oCSSParser.m_mapSettings.find(L"mso-layout-flow-alt");
if (pPair != oCSSParser.m_mapSettings.end())
pFind = oCSSParser.m_mapSettings.find(L"mso-layout-flow-alt");
if (pFind != oCSSParser.m_mapSettings.end())
{
if (pPair->second == L"bottom-to-top")
if (pFind->second == L"bottom-to-top")
{
if (pShape->oTextBoxBodyPr->vert.IsInit() == false)
pShape->oTextBoxBodyPr->vert = new PPTX::Limit::TextVerticalType();
@ -2604,12 +2605,12 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
pShape->txBody->bodyPr->vert = pShape->oTextBoxBodyPr->vert;
}
pPair = oCSSParser.m_mapSettings.find(L"mso-rotate");
if (pPair != oCSSParser.m_mapSettings.end())
pFind = oCSSParser.m_mapSettings.find(L"mso-rotate");
if (pFind != oCSSParser.m_mapSettings.end())
{
try
{
pShape->oTextBoxBodyPr->rot = _wtoi(pPair->second.c_str()) * 60000; //для docx, xlsx
pShape->oTextBoxBodyPr->rot = _wtoi(pFind->second.c_str()) * 60000; //для docx, xlsx
if (pShape->txBody.IsInit() == false) //для pptx
pShape->txBody = new PPTX::Logic::TxBody();
@ -2685,25 +2686,25 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
//-------------------------------------------------------------------------------------------------------------------
if (pShape && oCSSParser.m_mapSettings.size() > 0)
{
std::map<std::wstring, std::wstring>::iterator pPair = oCSSParser.m_mapSettings.find(L"v-text-anchor");
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"v-text-anchor");
if (pPair != oCSSParser.m_mapSettings.end())
if (pFind != oCSSParser.m_mapSettings.end())
{
if (pPair->second == L"middle") pShape->oTextBoxBodyPr->anchor = L"ctr";
if (pPair->second == L"bottom") pShape->oTextBoxBodyPr->anchor = L"b";
if (pPair->second == L"top-center") pShape->oTextBoxBodyPr->anchor = L"t";
if (pPair->second == L"middle-center") pShape->oTextBoxBodyPr->anchor = L"ctr";
if (pPair->second == L"bottom-center") pShape->oTextBoxBodyPr->anchor = L"b";
if (pPair->second == L"top-baseline") pShape->oTextBoxBodyPr->anchor = L"t";
if (pPair->second == L"bottom-baseline") pShape->oTextBoxBodyPr->anchor = L"b";
if (pPair->second == L"top-center-baseline") pShape->oTextBoxBodyPr->anchor = L"t";
if (pPair->second == L"bottom-center-baseline") pShape->oTextBoxBodyPr->anchor = L"b";
if (pFind->second == L"middle") pShape->oTextBoxBodyPr->anchor = L"ctr";
if (pFind->second == L"bottom") pShape->oTextBoxBodyPr->anchor = L"b";
if (pFind->second == L"top-center") pShape->oTextBoxBodyPr->anchor = L"t";
if (pFind->second == L"middle-center") pShape->oTextBoxBodyPr->anchor = L"ctr";
if (pFind->second == L"bottom-center") pShape->oTextBoxBodyPr->anchor = L"b";
if (pFind->second == L"top-baseline") pShape->oTextBoxBodyPr->anchor = L"t";
if (pFind->second == L"bottom-baseline") pShape->oTextBoxBodyPr->anchor = L"b";
if (pFind->second == L"top-center-baseline") pShape->oTextBoxBodyPr->anchor = L"t";
if (pFind->second == L"bottom-center-baseline") pShape->oTextBoxBodyPr->anchor = L"b";
}
pPair = oCSSParser.m_mapSettings.find(L"mso-wrap-style");
if (pPair != oCSSParser.m_mapSettings.end() )
pFind = oCSSParser.m_mapSettings.find(L"mso-wrap-style");
if (pFind != oCSSParser.m_mapSettings.end() )
{
if (pPair->second == L"none")
if (pFind->second == L"none")
pShape->oTextBoxBodyPr->wrap = L"none";
else
pShape->oTextBoxBodyPr->wrap = L"wrap";
@ -2730,26 +2731,24 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
pSpPr->xfrm->extY = oProps.Height;
}
std::map<std::wstring, std::wstring>::iterator pPair;
pPair = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pPair)
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pFind)
{
if (pPair->second == L"x")
if (pFind->second == L"x")
pSpPr->xfrm->flipH = true;
else if (pPair->second == L"y")
else if (pFind->second == L"y")
pSpPr->xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
else if ((pFind->second == L"xy") || (pFind->second == L"yx") || (pFind->second == L"x y") || (pFind->second == L"y x"))
{
pSpPr->xfrm->flipH = true;
pSpPr->xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
pFind = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pFind)
{
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pFind->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
}
}
else
@ -2766,26 +2765,24 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
pSpPr->xfrm->extX = oProps.Width;
pSpPr->xfrm->extY = oProps.Height;
std::map<std::wstring, std::wstring>::iterator pPair;
pPair = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pPair)
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pFind)
{
if (pPair->second == L"x")
if (pFind->second == L"x")
pSpPr->xfrm->flipH = true;
else if (pPair->second == L"y")
else if (pFind->second == L"y")
pSpPr->xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
else if ((pFind->second == L"xy") || (pFind->second == L"yx") || (pFind->second == L"x y") || (pFind->second == L"y x"))
{
pSpPr->xfrm->flipH = true;
pSpPr->xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
pFind = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pFind)
{
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pFind->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
}
}
@ -2946,26 +2943,24 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
pTree->grpSpPr.xfrm->chExtY = lCoordSizeH;
}
std::map<std::wstring, std::wstring>::iterator pPair;
pPair = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pPair)
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pFind)
{
if (pPair->second == L"x")
if (pFind->second == L"x")
pTree->grpSpPr.xfrm->flipH = true;
else if (pPair->second == L"y")
else if (pFind->second == L"y")
pTree->grpSpPr.xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
else if ((pFind->second == L"xy") || (pFind->second == L"yx") || (pFind->second == L"x y") || (pFind->second == L"y x"))
{
pTree->grpSpPr.xfrm->flipH = true;
pTree->grpSpPr.xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
pFind = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pFind)
{
pTree->grpSpPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pTree->grpSpPr.xfrm->flipH, pTree->grpSpPr.xfrm->flipV);
pTree->grpSpPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pFind->second, pTree->grpSpPr.xfrm->flipH, pTree->grpSpPr.xfrm->flipV);
}
}
else
@ -2988,26 +2983,24 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
pTree->grpSpPr.xfrm->chExtY = lCoordSizeH;
}
std::map<std::wstring, std::wstring>::iterator pPair;
pPair = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pPair)
std::map<std::wstring, std::wstring>::iterator pFind = oCSSParser.m_mapSettings.find(L"flip");
if (oCSSParser.m_mapSettings.end() != pFind)
{
if (pPair->second == L"x")
if (pFind->second == L"x")
pTree->grpSpPr.xfrm->flipH = true;
else if (pPair->second == L"y")
else if (pFind->second == L"y")
pTree->grpSpPr.xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
else if ((pFind->second == L"xy") || (pFind->second == L"yx") || (pFind->second == L"x y") || (pFind->second == L"y x"))
{
pTree->grpSpPr.xfrm->flipH = true;
pTree->grpSpPr.xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
pFind = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pFind)
{
pTree->grpSpPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pTree->grpSpPr.xfrm->flipH, pTree->grpSpPr.xfrm->flipV);
pTree->grpSpPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pFind->second, pTree->grpSpPr.xfrm->flipH, pTree->grpSpPr.xfrm->flipV);
}
}
@ -3110,7 +3103,7 @@ void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShapePtr pShap
std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps)
{
std::map<std::wstring, std::wstring>::iterator pPair;
std::map<std::wstring, std::wstring>::iterator pFind;
bool bIsInline = false;
@ -3124,8 +3117,8 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (!bIsInline)
{
pPair = oCssStyles.m_mapSettings.find(L"position");
if (oCssStyles.m_mapSettings.end() != pPair && pPair->second == L"static")
pFind = oCssStyles.m_mapSettings.find(L"position");
if (oCssStyles.m_mapSettings.end() != pFind && pFind->second == L"static")
{
bIsInline = true;
}
@ -3140,55 +3133,55 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
LONG width = 0;
LONG height = 0;
pPair = oCssStyles.m_mapSettings.find(L"polyline_correct");
bool bIsPolyCorrect = (oCssStyles.m_mapSettings.end() != pPair) ? true : false;
pFind = oCssStyles.m_mapSettings.find(L"polyline_correct");
bool bIsPolyCorrect = (oCssStyles.m_mapSettings.end() != pFind) ? true : false;
if (bIsPolyCorrect)
dKoefSize = 1;
if (!bIsInline)
{
pPair = oCssStyles.m_mapSettings.find(L"margin-left");
if (oCssStyles.m_mapSettings.end() == pPair)
pPair = oCssStyles.m_mapSettings.find(L"left");
pFind = oCssStyles.m_mapSettings.find(L"margin-left");
if (oCssStyles.m_mapSettings.end() == pFind)
pFind = oCssStyles.m_mapSettings.find(L"left");
if (oCssStyles.m_mapSettings.end() != pPair)
if (oCssStyles.m_mapSettings.end() != pFind)
{
left = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
left = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
}
pPair = oCssStyles.m_mapSettings.find(L"margin-top");
pFind = oCssStyles.m_mapSettings.find(L"margin-top");
if (oCssStyles.m_mapSettings.end() == pPair)
pPair = oCssStyles.m_mapSettings.find(L"top");
if (oCssStyles.m_mapSettings.end() == pFind)
pFind = oCssStyles.m_mapSettings.find(L"top");
if (oCssStyles.m_mapSettings.end() != pPair)
if (oCssStyles.m_mapSettings.end() != pFind)
{
top = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
top = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
}
}
pPair = oCssStyles.m_mapSettings.find(L"width");
if (oCssStyles.m_mapSettings.end() != pPair)
pFind = oCssStyles.m_mapSettings.find(L"width");
if (oCssStyles.m_mapSettings.end() != pFind)
{
width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
width = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
}
else
{
pPair = oCssStyles.m_mapSettings.find(L"margin-right");
pFind = oCssStyles.m_mapSettings.find(L"margin-right");
if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end())
width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5) - left;
width = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5) - left;
}
pPair = oCssStyles.m_mapSettings.find(L"height");
if (oCssStyles.m_mapSettings.end() != pPair)
pFind = oCssStyles.m_mapSettings.find(L"height");
if (oCssStyles.m_mapSettings.end() != pFind)
{
height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
height = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
}
else
{
pPair = oCssStyles.m_mapSettings.find(L"margin-bottom");
pFind = oCssStyles.m_mapSettings.find(L"margin-bottom");
if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end())
height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5) - top;
height = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5) - top;
}
unsigned long margL = (unsigned long)(9 * dKoef + 0.5);
@ -3196,21 +3189,47 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
unsigned long margR = (unsigned long)(9 * dKoef + 0.5);
unsigned long margB = 0;
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-left");
if (oCssStyles.m_mapSettings.end() != pPair)
margL = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pFind = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-left");
if (oCssStyles.m_mapSettings.end() != pFind)
margL = (unsigned long)(dKoef * parserPoint.FromString(pFind->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-top");
if (oCssStyles.m_mapSettings.end() != pPair)
margT = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pFind = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-top");
if (oCssStyles.m_mapSettings.end() != pFind)
margT = (unsigned long)(dKoef * parserPoint.FromString(pFind->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-right");
if (oCssStyles.m_mapSettings.end() != pPair)
margR = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pFind = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-right");
if (oCssStyles.m_mapSettings.end() != pFind)
margR = (unsigned long)(dKoef * parserPoint.FromString(pFind->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-bottom");
if (oCssStyles.m_mapSettings.end() != pPair)
margB = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pFind = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-bottom");
if (oCssStyles.m_mapSettings.end() != pFind)
margB = (unsigned long)(dKoef * parserPoint.FromString(pFind->second) + 0.5);
nullable_double rel_width;
nullable_double rel_height;
nullable_double rel_top;
nullable_double rel_left;
pFind = oCssStyles.m_mapSettings.find(L"mso-width-percent");
if (oCssStyles.m_mapSettings.end() != pFind)
{
rel_width = parserPoint.FromString(pFind->second) / 1000.;
}
pFind = oCssStyles.m_mapSettings.find(L"mso-height-percent");
if (oCssStyles.m_mapSettings.end() != pFind)
{
rel_height = parserPoint.FromString(pFind->second) / 1000.;
}
pFind = oCssStyles.m_mapSettings.find(L"mso-top-percent");
if (oCssStyles.m_mapSettings.end() != pFind)
{
rel_top = parserPoint.FromString(pFind->second) / 1000.;
}
pFind = oCssStyles.m_mapSettings.find(L"mso-left-percent");
if (oCssStyles.m_mapSettings.end() != pFind)
{
rel_left = parserPoint.FromString(pFind->second) / 1000.;
}
oProps.X = left;
oProps.Y = top;
@ -3229,7 +3248,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartNode(L"wp:inline");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"xmlns:wp", (std::wstring)L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"distT", margT);
oWriter.WriteAttribute(L"distB", margB);
oWriter.WriteAttribute(L"distL", margL);
@ -3238,8 +3257,8 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartNode(L"wp:extent");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"cx", width);
oWriter.WriteAttribute(L"cy", height);
oWriter.WriteAttribute(L"cx", width );
oWriter.WriteAttribute(L"cy", height );
oWriter.EndAttributes();
oWriter.EndNode(L"wp:extent");
@ -3252,6 +3271,35 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.EndAttributes();
oWriter.EndNode(L"wp:effectExtent");
if (rel_width.is_init())
{
oWriter.StartNode(L"wp14:sizeRelH");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"relativeFrom", L"page");
oWriter.EndAttributes();
oWriter.StartNode(L"wp14:pctWidth");
oWriter.EndAttributes();
oWriter.WriteString(std::to_wstring((INT)(*rel_width * 100000)));
oWriter.EndNode(L"wp14:pctWidth");
oWriter.EndNode(L"wp14:sizeRelH");
}
if (rel_height.is_init())
{
oWriter.StartNode(L"wp14:sizeRelV");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"relativeFrom", L"page");
oWriter.EndAttributes();
oWriter.StartNode(L"wp14:pctHeight");
oWriter.EndAttributes();
oWriter.WriteString(std::to_wstring((INT)(*rel_height * 100000)));
oWriter.EndNode(L"wp14:pctHeight");
oWriter.EndNode(L"wp14:sizeRelV");
}
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"/>";
m_lNextId++;
@ -3267,27 +3315,25 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartAttributes();
oWriter.WriteAttribute(L"xmlns:wp", (std::wstring)L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"distT", margT);
oWriter.WriteAttribute(L"distB", margB);
oWriter.WriteAttribute(L"distL", margL);
oWriter.WriteAttribute(L"distR", margR);
pPair = oCssStyles.m_mapSettings.find(L"z-index");
nullable_int zIndex;
if (oCssStyles.m_mapSettings.end() != pPair)
pFind = oCssStyles.m_mapSettings.find(L"z-index");
nullable_int64 zIndex;
if (oCssStyles.m_mapSettings.end() != pFind)
{
zIndex = (int)parserPoint.FromString(pPair->second);
if (*zIndex >= 0)
{
oWriter.WriteAttribute(L"relativeHeight", *zIndex);
}
else
{
// DWORD dwIndex = (DWORD)(*zIndex);
oWriter.WriteAttribute(L"relativeHeight", -(*zIndex));
}
zIndex = parserPoint.FromString(pFind->second);
_INT64 zIndex_ = *zIndex >= 0 ? *zIndex : -*zIndex;
if (zIndex_ < 0xF000000 && zIndex_ > 0x80000 )
zIndex_ = 0xF000000 - 0x80000 + zIndex_;
oWriter.WriteAttribute(L"relativeHeight", std::to_wstring(zIndex_));
}
XmlUtils::CXmlNode oNodeWrap = oNode.ReadNode(L"w10:wrap");
@ -3311,6 +3357,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
nullable_bool isAllowInCell;
nullable_string sAllowInCell;
oNode.ReadAttributeBase(L"o:allowincell", sAllowInCell);
if (sAllowInCell.is_init())
{
@ -3319,7 +3366,17 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if ((L"t" == *sAllowInCell) || (L"true"== *sAllowInCell))
isAllowInCell = true;
}
nullable_bool isAllowOverlap;
nullable_string sAllowOverlap;
oNode.ReadAttributeBase(L"o:allowoverlap", sAllowOverlap);
if (sAllowOverlap.is_init())
{
if ((L"f" == *sAllowOverlap) || (L"false"== *sAllowOverlap))
isAllowOverlap = false;
if ((L"t" == *sAllowOverlap) || (L"true"== *sAllowOverlap))
isAllowOverlap = true;
}
std::wstring strWrapPoints = oNode.GetAttribute(L"wrapcoords");
std::wstring strWrapPointsResult;
if (!strWrapPoints.empty())
@ -3352,20 +3409,26 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
if (*zIndex > 0)
{
oWriter.WriteAttribute(L"allowOverlap", (std::wstring)L"1");
oWriter.WriteAttribute(L"behindDoc", L"0");
}
else if (*zIndex < 0)
{
oWriter.WriteAttribute(L"behindDoc", (std::wstring)L"1");
oWriter.WriteAttribute(L"behindDoc", L"1");
}
}
if (isAllowOverlap.is_init())
{
if (*isAllowOverlap)
oWriter.WriteAttribute(L"allowOverlap", L"1");
else
oWriter.WriteAttribute(L"allowOverlap", L"0");
}
if (isAllowInCell.is_init())
{
if (*isAllowInCell)
oWriter.WriteAttribute(L"layoutInCell", (std::wstring)L"1");
oWriter.WriteAttribute(L"layoutInCell", L"1");
else
oWriter.WriteAttribute(L"layoutInCell", (std::wstring)L"0");
oWriter.WriteAttribute(L"layoutInCell", L"0");
}
oWriter.EndAttributes();
@ -3374,43 +3437,50 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartAttributes();
pPair = oCssStyles.m_mapSettings.find(L"mso-position-horizontal-relative");
if (pPair != oCssStyles.m_mapSettings.end())
pFind = oCssStyles.m_mapSettings.find(L"mso-position-horizontal-relative");
nullable_string sHRelativeFrom;
nullable_string sVRelativeFrom;
if (pFind != oCssStyles.m_mapSettings.end())
{
if (L"char" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"character");
else if (L"page" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"page");
else if (L"margin" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"margin");
else if (L"left-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"leftMargin");
else if (L"right-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"rightMargin");
else if (L"inner-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"insideMargin");
else if (L"outer-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"outsideMargin");
if (L"char" == pFind->second) sHRelativeFrom = L"character";
else if (L"page" == pFind->second) sHRelativeFrom = L"page";
else if (L"margin" == pFind->second) sHRelativeFrom = L"margin";
else if (L"left-margin-area" == pFind->second) sHRelativeFrom = L"leftMargin";
else if (L"right-margin-area" == pFind->second) sHRelativeFrom = L"rightMargin";
else if (L"inner-margin-area" == pFind->second) sHRelativeFrom = L"insideMargin";
else if (L"outer-margin-area" == pFind->second) sHRelativeFrom = L"outsideMargin";
else
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"column");
sHRelativeFrom = L"column";
}
else
{
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"column");
sHRelativeFrom = L"column";
}
oWriter.WriteAttribute(L"relativeFrom", *sHRelativeFrom);
oWriter.EndAttributes();
std::wstring strPosH = L"absolute";
pPair = oCssStyles.m_mapSettings.find(L"mso-position-horizontal");
if (oCssStyles.m_mapSettings.end() != pPair)
strPosH = pPair->second;
pFind = oCssStyles.m_mapSettings.find(L"mso-position-horizontal");
if (oCssStyles.m_mapSettings.end() != pFind)
strPosH = pFind->second;
if (strPosH == L"absolute")
{
oWriter.WriteString(L"<wp:posOffset>");
oWriter.WriteLONG(left);
oWriter.WriteString(L"</wp:posOffset>");
if (rel_left.is_init())
{
oWriter.WriteString(L"<wp14:pctPosHOffset>");
oWriter.WriteLONG((INT)(*rel_left * 100000));
oWriter.WriteString(L"</wp14:pctPosHOffset>");
}
else
{
oWriter.WriteString(L"<wp:posOffset>");
oWriter.WriteLONG(left);
oWriter.WriteString(L"</wp:posOffset>");
}
}
else
{
@ -3425,43 +3495,46 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartAttributes();
pPair = oCssStyles.m_mapSettings.find(L"mso-position-vertical-relative");
if (pPair != oCssStyles.m_mapSettings.end())
pFind = oCssStyles.m_mapSettings.find(L"mso-position-vertical-relative");
if (pFind != oCssStyles.m_mapSettings.end())
{
if (L"margin" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"margin");
else if (L"text" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"paragraph");
else if (L"page" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"page");
else if (L"top-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"topMargin");
else if (L"bottom-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"bottomMargin");
else if (L"inner-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"insideMargin");
else if (L"outer-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"outsideMargin");
if (L"margin" == pFind->second) sVRelativeFrom = L"margin";
else if (L"text" == pFind->second) sVRelativeFrom = L"paragraph";
else if (L"page" == pFind->second) sVRelativeFrom = L"page";
else if (L"top-margin-area" == pFind->second) sVRelativeFrom = L"topMargin";
else if (L"bottom-margin-area" == pFind->second) sVRelativeFrom = L"bottomMargin";
else if (L"inner-margin-area" == pFind->second) sVRelativeFrom = L"insideMargin";
else if (L"outer-margin-area" == pFind->second) sVRelativeFrom = L"outsideMargin";
else
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"line");
sVRelativeFrom = L"line";
}
else
{
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"paragraph");
sVRelativeFrom = L"paragraph";
}
oWriter.WriteAttribute(L"relativeFrom", *sVRelativeFrom);
oWriter.EndAttributes();
std::wstring strPosV = L"absolute";
pPair = oCssStyles.m_mapSettings.find(L"mso-position-vertical");
if (oCssStyles.m_mapSettings.end() != pPair)
strPosV = pPair->second;
pFind = oCssStyles.m_mapSettings.find(L"mso-position-vertical");
if (oCssStyles.m_mapSettings.end() != pFind)
strPosV = pFind->second;
if (strPosV == L"absolute")
{
oWriter.WriteString(L"<wp:posOffset>");
oWriter.WriteLONG(top);
oWriter.WriteString(L"</wp:posOffset>");
if (rel_top.is_init())
{
oWriter.WriteString(L"<wp14:pctPosVOffset>");
oWriter.WriteLONG((INT)(*rel_top * 100000));
oWriter.WriteString(L"</wp14:pctPosVOffset>");
}
else
{
oWriter.WriteString(L"<wp:posOffset>");
oWriter.WriteLONG(top);
oWriter.WriteString(L"</wp:posOffset>");
}
}
else
{
@ -3474,7 +3547,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartNode(L"wp:extent");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"cx", width);
oWriter.WriteAttribute(L"cx", width );
oWriter.WriteAttribute(L"cy", height);
oWriter.EndAttributes();
oWriter.EndNode(L"wp:extent");
@ -3521,12 +3594,40 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.WriteString(L"<wp:wrapNone/>");
}
bool bHidden = false;
pPair = oCssStyles.m_mapSettings.find(L"visibility");
if (oCssStyles.m_mapSettings.end() != pPair)
pFind = oCssStyles.m_mapSettings.find(L"visibility");
if (oCssStyles.m_mapSettings.end() != pFind)
{
if (L"hidden" == pPair->second)
if (L"hidden" == pFind->second)
bHidden = true;
}
if (rel_width.is_init())
{
oWriter.StartNode(L"wp14:sizeRelH");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"relativeFrom", *sHRelativeFrom);
oWriter.EndAttributes();
oWriter.StartNode(L"wp14:pctWidth");
oWriter.EndAttributes();
oWriter.WriteString(std::to_wstring((INT)(*rel_width * 100000)));
oWriter.EndNode(L"wp14:pctWidth");
oWriter.EndNode(L"wp14:sizeRelH");
}
if (rel_height.is_init())
{
oWriter.StartNode(L"wp14:sizeRelV");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"relativeFrom", *sVRelativeFrom);
oWriter.EndAttributes();
oWriter.StartNode(L"wp14:pctHeight");
oWriter.EndAttributes();
oWriter.WriteString(std::to_wstring((INT)(*rel_height * 100000)));
oWriter.EndNode(L"wp14:pctHeight");
oWriter.EndNode(L"wp14:sizeRelV");
}
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"" + (bHidden ? L" hidden=\"true\"" : L"") + L"/>";
m_lNextId++;
@ -3894,6 +3995,10 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
{
pBlipFill->tile = new PPTX::Logic::Tile();
}
else
{
pBlipFill->stretch = new PPTX::Logic::Stretch();
}
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
@ -4390,7 +4495,7 @@ HRESULT CDrawingConverter::LoadClrMap(const std::wstring& bsXml)
{
smart_ptr<PPTX::Logic::ClrMap> pClrMap = new PPTX::Logic::ClrMap();
std::wstring strXml = L"<main xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">" + (std::wstring)bsXml + L"</main>";
std::wstring strXml = L"<main xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">" + bsXml + L"</main>";
XmlUtils::CXmlNode oNode;
oNode.FromXmlString(strXml);
@ -4845,6 +4950,10 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
nullable_int margL; oNode.ReadAttributeBase(L"distL", margL);
nullable_int margR; oNode.ReadAttributeBase(L"distR", margR);
nullable_bool behindDoc; oNode.ReadAttributeBase(L"behindDoc", behindDoc);
nullable_bool allowOverlap; oNode.ReadAttributeBase(L"allowOverlap", allowOverlap);
nullable_bool layoutInCell; oNode.ReadAttributeBase(L"layoutInCell", layoutInCell);
if (margL.is_init())
oWriter.WriteAttributeCSS_double1_pt(L"mso-wrap-distance-left", dKoef * (*margL));
if (margT.is_init())
@ -4854,9 +4963,27 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
if (margB.is_init())
oWriter.WriteAttributeCSS_double1_pt(L"mso-wrap-distance-bottom", dKoef * (*margB));
nullable_int zIndex; oNode.ReadAttributeBase(L"relativeHeight", zIndex);
nullable_int64 zIndex; oNode.ReadAttributeBase(L"relativeHeight", zIndex);
if (zIndex.is_init())
oWriter.WriteAttributeCSS_int(L"z-index", *zIndex);
{
_INT64 z_index = *zIndex;
if ((behindDoc.IsInit()) && (*behindDoc == true))
{
z_index = -z_index;
}
oWriter.WriteAttributeCSS(L"z-index", std::to_wstring(z_index));
}
if (allowOverlap.is_init())
{
oWriter.WriteAttributeCSS(L"o:allowoverlap", *allowOverlap ? L"true" : L"false");
}
if (layoutInCell.is_init())
{
oWriter.WriteAttributeCSS(L"o:allowincell", *layoutInCell ? L"true" : L"false");
}
XmlUtils::CXmlNode oNodeHorP;
if (oNode.GetNode(L"wp:positionH", oNodeHorP))
@ -5077,7 +5204,7 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
HRESULT CDrawingConverter::SetFontDir(const std::wstring& bsFontDir)
{
m_strFontDirectory = (std::wstring)bsFontDir;
m_strFontDirectory = bsFontDir;
return S_OK;
}
@ -5273,7 +5400,7 @@ HRESULT CDrawingConverter::SetDstContentRels()
HRESULT CDrawingConverter::SaveDstContentRels(const std::wstring& bsRelsPath)
{
m_pReader->m_pRels->CloseRels();
m_pReader->m_pRels->SaveRels((std::wstring)bsRelsPath);
m_pReader->m_pRels->SaveRels(bsRelsPath);
--m_pReader->m_nCurrentRelsStack;
if (-1 > m_pReader->m_nCurrentRelsStack)
@ -5318,7 +5445,7 @@ HRESULT CDrawingConverter::SetFontPicker(COfficeFontPicker* pFontPicker)
HRESULT CDrawingConverter::SetAdditionalParam(const std::wstring& ParamName, BYTE *pArray, size_t szCount)
{
std::wstring name = (std::wstring)ParamName;
std::wstring name = ParamName;
if (name == L"xfrm_override" && pArray)
{
PPTX::Logic::Xfrm *pXfrm = (PPTX::Logic::Xfrm*)pArray;
@ -5330,7 +5457,7 @@ HRESULT CDrawingConverter::SetAdditionalParam(const std::wstring& ParamName, BYT
}
HRESULT CDrawingConverter::GetAdditionalParam(const std::wstring& ParamName, BYTE **pArray, size_t& szCount)
{
//std::wstring name = (std::wstring)ParamName;
//std::wstring name = ParamName;
//if (name == L"SerializeImageManager")
//{
// NSBinPptxRW::CBinaryFileWriter oWriter;

View File

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

View File

@ -356,7 +356,15 @@ namespace NSBinPptxRW
m_oWriter.WriteString(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int(const std::wstring& strAttributeName, const int& val)
AVSINLINE void WriteAttributeCSS(const std::wstring& strAttributeName, const wchar_t* val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.WriteString(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int(const std::wstring& strAttributeName, const int& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
@ -404,7 +412,16 @@ namespace NSBinPptxRW
m_oWriter.WriteString(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute2(const std::wstring& strAttributeName, const std::wstring& val)
AVSINLINE void WriteAttribute(const std::wstring& strAttributeName, const wchar_t* val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
m_oWriter.WriteString(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute2(const std::wstring& strAttributeName, const std::wstring& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);

View File

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

View File

@ -385,8 +385,10 @@ namespace PPTX
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.0"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
@ -438,9 +440,10 @@ namespace PPTX
std::wstring sXmlOptions, sMediaPath, sEmbedPath;
BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath);
std::map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
boost::unordered_map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
oXlsx.m_mapEnumeratedGlobal.clear();
@ -658,12 +661,12 @@ namespace PPTX
}
if (oleObject->m_sShapeId.IsInit() && pVml && !blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty())
{
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pFind = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
if (pVml->m_mapShapes.end() != pPair)
if (pVml->m_mapShapes.end() != pFind)
{
pPair->second.bUsed = true;
OOX::Vml::CVmlCommonElements* pShape = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pPair->second.pElement);
pFind->second.bUsed = true;
OOX::Vml::CVmlCommonElements* pShape = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pFind->second.pElement);
if (pShape)
{

View File

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

View File

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

View File

@ -149,6 +149,7 @@ void OfficeArtBStoreContainerFileBlock::load(XLS::CFRecord& record)
break;
case OfficeArtRecord::BlipPICT:
{
pict_type = L".pcz";
if (rc_header.recInstance == 0x542)
rgbUid1 = ReadMD4Digest(record);
else
@ -165,7 +166,6 @@ void OfficeArtBStoreContainerFileBlock::load(XLS::CFRecord& record)
isCompressed = true;
readCompressedData(record, metafileHeader);
}
pict_type = L".pic";///???? todooo
}
break;
case OfficeArtRecord::BlipJPEG:

View File

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

View File

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

View File

@ -62,8 +62,6 @@ namespace NSCommon
{
RELEASEOBJECT(m_pPointer);
}
public:
Type& operator*() { return *m_pPointer; }
Type* operator->() { return m_pPointer; }
@ -73,7 +71,6 @@ namespace NSCommon
const Type& get()const { return *m_pPointer; }
Type& get() { return *m_pPointer; }
public:
nullable_base<Type>& operator=(const nullable_base<Type> &oOther)
{
RELEASEOBJECT(m_pPointer);
@ -95,8 +92,6 @@ namespace NSCommon
m_pPointer = new Type(oSrc);
return *this;
}
public:
bool IsInit() const
{
return (NULL != m_pPointer);
@ -167,20 +162,6 @@ namespace NSCommon
return *this;
}
//nullable<Type>& operator=(std::wstring& cwsValue)
//{
// RELEASEOBJECT(this->m_pPointer);
// this->m_pPointer = new Type( cwsValue.c_str() );
// return *this;
//}
//nullable<Type>& operator=(const std::wstring& cwsValue)
//{
// RELEASEOBJECT(this->m_pPointer);
// this->m_pPointer = new Type( cwsValue.c_str() );
// return *this;
//}
nullable<Type>& operator=(const nullable<Type> &oOther)
{
RELEASEOBJECT(this->m_pPointer);
@ -283,8 +264,6 @@ namespace NSCommon
{
}
public:
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -296,17 +275,6 @@ namespace NSCommon
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = pType;
}
//#if defined(_WIN32) || defined (_WIN64)
// void operator=(const BSTR& value)
// {
// RELEASEOBJECT(this->m_pPointer);
// if (NULL != value)
// {
// this->m_pPointer = new Type();
// this->m_pPointer->_set((std::wstring)value);
// }
// }
//#endif
void operator=(const BYTE& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -343,7 +311,6 @@ namespace NSCommon
return this->m_pPointer->get();
}
public:
Type& operator*() { return *this->m_pPointer; }
Type* operator->() { return this->m_pPointer; }
@ -387,15 +354,6 @@ namespace NSCommon
return *this;
}
//#if defined(_WIN32) || defined (_WIN64)
// void operator=(const BSTR& value)
// {
// RELEASEOBJECT(this->m_pPointer);
//
// if (NULL != value)
// this->m_pPointer = new int(XmlUtils::GetInteger(value));
// }
//#endif
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -425,8 +383,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
int& operator*() { return *m_pPointer; }
int* operator->() { return m_pPointer; }
@ -434,15 +390,77 @@ namespace NSCommon
int* operator->() const { return m_pPointer; }
const int& get()const { return *m_pPointer; }
};
class nullable_int64 : public nullable_base<_INT64>
{
public:
std::wstring toString() const
nullable_int64() : nullable_base<_INT64>()
{
std::wstring result;
//if (IsInit())
// result = std::to_wstring( get());
return result;
}
void normalize(const _INT64& min, const _INT64& max)
{
if (IsInit())
{
if (*m_pPointer < min)
*m_pPointer = min;
else if (*m_pPointer > max)
*m_pPointer = max;
}
}
void normalize_positive()
{
if (IsInit())
{
if (*m_pPointer < 0)
*m_pPointer = 0;
}
}
nullable_int64& operator=(const wchar_t* cwsValue)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != cwsValue )
m_pPointer = new _INT64(XmlUtils::GetInteger64(cwsValue));
return *this;
}
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new _INT64(XmlUtils::GetInteger64(value));
}
void operator=(const _INT64& value)
{
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new _INT64(value);
}
nullable_int64& operator=(const nullable_int64& oSrc)
{
RELEASEOBJECT(m_pPointer);
if (NULL != oSrc.m_pPointer )
m_pPointer = new _INT64(*oSrc);
return *this;
}
_INT64 get_value_or(const _INT64& value) const
{
if (NULL == m_pPointer)
{
int ret = value;
return ret;
}
return *m_pPointer;
}
_INT64& operator*() { return *m_pPointer; }
_INT64* operator->() { return m_pPointer; }
_INT64& operator*() const { return *m_pPointer; }
_INT64* operator->() const { return m_pPointer; }
const _INT64& get()const { return *m_pPointer; }
};
class nullable_sizet : public nullable_base<size_t>
{
@ -494,7 +512,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
size_t& operator*() { return *m_pPointer; }
size_t* operator->() { return m_pPointer; }
@ -630,12 +647,6 @@ namespace NSCommon
const bool& get()const { return *m_pPointer; }
std::wstring toString() const
{
std::wstring result;
return result;
}
};
class nullable_string : public nullable_base<std::wstring>
{
@ -679,8 +690,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
std::wstring& operator*() { return *m_pPointer; }
std::wstring* operator->() { return m_pPointer; }

View File

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

View File

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

View File

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

View File

@ -189,6 +189,12 @@ namespace OOX
}
}
}
if ((m_oRunProperty) && (m_oRunProperty->m_pText))
{
m_arrItems.push_back( m_oRunProperty->m_pText);
m_oRunProperty->m_pText = NULL;
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
@ -279,6 +285,11 @@ namespace OOX
if ( pItem )
m_arrItems.push_back( pItem );
}
if ((m_oRunProperty) && (m_oRunProperty->m_pText))
{
m_arrItems.push_back( m_oRunProperty->m_pText);
m_oRunProperty->m_pText = NULL;
}
}
virtual std::wstring toXML() const
{

View File

@ -776,15 +776,13 @@ namespace OOX
CText() {}
virtual ~CText() {}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("xml:space"), m_oSpace );
m_sText = oNode.GetText();
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -793,7 +791,7 @@ namespace OOX
m_sText = oReader.GetText2();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult;

View File

@ -30,6 +30,7 @@
*
*/
#include "RunProperty.h"
#include "RunContent.h"
namespace OOX
{
@ -164,7 +165,26 @@ namespace OOX
if ( _T("w:b") == sName )
m_oBold = oReader;
else if ( _T("w:bCs") == sName )
m_oBoldCs = oReader;
{
if (!oReader.IsEmptyNode())
{
m_oBoldCs.Init();
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
std::wstring sName1 = oReader.GetName();
if ( _T("w:t") == sName1 )
{
m_pText = new CText( oReader );
break;
}
}
}
else
m_oBoldCs = oReader;
}
else if ( _T("w:bdr") == sName )
m_oBdr = oReader;
else if ( _T("w:caps") == sName )
@ -269,6 +289,159 @@ namespace OOX
}
}
}
void CRunProperty::fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:rPr") != oNode.GetName() )
return;
XmlUtils::CXmlNode oChild;
if ( oNode.GetNode( _T("w:b"), oChild ) )
m_oBold = oChild;
if ( oNode.GetNode( _T("w:bCs"), oChild ) )
{
m_oBoldCs = oChild;
XmlUtils::CXmlNode oChild1;
if (oChild.GetNode(L"w:t", oChild1))
{
m_pText = new CText(oChild1); //XpertdocOnlineDemoEn.docx
}
}
if ( oNode.GetNode( _T("w:bdr"), oChild ) )
m_oBdr = oChild;
if ( oNode.GetNode( _T("w:caps"), oChild ) )
m_oCaps = oChild;
if ( oNode.GetNode( _T("w:color"), oChild ) )
m_oColor = oChild;
if ( oNode.GetNode( _T("w:cs"), oChild ) )
m_oCs = oChild;
if ( oNode.GetNode( _T("w:del"), oChild ) )
m_oDel = oChild;
if ( oNode.GetNode( _T("w:dstrike"), oChild ) )
m_oDStrike = oChild;
if ( oNode.GetNode( _T("w:eastAsianLayout"), oChild ) )
m_oEastAsianLayout = oChild;
if ( oNode.GetNode( _T("w:effect"), oChild ) )
m_oEffect = oChild;
if ( oNode.GetNode( _T("w:em"), oChild ) )
m_oEm = oChild;
if ( oNode.GetNode( _T("w:emboss"), oChild ) )
m_oEmboss = oChild;
if ( oNode.GetNode( _T("w:fitText"), oChild ) )
m_oFitText = oChild;
if ( oNode.GetNode( _T("w:highlight"), oChild ) )
m_oHighlight = oChild;
if ( oNode.GetNode( _T("w:ins"), oChild ) )
m_oIns = oChild;
if ( oNode.GetNode( _T("w:i"), oChild ) )
m_oItalic = oChild;
if ( oNode.GetNode( _T("w:iCs"), oChild ) )
m_oItalicCs = oChild;
if ( oNode.GetNode( _T("w:imprint"), oChild ) )
m_oImprint = oChild;
if ( oNode.GetNode( _T("w:kern"), oChild ) )
m_oKern = oChild;
if ( oNode.GetNode( _T("w:lang"), oChild ) )
m_oLang = oChild;
if ( oNode.GetNode( _T("w:noProof"), oChild ) )
m_oNoProof = oChild;
if ( oNode.GetNode( _T("m:oMath"), oChild ) )
m_oMath = oChild;
if ( oNode.GetNode( _T("w:outline"), oChild ) )
m_oOutline = oChild;
if ( oNode.GetNode( _T("w:position"), oChild ) )
m_oPosition = oChild;
if ( oNode.GetNode( _T("w:rFonts"), oChild ) )
m_oRFonts = oChild;
if ( !m_bRPRChange && oNode.GetNode( _T("w:rPrChange"), oChild ) )
m_oRPrChange = oChild;
// В спецификации почему-то написано pStyle, хотя по смыслы, по ссылке в самой
// же спецификации и, в конце концов, по алфавиту тут толжно быть rStyle
if ( oNode.GetNode( _T("w:rStyle"), oChild ) )
m_oRStyle = oChild;
if ( !m_oRStyle.IsInit() && oNode.GetNode( _T("w:pStyle"), oChild ) )
m_oRStyle = oChild;
if ( oNode.GetNode( _T("w:rtl"), oChild ) )
m_oRtL = oChild;
if ( oNode.GetNode( _T("w:shadow"), oChild ) )
m_oShadow = oChild;
if ( oNode.GetNode( _T("w:shd"), oChild ) )
m_oShd = oChild;
if ( oNode.GetNode( _T("w:smallCaps"), oChild ) )
m_oSmallCaps = oChild;
if ( oNode.GetNode( _T("w:snapToGrid"), oChild ) )
m_oSnapToGrid = oChild;
if ( oNode.GetNode( _T("w:spacing"), oChild ) )
m_oSpacing = oChild;
if ( oNode.GetNode( _T("w:specVanish"), oChild ) )
m_oSpecVanish = oChild;
if ( oNode.GetNode( _T("w:strike"), oChild ) )
m_oStrike = oChild;
if ( oNode.GetNode( _T("w:sz"), oChild ) )
m_oSz = oChild;
if ( oNode.GetNode( _T("w:szCs"), oChild ) )
m_oSzCs = oChild;
if ( oNode.GetNode( _T("w:u"), oChild ) )
m_oU = oChild;
if ( oNode.GetNode( _T("w:vanish"), oChild ) )
m_oVanish = oChild;
if ( oNode.GetNode( _T("w:vertAlign"), oChild ) )
m_oVertAlign = oChild;
if ( oNode.GetNode( _T("w:w"), oChild ) )
m_oW = oChild;
if ( oNode.GetNode( _T("w:webHidden"), oChild ) )
m_oWebHidden = oChild;
if ( oNode.GetNode( _T("w:moveFrom"), oChild ) )
m_oMoveFrom = oChild;
if ( oNode.GetNode( _T("w:moveTo"), oChild ) )
m_oMoveTo = oChild;
}
} // Logic
} // ComplexTypes

View File

@ -737,18 +737,22 @@ namespace OOX
public:
CRunProperty()
{
m_pText = NULL;
m_bRPRChange = false;
}
virtual ~CRunProperty()
{
RELEASEOBJECT(m_pText);
}
CRunProperty(const XmlUtils::CXmlNode &oNode)
{
m_pText = NULL;
m_bRPRChange = false;
fromXML( (XmlUtils::CXmlNode &)oNode );
}
CRunProperty(const XmlUtils::CXmlLiteReader& oReader)
{
m_pText = NULL;
m_bRPRChange = false;
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
}
@ -764,152 +768,8 @@ namespace OOX
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:rPr") != oNode.GetName() )
return;
XmlUtils::CXmlNode oChild;
if ( oNode.GetNode( _T("w:b"), oChild ) )
m_oBold = oChild;
if ( oNode.GetNode( _T("w:bCs"), oChild ) )
m_oBoldCs = oChild;
if ( oNode.GetNode( _T("w:bdr"), oChild ) )
m_oBdr = oChild;
if ( oNode.GetNode( _T("w:caps"), oChild ) )
m_oCaps = oChild;
if ( oNode.GetNode( _T("w:color"), oChild ) )
m_oColor = oChild;
if ( oNode.GetNode( _T("w:cs"), oChild ) )
m_oCs = oChild;
if ( oNode.GetNode( _T("w:del"), oChild ) )
m_oDel = oChild;
if ( oNode.GetNode( _T("w:dstrike"), oChild ) )
m_oDStrike = oChild;
if ( oNode.GetNode( _T("w:eastAsianLayout"), oChild ) )
m_oEastAsianLayout = oChild;
if ( oNode.GetNode( _T("w:effect"), oChild ) )
m_oEffect = oChild;
if ( oNode.GetNode( _T("w:em"), oChild ) )
m_oEm = oChild;
if ( oNode.GetNode( _T("w:emboss"), oChild ) )
m_oEmboss = oChild;
if ( oNode.GetNode( _T("w:fitText"), oChild ) )
m_oFitText = oChild;
if ( oNode.GetNode( _T("w:highlight"), oChild ) )
m_oHighlight = oChild;
if ( oNode.GetNode( _T("w:ins"), oChild ) )
m_oIns = oChild;
if ( oNode.GetNode( _T("w:i"), oChild ) )
m_oItalic = oChild;
if ( oNode.GetNode( _T("w:iCs"), oChild ) )
m_oItalicCs = oChild;
if ( oNode.GetNode( _T("w:imprint"), oChild ) )
m_oImprint = oChild;
if ( oNode.GetNode( _T("w:kern"), oChild ) )
m_oKern = oChild;
if ( oNode.GetNode( _T("w:lang"), oChild ) )
m_oLang = oChild;
if ( oNode.GetNode( _T("w:noProof"), oChild ) )
m_oNoProof = oChild;
if ( oNode.GetNode( _T("m:oMath"), oChild ) )
m_oMath = oChild;
if ( oNode.GetNode( _T("w:outline"), oChild ) )
m_oOutline = oChild;
if ( oNode.GetNode( _T("w:position"), oChild ) )
m_oPosition = oChild;
if ( oNode.GetNode( _T("w:rFonts"), oChild ) )
m_oRFonts = oChild;
if ( !m_bRPRChange && oNode.GetNode( _T("w:rPrChange"), oChild ) )
m_oRPrChange = oChild;
// В спецификации почему-то написано pStyle, хотя по смыслы, по ссылке в самой
// же спецификации и, в конце концов, по алфавиту тут толжно быть rStyle
if ( oNode.GetNode( _T("w:rStyle"), oChild ) )
m_oRStyle = oChild;
if ( !m_oRStyle.IsInit() && oNode.GetNode( _T("w:pStyle"), oChild ) )
m_oRStyle = oChild;
if ( oNode.GetNode( _T("w:rtl"), oChild ) )
m_oRtL = oChild;
if ( oNode.GetNode( _T("w:shadow"), oChild ) )
m_oShadow = oChild;
if ( oNode.GetNode( _T("w:shd"), oChild ) )
m_oShd = oChild;
if ( oNode.GetNode( _T("w:smallCaps"), oChild ) )
m_oSmallCaps = oChild;
if ( oNode.GetNode( _T("w:snapToGrid"), oChild ) )
m_oSnapToGrid = oChild;
if ( oNode.GetNode( _T("w:spacing"), oChild ) )
m_oSpacing = oChild;
if ( oNode.GetNode( _T("w:specVanish"), oChild ) )
m_oSpecVanish = oChild;
if ( oNode.GetNode( _T("w:strike"), oChild ) )
m_oStrike = oChild;
if ( oNode.GetNode( _T("w:sz"), oChild ) )
m_oSz = oChild;
if ( oNode.GetNode( _T("w:szCs"), oChild ) )
m_oSzCs = oChild;
if ( oNode.GetNode( _T("w:u"), oChild ) )
m_oU = oChild;
if ( oNode.GetNode( _T("w:vanish"), oChild ) )
m_oVanish = oChild;
if ( oNode.GetNode( _T("w:vertAlign"), oChild ) )
m_oVertAlign = oChild;
if ( oNode.GetNode( _T("w:w"), oChild ) )
m_oW = oChild;
if ( oNode.GetNode( _T("w:webHidden"), oChild ) )
m_oWebHidden = oChild;
if ( oNode.GetNode( _T("w:moveFrom"), oChild ) )
m_oMoveFrom = oChild;
if ( oNode.GetNode( _T("w:moveTo"), oChild ) )
m_oMoveTo = oChild;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:rPr>");
@ -1228,9 +1088,6 @@ namespace OOX
{
return et_w_rPr;
}
public:
static const CRunProperty Merge(const CRunProperty& oPrev, const CRunProperty& oCurrent)
{
CRunProperty oProperties;
@ -1292,8 +1149,7 @@ namespace OOX
return oResult;
}
public:
const bool IsSimple() const
{
if ( m_oBold.IsInit() )
@ -1428,9 +1284,6 @@ namespace OOX
return true;
}
public:
bool m_bRPRChange; // Является ли данный w:rPr дочерним по отношению к w:rPrChange
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oBold;
@ -1480,6 +1333,7 @@ namespace OOX
PPTX::Logic::UniFill m_oTextFill;
nullable<PPTX::Logic::Ln> m_oTextOutline;
OOX::WritingElement* m_pText; //temp ... for Run object -> XpertdocOnlineDemoEn.docx
};
} // namespace Logic

View File

@ -54,12 +54,12 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:displayText"), m_sDisplayText );
oNode.ReadAttributeBase( _T("w:value"), m_sValue );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -91,7 +91,6 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:displayText"), m_sDisplayText )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:value"), m_sValue )
@ -118,13 +117,13 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:prefixMappings"), m_sPrefixMappings );
oNode.ReadAttributeBase( _T("w:storeItemID"), m_sStoreItemID );
oNode.ReadAttributeBase( _T("w:xpath"), m_sXPath );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -142,13 +141,6 @@ namespace ComplexTypes
sResult += _T("\" ");
}
if ( m_sStoreItemID.IsInit() )
{
sResult += _T("w:storeItemID=\"");
sResult += m_sStoreItemID.get2();
sResult += _T("\" ");
}
if ( m_sXPath.IsInit() )
{
sResult += _T("w:xpath=\"");
@ -156,13 +148,18 @@ namespace ComplexTypes
sResult += _T("\" ");
}
if ( m_sStoreItemID.IsInit() )
{
sResult += _T("w:storeItemID=\"");
sResult += m_sStoreItemID.get2();
sResult += _T("\" ");
}
return sResult;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:prefixMappings"), m_sPrefixMappings )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:storeItemID"), m_sStoreItemID )
@ -191,11 +188,11 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -236,11 +233,11 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -256,7 +253,6 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -281,11 +277,11 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -302,7 +298,6 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -327,11 +322,11 @@ namespace ComplexTypes
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:multiLine"), m_oMultiLine );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
@ -352,7 +347,6 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:multiLine"), m_oMultiLine )
WritingElement_ReadAttributes_End( oReader )
@ -382,7 +376,7 @@ namespace OOX
}
virtual ~CSdtComboBox()
{
for ( unsigned int nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
for ( size_t nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
{
if ( m_arrListItem[nIndex] )
delete m_arrListItem[nIndex];
@ -395,7 +389,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:lastValue"), m_sLastValue );
@ -414,7 +408,7 @@ namespace OOX
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -432,7 +426,7 @@ namespace OOX
}
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult;
@ -445,7 +439,7 @@ namespace OOX
else
sResult = _T("<w:comboBox>");
for (unsigned int nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
for (size_t nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
{
sResult += _T("<w:listItem ");
if (m_arrListItem[nIndex])
@ -467,7 +461,6 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:lastValue"), m_sLastValue )
WritingElement_ReadAttributes_End( oReader )
@ -498,7 +491,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:fullDate"), m_oFullDate );
@ -510,7 +503,7 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, _T("w:storeMappedDateAs"), m_oStoreMappedDateAs );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -531,7 +524,7 @@ namespace OOX
m_oStoreMappedDateAs = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult;
@ -562,7 +555,6 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:fullDate"), m_oFullDate )
WritingElement_ReadAttributes_End( oReader )
@ -596,7 +588,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
@ -605,7 +597,7 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, _T("w:docPartUnique"), m_oDocPartUnique );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -622,7 +614,7 @@ namespace OOX
m_oDocPartUnique = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:docPartList>");
@ -634,7 +626,7 @@ namespace OOX
return sResult;
}
std::wstring toXML2(const std::wstring& sName) const
std::wstring toXML2(const std::wstring& sName) const
{
std::wstring sResult = L"<" + sName + L">";
@ -670,7 +662,7 @@ namespace OOX
}
virtual ~CSdtDropDownList()
{
for ( unsigned int nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
for ( size_t nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
{
if ( m_arrListItem[nIndex] )
delete m_arrListItem[nIndex];
@ -681,9 +673,7 @@ namespace OOX
m_arrListItem.clear();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:lastValue"), m_sLastValue );
@ -702,7 +692,7 @@ namespace OOX
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -720,7 +710,7 @@ namespace OOX
}
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult;
@ -733,7 +723,7 @@ namespace OOX
else
sResult = _T("<w:dropDownList>");
for (unsigned int nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
for (size_t nIndex = 0; nIndex < m_arrListItem.size(); nIndex++ )
{
sResult += _T("<w:listItem ");
if (m_arrListItem[nIndex])
@ -754,7 +744,6 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:lastValue"), m_sLastValue )
WritingElement_ReadAttributes_End( oReader )
@ -782,16 +771,14 @@ namespace OOX
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:docPart"), m_oDocPart );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -804,7 +791,7 @@ namespace OOX
m_oDocPart = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:placeholder>");
@ -841,7 +828,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
@ -849,7 +836,7 @@ namespace OOX
m_oRPr = oChild;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -862,7 +849,7 @@ namespace OOX
m_oRPr = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:sdtEndPr>");
@ -917,7 +904,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = sdttypeUnknown;
@ -932,7 +919,7 @@ namespace OOX
if ( sdttypeUnknown == m_eType && oNode.GetNode( _T("w:citation"), oChild ) )
m_eType = sdttypeCitation;
if ( sdttypeUnknown == m_eType && oNode.GetNode( _T("w:alias"), oChild ) )
if ( sdttypeUnknown == m_eType && oNode.GetNode( _T("w:comboBox"), oChild ) )
{
m_oComboBox = oChild;
m_eType = sdttypeComboBox;
@ -1011,7 +998,7 @@ namespace OOX
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = sdttypeUnknown;
@ -1089,21 +1076,21 @@ namespace OOX
}
}
}
std::wstring toXMLStart() const
std::wstring toXMLStart() const
{
std::wstring sResult = _T("<w:sdtPr>");
WritingElement_WriteNode_2( m_oRPr );
WritingElement_WriteNode_1( _T("<w:alias "), m_oAlias );
WritingElement_WriteNode_1( _T("<w:label "), m_oLabel );
WritingElement_WriteNode_1( _T("<w:tabIndex "), m_oTabIndex );
WritingElement_WriteNode_1( _T("<w:lock "), m_oLock );
WritingElement_WriteNode_1( L"<w:alias ", m_oAlias );
WritingElement_WriteNode_1( L"<w:id ", m_oId );
WritingElement_WriteNode_1( L"<w:label ", m_oLabel );
WritingElement_WriteNode_1( L"<w:tabIndex ", m_oTabIndex );
WritingElement_WriteNode_1( L"<w:lock ", m_oLock );
WritingElement_WriteNode_2( m_oPlaceHolder );
WritingElement_WriteNode_1( _T("<w:showingPlcHdr "), m_oShowingPlcHdr );
WritingElement_WriteNode_1( _T("<w:dataBinding "), m_oDataBinding );
WritingElement_WriteNode_1( _T("<w:temporary "), m_oTemporary );
WritingElement_WriteNode_1( _T("<w:id "), m_oId );
WritingElement_WriteNode_1( _T("<w:tag "), m_oTag );
WritingElement_WriteNode_1( L"<w:showingPlcHdr ", m_oShowingPlcHdr );
WritingElement_WriteNode_1( L"<w:dataBinding ", m_oDataBinding );
WritingElement_WriteNode_1( L"<w:temporary ", m_oTemporary );
WritingElement_WriteNode_1( L"<w:tag ", m_oTag );
switch(m_eType)
{
@ -1186,12 +1173,12 @@ namespace OOX
return sResult;
}
std::wstring toXMLEnd() const
std::wstring toXMLEnd() const
{
return _T("</w:sdtPr>");
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return toXMLStart() + toXMLEnd();
}
@ -1233,8 +1220,8 @@ namespace OOX
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
@ -1261,7 +1248,7 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
@ -1275,7 +1262,7 @@ namespace OOX
m_oSdtPr = oChild;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -1292,7 +1279,7 @@ namespace OOX
m_oSdtPr = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:sdt>");

View File

@ -33,6 +33,7 @@
#include "../Base/Base.h"
#include "../Base/SmartPtr.h"
#include "../Base/Types_32.h"
#include <algorithm>
#include <sstream>
@ -77,9 +78,9 @@ namespace XmlUtils
return true;
return false;
}
AVSINLINE static __int64 GetHex (const std::wstring& string)
AVSINLINE static _INT64 GetHex (const std::wstring& string)
{
__int64 nResult = 0;
_INT64 nResult = 0;
size_t nLen = string.length();
for (size_t nIndex = 0; nIndex < nLen; ++nIndex )
{
@ -88,9 +89,9 @@ namespace XmlUtils
return nResult;
}
AVSINLINE static __int64 GetHex (const std::string& string)
AVSINLINE static _INT64 GetHex (const std::string& string)
{
__int64 nResult = 0;
_INT64 nResult = 0;
size_t nLen = string.length();
for (size_t nIndex = 0; nIndex < nLen; ++nIndex )
{
@ -169,7 +170,20 @@ namespace XmlUtils
return ( L"true" == sTemp || L"1" == sTemp || L"t" == sTemp || L"on" == sTemp );
}
AVSINLINE static int GetInteger (const std::wstring& string)
AVSINLINE static _INT64 GetInteger64 (const std::wstring& string)
{
if (string.empty()) return 0;
try
{
return _wtoi64(string.c_str());
}
catch(...)
{
return 0;
}
}
AVSINLINE static int GetInteger (const std::wstring& string)
{
if (string.empty()) return 0;

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */,

View File

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

View File

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