Compare commits

..

25 Commits

Author SHA1 Message Date
f764b034a1 . 2018-01-25 18:33:12 +03:00
73fe023460 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-25 18:26:55 +03:00
242af3c80e . 2018-01-25 18:26:14 +03:00
7756e4b8bd . 2018-01-25 18:17:46 +03:00
56a1d1f627 x2t -fix appVersion 2018-01-25 18:16:15 +03:00
11bd4ff61d . 2018-01-25 17:20:56 +03:00
93a06d7f86 . 2018-01-25 17:18:40 +03:00
76d2d429b7 x2t version 2.4.511 2018-01-25 17:07:43 +03:00
c6de37dbad . 2018-01-25 17:02:31 +03:00
d022e669f0 . 2018-01-25 15:57:17 +03:00
184e79bae1 . 2018-01-25 15:52:14 +03:00
e6581671c8 . 2018-01-25 15:27:06 +03:00
e0a1c688bf . 2018-01-24 19:28:04 +03:00
9e0b301179 write verion x2t to converted files 2018-01-24 18:25:23 +03:00
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
7e36d47991 fix bug #8010
OdfFormatReader - dropdown & user fields
2018-01-22 15:09:23 +03:00
419a01bd09 fix bug #36725 2018-01-22 11:21:28 +03:00
804a01cab3 x2t version 2.4.509 2018-01-20 15:22:31 +03:00
85 changed files with 3279 additions and 1953 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

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

View File

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

View File

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

View File

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

View File

@ -144,7 +144,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);
// svg:definition-src
@ -164,10 +163,8 @@ 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_REGISTER_OFFICE_ELEMENT2(svg_definition_src);
// style:font-face
class style_font_face : public office_element_impl<style_font_face>
{
@ -233,7 +230,6 @@ public:
friend class odf_document;
};
CP_REGISTER_OFFICE_ELEMENT2(style_font_face);
// office-font-face-decls
@ -257,7 +253,6 @@ 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_REGISTER_OFFICE_ELEMENT2(office_font_face_decls);
}

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"

View File

