mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e33a2308 | |||
| 54260e7562 | |||
| aed5e9a013 | |||
| b265d2852f | |||
| 3919a01c08 | |||
| 4f4553c189 | |||
| 5ec9ad38d0 | |||
| 3a8c3c8d39 | |||
| 62a5681771 | |||
| 3cc6a01f5a | |||
| 328ca886c7 | |||
| ff0f58cc3c | |||
| 2708b22cf3 | |||
| cb6c9838d3 | |||
| 8da8ad22d0 | |||
| 140d86b7ec | |||
| d57b9f975a | |||
| 80f51fa151 | |||
| ef3b5c2a6d | |||
| bf8ff829f3 | |||
| f981ff5a2f | |||
| 843e10c4a7 | |||
| d5a96c9828 | |||
| 8e45345f31 | |||
| ad1bf1def6 | |||
| d9c6ade2d9 | |||
| 448dc65550 | |||
| 1a722a46cb | |||
| 56a813e19f | |||
| 5ae1bfb8e2 | |||
| e15fdca981 | |||
| e4e24d0c3e | |||
| 1b0f0eae33 | |||
| ec93bce61c | |||
| 4fa865799b |
@ -91,8 +91,11 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
|
||||
rPrChange.AppendAttribute( date );
|
||||
|
||||
XMLTools::XMLElement rPr(L"w:rPr");
|
||||
//convert revision stack
|
||||
convertSprms( _revisionData->Changes, &rPrChange );
|
||||
convertSprms( _revisionData->Changes, &rPr);
|
||||
|
||||
rPrChange.AppendChild(rPr);
|
||||
|
||||
_rPr->AppendChild( rPrChange );
|
||||
}
|
||||
|
||||
@ -399,16 +399,17 @@ namespace DocFileFormat
|
||||
|
||||
if (Deleted == rev.Type)
|
||||
{
|
||||
//If it's a deleted run
|
||||
WideString* author = dynamic_cast<WideString*>(m_document->RevisionAuthorTable->operator[](rev.Isbt));
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:del", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:author", L"[b2x: could not retrieve author]");
|
||||
m_pXmlWriter->WriteAttribute(L"w:date", L"[b2x: could not retrieve date]");
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
|
||||
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||
}
|
||||
else if ( rev.Type == Inserted )
|
||||
{
|
||||
WideString* author = dynamic_cast<WideString*>(m_document->RevisionAuthorTable->operator[](rev.Isbt));
|
||||
//if it's a inserted run
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
|
||||
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
|
||||
|
||||
@ -60,65 +60,50 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( iter->OpCode)
|
||||
{
|
||||
//revision data
|
||||
case 0xCA89:
|
||||
case sprmCPropRMark2:
|
||||
{
|
||||
//revision mark
|
||||
collectRevisionData = false;
|
||||
//author
|
||||
this->Isbt = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
//date
|
||||
this->Dttm = DateAndTime( ( iter->Arguments + 3 ), 4 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0801:
|
||||
}break;
|
||||
case sprmCFRMark:
|
||||
{
|
||||
//revision mark
|
||||
collectRevisionData = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x4804:
|
||||
}break;
|
||||
case sprmCIbstRMark:
|
||||
{
|
||||
//author
|
||||
this->Isbt = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x6805:
|
||||
}break;
|
||||
case sprmCIbstRMarkDel:
|
||||
{
|
||||
this->Isbt = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
}break;
|
||||
case sprmCDttmRMark:
|
||||
{
|
||||
//date
|
||||
this->Dttm = DateAndTime( iter->Arguments, 4 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0800:
|
||||
}break;
|
||||
case sprmCDttmRMarkDel:
|
||||
{
|
||||
this->Dttm = DateAndTime(iter->Arguments, 4);
|
||||
}break;
|
||||
case sprmCFRMarkDel:
|
||||
{
|
||||
//delete mark
|
||||
this->Type = Deleted;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x6815:
|
||||
}break;
|
||||
case sprmCRsidProp:
|
||||
{
|
||||
this->RsidProp = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x6816:
|
||||
}break;
|
||||
case sprmCRsidText:
|
||||
{
|
||||
this->Rsid = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x6817:
|
||||
}break;
|
||||
case sprmCRsidRMDel:
|
||||
{
|
||||
this->RsidDel = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//put the sprm on the revision stack
|
||||
|
||||
@ -30,23 +30,50 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CustormXmlWriter.h"
|
||||
#include "CustomXmlWriter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h"
|
||||
#include "../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
CustomXmlWriter::CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter):m_sDir(sDir),m_pDrawingConverter(pDrawingConverter)
|
||||
CustomXmlWriter::CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter) : m_sDir(sDir), m_pDrawingConverter(pDrawingConverter)
|
||||
{
|
||||
m_nCount = 0;
|
||||
}
|
||||
std::wstring CustomXmlWriter::WriteCustomXml(const std::wstring& sUrl, const std::wstring& sXml)
|
||||
void CustomXmlWriter::WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContent)
|
||||
{
|
||||
m_nCount++;
|
||||
|
||||
std::wstring sCustomXmlDir = m_sDir + FILE_SEPARATOR_STR;
|
||||
sCustomXmlDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath();
|
||||
|
||||
std::wstring sCustomXmlRelsDir = sCustomXmlDir + FILE_SEPARATOR_STR + L"_rels";
|
||||
|
||||
std::wstring sCustomXMLPropsFilename = OOX::FileTypes::CustomXmlProps.DefaultFileName().GetBasename();
|
||||
sCustomXMLPropsFilename += std::to_wstring(m_nCount) + OOX::FileTypes::CustomXmlProps.DefaultFileName().GetExtention();
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXMLPropsFilename, sCustomXmlPropertiesContent);
|
||||
|
||||
std::wstring sCustomXmlFilename;
|
||||
sCustomXmlFilename = OOX::FileTypes::CustomXml.DefaultFileName().GetBasename() + std::to_wstring(m_nCount);
|
||||
sCustomXmlFilename += OOX::FileTypes::CustomXml.DefaultFileName().GetExtention();
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXmlFilename, sCustomXmlContent);
|
||||
|
||||
m_pDrawingConverter->SetDstContentRels();
|
||||
unsigned int lId;
|
||||
m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXmlProps.RelationType(), sCustomXMLPropsFilename, L"", &lId);
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
arItems.push_back(sCustomXmlFilename);
|
||||
}
|
||||
void CustomXmlWriter::WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml)
|
||||
{
|
||||
m_nCount++;
|
||||
OOX::CCustomXMLProps oCustomXMLProps(NULL);
|
||||
OOX::CCustomXMLProps::CShemaRef* pShemaRef = new OOX::CCustomXMLProps::CShemaRef();
|
||||
pShemaRef->m_sUri = sUrl;
|
||||
//todo guid
|
||||
//todo guid
|
||||
oCustomXMLProps.m_oItemID.FromString(L"{5D0AEA6B-E499-4EEF-98A3-AFBB261C493E}");
|
||||
oCustomXMLProps.m_oShemaRefs.Init();
|
||||
oCustomXMLProps.m_oShemaRefs->m_arrItems.push_back(pShemaRef);
|
||||
@ -71,6 +98,7 @@ namespace Writers
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXmlFilename, sXml);
|
||||
return sCustomXmlFilename;
|
||||
|
||||
arItems.push_back(sCustomXmlFilename);
|
||||
}
|
||||
}
|
||||
@ -29,8 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef CUSTOM_XML_WRITER
|
||||
#define CUSTOM_XML_WRITER
|
||||
#pragma once
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
|
||||
@ -44,11 +43,15 @@ namespace Writers
|
||||
class CustomXmlWriter
|
||||
{
|
||||
int m_nCount;
|
||||
std::wstring m_sDir;
|
||||
std::wstring m_sDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
|
||||
public:
|
||||
std::vector<std::wstring> arItems;
|
||||
|
||||
CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
std::wstring WriteCustomXml(const std::wstring& sUrl, const std::wstring& sXml);
|
||||
|
||||
void WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml);
|
||||
void WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContents);
|
||||
};
|
||||
}
|
||||
#endif // #ifndef CUSTOM_XML_WRITER
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Writers
|
||||
{
|
||||
std::wstring m_sDir;
|
||||
public:
|
||||
DocumentRelsWriter(std::wstring sDir):m_sDir(sDir), m_bHasCustom(false)
|
||||
DocumentRelsWriter(std::wstring sDir) : m_sDir(sDir), m_bHasCustomProperties(false)
|
||||
{
|
||||
}
|
||||
void Write(bool bGlossary = false)
|
||||
@ -51,7 +51,7 @@ namespace Writers
|
||||
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"word/document.xml\"/> \
|
||||
<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"docProps/core.xml\"/> \
|
||||
<Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\" Target=\"docProps/app.xml\"/>");
|
||||
if(m_bHasCustom)
|
||||
if (m_bHasCustomProperties)
|
||||
{
|
||||
s_Common += L"<Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\" Target=\"docProps/custom.xml\"/>";
|
||||
}
|
||||
@ -64,7 +64,6 @@ namespace Writers
|
||||
oFile.WriteStringUTF8(s_Common);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
public:
|
||||
bool m_bHasCustom;
|
||||
bool m_bHasCustomProperties = false;
|
||||
};
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
#include "DocumentRelsWriter.h"
|
||||
#include "webSettingsWriter.h"
|
||||
#include "DefaultThemeWriter.h"
|
||||
#include "CustormXmlWriter.h"
|
||||
#include "CustomXmlWriter.h"
|
||||
|
||||
namespace BinDocxRW
|
||||
{
|
||||
|
||||
@ -103,22 +103,22 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
}
|
||||
~HeaderFooterWriter()
|
||||
{
|
||||
for(size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
for (size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
delete m_aHeaders[i];
|
||||
m_aHeaders.clear();
|
||||
|
||||
for(size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
for (size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
delete m_aFooters[i];
|
||||
m_aFooters.clear();
|
||||
}
|
||||
void Write(bool bGlossary = false)
|
||||
{
|
||||
for(size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
for (size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pHeader = m_aHeaders[i];
|
||||
WriteItem(L"header", pHeader->m_sFilename, pHeader->Header, true);
|
||||
}
|
||||
for(size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
for (size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pFooter = m_aFooters[i];
|
||||
WriteItem(L"footer", pFooter->m_sFilename, pFooter->Header, false);
|
||||
@ -131,12 +131,12 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
|
||||
if(bHeader)
|
||||
if (bHeader)
|
||||
oFile.WriteStringUTF8(g_string_hdr_Start);
|
||||
else
|
||||
oFile.WriteStringUTF8(g_string_ftr_Start);
|
||||
oFile.WriteStringUTF8(m_oWriter.m_oContent.GetData());
|
||||
if(bHeader)
|
||||
if (bHeader)
|
||||
oFile.WriteStringUTF8(g_string_hdr_End);
|
||||
else
|
||||
oFile.WriteStringUTF8(g_string_ftr_End);
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h"
|
||||
|
||||
#include "../DocWrapper/XlsxSerializer.h"
|
||||
|
||||
@ -3514,8 +3515,63 @@ int Binary_OtherTableReader::ReadImageMapContent(BYTE type, long length, void* p
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------------------------------
|
||||
Binary_CustomsTableReader::Binary_CustomsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
|
||||
{
|
||||
}
|
||||
int Binary_CustomsTableReader::Read()
|
||||
{
|
||||
OOX::CCustomXMLProps oCustomXmlProps(NULL);
|
||||
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
READ_TABLE_DEF(res, this->ReadCustom, NULL);
|
||||
|
||||
return res;
|
||||
}
|
||||
int Binary_CustomsTableReader::ReadCustom(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
|
||||
if (c_oSerCustoms::Custom == type)
|
||||
{
|
||||
OOX::CCustomXMLProps oCustomXmlProps(NULL);
|
||||
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
READ1_DEF(length, res, this->ReadCustomContent, &oCustomXmlProps);
|
||||
|
||||
m_oFileWriter.m_oCustomXmlWriter.WriteCustom(oCustomXmlProps.toXML(), oCustomXmlProps.m_oCustomXmlContent);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int Binary_CustomsTableReader::ReadCustomContent(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::CCustomXMLProps* pCustomXMLProps = static_cast<OOX::CCustomXMLProps*>(poResult);
|
||||
|
||||
if (c_oSerCustoms::Uri == type)
|
||||
{
|
||||
if (false == pCustomXMLProps->m_oShemaRefs.IsInit())
|
||||
pCustomXMLProps->m_oShemaRefs.Init();
|
||||
|
||||
pCustomXMLProps->m_oShemaRefs->m_arrItems.push_back(new OOX::CCustomXMLProps::CShemaRef());
|
||||
pCustomXMLProps->m_oShemaRefs->m_arrItems.back()->m_sUri = m_oBufferedStream.GetString3(length);
|
||||
}
|
||||
else if (c_oSerCustoms::ItemId == type)
|
||||
{
|
||||
pCustomXMLProps->m_oItemID.FromString(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerCustoms::Content == type)
|
||||
{
|
||||
pCustomXMLProps->m_oCustomXmlContent = m_oBufferedStream.GetString3(length);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------------------------------
|
||||
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
|
||||
{
|
||||
@ -9514,14 +9570,20 @@ int BinaryFileReader::ReadMainTable()
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
if(-1 != nSettingsOffset)
|
||||
{
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nSettingsOffset);
|
||||
res = Binary_SettingsTableReader(m_oBufferedStream, m_oFileWriter, oSettingsCustom).Read();
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
|
||||
if (!oSettingsCustom.IsEmpty())
|
||||
{
|
||||
m_oFileWriter.m_oCustomXmlWriter.WriteCustomSettings(oSettingsCustom.GetSchemaUrl(), oSettingsCustom.ToXml());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -9531,7 +9593,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap);
|
||||
}
|
||||
BinaryStyleTableReader oBinaryStyleTableReader(m_oBufferedStream, m_oFileWriter);
|
||||
if(-1 != nStyleOffset)
|
||||
if (-1 != nStyleOffset)
|
||||
{
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nStyleOffset);
|
||||
@ -9540,7 +9602,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
return res;
|
||||
}
|
||||
Binary_CommentsTableReader oBinary_CommentsTableReader(m_oBufferedStream, m_oFileWriter);
|
||||
if(-1 != nCommentsOffset)
|
||||
if (-1 != nCommentsOffset)
|
||||
{
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nCommentsOffset);
|
||||
@ -9550,7 +9612,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
return res;
|
||||
}
|
||||
Binary_CommentsTableReader oBinary_DocumentCommentsTableReader(m_oBufferedStream, m_oFileWriter);
|
||||
if(-1 != nDocumentCommentsOffset)
|
||||
if (-1 != nDocumentCommentsOffset)
|
||||
{
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nDocumentCommentsOffset);
|
||||
@ -9600,23 +9662,28 @@ int BinaryFileReader::ReadMainTable()
|
||||
PPTX::CustomProperties* pCustomProperties = new PPTX::CustomProperties(NULL);
|
||||
pCustomProperties->fromPPTY(&m_oBufferedStream);
|
||||
m_oFileWriter.m_pCustomProperties = pCustomProperties;
|
||||
m_oFileWriter.m_oDocumentRelsWriter.m_bHasCustom = true;
|
||||
}break;
|
||||
m_oFileWriter.m_oDocumentRelsWriter.m_bHasCustomProperties = true;
|
||||
}break;
|
||||
case c_oSerTableTypes::HdrFtr:
|
||||
{
|
||||
res = Binary_HdrFtrTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments).Read();
|
||||
break;
|
||||
}break;
|
||||
case c_oSerTableTypes::Numbering:
|
||||
{
|
||||
res = Binary_NumberingTableReader(m_oBufferedStream, m_oFileWriter).Read();
|
||||
break;
|
||||
}break;
|
||||
case c_oSerTableTypes::Footnotes:
|
||||
{
|
||||
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, true).Read();
|
||||
break;
|
||||
}break;
|
||||
case c_oSerTableTypes::Endnotes:
|
||||
{
|
||||
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
|
||||
break;
|
||||
}break;
|
||||
case c_oSerTableTypes::VbaProject:
|
||||
{
|
||||
res = Binary_VbaProjectTableReader(m_oBufferedStream, m_oFileWriter).Read();
|
||||
break;
|
||||
}break;
|
||||
case c_oSerTableTypes::Glossary:
|
||||
{
|
||||
OOX::CPath pathGlossary = m_oFileWriter.get_document_writer().m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"glossary";
|
||||
@ -9631,11 +9698,21 @@ int BinaryFileReader::ReadMainTable()
|
||||
}
|
||||
else res = c_oSerConstants::ReadUnknown;
|
||||
}break;
|
||||
case c_oSerTableTypes::Customs:
|
||||
{
|
||||
OOX::CPath pathCustomXml = m_oFileWriter.get_document_writer().m_sDir + FILE_SEPARATOR_STR + L"customXml";
|
||||
OOX::CPath pathCustomXmlRels = pathCustomXml + FILE_SEPARATOR_STR + L"_rels";
|
||||
if (NSDirectory::CreateDirectory(pathCustomXml.GetPath()) && NSDirectory::CreateDirectory(pathCustomXmlRels.GetPath()))
|
||||
{
|
||||
Binary_CustomsTableReader oBinary_CustomsTableReader(m_oBufferedStream, m_oFileWriter);
|
||||
res = oBinary_CustomsTableReader.Read();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
if (c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
if(-1 != nDocumentOffset)
|
||||
if (-1 != nDocumentOffset)
|
||||
{
|
||||
m_oBufferedStream.Seek(nDocumentOffset);
|
||||
|
||||
@ -9667,13 +9744,13 @@ int BinaryFileReader::ReadMainTable()
|
||||
}
|
||||
}
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"styles.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"styles.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"settings.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"settings.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"webSettings.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"webSettings.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"fontTable.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"fontTable.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.theme+xml", L"/word/theme", L"theme1.xml");
|
||||
|
||||
if (false == m_oFileWriter.m_bGlossaryMode && false == m_oFileWriter.IsEmptyGlossary())
|
||||
@ -9687,7 +9764,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", L"numbering.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"numbering.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"numbering.xml");
|
||||
}
|
||||
if (false == m_oFileWriter.get_footnotes_writer().IsEmpty())
|
||||
{
|
||||
@ -9695,7 +9772,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", L"footnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"footnotes.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"footnotes.xml");
|
||||
}
|
||||
if (false == m_oFileWriter.get_endnotes_writer().IsEmpty())
|
||||
{
|
||||
@ -9703,7 +9780,7 @@ int BinaryFileReader::ReadMainTable()
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", L"endnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(std::wstring(L"/glossary")) : L""), L"endnotes.xml");
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), L"endnotes.xml");
|
||||
}
|
||||
for (size_t i = 0; i < m_oFileWriter.get_headers_footers_writer().m_aHeaders.size(); ++i)
|
||||
{
|
||||
@ -9716,13 +9793,13 @@ int BinaryFileReader::ReadMainTable()
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(L"/glossary") : L""), pHeader->m_sFilename);
|
||||
L"/word" + std::wstring(m_oFileWriter.m_bGlossaryMode ? L"/glossary" : L""), pHeader->m_sFilename);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < m_oFileWriter.get_headers_footers_writer().m_aFooters.size(); ++i)
|
||||
{
|
||||
Writers::HdrFtrItem* pFooter = m_oFileWriter.get_headers_footers_writer().m_aFooters[i];
|
||||
if(false == pFooter->IsEmpty())
|
||||
if (false == pFooter->IsEmpty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", pFooter->m_sFilename, std::wstring(), &rId);
|
||||
@ -9733,9 +9810,9 @@ int BinaryFileReader::ReadMainTable()
|
||||
L"/word" + (m_oFileWriter.m_bGlossaryMode ? std::wstring(L"/glossary") : L""), pFooter->m_sFilename);
|
||||
}
|
||||
}
|
||||
if (!oSettingsCustom.IsEmpty()){
|
||||
std::wstring sFilename = m_oFileWriter.m_oCustomXmlWriter.WriteCustomXml(oSettingsCustom.GetSchemaUrl(), oSettingsCustom.ToXml());
|
||||
std::wstring sRelsPath = L"../" + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath() + L"/" + sFilename;
|
||||
for (size_t i = 0; i < m_oFileWriter.m_oCustomXmlWriter.arItems.size(); ++i)
|
||||
{
|
||||
std::wstring sRelsPath = L"../" + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath() + L"/" + m_oFileWriter.m_oCustomXmlWriter.arItems[i];
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXml.RelationType(), sRelsPath, L"", &rId);
|
||||
}
|
||||
|
||||
@ -223,6 +223,15 @@ public:
|
||||
int ReadOtherContent(BYTE type, long length, void* poResult);
|
||||
int ReadImageMapContent(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_CustomsTableReader : public Binary_CommonReader
|
||||
{
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
public:
|
||||
Binary_CustomsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read();
|
||||
int ReadCustom(BYTE type, long length, void* poResult);
|
||||
int ReadCustomContent(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_CommentsTableReader : public Binary_CommonReader
|
||||
{
|
||||
public:
|
||||
|
||||
@ -145,7 +145,8 @@ extern int g_nCurFormatVersion;
|
||||
Core = 16,
|
||||
DocumentComments = 17,
|
||||
CustomProperties = 18,
|
||||
Glossary = 19
|
||||
Glossary = 19,
|
||||
Customs = 20
|
||||
};}
|
||||
namespace c_oSerSigTypes{enum c_oSerSigTypes
|
||||
{
|
||||
@ -1146,6 +1147,13 @@ extern int g_nCurFormatVersion;
|
||||
PrEndPos = 10,
|
||||
PrRef = 11
|
||||
};}
|
||||
namespace c_oSerCustoms {enum c_oSerCustoms
|
||||
{
|
||||
Custom = 0,
|
||||
ItemId = 1,
|
||||
Uri = 2,
|
||||
Content = 3
|
||||
};}
|
||||
namespace c_oSerApp{enum c_oSerApp
|
||||
{
|
||||
Application = 0,
|
||||
|
||||
@ -49,6 +49,8 @@
|
||||
#include "../../HtmlFile2/htmlfile2.h"
|
||||
#include "../../ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h"
|
||||
|
||||
|
||||
#define COMPLEX_BOOL_TO_UINT(offset, val) \
|
||||
if(val.IsInit()) { \
|
||||
@ -8771,8 +8773,59 @@ void BinaryNotesTableWriter::WriteNote(const OOX::CFtnEdn& oFtnEdn, BinaryDocume
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oFtnEdn.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
BinaryCustomsTableWriter::BinaryCustomsTableWriter(ParamsWriter& oParamsWriter) : m_oParamsWriter(oParamsWriter), m_oBcw(oParamsWriter)
|
||||
{
|
||||
}
|
||||
void BinaryCustomsTableWriter::Write(OOX::CDocument* pDocument)
|
||||
{
|
||||
if (!pDocument) return;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
std::vector<smart_ptr<OOX::File>>& container = pDocument->GetContainer();
|
||||
for (size_t i = 0; i < container.size(); ++i)
|
||||
{
|
||||
if (OOX::FileTypes::CustomXml == container[i]->type())
|
||||
{
|
||||
OOX::CCustomXML* pCustomXml = dynamic_cast<OOX::CCustomXML*>(container[i].GetPointer());
|
||||
if (pCustomXml->bUsed) continue;
|
||||
|
||||
int nCurPos = m_oBcw.WriteItemStart(BinDocxRW::c_oSerCustoms::Custom);
|
||||
|
||||
std::vector<smart_ptr<OOX::File>>& containerCustom = pCustomXml->GetContainer();
|
||||
for (size_t i = 0; i < containerCustom.size(); ++i)
|
||||
{
|
||||
if (OOX::FileTypes::CustomXmlProps == containerCustom[i]->type())
|
||||
{
|
||||
OOX::CCustomXMLProps* pCustomXmlProps = dynamic_cast<OOX::CCustomXMLProps*>(containerCustom[i].GetPointer());
|
||||
|
||||
int nCurPos1 = m_oBcw.WriteItemStart(c_oSerCustoms::ItemId);
|
||||
m_oBcw.m_oStream.WriteStringW3(pCustomXmlProps->m_oItemID.ToString());
|
||||
m_oBcw.WriteItemEnd(nCurPos1);
|
||||
|
||||
if (pCustomXmlProps->m_oShemaRefs.IsInit())
|
||||
{
|
||||
for (size_t j = 0; j < pCustomXmlProps->m_oShemaRefs->m_arrItems.size(); ++j)
|
||||
{
|
||||
nCurPos1 = m_oBcw.WriteItemStart(c_oSerCustoms::Uri);
|
||||
m_oBcw.m_oStream.WriteStringW3(pCustomXmlProps->m_oShemaRefs->m_arrItems[j]->m_sUri);
|
||||
m_oBcw.WriteItemEnd(nCurPos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerCustoms::Content);
|
||||
m_oBcw.m_oStream.WriteStringW3(pCustomXml->m_sXml);
|
||||
m_oBcw.WriteItemEnd(nCurPos2);
|
||||
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
pCustomXml->bUsed = true;
|
||||
}
|
||||
}
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
BinaryFileWriter::BinaryFileWriter(ParamsWriter& oParamsWriter) : m_oParamsWriter(oParamsWriter), m_oBcw(oParamsWriter)
|
||||
{
|
||||
m_nLastFilePos = 0;
|
||||
@ -9041,6 +9094,13 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
if (m_oParamsWriter.m_bLocalNumbering)
|
||||
delete m_oParamsWriter.m_pNumbering;
|
||||
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Customs);
|
||||
BinDocxRW::BinaryCustomsTableWriter oBinaryCustomsTableWriter(m_oParamsWriter);
|
||||
oBinaryCustomsTableWriter.Write(pDocument);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
if (pDocx && pDocx->m_oGlossary.document)
|
||||
{
|
||||
m_oParamsWriter.m_pSettings = pDocx->m_oGlossary.settings;
|
||||
|
||||
@ -499,6 +499,15 @@ namespace BinDocxRW
|
||||
void WriteSdtTextFormPr(const OOX::Logic::CTextFormPr& oTextFormPr);
|
||||
void WriteSdtTextFormPrComb(const ComplexTypes::Word::CComb& oComb);
|
||||
};
|
||||
class BinaryCustomsTableWriter
|
||||
{
|
||||
private:
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
BinaryCommonWriter m_oBcw;
|
||||
public:
|
||||
BinaryCustomsTableWriter(ParamsWriter& oParamsWriter);
|
||||
void Write(OOX::CDocument* poDocument);
|
||||
};
|
||||
class BinaryCommentsTableWriter
|
||||
{
|
||||
struct CCommentWriteTemp
|
||||
|
||||
@ -38,7 +38,7 @@ SOURCES += \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.cpp \
|
||||
../../OfficeCryptReader/source/CryptTransform.cpp \
|
||||
../BinReader/Readers.cpp \
|
||||
../BinReader/CustormXmlWriter.cpp \
|
||||
../BinReader/CustomXmlWriter.cpp \
|
||||
../BinReader/FileWriter.cpp
|
||||
|
||||
HEADERS += ../DocWrapper/DocxSerializer.h \
|
||||
@ -75,4 +75,4 @@ HEADERS += ../DocWrapper/DocxSerializer.h \
|
||||
../DocWrapper/ChartWriter.h \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.h \
|
||||
../../OfficeCryptReader/source/CryptTransform.h \
|
||||
../BinReader/CustormXmlWriter.h
|
||||
../BinReader/CustomXmlWriter.h
|
||||
|
||||
@ -101,11 +101,8 @@ void ods_table_context::start_table_part(const std::wstring &name, std::wstring
|
||||
|
||||
if (std::wstring::npos == ref.find(L"!") )
|
||||
{
|
||||
bool bQuotes = false;
|
||||
if (std::wstring::npos != table_state_list_.back()->office_table_name_.find(L" "))
|
||||
{
|
||||
bQuotes = true;
|
||||
}
|
||||
bool bQuotes = (std::wstring::npos != table_state_list_.back()->office_table_name_.find(L" "));
|
||||
|
||||
ref = (bQuotes ? L"'" : L"" ) + table_state_list_.back()->office_table_name_ + (bQuotes ? L"'" : L"" ) + L"!" + ref;
|
||||
}
|
||||
std::wstring odf_range = formulas_converter.convert_named_ref(ref);
|
||||
@ -138,7 +135,11 @@ void ods_table_context::add_table_part_column(std::wstring name)
|
||||
|
||||
std::wstring sCol = L"$" + utils::getColAddress(state()->table_parts_.back().col_start + column - 1);
|
||||
|
||||
std::wstring ref = L"$" + state()->office_table_name_ + L"." ;
|
||||
bool bQuotes = (std::wstring::npos != table_state_list_.back()->office_table_name_.find(L" "));
|
||||
|
||||
std::wstring ref = L"$";
|
||||
|
||||
ref += (bQuotes ? L"'" : L"") + table_state_list_.back()->office_table_name_ + (bQuotes ? L"'" : L"") + L".";
|
||||
|
||||
ref += sCol + std::to_wstring(state()->table_parts_.back().row_start);
|
||||
ref += L":";
|
||||
@ -168,14 +169,16 @@ void ods_table_context::add_autofilter(std::wstring ref)
|
||||
if (!table_database_ranges_.root) create_element(L"table", L"database-ranges", table_database_ranges_.root, &context_);
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"table", L"database-range",elm,&context_);
|
||||
create_element(L"table", L"database-range", elm, &context_);
|
||||
table_database_range * d_range = dynamic_cast<table_database_range*>(elm.get());
|
||||
|
||||
if (!d_range)return;
|
||||
|
||||
if (std::wstring::npos == ref.find(L"!") )
|
||||
{
|
||||
ref = table_state_list_.back()->office_table_name_ + L"!" + ref;
|
||||
bool bQuotes = (std::wstring::npos != table_state_list_.back()->office_table_name_.find(L" "));
|
||||
|
||||
ref = (bQuotes ? L"'" : L"") + table_state_list_.back()->office_table_name_ + (bQuotes ? L"'" : L"") + L"!" + ref;
|
||||
}
|
||||
formulasconvert::oox2odf_converter formulas_converter;
|
||||
|
||||
@ -184,6 +187,8 @@ void ods_table_context::add_autofilter(std::wstring ref)
|
||||
d_range->table_target_range_address_ = odf_range;
|
||||
d_range->table_display_filter_buttons_= true;
|
||||
|
||||
d_range->table_name_ = L"__Anonymous_Sheet_DB__" + std::to_wstring(table_database_ranges_.elements.size() + 1);
|
||||
|
||||
table_database_ranges_.root->add_child_element(elm);
|
||||
table_database_ranges_.elements.push_back(elm);
|
||||
|
||||
|
||||
@ -116,15 +116,15 @@ void office_spreadsheet::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
if (data_pilot_tables_)
|
||||
data_pilot_tables_->serialize(CP_XML_STREAM());
|
||||
|
||||
|
||||
if (named_expressions_)
|
||||
named_expressions_->serialize(CP_XML_STREAM());
|
||||
|
||||
if (database_ranges_)
|
||||
database_ranges_->serialize(CP_XML_STREAM());
|
||||
database_ranges_->serialize(CP_XML_STREAM());
|
||||
|
||||
if (data_pilot_tables_)
|
||||
data_pilot_tables_->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1181,7 +1181,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
level = oox_row->m_oOutlineLevel->GetValue();
|
||||
}
|
||||
|
||||
ods_context->start_row(row_number, 1, level,_default);
|
||||
ods_context->start_row(row_number, 1, level, _default);
|
||||
|
||||
if (oox_row->m_oHidden.IsInit()) ods_context->current_table()->set_row_hidden(true);
|
||||
if (oox_row->m_oCollapsed.IsInit()) ods_context->current_table()->set_row_hidden(true);
|
||||
@ -1208,12 +1208,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
}
|
||||
ods_context->current_table()->set_row_height(height);
|
||||
}
|
||||
if ((oox_row->m_oCustomHeight.IsInit() && oox_row->m_oCustomHeight->GetValue() == 1) ||
|
||||
(oox_row->m_oCustomFormat.IsInit() && oox_row->m_oCustomFormat->GetValue() == 1 && oox_row->m_oHt.IsInit()) )
|
||||
{
|
||||
ods_context->current_table()->set_row_optimal_height(false);
|
||||
}else
|
||||
ods_context->current_table()->set_row_optimal_height(true);
|
||||
if (false == _default)
|
||||
{
|
||||
if ((oox_row->m_oCustomHeight.IsInit() && oox_row->m_oCustomHeight->GetValue() == 1) ||
|
||||
(oox_row->m_oCustomFormat.IsInit() && oox_row->m_oCustomFormat->GetValue() == 1 && oox_row->m_oHt.IsInit()))
|
||||
{
|
||||
ods_context->current_table()->set_row_optimal_height(false);
|
||||
}
|
||||
else
|
||||
ods_context->current_table()->set_row_optimal_height(true);
|
||||
}
|
||||
|
||||
for (size_t cell = 0 ; cell < oox_row->m_arrItems.size();cell++)
|
||||
{
|
||||
@ -2006,7 +2010,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
|
||||
ods_context->current_table()->defaut_row_height_ = height;//pt
|
||||
row_properties->style_table_row_properties_attlist_.style_row_height_ = odf_types::length(odf_types::length(height,odf_types::length::pt).get_value_unit(odf_types::length::cm),odf_types::length::cm);
|
||||
}
|
||||
row_properties->style_table_row_properties_attlist_.style_use_optimal_row_height_ = true; //???? не знаю cтоит ли
|
||||
//row_properties->style_table_row_properties_attlist_.style_use_optimal_row_height_ = true; - UTF-8''Отчет о развертывании-1.xlsx
|
||||
row_properties->style_table_row_properties_attlist_.common_break_attlist_.fo_break_before_ = odf_types::fo_break(odf_types::fo_break::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,8 +653,10 @@ void Animation::FillCBhvr(
|
||||
if (delay > -1)
|
||||
{
|
||||
oBhvr.cTn.stCondLst = new PPTX::Logic::CondLst;
|
||||
oBhvr.cTn.stCondLst->node_name = L"stCondLst";
|
||||
PPTX::Logic::Cond cond;
|
||||
cond.delay = std::to_wstring(delay);
|
||||
oBhvr.cTn.stCondLst->list.push_back(cond);
|
||||
}
|
||||
|
||||
oBhvr.tgtEl.spTgt = new PPTX::Logic::SpTgt;
|
||||
@ -667,6 +669,8 @@ void Animation::FillCBhvr(
|
||||
attrName.text = attrname;
|
||||
oBhvr.attrNameLst->list.push_back(attrName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void Animation::FillCmd(
|
||||
CRecordExtTimeNodeContainer *pETNC,
|
||||
@ -1272,7 +1276,7 @@ void Animation::InitTimingTags(PPTX::Logic::Timing &oTiming)
|
||||
PPTX::Logic::BldP *pBldP = new PPTX::Logic::BldP();
|
||||
pBldP->spid = std::to_wstring(oldAnim.shapeId);
|
||||
pBldP->grpId = false;
|
||||
pBldP->animBg = true;
|
||||
pBldP->animBg = (bool)(oldAnim.anim->m_AnimationAtom.m_fAnimateBg);
|
||||
|
||||
oBuildNodeBase.m_node = pBldP;
|
||||
oTiming.bldLst->list.push_back(oBuildNodeBase);
|
||||
@ -1295,6 +1299,26 @@ void Animation::InitTimingTags(PPTX::Logic::Timing &oTiming)
|
||||
seq2->nextAc = L"seek";
|
||||
seq2->cTn.childTnLst = new PPTX::Logic::ChildTnLst;
|
||||
|
||||
std::list<std::list<SOldAnimation*> > arrClickPar;
|
||||
|
||||
for (auto oldAnim : m_arrOldAnim)
|
||||
{
|
||||
if (arrClickPar.empty())
|
||||
{
|
||||
std::list<SOldAnimation*> clickPar;
|
||||
clickPar.push_back(&oldAnim);
|
||||
arrClickPar.push_back(clickPar);
|
||||
} else if (oldAnim.anim->m_AnimationAtom.m_fAutomatic)
|
||||
{
|
||||
arrClickPar.back().push_back(&oldAnim);
|
||||
} else
|
||||
{
|
||||
std::list<SOldAnimation*> clickPar;
|
||||
clickPar.push_back(&oldAnim);
|
||||
arrClickPar.push_back(clickPar);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto oldAnim : m_arrOldAnim)
|
||||
{
|
||||
PPTX::Logic::TimeNodeBase child;
|
||||
@ -1310,11 +1334,13 @@ void Animation::InitTimingTags(PPTX::Logic::Timing &oTiming)
|
||||
seq2->nextCondLst = new PPTX::Logic::CondLst;
|
||||
seq2->nextCondLst->node_name = L"nextCondLst";
|
||||
cond.evt = L"onNext";
|
||||
cond.delay = L"0";
|
||||
seq2->nextCondLst->list.push_back(cond);
|
||||
|
||||
seq2->prevCondLst = new PPTX::Logic::CondLst;
|
||||
seq2->prevCondLst->node_name = L"prevCondLst";
|
||||
cond.evt = L"onPrev";
|
||||
cond.delay = L"0";
|
||||
seq2->prevCondLst->list.push_back(cond);
|
||||
|
||||
// push back
|
||||
@ -1330,33 +1356,90 @@ void Animation::InitTimingTags(PPTX::Logic::Timing &oTiming)
|
||||
|
||||
void Animation::FillOldAnim(SOldAnimation& oldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase)
|
||||
{
|
||||
auto animAtom = oldAnim.anim->m_AnimationAtom;
|
||||
|
||||
auto par1 = new PPTX::Logic::Par;
|
||||
par1->cTn.id = m_cTnId++;
|
||||
par1->cTn.fill = L"hold";
|
||||
par1->cTn.nodeType = L"clickPar";
|
||||
|
||||
// p:stCondLst
|
||||
// p:stCondLst 1
|
||||
par1->cTn.stCondLst = new PPTX::Logic::CondLst;
|
||||
PPTX::Logic::Cond cond;
|
||||
cond.delay = L"indefinite";
|
||||
par1->cTn.stCondLst->list.push_back(cond);
|
||||
par1->cTn.stCondLst->node_name = L"stCondLst";
|
||||
PPTX::Logic::Cond cond1;
|
||||
cond1.delay = L"indefinite";
|
||||
par1->cTn.stCondLst->list.push_back(cond1);
|
||||
if (animAtom.m_OrderID == 1 &&
|
||||
animAtom.m_fAutomatic)
|
||||
{
|
||||
PPTX::Logic::Cond cond11;
|
||||
cond11.evt = L"onBegin";
|
||||
cond11.delay = L"0";
|
||||
cond11.tn = 2;
|
||||
par1->cTn.stCondLst->list.push_back(cond11);
|
||||
}
|
||||
|
||||
// anim
|
||||
PPTX::Logic::TimeNodeBase animTimeNode;
|
||||
auto animSet = new PPTX::Logic::Set;
|
||||
// animSet->cBhvr.cTn
|
||||
|
||||
animTimeNode.m_node = animSet;
|
||||
// push_back(animTimeNode);
|
||||
auto par2 = new PPTX::Logic::Par;
|
||||
par2->cTn.id = m_cTnId++;
|
||||
par2->cTn.fill = L"hold";
|
||||
par2->cTn.nodeType = L"withGroup";
|
||||
|
||||
auto anim1 = new PPTX::Logic::Anim;
|
||||
// p:stCondLst 2
|
||||
par2->cTn.stCondLst = new PPTX::Logic::CondLst;
|
||||
par2->cTn.stCondLst->node_name = L"stCondLst";
|
||||
PPTX::Logic::Cond cond2;
|
||||
cond2.delay = animAtom.m_fAutomatic ? std::to_wstring(animAtom.m_DelayTime) : L"0"; // Experimental
|
||||
par2->cTn.stCondLst->list.push_back(cond2);
|
||||
|
||||
animTimeNode.m_node = anim1;
|
||||
// push_back(animTimeNode);
|
||||
auto anim2 = new PPTX::Logic::Anim;
|
||||
auto par3 = new PPTX::Logic::Par;
|
||||
par3->cTn.id = m_cTnId++;
|
||||
par3->cTn.fill = L"hold";
|
||||
par3->cTn.nodeType = (animAtom.m_fAutomatic ? L"afterEffect" : L"clickEffect");
|
||||
par3->cTn.presetID = 1;
|
||||
par3->cTn.presetSubtype = 0;
|
||||
par3->cTn.presetClass = L"entr";
|
||||
par3->cTn.grpId = 0;
|
||||
|
||||
animTimeNode.m_node = anim2;
|
||||
// push_back(animTimeNode);
|
||||
// p:stCondLst 3
|
||||
par3->cTn.stCondLst = new PPTX::Logic::CondLst;
|
||||
par3->cTn.stCondLst->node_name = L"stCondLst";
|
||||
PPTX::Logic::Cond cond3;
|
||||
cond3.delay = std::to_wstring(0); // Experimental
|
||||
par3->cTn.stCondLst->list.push_back(cond2);
|
||||
par3->cTn.childTnLst = new PPTX::Logic::ChildTnLst;
|
||||
|
||||
// anim
|
||||
PPTX::Logic::TimeNodeBase animTimeNode;
|
||||
auto animSet = new PPTX::Logic::Set;
|
||||
FillCBhvr(1,oldAnim.shapeId,L"style.visibility", 499, animSet->cBhvr);
|
||||
animSet->to = new PPTX::Logic::AnimVariant;
|
||||
animSet->to->node_name = L"to";
|
||||
animSet->to->strVal = L"visible";
|
||||
|
||||
animTimeNode.m_node = animSet;
|
||||
par3->cTn.childTnLst->list.push_back(animTimeNode);
|
||||
|
||||
// auto anim1 = new PPTX::Logic::Anim;
|
||||
|
||||
// animTimeNode.m_node = anim1;
|
||||
// // push_back(animTimeNode);
|
||||
// auto anim2 = new PPTX::Logic::Anim;
|
||||
|
||||
// animTimeNode.m_node = anim2;
|
||||
// // push_back(animTimeNode);
|
||||
|
||||
// p:childTnLst 3
|
||||
PPTX::Logic::TimeNodeBase timeNode3;
|
||||
timeNode3.m_node = par3;
|
||||
par2->cTn.childTnLst = new PPTX::Logic::ChildTnLst;
|
||||
par2->cTn.childTnLst->list.push_back(timeNode3);
|
||||
|
||||
// p:childTnLst 2
|
||||
PPTX::Logic::TimeNodeBase timeNode2;
|
||||
timeNode2.m_node = par2;
|
||||
par1->cTn.childTnLst = new PPTX::Logic::ChildTnLst;
|
||||
par1->cTn.childTnLst->list.push_back(timeNode2);
|
||||
|
||||
oTimeNodeBase.m_node = par1;
|
||||
}
|
||||
|
||||
@ -2068,6 +2068,9 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
oShapeElem.m_pShape->getBaseShape()->m_oPath.SetCoordsize(21600, 21600);
|
||||
}
|
||||
|
||||
if (pPPTShape->m_oSignatureLine.IsInit())
|
||||
pPPTShape->m_eType = PPTShapes::ShapeType::sptCFrame;
|
||||
|
||||
if (pPPTShape->m_eType == PPTShapes::sptCTextBox)
|
||||
{
|
||||
bTextBox = true;
|
||||
|
||||
@ -95,6 +95,10 @@ namespace PPTX
|
||||
{
|
||||
str = L"<a:effectLst>" + str + L"</a:effectLst>";
|
||||
}
|
||||
else
|
||||
{
|
||||
str = L"<a:effectLst/>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
void EffectLst::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
@ -102,6 +106,7 @@ namespace PPTX
|
||||
if (!blur.IsInit() && !fillOverlay.IsInit() && !glow.IsInit() && !innerShdw.IsInit() &&
|
||||
!outerShdw.IsInit() && !prstShdw.IsInit() && !reflection.IsInit() && !softEdge.IsInit())
|
||||
{
|
||||
pWriter->WriteString(L"a:effectLst/");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1384,7 +1384,8 @@ namespace PPTX
|
||||
{
|
||||
std::wstring strPenAttr = _T("");
|
||||
nullable<ShapeStyle> pShapeStyle;
|
||||
CalculateLine(spPr, pShapeStyle, oTheme, oClrMap, strPenAttr, strNodeVal, bOle);
|
||||
|
||||
CalculateLine(pWriter->m_lDocType, spPr, pShapeStyle, oTheme, oClrMap, strPenAttr, strNodeVal, bOle);
|
||||
pWriter->WriteString(strPenAttr);
|
||||
}
|
||||
|
||||
|
||||
@ -600,14 +600,17 @@ namespace PPTX
|
||||
LONG lW = 43200, lH = 43200;
|
||||
int dL = 0, dT = 0, dW = 0, dH = 0;
|
||||
|
||||
if (spPr.Geometry.is<PrstGeom>())
|
||||
if (bSignature)
|
||||
{
|
||||
vmlPrst = SimpleTypes::Vml::sptPictureFrame;
|
||||
}
|
||||
else if (spPr.Geometry.is<PrstGeom>())
|
||||
{
|
||||
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
|
||||
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
|
||||
vmlPrst = OOX::PrstGeom2VmlShapeType( ooxPrst.GetValue());
|
||||
}
|
||||
else if (bSignature) vmlPrst = SimpleTypes::Vml::sptPictureFrame;
|
||||
|
||||
if (spPr.xfrm.is_init())
|
||||
{
|
||||
@ -632,8 +635,8 @@ namespace PPTX
|
||||
std::wstring strFillNode;
|
||||
std::wstring strStrokeNode;;
|
||||
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false, bSignature);
|
||||
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, false);
|
||||
CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false, bSignature);
|
||||
CalculateLine(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, false);
|
||||
|
||||
pWriter->StartNode(L"v:shape");
|
||||
|
||||
@ -797,7 +800,7 @@ namespace PPTX
|
||||
void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap)
|
||||
{
|
||||
std::wstring strFillAttr, strFillNode;
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
|
||||
CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
|
||||
|
||||
pWriter->StartNode(L"v:background");
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ namespace PPTX
|
||||
return L"#" + sstream.str();
|
||||
}
|
||||
|
||||
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||
void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
|
||||
{
|
||||
PPTX::Logic::UniFill fill;
|
||||
@ -115,18 +115,25 @@ namespace PPTX
|
||||
}
|
||||
|
||||
std::wstring strId = oBlip.blip->embed->ToString();
|
||||
|
||||
if (XMLWRITER_DOC_TYPE_XLSX == lDocType)
|
||||
{
|
||||
strId = L"o:relid=\"" + strId + L"\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
strId = L"r:id=\"" + strId + L"\"";
|
||||
}
|
||||
if (bOle || bSignature)
|
||||
{
|
||||
strAttr = L" filled=\"f\"";
|
||||
strNode = L"<v:imagedata r:id=\"" + strId + L"\" o:title=\"\" />";
|
||||
strNode = L"<v:imagedata " + strId + L" o:title=\"\" />";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oBlip.tile.is_init())
|
||||
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"tile\"" + fopacity + L" />";
|
||||
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"tile\"" + fopacity + L"/>";
|
||||
else
|
||||
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"frame\"" + fopacity + L" />";
|
||||
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"frame\"" + fopacity + L"/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +190,7 @@ namespace PPTX
|
||||
}
|
||||
*/
|
||||
}
|
||||
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
|
||||
{
|
||||
PPTX::Logic::Ln line;
|
||||
|
||||
@ -43,10 +43,10 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
|
||||
void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
|
||||
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
|
||||
|
||||
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
|
||||
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
|
||||
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
|
||||
|
||||
class SpTreeElem : public WrapperWritingElement
|
||||
|
||||
@ -96,7 +96,7 @@ namespace PPTX
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4;
|
||||
LONG _end = pReader->GetPos() + pReader->GetRecordSize() + 4;
|
||||
|
||||
pReader->Skip(1); // attribute start
|
||||
while (true)
|
||||
@ -109,7 +109,7 @@ namespace PPTX
|
||||
else if (1 == _at) st = pReader->GetULong();
|
||||
else if (2 == _at) end = pReader->GetULong();
|
||||
}
|
||||
while (pReader->GetPos() < end)
|
||||
while (pReader->GetPos() < _end)
|
||||
{
|
||||
BYTE _rec = pReader->GetUChar();
|
||||
|
||||
@ -121,7 +121,7 @@ namespace PPTX
|
||||
}break;
|
||||
}
|
||||
}
|
||||
pReader->Seek(end);
|
||||
pReader->Seek(_end);
|
||||
}
|
||||
|
||||
nullable_sizet st;
|
||||
|
||||
@ -290,22 +290,20 @@ public:
|
||||
/*static */void ExecuteTextInternalSkipChars(std::wstring & sResult, RtfReader& oReader, std::string & sKey, int& nSkipChars)
|
||||
{
|
||||
//удаляем символы вслед за юникодом
|
||||
if( nSkipChars > 0 )
|
||||
if ( nSkipChars > 0 )
|
||||
{
|
||||
int nLength = (int)sResult.length();
|
||||
if( nSkipChars >= nLength )
|
||||
if ( nSkipChars >= (int)sResult.length())
|
||||
{
|
||||
nSkipChars = 0; //vedomost.rtf
|
||||
//nSkipChars -= nLength;
|
||||
//nSkipChars -= nLength;//vedomost.rtf
|
||||
sResult.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult = sResult.substr( nSkipChars );
|
||||
nSkipChars = 0;
|
||||
}
|
||||
nSkipChars = 0;
|
||||
}
|
||||
if( "u" == sKey )
|
||||
if ( "u" == sKey )
|
||||
{
|
||||
//надо правильно установить m_nSkipChars по значению \ucN
|
||||
nSkipChars = oReader.m_oState->m_nUnicodeClean;
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_CUSTOM_XML_INCLUDE_H_
|
||||
#define OOX_CUSTOM_XML_INCLUDE_H_
|
||||
|
||||
#include "File.h"
|
||||
#include "IFileContainer.h"
|
||||
@ -44,7 +42,7 @@ namespace OOX
|
||||
//--------------------------------------------------------------------------------
|
||||
// CCustomXML 22.5
|
||||
//--------------------------------------------------------------------------------
|
||||
class CCustomXMLProps : public OOX::File
|
||||
class CCustomXMLProps : public OOX::File, public WritingElement
|
||||
{
|
||||
public:
|
||||
|
||||
@ -61,22 +59,16 @@ namespace OOX
|
||||
virtual ~CShemaRef()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
const CShemaRef& operator =(const XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
fromXML( (XmlUtils::CXmlNode&)oNode );
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
XmlMacroReadAttributeBase( oNode, _T("ds:uri"), m_sUri );
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
std::wstring sResult = _T("<ds:schemaRef ds:uri=\"") + m_sUri + _T("\" />");
|
||||
return sResult;
|
||||
@ -86,11 +78,9 @@ namespace OOX
|
||||
return OOX::et_ds_schemaRef;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
std::wstring m_sUri;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
class CShemaRefs : public WritingElementWithChilds<CShemaRef>
|
||||
{
|
||||
public:
|
||||
@ -104,18 +94,12 @@ namespace OOX
|
||||
virtual ~CShemaRefs()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
const CShemaRefs& operator =(const XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
fromXML( (XmlUtils::CXmlNode&)oNode );
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if ( oNode.GetNodes( _T("ds:schemaRef"), oNodes ) )
|
||||
@ -131,7 +115,7 @@ namespace OOX
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
std::wstring sResult = _T("<ds:schemaRefs>");
|
||||
|
||||
@ -146,13 +130,8 @@ namespace OOX
|
||||
{
|
||||
return OOX::et_ds_schemaRefs;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
CCustomXMLProps(OOX::Document *pMain): OOX::File(pMain)
|
||||
{
|
||||
}
|
||||
@ -163,38 +142,52 @@ namespace OOX
|
||||
virtual ~CCustomXMLProps()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const CPath& oFilePath)
|
||||
const CCustomXMLProps& operator =(const XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
XmlUtils::CXmlNode oCustomXml;
|
||||
oCustomXml.FromXmlFile( oFilePath.GetPath(), true );
|
||||
|
||||
if ( _T("ds:datastoreItem") == oCustomXml.GetName() )
|
||||
fromXML((XmlUtils::CXmlNode&)oNode);
|
||||
return *this;
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
if (_T("ds:datastoreItem") == oNode.GetName())
|
||||
{
|
||||
m_oItemID = oCustomXml.ReadAttribute(_T("ds:itemID"));
|
||||
m_oItemID = oNode.ReadAttribute(_T("ds:itemID"));
|
||||
|
||||
XmlUtils::CXmlNode oItem;
|
||||
if ( oCustomXml.GetNode( _T("ds:schemaRefs"), oItem ) )
|
||||
if (oNode.GetNode(_T("ds:schemaRefs"), oItem))
|
||||
m_oShemaRefs = oItem;
|
||||
}
|
||||
}
|
||||
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
std::wstring sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ds:datastoreItem ds:itemID=\"");
|
||||
sXml += m_oItemID.ToString();
|
||||
sXml += _T("\" xmlns:ds=\"http://schemas.openxmlformats.org/officeDocument/2006/customXml\">");
|
||||
|
||||
if ( m_oShemaRefs.IsInit() )
|
||||
if (m_oShemaRefs.IsInit())
|
||||
sXml += m_oShemaRefs->toXML();
|
||||
|
||||
sXml += _T("</ds:datastoreItem>");
|
||||
NSFile::CFileBinary::SaveToFile(oFilePath.GetPath(), sXml);
|
||||
|
||||
return sXml;
|
||||
}
|
||||
virtual void read(const CPath& oFilePath)
|
||||
{
|
||||
XmlUtils::CXmlNode oCustomXml;
|
||||
oCustomXml.FromXmlFile( oFilePath.GetPath(), true );
|
||||
|
||||
fromXML(oCustomXml);
|
||||
}
|
||||
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
NSFile::CFileBinary::SaveToFile(oFilePath.GetPath(), toXML());
|
||||
|
||||
oContent.Registration( type().OverrideType(), type().DefaultDirectory(), oFilePath.GetFilename() );
|
||||
}
|
||||
|
||||
public:
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return OOX::et_ds_customXmlProps;
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::CustomXmlProps;
|
||||
@ -208,14 +201,13 @@ namespace OOX
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
SimpleTypes::CGuid m_oItemID;
|
||||
|
||||
// Childs
|
||||
// Childs
|
||||
nullable<CShemaRefs> m_oShemaRefs;
|
||||
//-------------
|
||||
std::wstring m_oCustomXmlContent;
|
||||
};
|
||||
|
||||
class CCustomXML : public OOX::File, public OOX::IFileContainer
|
||||
@ -231,8 +223,6 @@ namespace OOX
|
||||
virtual ~CCustomXML()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
CPath oRootPath;
|
||||
@ -250,8 +240,6 @@ namespace OOX
|
||||
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oFilePath.GetFilename() );
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::CustomXml;
|
||||
@ -284,13 +272,10 @@ namespace OOX
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
// Childs
|
||||
|
||||
std::wstring m_sXml;
|
||||
|
||||
bool bUsed = false;
|
||||
};
|
||||
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_CUSTOM_XML_INCLUDE_H_
|
||||
|
||||
@ -125,6 +125,7 @@ namespace OOX {
|
||||
OOX::CCustomXML* pCustomXml = dynamic_cast<OOX::CCustomXML*>(container[i].GetPointer());
|
||||
if(OOX::CSettingsCustom::GetSchemaUrl() == pCustomXml->GetSchemaUrl())
|
||||
{
|
||||
pCustomXml->bUsed = true;
|
||||
return pCustomXml->m_sXml;
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,6 +501,7 @@ namespace OOX
|
||||
et_a_buSzPts,
|
||||
et_a_buSzTx,
|
||||
|
||||
et_ds_customXmlProps,
|
||||
et_ds_schemaRefs, // <ds:shemeRefs>
|
||||
et_ds_schemaRef, // <ds:shemeRef>
|
||||
|
||||
|
||||
@ -534,6 +534,7 @@ namespace NSEditorApi
|
||||
js_wrapper<std::wstring> m_sUploadPath;
|
||||
js_wrapper<std::string> m_sBase64;
|
||||
js_wrapper<CAscBinaryData> m_oBinaryData;
|
||||
js_wrapper<std::wstring> m_sAdditionalParams;
|
||||
|
||||
public:
|
||||
CAscInsertImage()
|
||||
@ -548,6 +549,7 @@ namespace NSEditorApi
|
||||
LINK_PROPERTY_STRING_JS(UploadPath)
|
||||
LINK_PROPERTY_STRINGA_JS(Base64)
|
||||
LINK_PROPERTY_OBJECT_JS(CAscBinaryData, BinaryData)
|
||||
LINK_PROPERTY_STRING_JS(AdditionalParams)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -492,6 +492,8 @@
|
||||
#define c_oAscTypeSelectElement_Slide 7
|
||||
#define c_oAscTypeSelectElement_Chart 8
|
||||
#define c_oAscTypeSelectElement_Math 9
|
||||
#define c_oAscTypeSelectElement_MailMerge 10
|
||||
#define c_oAscTypeSelectElement_ContentControl 11
|
||||
|
||||
#define c_oAscTableBordersType_LEFT 0
|
||||
#define c_oAscTableBordersType_TOP 1
|
||||
@ -679,6 +681,14 @@
|
||||
#define c_oAscAdvancedOptionsID_TXT 1
|
||||
#define c_oAscAdvancedOptionsID_DRM 2
|
||||
|
||||
#define c_oAscContentControlSpecificTypeNone 0
|
||||
#define c_oAscContentControlSpecificTypeCheckBox 1
|
||||
#define c_oAscContentControlSpecificTypePicture 2
|
||||
#define c_oAscContentControlSpecificTypeComboBox 3
|
||||
#define c_oAscContentControlSpecificTypeDropDownList 4
|
||||
#define c_oAscContentControlSpecificTypeDateTime 5
|
||||
#define c_oAscContentControlSpecificTypeTOC 10
|
||||
|
||||
#define INSERT_PAGE_NUM_PARAM(AlignV, AlignH) ((AlignV << 16) | AlignH)
|
||||
|
||||
// MENU COMMANDS
|
||||
@ -844,6 +854,14 @@
|
||||
// Universal call
|
||||
#define ASC_MENU_EVENT_TYPE_DO_API_FUNCTION_CALL 25001
|
||||
|
||||
// Fill forms
|
||||
#define ASC_MENU_EVENT_TYPE_SHOW_CONTENT_CONTROLS_ACTIONS 26001
|
||||
#define ASC_MENU_EVENT_TYPE_HIDE_CONTENT_CONTROLS_ACTIONS 26002
|
||||
#define ASC_MENU_EVENT_TYPE_DO_SET_CONTENTCONTROL_PICTURE 26003
|
||||
|
||||
// Others
|
||||
#define ASC_MENU_EVENT_TYPE_FOCUS_OBJECT 26101
|
||||
|
||||
// Document Processing
|
||||
|
||||
#define ASC_EVENT_TYPE_OPEN_DOCUMENT_PROCESSING_BEGIN 60100
|
||||
|
||||
@ -1195,6 +1195,7 @@ void CGraphics::put_brushTexture(std::wstring src, int type)
|
||||
oFrame.put_Width(nSize);
|
||||
oFrame.put_Height(nSize);
|
||||
oFrame.put_Stride(4 * nSize);
|
||||
oFrame.put_IsRGBA(true);
|
||||
oFrame.SaveFile(strImage, 4);
|
||||
}
|
||||
m_pRenderer->put_BrushType(c_BrushTypeTexture);
|
||||
|
||||
@ -410,7 +410,9 @@ namespace NSJSBase
|
||||
|
||||
if (0 == argc)
|
||||
{
|
||||
_return->value = _funcN->Call(V8ContextFirstArg value, 0, NULL).ToLocalChecked();
|
||||
v8::MaybeLocal<v8::Value> retValue = _funcN->Call(V8ContextFirstArg value, 0, NULL);
|
||||
if (!retValue.IsEmpty())
|
||||
_return->value = retValue.ToLocalChecked();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
void SetImageValid(const std::wstring& file);
|
||||
void SetImageInvalid(const std::wstring& file);
|
||||
|
||||
void Sign();
|
||||
int Sign();
|
||||
|
||||
private:
|
||||
COOXMLSigner_private* m_internal;
|
||||
|
||||
@ -615,7 +615,7 @@ public:
|
||||
return nSignNum;
|
||||
}
|
||||
|
||||
void Sign()
|
||||
int Sign()
|
||||
{
|
||||
Parse();
|
||||
|
||||
@ -650,6 +650,8 @@ public:
|
||||
int nSignNum = AddSignatureReference();
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(m_sFolder + L"/_xmlsignatures/sig" + std::to_wstring(nSignNum + 1) + L".xml", builderResult.GetData(), false);
|
||||
|
||||
return (sSignedXml.empty()) ? 1 : 0;
|
||||
}
|
||||
};
|
||||
|
||||
@ -678,7 +680,7 @@ void COOXMLSigner::SetImageInvalid(const std::wstring& file)
|
||||
m_internal->SetImageInvalid(file);
|
||||
}
|
||||
|
||||
void COOXMLSigner::Sign()
|
||||
int COOXMLSigner::Sign()
|
||||
{
|
||||
m_internal->Sign();
|
||||
return m_internal->Sign();
|
||||
}
|
||||
|
||||
@ -94,6 +94,7 @@ public:
|
||||
|
||||
m_pBase = NULL;
|
||||
m_separator = ";;;;;;;ONLYOFFICE;;;;;;;";
|
||||
m_alg = OOXML_HASH_ALG_INVALID;
|
||||
}
|
||||
virtual ~CCertificate_openssl_private()
|
||||
{
|
||||
@ -131,10 +132,22 @@ public:
|
||||
return "";
|
||||
}
|
||||
|
||||
if (asn1_serial->type == V_ASN1_NEG_INTEGER)
|
||||
{
|
||||
std::string sPositive = "1";
|
||||
for (int i = 0; i < asn1_serial->length; ++i)
|
||||
sPositive += "00";
|
||||
BIGNUM* pn = NULL;
|
||||
int res = BN_hex2bn(&pn, sPositive.c_str());
|
||||
BN_add(bn, bn, pn);
|
||||
BN_free(pn);
|
||||
}
|
||||
|
||||
char *tmp = BN_bn2dec(bn);
|
||||
std::string sReturn(tmp);
|
||||
|
||||
BN_free(bn);
|
||||
OPENSSL_free(tmp);
|
||||
|
||||
return sReturn;
|
||||
}
|
||||
@ -271,7 +284,7 @@ public:
|
||||
return GetNumber();
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
std::string Sign(const std::string& sXml)
|
||||
{
|
||||
EVP_MD_CTX* pCtx = EVP_MD_CTX_create();
|
||||
@ -385,7 +398,7 @@ public:
|
||||
bool Verify(const std::string& sXml, std::string& sXmlSignature, int nAlg)
|
||||
{
|
||||
EVP_MD_CTX* pCtx = EVP_MD_CTX_create();
|
||||
const EVP_MD* pDigest = Get_EVP_MD(this->GetHashAlg());
|
||||
const EVP_MD* pDigest = Get_EVP_MD(nAlg);
|
||||
|
||||
int n1 = EVP_VerifyInit(pCtx, pDigest);
|
||||
n1 = n1;
|
||||
@ -442,8 +455,36 @@ public:
|
||||
if (!m_cert)
|
||||
return algs;
|
||||
|
||||
// TODO:
|
||||
// Check algs in cert
|
||||
//const X509_ALGOR* pAlgr = X509_get0_tbs_sigalg(m_cert);
|
||||
//int nAlg = OBJ_obj2nid(pAlgr);
|
||||
int nAlg = X509_get_signature_nid(m_cert);
|
||||
|
||||
switch (nAlg)
|
||||
{
|
||||
case NID_sha1:
|
||||
case NID_sha1WithRSA:
|
||||
case NID_sha1WithRSAEncryption:
|
||||
algs.push_back(OOXML_HASH_ALG_SHA1);
|
||||
break;
|
||||
case NID_sha256:
|
||||
case NID_sha256WithRSAEncryption:
|
||||
algs.push_back(OOXML_HASH_ALG_SHA256);
|
||||
break;
|
||||
case NID_sha224:
|
||||
case NID_sha224WithRSAEncryption:
|
||||
algs.push_back(OOXML_HASH_ALG_SHA224);
|
||||
break;
|
||||
case NID_sha384:
|
||||
case NID_sha384WithRSAEncryption:
|
||||
algs.push_back(OOXML_HASH_ALG_SHA384);
|
||||
break;
|
||||
case NID_sha512:
|
||||
case NID_sha512WithRSAEncryption:
|
||||
algs.push_back(OOXML_HASH_ALG_SHA512);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (algs.empty())
|
||||
m_alg = OOXML_HASH_ALG_SHA1;
|
||||
|
||||
@ -162,7 +162,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp" />
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\CustomXmlWriter.cpp" />
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\FileWriter.cpp" />
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp" />
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp">
|
||||
|
||||
@ -72,13 +72,13 @@
|
||||
<ClCompile Include="..\..\..\XlsxSerializerCom\Common\Common.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ASCConverters.cpp" />
|
||||
<ClCompile Include="..\..\src\cextracttools.cpp" />
|
||||
<ClCompile Include="..\..\..\Common\OfficeFileFormatChecker2.cpp" />
|
||||
<ClCompile Include="X2tTest.cpp" />
|
||||
<ClCompile Include="..\..\..\ASCOfficeDocxFile2\BinReader\CustomXmlWriter.cpp">
|
||||
<Filter>DOCX\Reader\OOXWriter</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.h">
|
||||
|
||||
Reference in New Issue
Block a user