@ -38,7 +38,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPColorUtils.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
namespace odf_reader {

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
@ -81,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

@ -69,8 +69,14 @@ enum ElementType
typeTextTime,
typeTextModificationTime,
typeTextFileName,
typeTextSequence,
typeTextSheetName,
typeTextTemplateName,
typeTextDropDown,
typeTextLabel,
typeTextSequenceDecls,
typeTextSequenceDecl,
typeTextSequence,
typePresentationFooter,
typePresentationDateTime,
@ -78,6 +84,8 @@ enum ElementType
typeDcCreator,
typeDcDate,
typeDrawA,
typeTextH,
typeTextP,
@ -90,28 +98,42 @@ enum ElementType
typeTextSectionSource,
typeTextIndexTitle,
typeTextIndexBody,
typeTextNumberedParagraph,
typeDrawA,
typeTextNumberedParagraph,
typeTextExpression,
typeTextTableOfContent,
typeTextIllustrationIndex,
typeTextTableIndex,
typeTextObjectIndex,
typeTextUserIndex,
typeTextAlphabeticalIndex,
typeTextBibliography,
typeTextBibliographyMark,
typeTextTableOfContentSource,
typeTextIllustrationIndex,
typeTextIllustrationIndexSource,
typeTextTableIndex,
typeTextTableIndexSource,
typeTextObjectIndex,
typeTextObjectIndexSource,
typeTextUserIndex,
typeTextUserIndexSource,
typeTextAlphabeticalIndex,
typeTextAlphabeticalIndexSource,
typeTextBibliographySource,
typeTextBibliography,
typeTextBibliographyMark,
typeTextBibliographySource,
typeTextVariableInput,
typeTextVariableGet,
typeTextVariableSet,
typeTextVariableDecl,
typeTextVariableDecls,
typeTextUserFieldDecls,
typeTextUserFieldDecl,
typeTextUserFieldGet,
typeTextUserFieldSet,
typeTextUserFieldInput,
typeTextTrackedChanges,
typeTextChangedRegion,
@ -125,6 +147,11 @@ enum ElementType
typeTextFormatChange,
typeTextInsertion,
typeTextMeta,
typeTextMetaField,
typeTextTextInput,
typeShape,
typeChangeMarks,
@ -206,6 +233,11 @@ enum ElementType
typeTableDatabaseRange,
typeTableSort,
typeTableSortBy,
typeTableCalculationSettings,
typeTableNullDate,
typeTableShapes,
typeTableContentValidation,
typeTableContentValidations,
typeTableFilter,
typeTableFilterAnd,
@ -384,9 +416,6 @@ enum ElementType
typeScriptEventListener,
typeTableCalculationSettings,
typeTableNullDate,
typeNumberNumberStyle,
typeNumberDataStyle,
typeNumberText,
@ -409,7 +438,6 @@ enum ElementType
typeNumberMinutes,
typeNumberSeconds,
typeNumberAmPm,
typeTableShapes,
typeChartChart,
typeChartTitle,

View File

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

View File

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

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/common/readstring.h>
#include <cpdoccore/odf/odf_document.h>
@ -742,7 +741,7 @@ std::wostream & title::text_to_stream(std::wostream & _Wostream) const
void title::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void title::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -806,7 +805,7 @@ std::wostream & subject::text_to_stream(std::wostream & _Wostream) const
void subject::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void subject::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -823,8 +822,8 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
Context.add_new_run();
std::wstring textNode = L"w:t";
@ -838,7 +837,7 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
strm << L"</" << textNode << L">";
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
void subject::xlsx_convert(oox::xlsx_conversion_context & Context)
@ -869,7 +868,7 @@ std::wostream & chapter::text_to_stream(std::wostream & _Wostream) const
void chapter::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void chapter::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1379,9 +1378,77 @@ void sequence::pptx_convert(oox::pptx_conversion_context & Context)
text_[i]->pptx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------------------------
// text:drop-down
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_drop_down::ns = L"text";
const wchar_t * text_drop_down::name = L"drop-down";
// text:sequesheet-namence
//////////////////////////////////////////////////////////////////////////////////////////////////
void text_drop_down::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_drop_down::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"label")
{
CP_CREATE_ELEMENT(content_);
}
else
{
}
}
void text_drop_down::add_text(const std::wstring & Text)
{
text_ = Text;
}
std::wostream & text_drop_down::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_drop_down::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << text_name_.get_value_or(L"") << L"\"/><w:enabled/>";
strm << L"<w:ddList><w:result w:val=\"0\"/>";
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
strm << L"</w:ddList></w:ffData>";
strm << L"</w:fldChar></w:r>";
strm << L"<w:r><w:instrText>FORMDROPDOWN</w:instrText></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
strm << L"<w:r><w:t>" << text_ << L"</w:t></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:label
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_label::ns = L"text";
const wchar_t * text_label::name = L"label";
void text_label::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:value", text_value_);
}
void text_label::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
strm << L"<w:listEntry w:val=\"" << text_value_.get_value_or(L"") << L"\"/>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * sheet_name::ns = L"text";
const wchar_t * sheet_name::name = L"sheet-name";

View File

@ -122,7 +122,6 @@ private:
_CP_OPT(unsigned int) text_c_;
_CP_OPT(std::wstring) content_;
};
CP_REGISTER_OFFICE_ELEMENT2(s);
// text:tab
@ -431,7 +430,6 @@ CP_REGISTER_OFFICE_ELEMENT2(a);
// text:note
//////////////////////////////////////////////////////////////////////////////////////////////////
class note : public paragraph_content_element<note>
{
public:
@ -452,18 +450,16 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(note);
// text:ruby
//////////////////////////////////////////////////////////////////////////////////////////////////
class ruby : public paragraph_content_element<ruby>
{
public:
@ -485,7 +481,6 @@ private:
office_element_ptr text_ruby_text_;
};
CP_REGISTER_OFFICE_ELEMENT2(ruby);
class common_field_fixed_attlist
@ -521,8 +516,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
office_element_ptr_array content_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -549,7 +544,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -577,7 +572,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -687,7 +682,7 @@ public:
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_;
office_element_ptr_array text_;
private:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -715,8 +710,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
//-------------------------------------------------------------------------------------------------------------------
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_time : public paragraph_content_element<text_time>
{
public:
@ -745,8 +741,9 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(text_time);
//-------------------------------------------------------------------------------------------------------------------
// text:modification-date
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_modification_time : public text_time
{
public:
@ -762,8 +759,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_time);
//-------------------------------------------------------------------------------------------------------------------
// text:file-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_file_name : public paragraph_content_element<text_file_name>
{
public:
@ -787,11 +785,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_file_name);
//-------------------------------------------------------------------------------------------------------------------
// text:sequence
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sequence : public paragraph_content_element<sequence>
{
public:
@ -815,11 +813,58 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sequence);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_drop_down : public paragraph_content_element<text_drop_down>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextDropDown;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
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);
virtual void add_text(const std::wstring & Text);
_CP_OPT(std::wstring) text_name_;
office_element_ptr_array content_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_drop_down);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_label : public paragraph_content_element<text_label>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextLabel;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_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) text_value_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_label);
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sheet_name : public paragraph_content_element<sheet_name>
{
public:
@ -837,11 +882,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sheet_name);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:footer
//-------------------------------------------------------------------------------------------------------------------
class presentation_footer : public paragraph_content_element<presentation_footer>
{
public:
@ -861,8 +906,9 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_footer);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:date-time
//-------------------------------------------------------------------------------------------------------------------
class presentation_date_time: public paragraph_content_element<presentation_date_time>
{
public:

View File

@ -33,7 +33,6 @@
#include "ruby.h"
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/xmlchar.h>

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include "styles.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>

View File

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

View File

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

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
#include "odfcontext.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>
@ -804,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;
@ -888,6 +889,10 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
}
if (attlist_.table_content_validation_name_)
{
}
}
if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
{

View File

@ -34,7 +34,7 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include "paragraph_elements.h"
#include "serialize_elements.h"
@ -341,13 +341,13 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
int textStyle = process_paragraph_attr(attrs_, Context);
first_text_paragraph->docx_convert(Context);
int str_start = Context.get_drop_cap_context().Length;
int str_size = store_str.length()-Context.get_drop_cap_context().Length;
size_t str_start = Context.get_drop_cap_context().Length;
size_t str_size = store_str.length() - Context.get_drop_cap_context().Length;
if (str_size < 0) str_size = 0; // это если на буквы в буквице разные стили
if (str_start > store_str.length()) str_start = store_str.length(); // это если на буквы в буквице разные стили
str=store_str.substr(str_start, str_size);
str = store_str.substr(str_start, str_size);
}
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
@ -1424,7 +1424,119 @@ void text_change_end::docx_convert(oox::docx_conversion_context & Context)
{
Context.end_text_changes (*text_change_id_);
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_input::ns = L"text";
const wchar_t * text_variable_input::name = L"variable-input";
void text_variable_input::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:description", text_description_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_input::add_text(const std::wstring & Text)
{
text_ = Text;
}
std::wostream & text_variable_input::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_variable_input::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>ASK &quot;" << text_name_.get_value_or(L"") << L"&quot; " << text_description_.get_value_or(L"") << L" \\d ";
strm << text_;
strm << L"</w:instrText></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>REF &quot;" << text_name_.get_value_or(L"") << L"&quot; </w:instrText></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
strm << L"<w:r><w:t>" << text_ << L"</w:t></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_get::ns = L"text";
const wchar_t * text_variable_get::name = L"variable-get";
void text_variable_get::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_get::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_set::ns = L"text";
const wchar_t * text_variable_set::name = L"variable-set";
void text_variable_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
CP_APPLY_ATTR(L"office:value", office_value_);
CP_APPLY_ATTR(L"office:boolean-value", office_boolean_value_);
CP_APPLY_ATTR(L"office:date-value", office_date_value_);
CP_APPLY_ATTR(L"office:time-value", office_time_value_);
CP_APPLY_ATTR(L"office:string-value", office_string_value_);
CP_APPLY_ATTR(L"office:currency", office_currency_);
CP_APPLY_ATTR(L"office:formula", office_formula_);
}
void text_variable_set::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_decl::ns = L"text";
const wchar_t * text_variable_decl::name = L"variable-decl";
void text_variable_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_decl::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_decls::ns = L"text";
const wchar_t * text_variable_decls::name = L"variable-decls";
void text_variable_decls::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"variable-decl")
{
CP_CREATE_ELEMENT(content_);
}
else
{
}
}
void text_variable_decls::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
}
}
}

View File

@ -535,8 +535,6 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(text_index_title);
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
class text_unknown_base_change : public office_element_impl<text_unknown_base_change>
{
@ -717,8 +715,137 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(text_change_end);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-input
//---------------------------------------------------------------------------------------------------
class text_variable_input : public office_element_impl<text_variable_input>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableInput;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
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){}
virtual void add_text(const std::wstring & Text);
_CP_OPT(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_description_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_input);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-get
//---------------------------------------------------------------------------------------------------
class text_variable_get : public office_element_impl<text_variable_get>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableGet;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_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) style_data_style_name_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_get);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-set
//---------------------------------------------------------------------------------------------------
class text_variable_set : public office_element_impl<text_variable_set>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableSet;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_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(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) office_boolean_value_;
_CP_OPT(std::wstring) office_date_value_;
_CP_OPT(std::wstring) office_time_value_;
_CP_OPT(std::wstring) office_string_value_;
_CP_OPT(std::wstring) office_value_;
_CP_OPT(std::wstring) office_currency_;
_CP_OPT(std::wstring) office_formula_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_set);
//---------------------------------------------------------------------------------------------------
//text:variable-decl
//---------------------------------------------------------------------------------------------------
class text_variable_decl : public office_element_impl<text_variable_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableDecl;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_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(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_decl);
//---------------------------------------------------------------------------------------------------
//text:variable-decls
//---------------------------------------------------------------------------------------------------
class text_variable_decls : public office_element_impl<text_variable_decls>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableDecls;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_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(text_variable_decls);
}
}
}

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

@ -2992,7 +2992,10 @@ void DocxConverter::convert_styles()
{
if (docx_styles->m_arrStyle[i] == NULL) continue;
current_font_size.erase(current_font_size.begin() + 1, current_font_size.end());
if (!current_font_size.empty())
{
current_font_size.erase(current_font_size.begin() + 1, current_font_size.end());
}
convert(docx_styles->m_arrStyle[i]);

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

@ -33,9 +33,12 @@
#ifndef PPTX_IFILE_CONTAINER_INCLUDE_H_
#define PPTX_IFILE_CONTAINER_INCLUDE_H_
#include "../../Common/DocxFormat/Source/DocxFormat/IFileContainer.h"
#include "FileMap.h"
#include "PPTXEvent.h"
#include "../../Common/DocxFormat/Source/DocxFormat/IFileContainer.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/External.h"
namespace PPTX
{
@ -52,7 +55,32 @@ namespace PPTX
virtual ~FileContainer()
{
}
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename;
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
protected:
void read(const OOX::CPath& filename);
void read(const OOX::CRels& rels, const OOX::CPath& path);

View File

@ -110,11 +110,9 @@ namespace PPTX
return p->filename().m_strFilename;
}
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*embed);
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*embed);
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*embed);
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*embed);
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*embed);
if(parentFileIs<FileContainer>())
return parentFileAs<FileContainer>().GetImagePathNameFromRId(*embed);
return _T("");
}
else if(link.IsInit())
@ -126,11 +124,9 @@ namespace PPTX
return p->filename().m_strFilename;
}
if(parentFileIs<Slide>()) return parentFileAs<Slide>().GetImagePathNameFromRId(*link);
else if(parentFileIs<SlideLayout>()) return parentFileAs<SlideLayout>().GetImagePathNameFromRId(*link);
else if(parentFileIs<SlideMaster>()) return parentFileAs<SlideMaster>().GetImagePathNameFromRId(*link);
else if(parentFileIs<Theme>()) return parentFileAs<Theme>().GetImagePathNameFromRId(*link);
else if(parentFileIs<NotesSlide>()) return parentFileAs<NotesSlide>().GetImagePathNameFromRId(*link);
if(parentFileIs<FileContainer>())
return parentFileAs<FileContainer>().GetImagePathNameFromRId(*link);
return _T("");
}
return _T("");
@ -140,12 +136,7 @@ namespace PPTX
smart_ptr<OOX::OleObject> pOleObject;
if (pRels != NULL) pOleObject = pRels->Get<OOX::OleObject>(oRId);
else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().Get<OOX::OleObject>(oRId);
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().Get<OOX::OleObject>(oRId);
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().Get<OOX::OleObject>(oRId);
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().Get<OOX::OleObject>(oRId);
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().Get<OOX::OleObject>(oRId);
else if(parentFileIs<FileContainer>()) pOleObject = parentFileAs<FileContainer>().Get<OOX::OleObject>(oRId);
if (pOleObject.IsInit())
return pOleObject->filename().m_strFilename;

View File

@ -58,11 +58,8 @@ namespace PPTX
}
if(sLink.empty())
{
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
if(parentFileIs<FileContainer>())
sLink = parentFileAs<FileContainer>().GetLinkFromRId(rid);
}
XmlUtils::replace_all(sLink, L"\\", L"/");

View File

@ -57,11 +57,8 @@ namespace PPTX
}
if(sLink.empty())
{
if(parentFileIs<Slide>()) sLink = parentFileAs<Slide>().GetLinkFromRId(rid);
else if(parentFileIs<SlideLayout>()) sLink = parentFileAs<SlideLayout>().GetLinkFromRId(rid);
else if(parentFileIs<SlideMaster>()) sLink = parentFileAs<SlideMaster>().GetLinkFromRId(rid);
else if(parentFileIs<Theme>()) sLink = parentFileAs<Theme>().GetLinkFromRId(rid);
else if(parentFileIs<NotesSlide>()) sLink = parentFileAs<NotesSlide>().GetLinkFromRId(rid);
if(parentFileIs<FileContainer>())
sLink = parentFileAs<FileContainer>().GetLinkFromRId(rid);
}
return sLink;

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)
{
@ -1148,7 +1151,7 @@ namespace PPTX
{
double trim = 0.0;
if (parentFileIs<Slide>())
if (parentFileIs<FileContainer>())
{
if (nvPicPr.nvPr.media.is<MediaFile>())
{
@ -1156,7 +1159,7 @@ namespace PPTX
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
{
if (std::wstring (_T("NULL")) == parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get()) ) // HAVE TRIM
if (std::wstring (_T("NULL")) == parentFileAs<FileContainer>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get()) ) // HAVE TRIM
{
if(nvPicPr.nvPr.extLst.size())
{
@ -1175,15 +1178,15 @@ namespace PPTX
{
double trim = -1.0;
if (parentFileIs<Slide>())
if (nvPicPr.nvPr.media.is<MediaFile>())
{
if (nvPicPr.nvPr.media.is<MediaFile>())
if ((nvPicPr.nvPr.media.as<MediaFile>().name == _T("videoFile")) ||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
{
if ((nvPicPr.nvPr.media.as<MediaFile>().name == _T("videoFile")) ||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")) ||
(nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile")) )
if (parentFileIs<FileContainer>())
{
if (std::wstring (_T("NULL")) == parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get())) // HAVE TRIM
if (std::wstring (_T("NULL")) == parentFileAs<FileContainer>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get())) // HAVE TRIM
{
if(nvPicPr.nvPr.extLst.size())
{

View File

@ -88,25 +88,6 @@ namespace PPTX
{
return type().DefaultFileName();
}
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename; //??? целесообразность ??
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->StartRecord(NSBinPptxRW::NSMainTables::NotesSlides);

View File

@ -49,9 +49,6 @@
#include "NotesSlide.h"
#include "TableStyles.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/External.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
@ -144,33 +141,6 @@ namespace PPTX
return type().DefaultFileName();
}
//-------------------------------------------------
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename;
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual DWORD GetRGBAFromMap(const std::wstring& str)const
{
if(!(clrMapOvr.is_init()))

View File

@ -185,32 +185,6 @@ namespace PPTX
}
}
}
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename;
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual DWORD GetRGBAFromMap(const std::wstring& str)const
{
if(!(clrMapOvr.is_init()))

View File

@ -51,8 +51,6 @@
#include "Theme.h"
#include "TableStyles.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
@ -172,32 +170,6 @@ namespace PPTX
}
}
}
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename;
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
//---------------------Colors from map---------------------------------------
DWORD GetRGBAFromMap(const std::wstring& str)const

View File

@ -334,33 +334,6 @@ namespace PPTX
{
return GetABGRFromScheme(m_map->GetColorSchemeIndex(str));
}
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
if (pExt.IsInit())
return pExt->Uri().m_strFilename;
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
if (pMedia.IsInit())
return pMedia->filename().m_strFilename;
return _T("");
}
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
{
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
if (!p.is_init())
return _T("");
return p->filename().m_strFilename;
}
void GetLineStyle(int number, Logic::Ln& lnStyle)const
{
themeElements.fmtScheme.GetLineStyle(number, lnStyle);

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

@ -45,6 +45,8 @@
#include "../../../../DesktopEditor/common/File.h"
#include <boost/unordered_map.hpp>
namespace OOX
{
namespace Rels
@ -313,7 +315,7 @@ namespace OOX
{
(*ppRelationShip) = NULL;
std::map<std::wstring, Rels::CRelationShip*>::iterator pFind = m_mapRelations.find(rId.get());
boost::unordered_map<std::wstring, Rels::CRelationShip*>::iterator pFind = m_mapRelations.find(rId.get());
if (pFind != m_mapRelations.end())
{
(*ppRelationShip) = pFind->second;
@ -336,7 +338,7 @@ namespace OOX
public:
std::vector<Rels::CRelationShip*> m_arRelations;
std::map<std::wstring, Rels::CRelationShip*> m_mapRelations;
boost::unordered_map<std::wstring, Rels::CRelationShip*> m_mapRelations;
};
} // namespace OOX

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

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

View File

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

View File

@ -7,9 +7,6 @@
QT -= core
QT -= gui
VERSION = 2.4.508.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;
}