mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Compare commits
10 Commits
core-linux
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e1a0e365f | |||
| 39e2b69b8e | |||
| 58c00745a7 | |||
| 4015e8ba4d | |||
| 276af55699 | |||
| ebdfcbd7ee | |||
| 867c09c85d | |||
| cd12777c68 | |||
| 0708c1f45a | |||
| ee577e629a |
@ -147,10 +147,11 @@ namespace DocFileFormat
|
||||
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
break;
|
||||
case 0x6801:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
|
||||
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
|
||||
break;
|
||||
case 0x660E:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
|
||||
@ -507,9 +507,9 @@ namespace DocFileFormat
|
||||
class FileInformationBlock
|
||||
{
|
||||
public:
|
||||
bool m_bOlderVersion;
|
||||
int m_CodePage;
|
||||
FibBase m_FibBase;
|
||||
bool m_bOlderVersion;
|
||||
int m_CodePage;
|
||||
FibBase m_FibBase;
|
||||
|
||||
RgW97 m_RgW97;
|
||||
RgLw97 m_RgLw97;
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "RegularContainer.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class OfficeArtFRITContainer: public RegularContainer
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF118 = 0xF118;
|
||||
|
||||
OfficeArtFRITContainer () : RegularContainer()
|
||||
{
|
||||
}
|
||||
|
||||
OfficeArtFRITContainer (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : RegularContainer (_reader, size, typeCode, version, instance)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~OfficeArtFRITContainer()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Record* NewObject (IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance)
|
||||
{
|
||||
return new OfficeArtFRITContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -50,6 +50,7 @@
|
||||
#include "GroupShapeRecord.h"
|
||||
#include "OfficeArtClientTextbox.h"
|
||||
#include "UnknownRecord.h"
|
||||
#include "OfficeArtFRITContainer.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -135,6 +136,7 @@ namespace DocFileFormat
|
||||
case GroupContainer::TYPE_CODE_0xF003 : return new GroupContainer();
|
||||
case GroupShapeRecord::TYPE_CODE_0xF009 : return new GroupShapeRecord ();
|
||||
case OfficeArtClientTextbox::TYPE_CODE_0xF00D : return new OfficeArtClientTextbox ();
|
||||
case OfficeArtFRITContainer::TYPE_CODE_0xF118 : return new OfficeArtFRITContainer ();
|
||||
|
||||
default:
|
||||
return new UnknownRecord();
|
||||
|
||||
@ -247,9 +247,8 @@ namespace DocFileFormat
|
||||
{
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
@ -446,7 +445,7 @@ namespace DocFileFormat
|
||||
{
|
||||
yCoord = iter->op;
|
||||
}break;
|
||||
// OUTLINE
|
||||
// LINE
|
||||
case lineColor:
|
||||
{
|
||||
RGBColor lineColor((int)iter->op, RedFirst);
|
||||
@ -493,6 +492,21 @@ namespace DocFileFormat
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"startarrowwidth", getArrowWidth( iter->op ));
|
||||
}break;
|
||||
case cxstyle:
|
||||
{
|
||||
if (pShape->GetShapeType() == NULL)
|
||||
{
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute(L"type", L"#_x0000_t32");
|
||||
}
|
||||
switch(iter->op)
|
||||
{
|
||||
case 0: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"straight"); break;
|
||||
case 1: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"elbow"); break;
|
||||
case 2: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"curved"); break;
|
||||
case 3: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"none"); break;
|
||||
}
|
||||
}break;
|
||||
// FILL
|
||||
case fillColor:
|
||||
{
|
||||
@ -544,6 +558,14 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
}break;
|
||||
case fillBlipName:
|
||||
{
|
||||
std::wstring name;
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex.get(), iter->op, ENCODING_UTF16);
|
||||
if (!name.empty())
|
||||
appendValueAttribute(&m_fill, L"o:title", FormatUtils::XmlEncode(name));
|
||||
|
||||
}break;
|
||||
case fillOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"opacity", ( FormatUtils::IntToWideString( iter->op ) + L"f" ));
|
||||
|
||||
@ -153,6 +153,24 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
//POLE::Stream * pStream = NULL;
|
||||
//if (m_pStorage->GetStream ("EncryptedSummaryInformation", &pStream))
|
||||
//{
|
||||
// VirtualStreamReader tStream( pStream, 0, FIB->m_bOlderVersion);
|
||||
|
||||
// _UINT32 StreamDescriptorArrayOffset = tStream.ReadUInt32();
|
||||
// _UINT32 StreamDescriptorArraySize = tStream.ReadUInt32();
|
||||
|
||||
// for (int i = 0; i < StreamDescriptorArraySize; i++)
|
||||
// {
|
||||
// }
|
||||
// _UINT32 EncryptedStreamDescriptorCount = tStream.ReadUInt32();
|
||||
|
||||
// for (int i = 0; i < EncryptedStreamDescriptorCount; i++)
|
||||
// {
|
||||
// }
|
||||
// RELEASEOBJECT(pStream);
|
||||
//}
|
||||
CRYPT::ECMADecryptor Decryptor;
|
||||
|
||||
Decryptor.SetCryptData(encryptionHeader->crypt_data_aes);
|
||||
@ -470,11 +488,6 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
//DecryptStream(Decryptor, "WordDocument", storageIn, storageOut);
|
||||
//if (FIB->m_FibBase.fWhichTblStm)
|
||||
// DecryptStream(Decryptor, "1Table", storageIn, storageOut);
|
||||
//else
|
||||
// DecryptStream(Decryptor, "0Table", storageIn, storageOut);
|
||||
|
||||
std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
@ -486,15 +499,11 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
|
||||
{
|
||||
//if (*it2 != "WordDocument" && std::wstring::npos == it2->find("Table"))
|
||||
// CopyStream( *it2, storageIn, storageOut);
|
||||
DecryptStream(Decryptor, *it2, storageIn, storageOut);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (*it != "WordDocument" && std::wstring::npos == it->find("Table"))
|
||||
// CopyStream( *it, storageIn, storageOut);
|
||||
DecryptStream(Decryptor, *it, storageIn, storageOut);
|
||||
}
|
||||
|
||||
@ -554,32 +563,40 @@ namespace DocFileFormat
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
int sz_stream = stream->size();
|
||||
int size_stream = stream->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, sz_stream);
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
if (!streamNew) return false;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[sz_stream];
|
||||
stream->read(data_stream, sz_stream);
|
||||
unsigned char* data_stream = new unsigned char[size_stream];
|
||||
stream->read(data_stream, size_stream);
|
||||
|
||||
unsigned char* data_store = NULL;
|
||||
int sz_data_store = 0;
|
||||
int size_data_store = 0;
|
||||
|
||||
if ("WordDocument" == streamName)
|
||||
{
|
||||
sz_data_store = 68;
|
||||
data_store = new unsigned char[sz_data_store];
|
||||
size_data_store = 68;
|
||||
data_store = new unsigned char[size_data_store];
|
||||
}
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_store, data_stream, sz_data_store);
|
||||
memcpy(data_store, data_stream, size_data_store);
|
||||
|
||||
int size_block = 0x200;
|
||||
for (int pos = 0, block = 0 ; pos < size_stream; pos += size_block, block++)
|
||||
{
|
||||
if (pos + size_block > size_stream)
|
||||
size_block = size_stream - pos;
|
||||
|
||||
Decryptor->Decrypt((char*)data_stream + pos, size_block, block);
|
||||
}
|
||||
|
||||
Decryptor->Decrypt((char*)data_stream, sz_stream, 0);
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_stream, data_store, sz_data_store);
|
||||
memcpy(data_stream, data_store, size_data_store);
|
||||
|
||||
streamNew->write(data_stream, sz_stream);
|
||||
streamNew->write(data_stream, size_stream);
|
||||
|
||||
RELEASEARRAYOBJECTS(data_store);
|
||||
RELEASEARRAYOBJECTS(data_stream);
|
||||
|
||||
@ -405,6 +405,8 @@ public:
|
||||
std::wstring Fill;
|
||||
std::wstring Del;
|
||||
std::wstring Ins;
|
||||
std::wstring MoveFrom;
|
||||
std::wstring MoveTo;
|
||||
std::wstring rPrChange;
|
||||
|
||||
bool bBold;
|
||||
@ -492,13 +494,15 @@ public:
|
||||
Fill.clear();
|
||||
Del.clear();
|
||||
Ins.clear();
|
||||
MoveFrom.clear();
|
||||
MoveTo.clear();
|
||||
rPrChange.clear();
|
||||
}
|
||||
bool IsNoEmpty()
|
||||
{
|
||||
return bBold || bItalic || bUnderline || bStrikeout || bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontSize || bColor || bVertAlign || bHighLight || bShd ||
|
||||
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !rPrChange.empty();
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty();
|
||||
}
|
||||
void Write(XmlUtils::CStringWriter* pCStringWriter)
|
||||
{
|
||||
@ -749,6 +753,10 @@ public:
|
||||
pCStringWriter->WriteString(Del);
|
||||
if (!Ins.empty())
|
||||
pCStringWriter->WriteString(Ins);
|
||||
if (!MoveFrom.empty())
|
||||
pCStringWriter->WriteString(MoveFrom);
|
||||
if (!MoveTo.empty())
|
||||
pCStringWriter->WriteString(MoveTo);
|
||||
if (!rPrChange.empty())
|
||||
pCStringWriter->WriteString(rPrChange);
|
||||
pCStringWriter->WriteString(L"</w:rPr>");
|
||||
|
||||
@ -570,6 +570,20 @@ public:
|
||||
orPr->Ins = oIns.ToString(_T("w:ins"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::MoveFrom:
|
||||
{
|
||||
TrackRevision oMoveFrom;
|
||||
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
|
||||
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::MoveTo:
|
||||
{
|
||||
TrackRevision oMoveTo;
|
||||
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
|
||||
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::rPrChange:
|
||||
{
|
||||
TrackRevision oRPrChange;
|
||||
@ -3771,6 +3785,42 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveFrom == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:moveFrom"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveTo == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:moveTo"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveFromRangeStart, this, &oMoveFromRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveFromRangeEnd, this, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveToRangeStart, this, &oMoveToRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveToRangeEnd, this, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(1);
|
||||
@ -3797,6 +3847,138 @@ public:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveFromRangeStart(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(poResult);
|
||||
if (c_oSerMoveRange::Author == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sAuthor.Init();
|
||||
pMoveFromRangeStart->m_sAuthor->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::ColFirst == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oColFirst.Init();
|
||||
pMoveFromRangeStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::ColLast == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oColLast.Init();
|
||||
pMoveFromRangeStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Date == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oDate.Init();
|
||||
pMoveFromRangeStart->m_oDate->SetValue(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oDisplacedByCustomXml.Init();
|
||||
pMoveFromRangeStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oId.Init();
|
||||
pMoveFromRangeStart->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Name == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sName.Init();
|
||||
pMoveFromRangeStart->m_sName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::UserId == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sUserId.Init();
|
||||
pMoveFromRangeStart->m_sUserId->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveToRangeStart(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(poResult);
|
||||
if (c_oSerMoveRange::Author == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sAuthor.Init();
|
||||
pMoveToRangeStart->m_sAuthor->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::ColFirst == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oColFirst.Init();
|
||||
pMoveToRangeStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::ColLast == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oColLast.Init();
|
||||
pMoveToRangeStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Date == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oDate.Init();
|
||||
pMoveToRangeStart->m_oDate->SetValue(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oDisplacedByCustomXml.Init();
|
||||
pMoveToRangeStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oId.Init();
|
||||
pMoveToRangeStart->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Name == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sName.Init();
|
||||
pMoveToRangeStart->m_sName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::UserId == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sUserId.Init();
|
||||
pMoveToRangeStart->m_sUserId->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveFromRangeEnd(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(poResult);
|
||||
if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveFromRangeEnd->m_oDisplacedByCustomXml.Init();
|
||||
pMoveFromRangeEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveFromRangeEnd->m_oId.Init();
|
||||
pMoveFromRangeEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveToRangeEnd(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(poResult);
|
||||
if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveToRangeEnd->m_oDisplacedByCustomXml.Init();
|
||||
pMoveToRangeEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveToRangeEnd->m_oId.Init();
|
||||
pMoveToRangeEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFldSimple(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
|
||||
@ -381,7 +381,9 @@ extern int g_nCurFormatVersion;
|
||||
TextFill = 32,
|
||||
Del = 33,
|
||||
Ins = 34,
|
||||
rPrChange = 35
|
||||
rPrChange = 35,
|
||||
MoveFrom = 36,
|
||||
MoveTo = 37
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
@ -464,7 +466,13 @@ extern int g_nCurFormatVersion;
|
||||
Del = 12,
|
||||
Ins = 13,
|
||||
Background = 14,
|
||||
Sdt = 15
|
||||
Sdt = 15,
|
||||
MoveFrom = 16,
|
||||
MoveTo = 17,
|
||||
MoveFromRangeStart = 18,
|
||||
MoveFromRangeEnd = 19,
|
||||
MoveToRangeStart = 20,
|
||||
MoveToRangeEnd = 21
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -1073,6 +1081,17 @@ extern int g_nCurFormatVersion;
|
||||
TIMaxLength = 23,
|
||||
TIType = 24,
|
||||
};}
|
||||
namespace c_oSerMoveRange{enum c_oSerMoveRange
|
||||
{
|
||||
Author = 0,
|
||||
ColFirst = 1,
|
||||
ColLast = 2,
|
||||
Date = 3,
|
||||
DisplacedByCustomXml = 4,
|
||||
Id = 5,
|
||||
Name = 6,
|
||||
UserId = 7
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -831,6 +831,22 @@ namespace BinDocxRW
|
||||
Write_rPrChange(rPr.m_oRPrChange.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(rPr.m_oMoveFrom.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::MoveFrom);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
m_oBcw.WriteTrackRevision(rPr.m_oMoveFrom.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(rPr.m_oMoveTo.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::MoveTo);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
m_oBcw.WriteTrackRevision(rPr.m_oMoveTo.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void Write_rPrChange(const OOX::Logic::CRPrChange& rPrChange)
|
||||
{
|
||||
@ -3229,6 +3245,22 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveFrom:
|
||||
{
|
||||
OOX::Logic::CMoveFrom* pMoveFrom = static_cast<OOX::Logic::CMoveFrom*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFrom);
|
||||
WriteMoveFrom(*pMoveFrom);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveTo:
|
||||
{
|
||||
OOX::Logic::CMoveTo* pMoveTo = static_cast<OOX::Logic::CMoveTo*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveTo);
|
||||
WriteMoveTo(*pMoveTo);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_commentRangeStart:
|
||||
{
|
||||
OOX::Logic::CCommentRangeStart* pCommentRangeStart = static_cast<OOX::Logic::CCommentRangeStart*>(item);
|
||||
@ -3241,6 +3273,39 @@ namespace BinDocxRW
|
||||
WriteComment(OOX::et_w_commentRangeEnd, pCommentRangeEnd->m_oId);
|
||||
break;
|
||||
}
|
||||
//todo moveRange on all levels(body, p ...)
|
||||
// case OOX::et_w_moveFromRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveFromRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
case OOX::et_m_oMathPara:
|
||||
{
|
||||
OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item);
|
||||
@ -3280,6 +3345,92 @@ namespace BinDocxRW
|
||||
WriteParagraphContent(oIns.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteMoveFrom(const OOX::Logic::CMoveFrom& oMoveFrom)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
m_oBcw.WriteTrackRevision(oMoveFrom);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::Content);
|
||||
WriteParagraphContent(oMoveFrom.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteMoveTo(const OOX::Logic::CMoveTo& oMoveTo)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
m_oBcw.WriteTrackRevision(oMoveTo);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::Content);
|
||||
WriteParagraphContent(oMoveTo.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
template<typename T> void WriteMoveRangeStart(const T& elem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (elem.m_sAuthor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Author);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sAuthor.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oColFirst.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::ColFirst);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oColFirst->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oColLast.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::ColLast);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oColLast->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Date);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_oDate->ToString());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oDisplacedByCustomXml.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::DisplacedByCustomXml);
|
||||
m_oBcw.m_oStream.WriteBYTE(elem.m_oDisplacedByCustomXml->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Id);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_sName.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Name);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sName.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_sUserId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::UserId);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sUserId.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
template<typename T> void WriteMoveRangeEnd(const T& elem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (elem.m_oDisplacedByCustomXml.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::DisplacedByCustomXml);
|
||||
m_oBcw.m_oStream.WriteBYTE(elem.m_oDisplacedByCustomXml->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Id);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteComment(OOX::EElementType eType, nullable<SimpleTypes::CDecimalNumber<>>& oId)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
|
||||
@ -176,6 +176,7 @@ SOURCES += \
|
||||
../Reader/ReadStructures.cpp \
|
||||
../Reader/PPTDocumentInfoOneUser.cpp \
|
||||
../Reader/Records.cpp \
|
||||
../Reader/PPTFileReader.cpp \
|
||||
../Reader/SlidePersist.cpp \
|
||||
../Records/Animations/AnimationTypes.cpp \
|
||||
../Records/Drawing/ArtBlip.cpp \
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
#include "../Reader/ReadStructures.cpp"
|
||||
#include "../Reader/PPTDocumentInfoOneUser.cpp"
|
||||
#include "../Reader/PPTFileReader.cpp"
|
||||
#include "../Reader/Records.cpp"
|
||||
#include "../Reader/SlidePersist.cpp"
|
||||
#include "../Records/Animations/AnimationTypes.cpp"
|
||||
|
||||
@ -64,7 +64,7 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
|
||||
m_pReader = new CPPTFileReader(pStgFrom, m_strTempDirectory);
|
||||
CPPTFileReader* pptReader = (CPPTFileReader*)m_pReader;
|
||||
|
||||
pptReader->m_oDocumentInfo.m_strFileDirectory = GetDirectory(sFileName.c_str());
|
||||
pptReader->m_oDocumentInfo.m_strTmpDirectory = m_strTempDirectory;
|
||||
pptReader->m_oDocumentInfo.m_strPassword = password;
|
||||
|
||||
if (pptReader->IsPowerPoint() == false)
|
||||
@ -75,50 +75,20 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
|
||||
}
|
||||
|
||||
if (pptReader->ReadPersists() == false)
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
|
||||
if (pptReader->IsEncrypted())
|
||||
{
|
||||
CEncryptionHeader *pEncryptionHeader = pptReader->GetEncryptionHeader();
|
||||
if (!pEncryptionHeader) return AVS_ERROR_FILEFORMAT;
|
||||
if (password.empty()) return AVS_ERROR_DRM;
|
||||
|
||||
if (pEncryptionHeader->bStandard)
|
||||
if (pptReader->IsEncrypted())
|
||||
{
|
||||
CRYPT::RC4Decryptor Decryptor(pEncryptionHeader->crypt_data_rc4, password, 1);
|
||||
|
||||
if (Decryptor.IsVerify() == false)
|
||||
{
|
||||
return AVS_ERROR_PASSWORD;
|
||||
}
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
|
||||
return AVS_ERROR_PASSWORD;
|
||||
//return OpenFile(m_sTempDecryptFileName, L"");
|
||||
}
|
||||
else
|
||||
{
|
||||
CRYPT::ECMADecryptor Decryptor;
|
||||
|
||||
Decryptor.SetCryptData(pEncryptionHeader->crypt_data_aes);
|
||||
|
||||
if (Decryptor.SetPassword(password) == false)
|
||||
{
|
||||
return AVS_ERROR_PASSWORD;
|
||||
}
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
|
||||
return AVS_ERROR_PASSWORD;
|
||||
pptReader->ReadDocument(&Decryptor);
|
||||
//return OpenFile(m_sTempDecryptFileName, L"");
|
||||
if (password.empty()) return AVS_ERROR_DRM;
|
||||
else return AVS_ERROR_PASSWORD;
|
||||
}
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
pptReader->ReadDocument(NULL);
|
||||
|
||||
m_Status = READMODE;
|
||||
}
|
||||
//pptReader->ReadEncryptedSummary();
|
||||
//pptReader->ReadDocumentSummary();
|
||||
pptReader->ReadDocument();
|
||||
|
||||
m_Status = READMODE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -166,94 +136,3 @@ std::wstring COfficePPTFile::GetDirectory(std::wstring strFileName)
|
||||
}
|
||||
return strFileName;
|
||||
}
|
||||
|
||||
bool COfficePPTFile::DecryptOfficeFile(CRYPT::Decryptor* Decryptor)
|
||||
{
|
||||
if (!m_pReader) return false;
|
||||
CPPTFileReader* pptReader = (CPPTFileReader*)(m_pReader);
|
||||
|
||||
if (m_strTempDirectory.empty())
|
||||
{
|
||||
m_strTempDirectory = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
m_sTempDecryptFileName = m_strTempDirectory + FILE_SEPARATOR_STR + L"~tempFile.ppt";
|
||||
|
||||
POLE::Storage *storageIn = pptReader->m_pPowerPointStg;
|
||||
POLE::Storage *storageOut = new POLE::Storage(m_sTempDecryptFileName.c_str());
|
||||
|
||||
if (!storageOut || !storageIn) return false;
|
||||
|
||||
if (!storageOut->open(true, true))
|
||||
{
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
{
|
||||
if (storageIn->isDirectory(*it))
|
||||
{
|
||||
std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
|
||||
|
||||
for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
|
||||
{
|
||||
DecryptStream(Decryptor, *it2, storageIn, storageOut);
|
||||
}
|
||||
}
|
||||
else
|
||||
DecryptStream(Decryptor, *it, storageIn, storageOut);
|
||||
|
||||
}
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool COfficePPTFile::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
int sz_stream = stream->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, sz_stream);
|
||||
if (!streamNew) return false;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[sz_stream];
|
||||
stream->read(data_stream, sz_stream);
|
||||
|
||||
unsigned char* data_store = NULL;
|
||||
int sz_data_store = 0;
|
||||
|
||||
//if ("WordDocument" == streamName)
|
||||
//{
|
||||
// sz_data_store = 68;
|
||||
// data_store = new unsigned char[sz_data_store];
|
||||
//}
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_store, data_stream, sz_data_store);
|
||||
|
||||
Decryptor->Decrypt((char*)data_stream, sz_stream, 0);
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_stream, data_store, sz_data_store);
|
||||
|
||||
streamNew->write(data_stream, sz_stream);
|
||||
|
||||
RELEASEARRAYOBJECTS(data_store);
|
||||
RELEASEARRAYOBJECTS(data_stream);
|
||||
|
||||
streamNew->flush();
|
||||
|
||||
delete streamNew;
|
||||
delete stream;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,9 +79,6 @@ private:
|
||||
long OpenFile(const std::wstring & fileName, const std::wstring & password);
|
||||
bool CloseFile();
|
||||
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
bool DecryptStream (CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage* storageIn, POLE::Storage* storageOut);
|
||||
|
||||
std::wstring GetDirectory(std::wstring strFileName);
|
||||
};
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class CPPTDocumentInfo
|
||||
public:
|
||||
CCurrentUser m_oCurrentUser;
|
||||
std::vector<CPPTUserInfo*> m_arUsers;
|
||||
std::wstring m_strFileDirectory;
|
||||
std::wstring m_strTmpDirectory;
|
||||
std::map<int, std::wstring> m_mapStoreImageFile;
|
||||
std::wstring m_strPassword;
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
CPPTUserInfo* pInfo = new CPPTUserInfo();
|
||||
|
||||
pInfo->m_strFileDirectory = m_strFileDirectory;
|
||||
pInfo->m_strTmpDirectory = m_strTmpDirectory;
|
||||
pInfo->m_bEncrypt = m_oCurrentUser.m_bIsEncrypt;
|
||||
pInfo->m_strPassword = m_strPassword;
|
||||
|
||||
@ -96,7 +96,9 @@ public:
|
||||
if (bResult == false)
|
||||
{
|
||||
delete pInfo;
|
||||
continue;
|
||||
|
||||
if (pInfo->m_bEncrypt) return false;
|
||||
else continue;
|
||||
}
|
||||
|
||||
m_arUsers.push_back(pInfo);
|
||||
|
||||
@ -48,6 +48,8 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
|
||||
m_mapNotes(),
|
||||
m_mapSlides(),
|
||||
m_bEncrypt(false),
|
||||
m_pStorageDecrypt(NULL),
|
||||
m_pDecryptor(NULL),
|
||||
m_arOffsetPictures()
|
||||
{
|
||||
m_pDocumentInfo = NULL;
|
||||
@ -59,7 +61,6 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
|
||||
m_nWriteSlideTimeOffset = 0.0;
|
||||
m_nWriteSlideTime = 0.0;
|
||||
|
||||
m_strFileDirectory = _T("");
|
||||
m_bIsSetupEmpty = false;
|
||||
|
||||
m_bRtl = false;
|
||||
@ -79,6 +80,9 @@ CPPTUserInfo::~CPPTUserInfo()
|
||||
void CPPTUserInfo::Clear()
|
||||
{
|
||||
CDocument::Clear();
|
||||
|
||||
RELEASEOBJECT(m_pDecryptor);
|
||||
RELEASEOBJECT(m_pStorageDecrypt);
|
||||
|
||||
for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapSlides.begin(); pPair != m_mapSlides.end(); ++pPair)
|
||||
{
|
||||
@ -150,7 +154,6 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
oPersist.ReadFromStream(oHeader, pStream);
|
||||
oPersist.ToMap(&m_mapOffsetInPIDs);
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CRYPT::ECMADecryptor *pDecryptor = NULL;
|
||||
std::map<DWORD, DWORD>::iterator pPair = m_mapOffsetInPIDs.find(m_oUser.m_nEncryptRef);
|
||||
|
||||
if (pPair != m_mapOffsetInPIDs.end())
|
||||
@ -163,21 +166,49 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
m_bEncrypt = true;
|
||||
m_oEncryptionHeader.ReadFromStream(oHeader, pStream);
|
||||
|
||||
pDecryptor = new CRYPT::ECMADecryptor();
|
||||
pDecryptor->SetCryptData(m_oEncryptionHeader.crypt_data_aes);
|
||||
|
||||
if (pDecryptor->SetPassword(m_strPassword) == false)
|
||||
m_pDecryptor = new CRYPT::ECMADecryptor();
|
||||
m_pDecryptor->SetCryptData(m_oEncryptionHeader.crypt_data_aes);
|
||||
|
||||
if (m_strPassword.empty())
|
||||
{
|
||||
delete pDecryptor;
|
||||
pDecryptor = NULL;
|
||||
|
||||
//return true;
|
||||
if (m_pDecryptor->SetPassword(L"VelvetSweatshop") == false)
|
||||
return false;
|
||||
}
|
||||
return true;//read persis decrypt
|
||||
else if (m_pDecryptor->SetPassword(m_strPassword) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::wstring sTemp = m_strTmpDirectory + FILE_SEPARATOR_STR + L"~tempFile.ppt";
|
||||
|
||||
m_pStorageDecrypt = new POLE::Storage(sTemp.c_str());
|
||||
m_pStorageDecrypt->open(true, true);
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
pPair = m_mapOffsetInPIDs.find(m_oUser.m_nDocumentRef);
|
||||
|
||||
ReadDocumentPersists(pStream);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPPTUserInfo::DecryptStream(POLE::Stream *pStream, int block)
|
||||
{
|
||||
int size = pStream->size() - pStream->tell();
|
||||
|
||||
POLE::Stream *pStreamTmp = new POLE::Stream(m_pStorageDecrypt, "Tmp" + std::to_string(m_arStreamDecrypt.size() + 1), true, size);
|
||||
unsigned char* data_stream = new unsigned char[size];
|
||||
|
||||
pStream->read(data_stream, size);
|
||||
m_pDecryptor->Decrypt((char*)data_stream, size, block);
|
||||
pStreamTmp->write(data_stream, size);
|
||||
pStreamTmp->flush();
|
||||
pStreamTmp->seek(0);
|
||||
|
||||
m_arStreamDecrypt.push_back(CFStreamPtr(new CFStream(pStreamTmp)));
|
||||
}
|
||||
|
||||
bool CPPTUserInfo::ReadDocumentPersists(POLE::Stream* pStream)
|
||||
{
|
||||
SRecordHeader oHeader;
|
||||
std::map<DWORD, DWORD>::iterator pPair = m_mapOffsetInPIDs.find(m_oUser.m_nDocumentRef);
|
||||
|
||||
if (pPair == m_mapOffsetInPIDs.end())
|
||||
return false;
|
||||
@ -185,44 +216,19 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
DWORD offset_stream = pPair->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
if (pDecryptor)
|
||||
POLE::Stream * pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
POLE::Storage *pStorageOut = NULL;
|
||||
POLE::Stream *pStreamTmp = NULL;
|
||||
|
||||
std::wstring sTemp = m_strFileDirectory + FILE_SEPARATOR_STR + L"~tempFile.ppt";
|
||||
|
||||
pStorageOut = new POLE::Storage(sTemp.c_str());
|
||||
pStorageOut->open(true, true);
|
||||
|
||||
pStreamTmp = new POLE::Stream(pStorageOut, "Tmp", true, oHeader.RecLen);
|
||||
|
||||
unsigned char* data_stream = new unsigned char[oHeader.RecLen];
|
||||
pStream->read(data_stream, oHeader.RecLen);
|
||||
pDecryptor->Decrypt((char*)data_stream, oHeader.RecLen, m_oUser.m_nDocumentRef);
|
||||
pStreamTmp->write(data_stream, oHeader.RecLen);
|
||||
pStreamTmp->flush();
|
||||
pStreamTmp->seek(0);
|
||||
|
||||
m_oDocument.ReadFromStream(oHeader, pStreamTmp);
|
||||
|
||||
delete pStream;
|
||||
delete pStorageOut;
|
||||
|
||||
//NSFile::DeleteFile(sTemp);
|
||||
DecryptStream(pStream, m_oUser.m_nDocumentRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
else
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
if (RECORD_TYPE_DOCUMENT != oHeader.RecType)
|
||||
{
|
||||
if (RECORD_TYPE_DOCUMENT != oHeader.RecType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_oDocument.ReadFromStream(oHeader, pStream);
|
||||
return false;
|
||||
}
|
||||
|
||||
Clear();
|
||||
m_oDocument.ReadFromStream(oHeader, pStreamTmp);
|
||||
|
||||
std::map<DWORD, DWORD>::iterator nIndexPsrRef;
|
||||
|
||||
@ -235,11 +241,16 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
POLE::Stream *pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, m_oDocument.m_arMasterPersists[index].m_nPsrRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->ReadFromStream(oHeader, pStreamTmp);
|
||||
pSlide->m_oPersist = m_oDocument.m_arMasterPersists[index];
|
||||
|
||||
pSlide->m_Index = m_mapMasters.size();
|
||||
@ -260,10 +271,17 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
{
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
POLE::Stream *pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, m_oDocument.m_arNotePersists[index].m_nPsrRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->ReadFromStream(oHeader, pStreamTmp);
|
||||
pSlide->m_oPersist = m_oDocument.m_arNotePersists[index];
|
||||
|
||||
pSlide->m_Index = m_mapNotes.size();
|
||||
@ -284,13 +302,18 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
offset_stream = (long)nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
POLE::Stream *pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, m_oDocument.m_arSlidePersists[index].m_nPsrRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->ReadFromStream(oHeader, pStreamTmp);
|
||||
pSlide->m_oPersist = m_oDocument.m_arSlidePersists[index];
|
||||
|
||||
pSlide->m_Index = m_mapSlides.size(); // in m_arrSlidesOrder
|
||||
@ -327,13 +350,18 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
POLE::Stream *pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, oArrayDoc[0]->m_nNotesMasterPersistIDRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->ReadFromStream(oHeader, pStreamTmp);
|
||||
pSlide->m_oPersist.m_nPsrRef = oArrayDoc[0]->m_nNotesMasterPersistIDRef;
|
||||
pSlide->m_Index = 0;
|
||||
|
||||
@ -344,13 +372,18 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
POLE::Stream *pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, oArrayDoc[0]->m_nHandoutMasterPersistIDRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->ReadFromStream(oHeader, pStreamTmp);
|
||||
pSlide->m_oPersist.m_nPsrRef = oArrayDoc[0]->m_nHandoutMasterPersistIDRef;
|
||||
pSlide->m_Index = 0;
|
||||
|
||||
@ -364,7 +397,6 @@ void CPPTUserInfo::ReadExtenalObjects(std::wstring strFolderMem)
|
||||
{
|
||||
// так... теперь берем всю инфу о ExObject -----------------------------
|
||||
m_oExMedia.m_strPresentationDirectory = strFolderMem;
|
||||
m_oExMedia.m_strSourceDirectory = m_strFileDirectory;
|
||||
|
||||
NSPresentationEditor::CExFilesInfo oInfo;
|
||||
|
||||
|
||||
@ -51,7 +51,10 @@ public:
|
||||
CEncryptionHeader m_oEncryptionHeader;
|
||||
bool m_bEncrypt;
|
||||
std::wstring m_strPassword;
|
||||
|
||||
CRYPT::ECMADecryptor* m_pDecryptor;
|
||||
POLE::Storage* m_pStorageDecrypt;
|
||||
std::vector<CFStreamPtr> m_arStreamDecrypt; // на каждый Persist свой ... оО
|
||||
|
||||
std::map<DWORD, CRecordSlide*> m_mapSlides;
|
||||
std::map<DWORD, CRecordSlide*> m_mapMasters;
|
||||
std::map<DWORD, CRecordSlide*> m_mapNotes;
|
||||
@ -106,7 +109,7 @@ public:
|
||||
std::vector<int> m_arOffsetPictures;
|
||||
bool m_bIsSetupEmpty;
|
||||
|
||||
std::wstring m_strFileDirectory;
|
||||
std::wstring m_strTmpDirectory;
|
||||
|
||||
// вся инфа о ex - файлах
|
||||
CExMedia m_oExMedia;
|
||||
@ -124,7 +127,11 @@ public:
|
||||
void Clear();
|
||||
|
||||
bool ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream);
|
||||
bool ReadDocumentPersists(POLE::Stream* pStream);
|
||||
void ReadExtenalObjects(std::wstring strFolderMem);
|
||||
|
||||
void DecryptStream(POLE::Stream *pStream, int block);
|
||||
|
||||
void FromDocument();
|
||||
|
||||
void NormalizeCoords(long lWidth, long lHeight);
|
||||
@ -301,7 +308,6 @@ public:
|
||||
}
|
||||
return _T("blank");
|
||||
}
|
||||
|
||||
|
||||
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
|
||||
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
|
||||
|
||||
268
ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp
Normal file
268
ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp
Normal file
@ -0,0 +1,268 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "PPTFileReader.h"
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Crypt/Decryptor.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
|
||||
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../Records/Drawing/ArtBlip.h"
|
||||
|
||||
#define CURRENT_USER_STREAM "Current User"
|
||||
|
||||
#define DOCUMENT_STREAM "PowerPoint Document"
|
||||
|
||||
#define PICTURE_STREAM "Pictures"
|
||||
#define HEADER_STREAM "Header"
|
||||
|
||||
#define PP97_DUALSTORAGE "PP97_DUALSTORAGE"
|
||||
|
||||
#define ENCRYPTED_SUMMARY_STREAM "EncryptedSummary"
|
||||
#define DOCUMENT_SUMMARY_STREAM "DocumentSummaryInformation"
|
||||
|
||||
CPPTFileReader::CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp):
|
||||
m_pStorage(pStorage),
|
||||
m_bIsPPTFile(false),
|
||||
m_nPresentationCodePage(1250),
|
||||
m_pDocumentStream(NULL), m_pPictureStream(NULL), m_pDocumentSummaryStream(NULL), m_pEncryptedSummaryStream(NULL),
|
||||
m_strTmpDirectory(strTemp),
|
||||
m_oDocumentInfo()
|
||||
{
|
||||
m_bDualStorage = false;
|
||||
|
||||
POLE::Stream *pStm = new POLE::Stream( m_pStorage, CURRENT_USER_STREAM);
|
||||
|
||||
if ( ReadCurrentUser(pStm) )
|
||||
{
|
||||
m_bIsPPTFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEOBJECT(pStm);
|
||||
|
||||
std::string stream_name = std::string(PP97_DUALSTORAGE) + std::string("/") + std::string(CURRENT_USER_STREAM);
|
||||
pStm = new POLE::Stream( m_pStorage, stream_name);
|
||||
|
||||
if (pStm == NULL)
|
||||
return;
|
||||
|
||||
m_bDualStorage = true;
|
||||
if ( ReadCurrentUser(pStm))
|
||||
{
|
||||
m_bIsPPTFile = true;
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEOBJECT(pStm);
|
||||
|
||||
if (0 == m_strTmpDirectory.length())
|
||||
{
|
||||
m_strTmpDirectory = NSDirectory::GetTempPath();
|
||||
}
|
||||
|
||||
m_strTmpDirectory = NSDirectory::CreateDirectoryWithUniqueName(m_strTmpDirectory);
|
||||
|
||||
}
|
||||
CPPTFileReader::~CPPTFileReader()
|
||||
{
|
||||
RELEASEOBJECT(m_pStorage);
|
||||
|
||||
NSDirectory::DeleteDirectory(m_strTmpDirectory);
|
||||
}
|
||||
|
||||
bool CPPTFileReader::IsPowerPoint()
|
||||
{
|
||||
return m_bIsPPTFile;
|
||||
}
|
||||
bool CPPTFileReader::IsEncrypted()
|
||||
{
|
||||
if (m_oDocumentInfo.m_arUsers.empty())
|
||||
return m_oDocumentInfo.m_oCurrentUser.m_bIsEncrypt; //wps не выставляет флаг!
|
||||
|
||||
return m_oDocumentInfo.m_arUsers[0]->m_bEncrypt;
|
||||
}
|
||||
|
||||
bool CPPTFileReader::ReadPersists()
|
||||
{
|
||||
CFStreamPtr pStream = GetDocumentStream();
|
||||
if (!pStream) return false;
|
||||
|
||||
if (m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, pStream->stream_) == false) return false;
|
||||
}
|
||||
void CPPTFileReader::ReadDocument()
|
||||
{
|
||||
ReadPictures();
|
||||
m_oDocumentInfo.LoadDocument(m_strTmpDirectory);
|
||||
}
|
||||
|
||||
bool CPPTFileReader::ReadCurrentUser(POLE::Stream *pStm)
|
||||
{
|
||||
if (!pStm) return false;
|
||||
|
||||
SRecordHeader oHeader;
|
||||
bool isPP = false;
|
||||
|
||||
if( oHeader.ReadFromStream(pStm))
|
||||
{
|
||||
m_oCurrentUser.ReadFromStream(oHeader, pStm);
|
||||
|
||||
isPP = (m_oCurrentUser.m_nSize == 0x00000014 && (m_oCurrentUser.m_nLenUserName <= 255));
|
||||
}
|
||||
|
||||
return isPP;
|
||||
}
|
||||
|
||||
CFStreamPtr CPPTFileReader::GetDocumentStream()
|
||||
{
|
||||
if (!m_pDocumentStream)
|
||||
{
|
||||
m_pDocumentStream = GetStreamByName(DOCUMENT_STREAM);
|
||||
}
|
||||
return m_pDocumentStream;
|
||||
}
|
||||
CFStreamPtr CPPTFileReader::GetPictureStream()
|
||||
{
|
||||
if (!m_pPictureStream)
|
||||
{
|
||||
m_pPictureStream = GetStreamByName(PICTURE_STREAM);
|
||||
}
|
||||
return m_pPictureStream;
|
||||
}
|
||||
CFStreamPtr CPPTFileReader::GetStreamByName(const std::string & name)
|
||||
{
|
||||
if (!m_bIsPPTFile)
|
||||
return CFStreamPtr();
|
||||
|
||||
std::string stream_name;
|
||||
|
||||
if (m_bDualStorage) stream_name = std::string(PP97_DUALSTORAGE) + std::string("/");
|
||||
|
||||
POLE::Stream *pStream = new POLE::Stream(m_pStorage, stream_name + name);
|
||||
|
||||
if (pStream->fail())
|
||||
{
|
||||
RELEASEOBJECT(pStream);
|
||||
return CFStreamPtr();
|
||||
}
|
||||
return CFStreamPtr( new CFStream(pStream));
|
||||
}
|
||||
CFStreamPtr CPPTFileReader::GetEncryptedSummaryStream()
|
||||
{
|
||||
if (m_pEncryptedSummaryStream == NULL)
|
||||
{
|
||||
m_pEncryptedSummaryStream = GetStreamByName(ENCRYPTED_SUMMARY_STREAM);
|
||||
}
|
||||
return m_pEncryptedSummaryStream;
|
||||
}
|
||||
|
||||
CFStreamPtr CPPTFileReader::GetDocumentSummaryStream()
|
||||
{
|
||||
if (!m_pDocumentSummaryStream)
|
||||
{
|
||||
m_pDocumentSummaryStream = GetStreamByName(DOCUMENT_SUMMARY_STREAM);
|
||||
}
|
||||
return m_pDocumentSummaryStream;
|
||||
}
|
||||
void CPPTFileReader::ReadEncryptedSummary()
|
||||
{
|
||||
CFStreamPtr pStream = GetEncryptedSummaryStream();
|
||||
if (!pStream) return;
|
||||
|
||||
SRecordHeader oHeader;
|
||||
|
||||
if (oHeader.ReadFromStream(pStream) == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
CRecordEncryptedSummary info;
|
||||
|
||||
info.ReadFromStream(oHeader, pStream);
|
||||
}
|
||||
|
||||
void CPPTFileReader::ReadDocumentSummary()
|
||||
{
|
||||
CFStreamPtr pStream = GetDocumentSummaryStream();
|
||||
if (!pStream) return;
|
||||
|
||||
OLEPS::SummaryInformation doc_summary_info(pStream);
|
||||
|
||||
m_nPresentationCodePage = doc_summary_info.GetCodePage();
|
||||
|
||||
if (m_nPresentationCodePage == 0)
|
||||
m_nPresentationCodePage = 1250;
|
||||
}
|
||||
|
||||
void CPPTFileReader::ReadPictures()
|
||||
{
|
||||
if (m_oDocumentInfo.m_arUsers.empty()) return;
|
||||
|
||||
CFStreamPtr pStream = GetPictureStream();
|
||||
if (!pStream) return;
|
||||
|
||||
CRYPT::ECMADecryptor *pDecryptor = m_oDocumentInfo.m_arUsers[0]->m_pDecryptor;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (pStream->isEOF())
|
||||
break;
|
||||
|
||||
int pos = pStream->getStreamPointer();
|
||||
|
||||
SRecordHeader oHeader;
|
||||
if (pDecryptor)
|
||||
{
|
||||
BYTE pHeader[8];
|
||||
pStream->read(pHeader, 8);
|
||||
|
||||
pDecryptor->Decrypt((char*)pHeader, 8, 0);
|
||||
|
||||
unsigned short rec =0;
|
||||
memcpy(&rec, pHeader + 0, 2);
|
||||
memcpy(&oHeader.RecType,pHeader + 2, 2);
|
||||
memcpy(&oHeader.RecLen, pHeader + 4, 4);
|
||||
|
||||
oHeader.RecInstance = rec >> 4;
|
||||
oHeader.RecVersion = rec - (oHeader.RecInstance << 4);
|
||||
}
|
||||
else
|
||||
oHeader.ReadFromStream(pStream->stream_);
|
||||
|
||||
CRecordOfficeArtBlip art_blip;
|
||||
art_blip.m_strTmpDirectory = m_strTmpDirectory;
|
||||
art_blip.m_oDocumentInfo = &m_oDocumentInfo;
|
||||
|
||||
art_blip.ReadFromStream(oHeader, pStream->stream_);
|
||||
m_oDocumentInfo.m_mapStoreImageFile[ pos ] = art_blip.m_sFileName;
|
||||
|
||||
pStream->seekFromBegin(pos + oHeader.RecLen + 8);
|
||||
}
|
||||
}
|
||||
@ -31,222 +31,48 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Crypt/Decryptor.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../Records/Drawing/ArtBlip.h"
|
||||
|
||||
#include "PPTDocumentInfo.h"
|
||||
|
||||
#define CURRENT_USER_STREAM "Current User"
|
||||
|
||||
#define DOCUMENT_STREAM "PowerPoint Document"
|
||||
|
||||
#define PICTURE_STREAM "Pictures"
|
||||
#define HEADER_STREAM "Header"
|
||||
|
||||
#define PP97_DUALSTORAGE "PP97_DUALSTORAGE"
|
||||
|
||||
#define ENCRYPTION_STREAM "EncryptedSummary"
|
||||
using namespace XLS;
|
||||
|
||||
class CPPTFileReader
|
||||
{
|
||||
public:
|
||||
CPPTFileReader(POLE::Storage *pStg, std::wstring strTemp):
|
||||
m_pPowerPointStg(pStg),
|
||||
m_bIsPPTFile(false),
|
||||
m_pDocStream(NULL),
|
||||
m_pPictureStream(NULL),
|
||||
m_strMemoryForder(strTemp),
|
||||
m_oDocumentInfo()
|
||||
{
|
||||
m_bDualStorage = false;
|
||||
|
||||
POLE::Stream *pStm = new POLE::Stream( m_pPowerPointStg, CURRENT_USER_STREAM);
|
||||
|
||||
if ( ReadCurrentUser(pStm) )
|
||||
{
|
||||
m_bIsPPTFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEOBJECT(pStm);
|
||||
|
||||
std::string stream_name = std::string(PP97_DUALSTORAGE) + std::string("/") + std::string(CURRENT_USER_STREAM);
|
||||
pStm = new POLE::Stream( m_pPowerPointStg, stream_name);
|
||||
|
||||
if (pStm == NULL)
|
||||
return;
|
||||
|
||||
m_bDualStorage = true;
|
||||
if ( ReadCurrentUser(pStm))
|
||||
{
|
||||
m_bIsPPTFile = true;
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEOBJECT(pStm);
|
||||
|
||||
if (0 == m_strMemoryForder.length())
|
||||
{
|
||||
m_strMemoryForder = NSDirectory::GetTempPath();
|
||||
}
|
||||
|
||||
m_strMemoryForder = NSDirectory::CreateDirectoryWithUniqueName(m_strMemoryForder);
|
||||
|
||||
}
|
||||
~CPPTFileReader()
|
||||
{
|
||||
RELEASEOBJECT(m_pDocStream);
|
||||
RELEASEOBJECT(m_pPictureStream);
|
||||
|
||||
RELEASEOBJECT(m_pPowerPointStg);
|
||||
|
||||
NSDirectory::DeleteDirectory(m_strMemoryForder);
|
||||
}
|
||||
|
||||
bool IsPowerPoint()
|
||||
{
|
||||
return m_bIsPPTFile;
|
||||
}
|
||||
bool IsEncrypted()
|
||||
{
|
||||
if (m_oDocumentInfo.m_arUsers.empty())
|
||||
return m_oDocumentInfo.m_oCurrentUser.m_bIsEncrypt; //wps не выставляет флаг!
|
||||
|
||||
return m_oDocumentInfo.m_arUsers[0]->m_bEncrypt;
|
||||
}
|
||||
CEncryptionHeader* GetEncryptionHeader()
|
||||
{
|
||||
if (m_oDocumentInfo.m_arUsers.empty()) return NULL;
|
||||
|
||||
return &m_oDocumentInfo.m_arUsers[0]->m_oEncryptionHeader;
|
||||
}
|
||||
bool ReadPersists()
|
||||
{
|
||||
return m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, GetDocStream());
|
||||
}
|
||||
void ReadDocument(CRYPT::ECMADecryptor *pDecryptor)
|
||||
{
|
||||
ReadPictures(pDecryptor);
|
||||
m_oDocumentInfo.LoadDocument(m_strMemoryForder);
|
||||
}
|
||||
|
||||
CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp);
|
||||
~CPPTFileReader();
|
||||
bool IsPowerPoint();
|
||||
bool IsEncrypted();
|
||||
bool ReadPersists();
|
||||
void ReadDocument();
|
||||
protected:
|
||||
|
||||
bool ReadCurrentUser(POLE::Stream *pStm)
|
||||
{
|
||||
if (!pStm) return false;
|
||||
|
||||
SRecordHeader oHeader;
|
||||
bool isPP = false;
|
||||
|
||||
if( oHeader.ReadFromStream(pStm))
|
||||
{
|
||||
m_oCurrentUser.ReadFromStream(oHeader, pStm);
|
||||
|
||||
isPP = (m_oCurrentUser.m_nSize == 0x00000014 && (m_oCurrentUser.m_nLenUserName <= 255));
|
||||
}
|
||||
|
||||
return isPP;
|
||||
}
|
||||
|
||||
POLE::Stream* GetDocStream()
|
||||
{
|
||||
if (m_pDocStream == NULL)
|
||||
{
|
||||
if (!m_bIsPPTFile)
|
||||
return NULL;
|
||||
|
||||
std::string stream_name;
|
||||
|
||||
if (m_bDualStorage) stream_name = std::string(PP97_DUALSTORAGE) + std::string("/");
|
||||
|
||||
m_pDocStream = new POLE::Stream(m_pPowerPointStg, stream_name + DOCUMENT_STREAM);
|
||||
}
|
||||
return m_pDocStream;
|
||||
}
|
||||
POLE::Stream* GetPictureStream()
|
||||
{
|
||||
if (m_pPictureStream == NULL)
|
||||
{
|
||||
if (!m_bIsPPTFile)
|
||||
return NULL;
|
||||
|
||||
std::string stream_name;
|
||||
|
||||
if (m_bDualStorage) stream_name = std::string(PP97_DUALSTORAGE) + std::string("/");
|
||||
|
||||
m_pPictureStream = new POLE::Stream(m_pPowerPointStg, stream_name + PICTURE_STREAM);
|
||||
}
|
||||
return m_pPictureStream;
|
||||
}
|
||||
|
||||
void ReadPictures(CRYPT::ECMADecryptor *pDecryptor)
|
||||
{
|
||||
POLE::Stream* pStream = GetPictureStream();
|
||||
if (NULL == pStream) return;
|
||||
|
||||
SRecordHeader oHeader;
|
||||
ULONG nRd = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (oHeader.ReadFromStream(pStream) == false )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CRecordOfficeArtBlip art_blip;
|
||||
art_blip.m_strMemoryForder = m_strMemoryForder;
|
||||
art_blip.m_oDocumentInfo = &m_oDocumentInfo;
|
||||
|
||||
if (pDecryptor)
|
||||
{
|
||||
POLE::Storage *pStorageOut = NULL;
|
||||
POLE::Stream *pStreamTmp = NULL;
|
||||
|
||||
std::wstring sTemp = m_strMemoryForder + FILE_SEPARATOR_STR + L"~tempFile.ppt";
|
||||
|
||||
pStorageOut = new POLE::Storage(sTemp.c_str());
|
||||
pStorageOut->open(true, true);
|
||||
|
||||
pStreamTmp = new POLE::Stream(pStorageOut, "Tmp", true, oHeader.RecLen);
|
||||
|
||||
unsigned char* data_stream = new unsigned char[oHeader.RecLen];
|
||||
pStream->read(data_stream, oHeader.RecLen);
|
||||
pDecryptor->Decrypt((char*)data_stream, oHeader.RecLen, 0);
|
||||
pStreamTmp->write(data_stream, oHeader.RecLen);
|
||||
pStreamTmp->flush();
|
||||
pStreamTmp->seek(0);
|
||||
|
||||
art_blip.ReadFromStream(oHeader, pStreamTmp);
|
||||
|
||||
delete pStream;
|
||||
delete pStorageOut;
|
||||
|
||||
//NSFile::DeleteFile(sTemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
art_blip.ReadFromStream(oHeader, pStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
CFStreamPtr GetDocumentStream();
|
||||
CFStreamPtr GetPictureStream();
|
||||
CFStreamPtr GetEncryptedSummaryStream();
|
||||
CFStreamPtr GetDocumentSummaryStream();
|
||||
|
||||
CFStreamPtr GetStreamByName(const std::string & name);
|
||||
|
||||
bool ReadCurrentUser(POLE::Stream *pStm);
|
||||
void ReadEncryptedSummary();
|
||||
void ReadDocumentSummary();
|
||||
void ReadPictures();
|
||||
|
||||
private:
|
||||
bool m_bDualStorage;
|
||||
CRecordCurrentUserAtom m_oCurrentUser;
|
||||
POLE::Stream * m_pDocStream;
|
||||
POLE::Stream * m_pPictureStream;
|
||||
|
||||
XLS::CFStreamPtr m_pDocumentStream;
|
||||
XLS::CFStreamPtr m_pPictureStream;
|
||||
XLS::CFStreamPtr m_pDocumentSummaryStream;
|
||||
XLS::CFStreamPtr m_pEncryptedSummaryStream;
|
||||
|
||||
bool m_bIsPPTFile;
|
||||
|
||||
public:
|
||||
POLE::Storage* m_pPowerPointStg;
|
||||
std::wstring m_strMemoryForder;
|
||||
|
||||
POLE::Storage* m_pStorage;
|
||||
std::wstring m_strTmpDirectory;
|
||||
std::vector<bool> m_arLoadImageFlags;
|
||||
|
||||
CPPTDocumentInfo m_oDocumentInfo;
|
||||
int m_nPresentationCodePage;
|
||||
};
|
||||
|
||||
@ -33,8 +33,10 @@
|
||||
|
||||
#include "ReadStructures.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include "../../../ASCOfficeDocFile/DocDocxConverter/MemoryStream.h"
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
using namespace NSPresentationEditor;
|
||||
|
||||
@ -639,22 +641,31 @@ namespace NSPresentationEditor
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------
|
||||
void CMetaHeader::FromStream(POLE::Stream* pStream)
|
||||
void CMetaHeader::FromStream(POLE::Stream* pStream, CRYPT::ECMADecryptor *pDecryptor)
|
||||
{
|
||||
cbSize = StreamUtils::ReadDWORD(pStream);
|
||||
BYTE pData[34];
|
||||
pStream->read(pData, 34);
|
||||
|
||||
rcBounds.left = StreamUtils::ReadLONG(pStream);
|
||||
rcBounds.top = StreamUtils::ReadLONG(pStream);
|
||||
rcBounds.right = StreamUtils::ReadLONG(pStream);
|
||||
rcBounds.bottom = StreamUtils::ReadLONG(pStream);
|
||||
if (pDecryptor)
|
||||
{
|
||||
pDecryptor->Decrypt((char*)pData, 34, 0);
|
||||
}
|
||||
MemoryStream memStream(pData, 34, false);
|
||||
|
||||
ptSize.x = StreamUtils::ReadLONG(pStream);
|
||||
ptSize.y = StreamUtils::ReadLONG(pStream);
|
||||
cbSize = memStream.ReadUInt32();
|
||||
|
||||
rcBounds.left = memStream.ReadInt32();
|
||||
rcBounds.top = memStream.ReadInt32();
|
||||
rcBounds.right = memStream.ReadInt32();
|
||||
rcBounds.bottom = memStream.ReadInt32();
|
||||
|
||||
cbSave = StreamUtils::ReadDWORD(pStream);
|
||||
ptSize.x = memStream.ReadInt32();
|
||||
ptSize.y = memStream.ReadInt32();
|
||||
|
||||
compression = StreamUtils::ReadBYTE(pStream);
|
||||
filter = StreamUtils::ReadBYTE(pStream);
|
||||
cbSave = memStream.ReadUInt32();
|
||||
|
||||
compression = memStream.ReadByte();
|
||||
filter = memStream.ReadByte();
|
||||
}
|
||||
|
||||
void CMetaHeader::ToEMFHeader(Gdiplus::ENHMETAHEADER3* pHeader)
|
||||
|
||||
@ -43,6 +43,10 @@ namespace NSZLib
|
||||
bool Decompress(const BYTE* pSrcBuffer, const ULONG& lSrcBufferLen,
|
||||
BYTE* pDstBuffer, ULONG& lDstBufferLen);
|
||||
}
|
||||
namespace CRYPT
|
||||
{
|
||||
class ECMADecryptor;
|
||||
}
|
||||
/**************************************************************
|
||||
теперь все структуры...
|
||||
которые участвуют в записях
|
||||
@ -170,7 +174,7 @@ public:
|
||||
CMetaHeader()
|
||||
{
|
||||
}
|
||||
void FromStream(POLE::Stream* pStream);
|
||||
void FromStream(POLE::Stream* pStream, CRYPT::ECMADecryptor *pDecryptor = NULL);
|
||||
|
||||
void ToEMFHeader (Gdiplus::ENHMETAHEADER3* pHeader);
|
||||
void ToWMFHeader (Gdiplus::WmfPlaceableFileHeader* pHeader);
|
||||
|
||||
@ -35,6 +35,97 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
std::wstring CUnknownRecord::ReadStringW(const CFStreamPtr &pStream, int lLen)
|
||||
{
|
||||
if (!pStream) return (L"");
|
||||
|
||||
unsigned char* pData = new unsigned char[2 * (lLen + 1)];
|
||||
memset (pData, 0, 2 * (lLen + 1));
|
||||
|
||||
pStream->read(pData, 2 * lLen);
|
||||
|
||||
if (sizeof(wchar_t) == 4)
|
||||
{
|
||||
ConversionResult eUnicodeConversionResult;
|
||||
UTF32 *pStrUtf32 = new UTF32 [lLen + 1];
|
||||
pStrUtf32[lLen] = 0 ;
|
||||
|
||||
const UTF16 *pStrUtf16_Conv = (const UTF16 *) pData;
|
||||
UTF32 *pStrUtf32_Conv = pStrUtf32;
|
||||
|
||||
eUnicodeConversionResult = ConvertUTF16toUTF32 ( &pStrUtf16_Conv
|
||||
, &pStrUtf16_Conv[lLen]
|
||||
, &pStrUtf32_Conv
|
||||
, &pStrUtf32 [lLen]
|
||||
, strictConversion);
|
||||
|
||||
if (conversionOK != eUnicodeConversionResult)
|
||||
{
|
||||
delete [] pStrUtf32;
|
||||
return (L"");
|
||||
}
|
||||
std::wstring res((wchar_t*)pStrUtf32, lLen);
|
||||
if (pStrUtf32) delete [] pStrUtf32;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring str((wchar_t*)pData);
|
||||
delete[] pData;
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
std::string CUnknownRecord::ReadStringA(const CFStreamPtr &pStream, int lLen)
|
||||
{
|
||||
if (!pStream) return ("");
|
||||
|
||||
char* pData = new char[lLen + 1];
|
||||
|
||||
pStream->read((unsigned char*)pData, lLen);
|
||||
|
||||
pData[lLen] = 0;
|
||||
|
||||
std::string str(pData, lLen);
|
||||
|
||||
delete[] pData;
|
||||
return str;
|
||||
}
|
||||
|
||||
void CRecordsContainer::ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
m_arRecords.clear();
|
||||
|
||||
LONG lPosition = pStream->getStreamPointer();
|
||||
|
||||
m_oHeader = oHeader;
|
||||
|
||||
UINT lCurLen = 0;
|
||||
ULONG lReadLen = 0;
|
||||
SRecordHeader oRec;
|
||||
|
||||
while (lCurLen < m_oHeader.RecLen)
|
||||
{
|
||||
if (oRec.ReadFromStream(pStream) == FALSE )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
IRecord* pRecord = CreateByType(oRec);
|
||||
pRecord->ReadFromStream(oRec, pStream);
|
||||
|
||||
m_arRecords.push_back(pRecord);
|
||||
lCurLen += (8 + oRec.RecLen);
|
||||
}
|
||||
if (lCurLen != m_oHeader.RecLen)
|
||||
{
|
||||
// нужно разобраться, что тут такое!!!
|
||||
LONG lPosition = 0;
|
||||
pStream->seekFromBegin(lPosition + m_oHeader.RecLen);
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordsContainer::ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
@ -34,49 +34,77 @@
|
||||
#include "PPTFileDefines.h"
|
||||
#include "../Reader/ReadStructures.h"
|
||||
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Enums.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h"
|
||||
#include "../../../Common/3dParty/pole/pole.h"
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
using namespace NSPresentationEditor;
|
||||
using namespace XLS;
|
||||
|
||||
class SRecordHeader
|
||||
{
|
||||
public:
|
||||
BYTE RecVersion;
|
||||
USHORT RecInstance;
|
||||
USHORT RecType;
|
||||
UINT RecLen;
|
||||
unsigned char RecVersion;
|
||||
unsigned short RecInstance;
|
||||
unsigned short RecType;
|
||||
_UINT32 RecLen;
|
||||
|
||||
SRecordHeader()
|
||||
void Clear()
|
||||
{
|
||||
RecVersion = 0;
|
||||
RecInstance = 0;
|
||||
RecType = 0;
|
||||
RecLen = 0;
|
||||
}
|
||||
SRecordHeader()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
bool ReadFromStream(const CFStreamPtr &pStream)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (pStream->isEOF()) return FALSE;
|
||||
POLE::uint64 nRd = 0;
|
||||
|
||||
unsigned short rec =0;
|
||||
pStream->read((unsigned char*)&(rec), 2);
|
||||
|
||||
RecInstance = rec >> 4;
|
||||
RecVersion = rec - (RecInstance << 4);
|
||||
|
||||
*pStream >> RecType >> RecLen;
|
||||
|
||||
unsigned long sz = pStream->getStreamSize() - pStream->getStreamPointer();
|
||||
|
||||
if (RecLen > sz )
|
||||
{
|
||||
RecLen = sz;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadFromStream(POLE::Stream * pStream)
|
||||
{
|
||||
RecVersion = 0;
|
||||
RecInstance = RecType = 0;
|
||||
RecLen = 0;
|
||||
Clear();
|
||||
if (!pStream) return false;
|
||||
|
||||
POLE::uint64 nRd = 0;
|
||||
|
||||
unsigned short rec =0;
|
||||
nRd = pStream->read((unsigned char*)&(rec), 2);
|
||||
|
||||
if (nRd != 2) return FALSE;
|
||||
if (nRd != 2) return false;
|
||||
|
||||
//RecVersion = rec & 0xFF0F;
|
||||
RecInstance = rec >> 4;
|
||||
RecVersion = rec - (RecInstance<<4);
|
||||
RecVersion = rec - (RecInstance<<4);
|
||||
|
||||
nRd = pStream->read((unsigned char*)&(RecType), 2);
|
||||
|
||||
nRd = pStream->read((unsigned char*)&(RecLen), 4);
|
||||
|
||||
POLE::uint64 sz = pStream->size()-pStream->tell();
|
||||
POLE::uint64 sz = pStream->size() - pStream->tell();
|
||||
|
||||
if (RecLen > sz )
|
||||
{
|
||||
@ -119,8 +147,8 @@ public:
|
||||
SRecordHeader m_oHeader;
|
||||
|
||||
public:
|
||||
// читаем из файла
|
||||
virtual ~IRecord(){}
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream) = 0;
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) = 0;
|
||||
};
|
||||
|
||||
@ -137,17 +165,26 @@ public:
|
||||
~CUnknownRecord()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
pStream->seekFromCurForward(m_oHeader.RecLen);
|
||||
}
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
StreamUtils::StreamSkip((long)m_oHeader.RecLen, pStream);
|
||||
}
|
||||
|
||||
std::wstring ReadStringW(const CFStreamPtr &pStream, int size);
|
||||
std::string ReadStringA(const CFStreamPtr &pStream, int size);
|
||||
};
|
||||
|
||||
IRecord* CreateByType(SRecordHeader oHeader);
|
||||
|
||||
class CRecordsContainer : public IRecord
|
||||
class CRecordsContainer : public CUnknownRecord
|
||||
{
|
||||
protected:
|
||||
std::vector<IRecord*> m_arRecords;
|
||||
@ -176,6 +213,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream);
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream);
|
||||
|
||||
template <typename T>
|
||||
|
||||
@ -315,7 +315,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct BuildAtom : public IRecord
|
||||
struct BuildAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -346,7 +346,7 @@ namespace Animations
|
||||
bool fExpanded;
|
||||
bool fUIExpanded;
|
||||
};
|
||||
struct ParaBuildAtom : public IRecord
|
||||
struct ParaBuildAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -395,7 +395,7 @@ namespace Animations
|
||||
|
||||
DWORD delayTime;
|
||||
};
|
||||
struct LevelInfoAtom : public IRecord
|
||||
struct LevelInfoAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -429,7 +429,7 @@ namespace Animations
|
||||
IRecord* timeNode; // ExtTimeNodeContainer
|
||||
};
|
||||
|
||||
struct ParaBuildContainer : public IRecord
|
||||
struct ParaBuildContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -499,7 +499,7 @@ namespace Animations
|
||||
std::vector <ParaBuildLevel*> rgParaBuildLevel;
|
||||
};
|
||||
|
||||
struct BuildListContainer : public IRecord
|
||||
struct BuildListContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -575,7 +575,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeVariant : public IRecord
|
||||
struct TimeVariant : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -709,7 +709,7 @@ namespace Animations
|
||||
std::wstring stringValue;
|
||||
};
|
||||
|
||||
struct TimeStringListContainer : public IRecord
|
||||
struct TimeStringListContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -744,7 +744,7 @@ namespace Animations
|
||||
std::vector <TimeVariantString> m_Values;
|
||||
};
|
||||
// structures for ExtTimeNodeContainer
|
||||
struct TimeNodeAtom : public IRecord
|
||||
struct TimeNodeAtom : public CUnknownRecord
|
||||
{
|
||||
static const DWORD RT_TimeSequenceData = 0xF141;
|
||||
|
||||
@ -808,7 +808,7 @@ namespace Animations
|
||||
bool m_bDurationProperty;
|
||||
};
|
||||
|
||||
struct TimeSequenceDataAtom : public IRecord
|
||||
struct TimeSequenceDataAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -938,7 +938,7 @@ namespace Animations
|
||||
};
|
||||
|
||||
|
||||
struct TimePropertyList4TimeNodeContainer : public IRecord
|
||||
struct TimePropertyList4TimeNodeContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
//static const DWORD RT_TimePropertyList = 0xF13D; // Specifies a TimePropertyList4TimeNodeContainer or TimePropertyList4TimeBehavior.
|
||||
@ -1113,7 +1113,7 @@ namespace Animations
|
||||
TimeEffectDir m_EffectDir;
|
||||
};
|
||||
|
||||
struct TimePropertyList4TimeBehavior : public IRecord
|
||||
struct TimePropertyList4TimeBehavior : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
//static const DWORD RT_TimePropertyList = 0xF13D; // Specifies a TimePropertyList4TimeNodeContainer or TimePropertyList4TimeBehavior.
|
||||
@ -1156,7 +1156,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct VisualShapeAtom : public IRecord
|
||||
struct VisualShapeAtom : public CUnknownRecord
|
||||
{
|
||||
// Привязка анимации через этот объект к ID объекту
|
||||
|
||||
@ -1191,7 +1191,7 @@ namespace Animations
|
||||
DWORD m_nData2;
|
||||
};
|
||||
|
||||
struct VisualPageAtom : public IRecord
|
||||
struct VisualPageAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1216,7 +1216,7 @@ namespace Animations
|
||||
TimeVisualElementEnum m_Type;
|
||||
};
|
||||
|
||||
struct ClientVisualElementContainer : public IRecord
|
||||
struct ClientVisualElementContainer : public CUnknownRecord
|
||||
{
|
||||
|
||||
ClientVisualElementContainer ()
|
||||
@ -1269,7 +1269,7 @@ namespace Animations
|
||||
bool m_bVisualShapeAtom;
|
||||
};
|
||||
|
||||
struct TimeBehaviorAtom : public IRecord
|
||||
struct TimeBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1310,7 +1310,7 @@ namespace Animations
|
||||
DWORD m_nBehaviorTransform;
|
||||
};
|
||||
|
||||
struct TimeBehaviorContainer : public IRecord
|
||||
struct TimeBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
TimeBehaviorContainer ()
|
||||
{
|
||||
@ -1452,7 +1452,7 @@ namespace Animations
|
||||
ClientVisualElementContainer clientVisualElement;
|
||||
};
|
||||
|
||||
struct TimeEffectBehaviorAtom : public IRecord
|
||||
struct TimeEffectBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1492,7 +1492,7 @@ namespace Animations
|
||||
DWORD m_nEffectTransition;
|
||||
};
|
||||
|
||||
struct TimeEffectBehaviorContainer : public IRecord
|
||||
struct TimeEffectBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1562,7 +1562,7 @@ namespace Animations
|
||||
TimeBehaviorContainer m_oBehavior;
|
||||
|
||||
};
|
||||
struct TimeConditionAtom : public IRecord
|
||||
struct TimeConditionAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1593,7 +1593,7 @@ namespace Animations
|
||||
LONG m_nTimeDelay;
|
||||
};
|
||||
|
||||
struct TimeConditionContainer : public IRecord
|
||||
struct TimeConditionContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1634,7 +1634,7 @@ namespace Animations
|
||||
ClientVisualElementContainer m_oVisualElement;
|
||||
};
|
||||
|
||||
struct TimeIterateDataAtom: public IRecord
|
||||
struct TimeIterateDataAtom: public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -1675,7 +1675,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeMotionBehaviorAtom : public IRecord
|
||||
struct TimeMotionBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1730,7 +1730,7 @@ namespace Animations
|
||||
DWORD m_nBehaviorOrigin;
|
||||
};
|
||||
|
||||
struct TimeMotionBehaviorContainer : public IRecord
|
||||
struct TimeMotionBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1784,7 +1784,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeSetBehaviorAtom : public IRecord
|
||||
struct TimeSetBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1817,7 +1817,7 @@ namespace Animations
|
||||
TimeAnimateBehaviorValueTypeEnum m_ValueType;
|
||||
};
|
||||
|
||||
struct TimeSetBehaviorContainer : public IRecord
|
||||
struct TimeSetBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1858,7 +1858,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeAnimateBehaviorAtom : public IRecord
|
||||
struct TimeAnimateBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1903,7 +1903,7 @@ namespace Animations
|
||||
TimeAnimateBehaviorValueTypeEnum m_ValueType;
|
||||
};
|
||||
|
||||
struct TimeAnimationValueAtom : public IRecord
|
||||
struct TimeAnimationValueAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -1958,7 +1958,7 @@ namespace Animations
|
||||
TimeVariantString m_VarFormula;
|
||||
};
|
||||
|
||||
struct TimeAnimationValueListContainer : public IRecord
|
||||
struct TimeAnimationValueListContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2004,7 +2004,7 @@ namespace Animations
|
||||
std::vector<TimeAnimationEntry> m_arrEntry;
|
||||
};
|
||||
|
||||
struct TimeAnimateBehaviorContainer : public IRecord
|
||||
struct TimeAnimateBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2069,7 +2069,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeRotationBehaviorAtom : public IRecord
|
||||
struct TimeRotationBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2106,7 +2106,7 @@ namespace Animations
|
||||
float fTo;
|
||||
DWORD rotationDirection; // 0 - rotate clockwise, 1 - rotate counter clockwise
|
||||
};
|
||||
struct TimeRotationBehaviorContainer : public IRecord
|
||||
struct TimeRotationBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2136,7 +2136,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeScaleBehaviorAtom : public IRecord
|
||||
struct TimeScaleBehaviorAtom : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2181,7 +2181,7 @@ namespace Animations
|
||||
bool fZoomContents;
|
||||
};
|
||||
|
||||
struct TimeScaleBehaviorContainer : public IRecord
|
||||
struct TimeScaleBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
@ -2237,7 +2237,7 @@ namespace Animations
|
||||
}
|
||||
};
|
||||
|
||||
struct TimeColorBehaviorAtom: public IRecord
|
||||
struct TimeColorBehaviorAtom: public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -2278,7 +2278,7 @@ namespace Animations
|
||||
TimeAnimateColor colorTo;
|
||||
};
|
||||
|
||||
struct TimeColorBehaviorContainer : public IRecord
|
||||
struct TimeColorBehaviorContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -2308,7 +2308,7 @@ namespace Animations
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
struct TimeModifierAtom : public IRecord
|
||||
struct TimeModifierAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
@ -2335,7 +2335,7 @@ namespace Animations
|
||||
float value;
|
||||
};
|
||||
|
||||
struct SlaveContainer : public IRecord
|
||||
struct SlaveContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -2464,7 +2464,7 @@ namespace Animations
|
||||
bool haveExtTimeContainer;
|
||||
};
|
||||
|
||||
struct ExtTimeNodeContainer : public IRecord
|
||||
struct ExtTimeNodeContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -2818,7 +2818,7 @@ namespace Animations
|
||||
bool haveBuildList;
|
||||
};
|
||||
|
||||
struct SlideTime10Atom : public IRecord
|
||||
struct SlideTime10Atom : public CUnknownRecord
|
||||
{
|
||||
static const DWORD RT_SlideTime10Atom = 0x2EEB;
|
||||
|
||||
@ -2853,7 +2853,7 @@ namespace Animations
|
||||
SYSTEMTIME m_SystemTime;
|
||||
};
|
||||
|
||||
struct SlideFlags10Atom : public IRecord
|
||||
struct SlideFlags10Atom : public CUnknownRecord
|
||||
{
|
||||
static const DWORD RT_SlideFlags10Atom = 0x2EEA;
|
||||
|
||||
@ -2885,7 +2885,7 @@ namespace Animations
|
||||
bool m_bOverrideMasterAnimation; // A bit that specifies whether the slide does not follow the animations on the main master slide or title master slide.
|
||||
};
|
||||
|
||||
struct HashCode10Atom : public IRecord
|
||||
struct HashCode10Atom : public CUnknownRecord
|
||||
{
|
||||
//static const DWORD RT_HashCodeAtom = 0x2B00;
|
||||
|
||||
@ -3756,7 +3756,7 @@ namespace Animations
|
||||
};
|
||||
}
|
||||
|
||||
struct PP10SlideBinaryTagExtension : public IRecord
|
||||
struct PP10SlideBinaryTagExtension : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -3824,7 +3824,7 @@ public:
|
||||
Animations::BuildListContainer* buildListContainer; // OPTIONAL
|
||||
};
|
||||
|
||||
struct SlideProgTagsContainer : public IRecord
|
||||
struct SlideProgTagsContainer : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@ -36,8 +36,6 @@ class CRecordCString : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
std::wstring m_strText;
|
||||
|
||||
public:
|
||||
|
||||
CRecordCString()
|
||||
{
|
||||
|
||||
@ -32,6 +32,35 @@
|
||||
#pragma once
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Crypt/Decryptor.h"
|
||||
|
||||
class CRecordEncryptedSummary : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
CRecordEncryptedSummary(){}
|
||||
~CRecordEncryptedSummary(){}
|
||||
|
||||
DWORD StreamOffset;
|
||||
DWORD StreamSize;
|
||||
unsigned short Block;
|
||||
unsigned char NameSize;
|
||||
bool fStream;
|
||||
std::wstring StreamName;
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
unsigned char flags;
|
||||
|
||||
*pStream >> StreamOffset >> StreamSize >> Block >> NameSize >> flags;
|
||||
|
||||
fStream = GETBIT(flags, 0);
|
||||
|
||||
if (NameSize > 0 && NameSize < 0xff)
|
||||
{
|
||||
StreamName = ReadStringW(pStream, NameSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
class CEncryptionHeader : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
@ -40,13 +69,8 @@ public:
|
||||
CRYPT::_ecmaCryptData crypt_data_aes;
|
||||
bool bStandard;
|
||||
|
||||
CEncryptionHeader()
|
||||
{
|
||||
}
|
||||
|
||||
~CEncryptionHeader()
|
||||
{
|
||||
}
|
||||
CEncryptionHeader(){}
|
||||
~CEncryptionHeader(){}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
@ -141,6 +165,8 @@ public:
|
||||
case 0x6801:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
if (crypt_data_aes.keySize == 0)
|
||||
crypt_data_aes.keySize = 5; // 40 bit
|
||||
break;
|
||||
case 0x660E:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
|
||||
@ -39,194 +39,198 @@
|
||||
|
||||
void CRecordOfficeArtBlip::ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
CMetaFileBuffer oMetaFile;
|
||||
if ((oHeader.RecVersion == PSFLAG_CONTAINER) || ((oHeader.RecVersion & 0x0F) == 0x0F)) return;
|
||||
|
||||
CRYPT::ECMADecryptor *pDecryptor = m_oDocumentInfo ? m_oDocumentInfo->m_arUsers[0]->m_pDecryptor : NULL;
|
||||
|
||||
CMetaFileBuffer oMetaFile;
|
||||
std::wstring sExt = L".jpg";
|
||||
int lOffset = 0;
|
||||
|
||||
int pos = pStream->tell();
|
||||
|
||||
if ((oHeader.RecVersion != PSFLAG_CONTAINER) && ((oHeader.RecVersion & 0x0F) != 0x0F))
|
||||
switch (oHeader.RecType)
|
||||
{
|
||||
int lOffset = 0;
|
||||
|
||||
switch (oHeader.RecType)
|
||||
case RECORD_TYPE_ESCHER_BLIP_EMF:
|
||||
{
|
||||
case RECORD_TYPE_ESCHER_BLIP_EMF:
|
||||
{
|
||||
if (0x03D4 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x03D5 == oHeader.RecInstance) lOffset = 32;
|
||||
if (0x03D4 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x03D5 == oHeader.RecInstance) lOffset = 32;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
lOffset += 34;
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
lOffset += 34;
|
||||
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".emf";
|
||||
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream);
|
||||
|
||||
Gdiplus::ENHMETAHEADER3 oEmfHeader;
|
||||
oMetaHeader.ToEMFHeader(&oEmfHeader);
|
||||
|
||||
oMetaFile.SetHeader(NULL, 0);
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_WMF:
|
||||
{
|
||||
if (0x0216 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x0217 == oHeader.RecInstance) lOffset = 32;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
lOffset += 34;
|
||||
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".wmf";
|
||||
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream);
|
||||
Gdiplus::WmfPlaceableFileHeader oWmfHeader;
|
||||
oMetaHeader.ToWMFHeader(&oWmfHeader);
|
||||
|
||||
LONG lLenHeader = 22;
|
||||
BYTE* pMetaHeader = new BYTE[lLenHeader]; // удалится в oMetaFile
|
||||
memcpy(pMetaHeader, (void*)(&oWmfHeader), lLenHeader);
|
||||
|
||||
oMetaFile.SetHeader(pMetaHeader, lLenHeader);
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_PICT://Medwoche.ppt , (483)
|
||||
{
|
||||
if (0x0542 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x0543 == oHeader.RecInstance) lOffset = 32;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
lOffset += 34;
|
||||
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".wmf";//L".pct"; - ВРЕМЕННО пока не сделана конвертация pct(pic) хоть во что нито !!!
|
||||
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream); //отдельно вынесенный заголовок.. "форматный" находится в блоке данных
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_JPEG:
|
||||
{
|
||||
if (0x046A == oHeader.RecInstance || 0x06E2 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x046B == oHeader.RecInstance || 0x06E3 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".jpg");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_PNG:
|
||||
{
|
||||
if (0x06E0 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x06E1 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".png");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_DIB:
|
||||
{
|
||||
if (0x07A8 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x07A9 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".emf";
|
||||
|
||||
sExt = _T(".bmp");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_TIFF:
|
||||
{
|
||||
if (0x06E4 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x06E5 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".tif");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
int nImagesCount = 0;
|
||||
if (m_oDocumentInfo)
|
||||
{
|
||||
nImagesCount = m_oDocumentInfo->m_mapStoreImageFile.size();
|
||||
}
|
||||
//else nImagesCount = generate uniq name
|
||||
|
||||
if (oMetaFile.m_bIsValid)
|
||||
{
|
||||
std::wstring strFile = L"Image " +std::to_wstring(nImagesCount + 1) + oMetaFile.m_sExtension;
|
||||
|
||||
CFile fileMeta;
|
||||
HRESULT hr = fileMeta.CreateFile(m_strMemoryForder + FILE_SEPARATOR_STR + strFile);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
oMetaFile.ToFile(&fileMeta);
|
||||
fileMeta.CloseFile();
|
||||
}
|
||||
m_sFileName = strFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pImage = new BYTE[oHeader.RecLen - lOffset];
|
||||
|
||||
pStream->read(pImage, oHeader.RecLen - lOffset);
|
||||
|
||||
std::wstring strFile = L"Image " + std::to_wstring(nImagesCount + 1) + sExt;
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream, pDecryptor);
|
||||
|
||||
CFile fileImage;
|
||||
HRESULT hr = fileImage.CreateFile(m_strMemoryForder + FILE_SEPARATOR_STR + strFile);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (RECORD_TYPE_ESCHER_BLIP_DIB == oHeader.RecType)
|
||||
{
|
||||
WORD vtType = 0x4D42;
|
||||
fileImage.WriteFile((void*)&vtType, 2);
|
||||
DWORD dwLen = oHeader.RecLen - lOffset;
|
||||
fileImage.WriteFile((void*)&dwLen, 4);
|
||||
DWORD dwRes = 0;
|
||||
fileImage.WriteFile((void*)&dwRes, 4);
|
||||
DWORD dwOffset = 2;
|
||||
fileImage.WriteFile((void*)&dwOffset, 4);
|
||||
}
|
||||
fileImage.WriteFile((void*)pImage, oHeader.RecLen - lOffset);
|
||||
fileImage.CloseFile();
|
||||
}
|
||||
if (pImage)delete[] pImage;
|
||||
pImage = NULL;
|
||||
Gdiplus::ENHMETAHEADER3 oEmfHeader;
|
||||
oMetaHeader.ToEMFHeader(&oEmfHeader);
|
||||
|
||||
m_sFileName = strFile;
|
||||
}
|
||||
int dwOffset = pos - 8;
|
||||
|
||||
if (m_oDocumentInfo)
|
||||
oMetaFile.SetHeader(NULL, 0);
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
if (pDecryptor)
|
||||
{
|
||||
pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
|
||||
}
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_WMF:
|
||||
{
|
||||
m_oDocumentInfo->m_mapStoreImageFile[dwOffset ] = m_sFileName;
|
||||
if (0x0216 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x0217 == oHeader.RecInstance) lOffset = 32;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
lOffset += 34;
|
||||
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".wmf";
|
||||
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream, pDecryptor);
|
||||
|
||||
Gdiplus::WmfPlaceableFileHeader oWmfHeader;
|
||||
oMetaHeader.ToWMFHeader(&oWmfHeader);
|
||||
|
||||
LONG lLenHeader = 22;
|
||||
BYTE* pMetaHeader = new BYTE[lLenHeader]; // удалится в oMetaFile
|
||||
memcpy(pMetaHeader, (void*)(&oWmfHeader), lLenHeader);
|
||||
|
||||
oMetaFile.SetHeader(pMetaHeader, lLenHeader);
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
if (pDecryptor)
|
||||
{
|
||||
pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
|
||||
}
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_PICT://Medwoche.ppt , (483)
|
||||
{
|
||||
if (0x0542 == oHeader.RecInstance) lOffset = 16;
|
||||
else if (0x0543 == oHeader.RecInstance) lOffset = 32;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
lOffset += 34;
|
||||
|
||||
oMetaFile.m_bIsValid = TRUE;
|
||||
oMetaFile.m_sExtension = L".wmf";//L".pct"; - ВРЕМЕННО пока не сделана конвертация pct(pic) хоть во что нито !!!
|
||||
|
||||
CMetaHeader oMetaHeader;
|
||||
oMetaHeader.FromStream(pStream, pDecryptor); //отдельно вынесенный заголовок.. "форматный" находится в блоке данных
|
||||
|
||||
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
|
||||
pStream->read(pData, oHeader.RecLen - lOffset);
|
||||
if (pDecryptor)
|
||||
{
|
||||
pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
|
||||
}
|
||||
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
|
||||
}break;
|
||||
case RECORD_TYPE_ESCHER_BLIP_JPEG:
|
||||
{
|
||||
if (0x046A == oHeader.RecInstance || 0x06E2 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x046B == oHeader.RecInstance || 0x06E3 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".jpg");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_PNG:
|
||||
{
|
||||
if (0x06E0 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x06E1 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".png");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_DIB:
|
||||
{
|
||||
if (0x07A8 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x07A9 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".bmp");
|
||||
break;
|
||||
}
|
||||
case RECORD_TYPE_ESCHER_BLIP_TIFF:
|
||||
{
|
||||
if (0x06E4 == oHeader.RecInstance) lOffset = 17;
|
||||
else if (0x06E5 == oHeader.RecInstance) lOffset = 33;
|
||||
|
||||
StreamUtils::StreamSkip(lOffset, pStream);
|
||||
|
||||
sExt = _T(".tif");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
int nImagesCount = 0;
|
||||
if (m_oDocumentInfo)
|
||||
{
|
||||
nImagesCount = m_oDocumentInfo->m_mapStoreImageFile.size();
|
||||
}
|
||||
//else nImagesCount = generate uniq name
|
||||
|
||||
if (oMetaFile.m_bIsValid)
|
||||
{
|
||||
std::wstring strFile = L"Image " +std::to_wstring(nImagesCount + 1) + oMetaFile.m_sExtension;
|
||||
|
||||
CFile fileMeta;
|
||||
HRESULT hr = fileMeta.CreateFile(m_strTmpDirectory + FILE_SEPARATOR_STR + strFile);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
oMetaFile.ToFile(&fileMeta);
|
||||
fileMeta.CloseFile();
|
||||
}
|
||||
m_sFileName = strFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pImage = new BYTE[oHeader.RecLen - lOffset];
|
||||
|
||||
pStream->read(pImage, oHeader.RecLen - lOffset);
|
||||
if (pDecryptor)
|
||||
{
|
||||
pDecryptor->Decrypt((char*)pImage, oHeader.RecLen - lOffset, 0);
|
||||
}
|
||||
std::wstring strFile = L"Image " + std::to_wstring(nImagesCount + 1) + sExt;
|
||||
|
||||
CFile fileImage;
|
||||
HRESULT hr = fileImage.CreateFile(m_strTmpDirectory + FILE_SEPARATOR_STR + strFile);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (RECORD_TYPE_ESCHER_BLIP_DIB == oHeader.RecType)
|
||||
{
|
||||
WORD vtType = 0x4D42;
|
||||
fileImage.WriteFile((void*)&vtType, 2);
|
||||
DWORD dwLen = oHeader.RecLen - lOffset;
|
||||
fileImage.WriteFile((void*)&dwLen, 4);
|
||||
DWORD dwRes = 0;
|
||||
fileImage.WriteFile((void*)&dwRes, 4);
|
||||
DWORD dwOffset = 2;
|
||||
fileImage.WriteFile((void*)&dwOffset, 4);
|
||||
}
|
||||
fileImage.WriteFile((void*)pImage, oHeader.RecLen - lOffset);
|
||||
fileImage.CloseFile();
|
||||
}
|
||||
if (pImage)delete[] pImage;
|
||||
pImage = NULL;
|
||||
|
||||
m_sFileName = strFile;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
CPPTDocumentInfo * m_oDocumentInfo;
|
||||
|
||||
std::wstring m_sFileName;
|
||||
std::wstring m_strMemoryForder;
|
||||
std::wstring m_strTmpDirectory;
|
||||
|
||||
CRecordOfficeArtBlip()
|
||||
{
|
||||
|
||||
@ -486,6 +486,10 @@
|
||||
RelativePath="..\Reader\PPTFileDefines.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Reader\PPTFileReader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Reader\PPTFileReader.h"
|
||||
>
|
||||
|
||||
@ -109,15 +109,14 @@ namespace NSPresentationEditor
|
||||
class CExMedia
|
||||
{
|
||||
public:
|
||||
std::wstring m_strPresentationDirectory;
|
||||
std::wstring m_strSourceDirectory;
|
||||
std::wstring m_strPresentationDirectory;
|
||||
|
||||
std::vector<CExFilesInfo> m_arVideos;
|
||||
std::vector<CExFilesInfo> m_arImages;
|
||||
std::vector<CExFilesInfo> m_arAudios;
|
||||
std::vector<CExFilesInfo> m_arHyperlinks;
|
||||
std::vector<CExFilesInfo> m_arVideos;
|
||||
std::vector<CExFilesInfo> m_arImages;
|
||||
std::vector<CExFilesInfo> m_arAudios;
|
||||
std::vector<CExFilesInfo> m_arHyperlinks;
|
||||
|
||||
std::vector<CExFilesInfo> m_arAudioCollection;
|
||||
std::vector<CExFilesInfo> m_arAudioCollection;
|
||||
|
||||
public:
|
||||
void Clear()
|
||||
@ -131,8 +130,6 @@ namespace NSPresentationEditor
|
||||
public:
|
||||
CExMedia() : m_arVideos(), m_arImages(), m_arAudios()
|
||||
{
|
||||
m_strPresentationDirectory = _T("");
|
||||
m_strSourceDirectory = _T("");
|
||||
}
|
||||
|
||||
CExMedia(const CExMedia& oSrc)
|
||||
@ -143,7 +140,6 @@ namespace NSPresentationEditor
|
||||
CExMedia& operator=(const CExMedia& oSrc)
|
||||
{
|
||||
m_strPresentationDirectory = oSrc.m_strPresentationDirectory;
|
||||
m_strSourceDirectory = oSrc.m_strSourceDirectory;
|
||||
|
||||
for (size_t i=0; i < oSrc.m_arVideos.size(); i++)
|
||||
m_arVideos.push_back(oSrc.m_arVideos[i]);
|
||||
|
||||
@ -165,23 +165,6 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// std::wstring ToString()
|
||||
// {
|
||||
// std::wstring str = _T("");
|
||||
// str.Format(_T("%d,%d,%d,%d"), (long)m_ePID, (long)m_bIsBlip, (long)m_bComplex, (long)m_lValue);
|
||||
// // не будем ничего писать - а то xml - не распознаются
|
||||
// /*if (m_bComplex)
|
||||
// {
|
||||
// std::wstring strProp = CDirectory::BYTEArrayToString(m_pOptions, m_lValue);
|
||||
// if (NSOfficeDrawing::pibName == m_ePID)
|
||||
// {
|
||||
// strProp = (std::wstring)CDirectory::BYTEArrayToStringW(m_pOptions, m_lValue);
|
||||
// }
|
||||
// str += _T(" options=") + strProp;
|
||||
// }*/
|
||||
// return _T("<Property command='") + str + _T("'/>");
|
||||
// }
|
||||
};
|
||||
|
||||
// А вот контейнер пропертей
|
||||
|
||||
@ -96,9 +96,8 @@ public:
|
||||
void appendDelayedItems(const ReceiverItems& receiver_items_from_record, const SourceItems& source_items_from_record);
|
||||
void applyDelayedItems();
|
||||
|
||||
|
||||
POLE::Stream *stream_;
|
||||
private:
|
||||
POLE::Stream * stream_;
|
||||
CFStream::ReceiverItems receiver_items;
|
||||
CFStream::SourceItems source_items;
|
||||
};
|
||||
|
||||
@ -107,14 +107,14 @@ namespace OOX
|
||||
pItem = new Logic::CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new Logic::CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oReader );
|
||||
pItem = new Logic::CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new Logic::CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -267,14 +267,14 @@ namespace OOX
|
||||
pItem = new Logic::CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new Logic::CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oReader );
|
||||
pItem = new Logic::CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new Logic::CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
@ -414,9 +414,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oItem );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oItem );
|
||||
pItem = new Logic::CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
|
||||
@ -139,9 +139,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oItem );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oItem );
|
||||
pItem = new Logic::CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -224,14 +224,14 @@ namespace OOX
|
||||
pItem = new Logic::CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new Logic::CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oReader );
|
||||
pItem = new Logic::CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new Logic::CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -153,14 +153,14 @@ namespace OOX
|
||||
pItem = new Logic::CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new Logic::CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oReader );
|
||||
pItem = new Logic::CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new Logic::CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
@ -243,9 +243,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new Logic::CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new Logic::CMoveToRangeEnd( oItem );
|
||||
pItem = new Logic::CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new Logic::CMoveToRangeStart( oItem );
|
||||
pItem = new Logic::CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new Logic::CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
|
||||
@ -44,8 +44,6 @@
|
||||
|
||||
// TO DO: Нехватающие классы:
|
||||
// <w:customXml>
|
||||
// <w:moveFrom>
|
||||
// <w:moveTo>
|
||||
// <w:subDoc>
|
||||
|
||||
|
||||
@ -53,6 +51,198 @@ namespace OOX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
void CMoveFrom::fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
void CMoveFrom::fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nParentDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nParentDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
WritingElement *pItem = NULL;
|
||||
|
||||
if ( _T("w:bdo") == sName )
|
||||
pItem = new CBdo( oReader );
|
||||
else if ( _T("w:bookmarkEnd") == sName )
|
||||
pItem = new CBookmarkEnd( oReader );
|
||||
else if ( _T("w:bookmarkStart") == sName )
|
||||
pItem = new CBookmarkStart( oReader );
|
||||
else if ( _T("w:commentRangeEnd") == sName )
|
||||
pItem = new CCommentRangeEnd( oReader );
|
||||
else if ( _T("w:commentRangeStart") == sName )
|
||||
pItem = new CCommentRangeStart( oReader );
|
||||
//else if ( _T("w:customXml") == sName )
|
||||
// pItem = new CCustomXml( oReader );
|
||||
else if ( _T("w:customXmlDelRangeEnd") == sName )
|
||||
pItem = new CCustomXmlDelRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlDelRangeStart") == sName )
|
||||
pItem = new CCustomXmlDelRangeStart( oReader );
|
||||
else if ( _T("w:customXmlInsRangeEnd") == sName )
|
||||
pItem = new CCustomXmlInsRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlInsRangeStart") == sName )
|
||||
pItem = new CCustomXmlInsRangeStart( oReader );
|
||||
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
|
||||
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
|
||||
pItem = new CCustomXmlMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
|
||||
pItem = new CCustomXmlMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlMoveToRangeStart") == sName )
|
||||
pItem = new CCustomXmlMoveToRangeStart( oReader );
|
||||
else if ( _T("w:del") == sName )
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:dir") == sName )
|
||||
pItem = new CDir( oReader );
|
||||
else if ( _T("w:fldSimple") == sName )
|
||||
pItem = new CFldSimple( oReader );
|
||||
else if ( _T("w:hyperlink") == sName )
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
else if ( _T("m:oMath") == sName )
|
||||
pItem = new COMath( oReader );
|
||||
else if ( _T("m:oMathPara") == sName )
|
||||
pItem = new COMathPara( oReader );
|
||||
else if ( _T("w:permEnd") == sName )
|
||||
pItem = new CPermEnd( oReader );
|
||||
else if ( _T("w:permStart") == sName )
|
||||
pItem = new CPermStart( oReader );
|
||||
else if ( _T("w:proofErr") == sName )
|
||||
pItem = new CProofErr( oReader );
|
||||
else if ( _T("w:r") == sName )
|
||||
pItem = new CRun( oReader );
|
||||
else if ( _T("w:sdt") == sName )
|
||||
pItem = new CSdt( oReader );
|
||||
else if ( _T("w:smartTag") == sName )
|
||||
pItem = new CSmartTag( oReader );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oReader );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
}
|
||||
}
|
||||
std::wstring CMoveFrom::toXML() const
|
||||
{
|
||||
//todo
|
||||
std::wstring sResult = _T("");
|
||||
return sResult;
|
||||
}
|
||||
void CMoveTo::fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
void CMoveTo::fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nParentDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nParentDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
WritingElement *pItem = NULL;
|
||||
|
||||
if ( _T("w:bdo") == sName )
|
||||
pItem = new CBdo( oReader );
|
||||
else if ( _T("w:bookmarkEnd") == sName )
|
||||
pItem = new CBookmarkEnd( oReader );
|
||||
else if ( _T("w:bookmarkStart") == sName )
|
||||
pItem = new CBookmarkStart( oReader );
|
||||
else if ( _T("w:commentRangeEnd") == sName )
|
||||
pItem = new CCommentRangeEnd( oReader );
|
||||
else if ( _T("w:commentRangeStart") == sName )
|
||||
pItem = new CCommentRangeStart( oReader );
|
||||
//else if ( _T("w:customXml") == sName )
|
||||
// pItem = new CCustomXml( oReader );
|
||||
else if ( _T("w:customXmlDelRangeEnd") == sName )
|
||||
pItem = new CCustomXmlDelRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlDelRangeStart") == sName )
|
||||
pItem = new CCustomXmlDelRangeStart( oReader );
|
||||
else if ( _T("w:customXmlInsRangeEnd") == sName )
|
||||
pItem = new CCustomXmlInsRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlInsRangeStart") == sName )
|
||||
pItem = new CCustomXmlInsRangeStart( oReader );
|
||||
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
|
||||
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
|
||||
pItem = new CCustomXmlMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
|
||||
pItem = new CCustomXmlMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:customXmlMoveToRangeStart") == sName )
|
||||
pItem = new CCustomXmlMoveToRangeStart( oReader );
|
||||
else if ( _T("w:del") == sName )
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:dir") == sName )
|
||||
pItem = new CDir( oReader );
|
||||
else if ( _T("w:fldSimple") == sName )
|
||||
pItem = new CFldSimple( oReader );
|
||||
else if ( _T("w:hyperlink") == sName )
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
else if ( _T("m:oMath") == sName )
|
||||
pItem = new COMath( oReader );
|
||||
else if ( _T("m:oMathPara") == sName )
|
||||
pItem = new COMathPara( oReader );
|
||||
else if ( _T("w:permEnd") == sName )
|
||||
pItem = new CPermEnd( oReader );
|
||||
else if ( _T("w:permStart") == sName )
|
||||
pItem = new CPermStart( oReader );
|
||||
else if ( _T("w:proofErr") == sName )
|
||||
pItem = new CProofErr( oReader );
|
||||
else if ( _T("w:r") == sName )
|
||||
pItem = new CRun( oReader );
|
||||
else if ( _T("w:sdt") == sName )
|
||||
pItem = new CSdt( oReader );
|
||||
else if ( _T("w:smartTag") == sName )
|
||||
pItem = new CSmartTag( oReader );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oReader );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
}
|
||||
}
|
||||
std::wstring CMoveTo::toXML() const
|
||||
{
|
||||
//todo
|
||||
std::wstring sResult = _T("");
|
||||
return sResult;
|
||||
}
|
||||
void CIns::fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
//todo
|
||||
@ -108,14 +298,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
@ -204,14 +394,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -871,7 +871,7 @@ namespace OOX
|
||||
if ( m_sAuthor.IsInit() )
|
||||
{
|
||||
sResult += _T("w:author=\"");
|
||||
sResult += m_sAuthor.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sAuthor.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
@ -884,14 +884,14 @@ namespace OOX
|
||||
if ( m_sName.IsInit() )
|
||||
{
|
||||
sResult += _T("w:name=\"");
|
||||
sResult += m_sName.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sName.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
if ( m_sUserId.IsInit() )
|
||||
{
|
||||
sResult += _T("oouserid=\"");
|
||||
sResult += m_sUserId.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sUserId.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
@ -917,7 +917,7 @@ namespace OOX
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:displacedbyCustomXml"), m_oDisplacedByCustomXml )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:name"), m_sName )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserisd"), m_sUserId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
|
||||
@ -1032,7 +1032,7 @@ namespace OOX
|
||||
if ( m_sAuthor.IsInit() )
|
||||
{
|
||||
sResult += _T("w:author=\"");
|
||||
sResult += m_sAuthor.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sAuthor.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
@ -1045,14 +1045,14 @@ namespace OOX
|
||||
if ( m_sName.IsInit() )
|
||||
{
|
||||
sResult += _T("w:name=\"");
|
||||
sResult += m_sName.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sName.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
if ( m_sUserId.IsInit() )
|
||||
{
|
||||
sResult += _T("oouserid=\"");
|
||||
sResult += m_sUserId.get2();
|
||||
sResult += XmlUtils::EncodeXmlString(m_sUserId.get2());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
@ -1094,6 +1094,137 @@ namespace OOX
|
||||
nullable<std::wstring > m_sUserId;
|
||||
};
|
||||
|
||||
class CMoveFrom : public WritingElementWithChilds<>
|
||||
{
|
||||
public:
|
||||
CMoveFrom()
|
||||
{
|
||||
}
|
||||
CMoveFrom(XmlUtils::CXmlNode &oNode)
|
||||
{
|
||||
fromXML( oNode );
|
||||
}
|
||||
CMoveFrom(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
fromXML( oReader );
|
||||
}
|
||||
virtual ~CMoveFrom()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void Clear()
|
||||
{
|
||||
for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ )
|
||||
{
|
||||
if ( m_arrItems[nIndex] )
|
||||
delete m_arrItems[nIndex];
|
||||
|
||||
m_arrItems[nIndex] = NULL;
|
||||
}
|
||||
|
||||
m_arrItems.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode);
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
|
||||
virtual std::wstring toXML() const;
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_w_moveFrom;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
// Читаем атрибуты
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if( oReader, _T("w:author"), m_sAuthor )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Attributes
|
||||
nullable<std::wstring > m_sAuthor;
|
||||
nullable<SimpleTypes::CDateTime > m_oDate;
|
||||
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
|
||||
nullable<std::wstring > m_sUserId;
|
||||
|
||||
// Childs
|
||||
};
|
||||
|
||||
class CMoveTo : public WritingElementWithChilds<>
|
||||
{
|
||||
public:
|
||||
CMoveTo()
|
||||
{
|
||||
}
|
||||
CMoveTo(XmlUtils::CXmlNode &oNode)
|
||||
{
|
||||
fromXML( oNode );
|
||||
}
|
||||
CMoveTo(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
fromXML( oReader );
|
||||
}
|
||||
virtual ~CMoveTo()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void Clear()
|
||||
{
|
||||
for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ )
|
||||
{
|
||||
if ( m_arrItems[nIndex] )
|
||||
delete m_arrItems[nIndex];
|
||||
|
||||
m_arrItems[nIndex] = NULL;
|
||||
}
|
||||
|
||||
m_arrItems.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode);
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
|
||||
virtual std::wstring toXML() const;
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_w_moveTo;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
// Читаем атрибуты
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if( oReader, _T("w:author"), m_sAuthor )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Attributes
|
||||
nullable<std::wstring > m_sAuthor;
|
||||
nullable<SimpleTypes::CDateTime > m_oDate;
|
||||
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
|
||||
nullable<std::wstring > m_sUserId;
|
||||
|
||||
// Childs
|
||||
};
|
||||
} // Logic
|
||||
// Bookmarks 17.13.6
|
||||
namespace Logic
|
||||
|
||||
@ -112,9 +112,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -199,14 +199,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -102,14 +102,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -115,9 +115,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -204,14 +204,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -120,9 +120,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -207,14 +207,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -120,9 +120,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -213,14 +213,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -205,6 +205,10 @@ namespace OOX
|
||||
m_oNoProof = oReader;
|
||||
else if ( _T("m:oMath") == sName )
|
||||
m_oMath = oReader;
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
m_oMoveFrom = oReader;
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
m_oMoveTo = oReader;
|
||||
else if ( _T("w:outline") == sName )
|
||||
m_oOutline = oReader;
|
||||
else if ( _T("w:position") == sName )
|
||||
|
||||
@ -902,6 +902,12 @@ namespace OOX
|
||||
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 std::wstring toXML() const
|
||||
@ -1062,6 +1068,20 @@ namespace OOX
|
||||
sResult += _T("/>");
|
||||
}
|
||||
|
||||
if ( m_oMoveFrom.IsInit() )
|
||||
{
|
||||
sResult += _T("<w:moveFrom ");
|
||||
sResult += m_oMoveFrom->ToString();
|
||||
sResult += _T("/>");
|
||||
}
|
||||
|
||||
if ( m_oMoveTo.IsInit() )
|
||||
{
|
||||
sResult += _T("<w:moveTo ");
|
||||
sResult += m_oMoveTo->ToString();
|
||||
sResult += _T("/>");
|
||||
}
|
||||
|
||||
if ( m_oOutline.IsInit() )
|
||||
{
|
||||
sResult += _T("<w:outline ");
|
||||
@ -1236,6 +1256,8 @@ namespace OOX
|
||||
oProperties.m_oLang = Merge( oPrev.m_oLang, oCurrent.m_oLang );
|
||||
oProperties.m_oNoProof = Merge( oPrev.m_oNoProof, oCurrent.m_oNoProof );
|
||||
oProperties.m_oMath = Merge( oPrev.m_oMath, oCurrent.m_oMath );
|
||||
oProperties.m_oMoveFrom = Merge( oPrev.m_oMoveFrom, oCurrent.m_oMoveFrom );
|
||||
oProperties.m_oMoveTo = Merge( oPrev.m_oMoveTo, oCurrent.m_oMoveTo );
|
||||
oProperties.m_oOutline = Merge( oPrev.m_oOutline, oCurrent.m_oOutline );
|
||||
oProperties.m_oPosition = Merge( oPrev.m_oPosition, oCurrent.m_oPosition );
|
||||
oProperties.m_oRFonts = Merge( oPrev.m_oRFonts, oCurrent.m_oRFonts );
|
||||
@ -1340,6 +1362,12 @@ namespace OOX
|
||||
if ( m_oMath.IsInit() )
|
||||
return false;
|
||||
|
||||
if ( m_oMoveFrom.IsInit() )
|
||||
return false;
|
||||
|
||||
if ( m_oMoveTo.IsInit() )
|
||||
return false;
|
||||
|
||||
if ( m_oOutline.IsInit() )
|
||||
return false;
|
||||
|
||||
@ -1427,6 +1455,8 @@ namespace OOX
|
||||
nullable<ComplexTypes::Word::CLanguage > m_oLang;
|
||||
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oNoProof;
|
||||
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oMath;
|
||||
nullable<ComplexTypes::Word::CTrackChange > m_oMoveFrom;
|
||||
nullable<ComplexTypes::Word::CTrackChange > m_oMoveTo;
|
||||
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oOutline;
|
||||
nullable<ComplexTypes::Word::CSignedHpsMeasure > m_oPosition;
|
||||
nullable<ComplexTypes::Word::CFonts > m_oRFonts;
|
||||
|
||||
@ -114,9 +114,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -208,14 +208,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -116,9 +116,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -203,14 +203,14 @@ namespace OOX
|
||||
pItem = new CHyperlink( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -307,9 +307,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -386,14 +386,14 @@ namespace OOX
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
@ -511,9 +511,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -611,14 +611,14 @@ namespace OOX
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
@ -762,9 +762,9 @@ namespace OOX
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oItem );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oItem );
|
||||
pItem = new CMoveFromRangeEnd( oItem );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oItem );
|
||||
pItem = new CMoveFromRangeStart( oItem );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oItem );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
@ -845,14 +845,14 @@ namespace OOX
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -107,14 +107,14 @@ namespace OOX
|
||||
pItem = new CDel( oReader );
|
||||
else if ( _T("w:ins") == sName )
|
||||
pItem = new CIns( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
pItem = new CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new CMoveToRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
pItem = new CMoveFromRangeStart( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -128,14 +128,14 @@ namespace OOX
|
||||
pItem = new OOX::Logic::CLimUpp( oReader );
|
||||
else if ( _T("m:m") == sName )
|
||||
pItem = new OOX::Logic::CMatrix( oReader );
|
||||
//else if ( _T("w:moveFrom") == sName )
|
||||
// pItem = new OOX::Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFrom") == sName )
|
||||
pItem = new OOX::Logic::CMoveFrom( oReader );
|
||||
else if ( _T("w:moveFromRangeEnd") == sName )
|
||||
pItem = new OOX::Logic::CMoveFromRangeEnd( oReader );
|
||||
else if ( _T("w:moveFromRangeStart") == sName )
|
||||
pItem = new OOX::Logic::CMoveFromRangeStart( oReader );
|
||||
//else if ( _T("w:moveTo") == sName )
|
||||
// pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveTo") == sName )
|
||||
pItem = new CMoveTo( oReader );
|
||||
else if ( _T("w:moveToRangeEnd") == sName )
|
||||
pItem = new OOX::Logic::CMoveToRangeEnd( oReader );
|
||||
else if ( _T("w:moveToRangeStart") == sName )
|
||||
|
||||
@ -695,6 +695,8 @@ namespace OOX
|
||||
et_w_lvlOverride, // <w:lvlOverride>
|
||||
et_w_monthLong, // <w:monthLong>
|
||||
et_w_monthShort, // <w:monthShort>
|
||||
et_w_moveFrom, // <w:moveFrom>
|
||||
et_w_moveTo, // <w:moveTo>
|
||||
et_w_moveFromRangeEnd, // <w:moveFromRangeEnd>
|
||||
et_w_moveFromRangeStart, // <w:moveFromRangeStart>
|
||||
et_w_moveToRangeEnd, // <w:moveToRangeEnd>
|
||||
|
||||
@ -163,8 +163,9 @@ namespace OOX
|
||||
if (!m_pStyles->m_oDxfs.IsInit())
|
||||
m_pStyles->m_oDxfs.Init();
|
||||
|
||||
m_pStyles->m_oDxfs->m_arrItems.push_back(rule->m_oDxf.GetPointerEmptyNullable());
|
||||
//DxfId starts from 0
|
||||
rule->m_oDxfId = std::to_wstring(m_pStyles->m_oDxfs->m_arrItems.size());
|
||||
m_pStyles->m_oDxfs->m_arrItems.push_back(rule->m_oDxf.GetPointerEmptyNullable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,6 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h"
|
||||
|
||||
static const unsigned char encrVerifierHashInputBlockKey[8] = { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79 };
|
||||
static const unsigned char encrVerifierHashValueBlockKey[8] = { 0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 0x34, 0x4e };
|
||||
@ -381,8 +380,8 @@ bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYP
|
||||
|
||||
return true;
|
||||
}
|
||||
ARC4::Decryption rc4Decryption;
|
||||
//CipherARCFOUR rc4Decryption;
|
||||
|
||||
ARC4::Decryption rc4Decryption; // todooo -> in impl
|
||||
|
||||
bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYPT_METHOD::_cipherAlgorithm algorithm,
|
||||
StreamTransformationFilter::BlockPaddingScheme padding = StreamTransformationFilter::NO_PADDING)
|
||||
@ -398,7 +397,6 @@ bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRY
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
//rc4Decryption.Decode(data_inp.ptr, data_inp.size, data_out.ptr, data_out.size);
|
||||
rc4Decryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
|
||||
}
|
||||
else //AES
|
||||
@ -485,8 +483,9 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
|
||||
CorrectHashSize(verifierKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(verifierKey.ptr, verifierKey.size);
|
||||
|
||||
}
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes;
|
||||
DecryptCipher(verifierKey, pSalt, pEncVerInput, decryptedVerifierHashInputBytes, cryptData.cipherAlgorithm);
|
||||
@ -512,12 +511,12 @@ void ECMADecryptor::SetCryptData(_ecmaCryptData & data)
|
||||
{
|
||||
cryptData = data;
|
||||
}
|
||||
void ECMADecryptor::Decrypt(char* data , const size_t size, const unsigned long stream_pos)
|
||||
void ECMADecryptor::Decrypt(char* data , const size_t size, const unsigned long start_iv_block)
|
||||
{
|
||||
if (bVerify)
|
||||
{
|
||||
unsigned char* data_out = NULL;
|
||||
Decrypt((unsigned char*)data, size, data_out);
|
||||
Decrypt((unsigned char*)data, size, data_out, start_iv_block);
|
||||
|
||||
if (data_out)
|
||||
{
|
||||
@ -565,19 +564,14 @@ bool ECMADecryptor::CheckDataIntegrity(unsigned char* data, int size)
|
||||
|
||||
return (hmac == expected);
|
||||
}
|
||||
void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned char*& data_out)
|
||||
void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*& data_out, int start_iv_block)
|
||||
{
|
||||
data_out = NULL;
|
||||
data_out = new unsigned char[size];
|
||||
|
||||
_buf pPassword (password);
|
||||
_buf pSalt (cryptData.saltValue);
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
int size = data_size - 8;
|
||||
unsigned char* data_inp = data_ptr + 8;
|
||||
|
||||
data_out = new unsigned char[size];
|
||||
|
||||
if (cryptData.bAgile)
|
||||
{
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
@ -592,7 +586,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned ch
|
||||
_buf iv(cryptData.blockSize);
|
||||
memset( iv.ptr, 0x00, cryptData.blockSize );
|
||||
|
||||
int i = 0, sz = 4096, pos = 0;
|
||||
int i = start_iv_block, sz = 4096, pos = 0;//aes block size = 4096
|
||||
|
||||
while (pos < size)
|
||||
{
|
||||
@ -611,62 +605,24 @@ void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned ch
|
||||
|
||||
pos += sz; i++;
|
||||
}
|
||||
//--------------------------------------------
|
||||
_buf pEncVerKeyMac (cryptData.encryptedHmacKey);
|
||||
_buf pEncVerValueMac (cryptData.encryptedHmacValue);
|
||||
|
||||
_buf iv1(cryptData.blockSize);
|
||||
memset( iv1.ptr, 0x00, cryptData.blockSize );
|
||||
|
||||
i = 0;
|
||||
_buf pIndex1((unsigned char*)&i, 4);
|
||||
iv1 = HashAppend(pDataSalt, pIndex1, cryptData.hashAlgorithm);
|
||||
|
||||
CorrectHashSize(iv1, cryptData.blockSize, 0x36);
|
||||
|
||||
_buf pOut1(pEncVerKeyMac.size);
|
||||
_buf pOut2(pEncVerValueMac.size);
|
||||
|
||||
DecryptCipher(pDecryptedKey, iv, pEncVerKeyMac, pOut1, cryptData.cipherAlgorithm);
|
||||
DecryptCipher(pDecryptedKey, iv, pEncVerValueMac, pOut2, cryptData.cipherAlgorithm);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm, start_iv_block);
|
||||
CorrectHashSize(hashKey, cryptData.keySize, 0);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
int i = 0, sz = 512, pos = 0;
|
||||
|
||||
while (pos < size)
|
||||
{
|
||||
if (pos + sz > size)
|
||||
sz = size - pos;
|
||||
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm, i);
|
||||
CorrectHashSize(hashKey, cryptData.keySize, 0);
|
||||
if (cryptData.keySize == 5)
|
||||
CorrectHashSize(hashKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
|
||||
_buf pInp(data_inp + pos, sz, false);
|
||||
_buf pOut(data_out + pos, sz, false);
|
||||
|
||||
DecryptCipher(empty, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
|
||||
pos += sz; i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
CorrectHashSize(hashKey, cryptData.keySize, 0);
|
||||
if (cryptData.keySize == 5)
|
||||
CorrectHashSize(hashKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
_buf pInp(data_inp, size, false);
|
||||
_buf pOut(data_out, size, false);
|
||||
|
||||
DecryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
}
|
||||
|
||||
_buf pInp(data_inp, size, false);
|
||||
_buf pOut(data_out, size, false);
|
||||
|
||||
DecryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -128,9 +128,9 @@ public:
|
||||
ECMADecryptor();
|
||||
virtual ~ECMADecryptor();
|
||||
|
||||
void Decrypt (unsigned char* data, int size, unsigned char*& data_out);
|
||||
void Decrypt (unsigned char* data, int size, unsigned char*& data_out, int start_iv_block = 0);
|
||||
|
||||
virtual void Decrypt (char* data, const size_t size, const unsigned long stream_pos);
|
||||
virtual void Decrypt (char* data, const size_t size, const unsigned long start_iv_block);
|
||||
virtual bool SetPassword (std::wstring password);
|
||||
virtual bool IsVerify();
|
||||
|
||||
|
||||
@ -713,10 +713,11 @@ bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
unsigned char* data_out = NULL;
|
||||
|
||||
int readTrue = pStream->read(data, lengthRead);
|
||||
int readData = readTrue - 8;
|
||||
|
||||
lengthData = *((_UINT64*)data);
|
||||
|
||||
decryptor.Decrypt(data, readTrue, data_out);//todoo сделать покусочное чтение декриптование
|
||||
decryptor.Decrypt(data + 8, readData, data_out);//todoo сделать покусочное чтение декриптование
|
||||
|
||||
if (data_out)
|
||||
{
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
6967AFB11E2793A500A129E2 /* cextracttools.h in Headers */ = {isa = PBXBuildFile; fileRef = 6967AFAF1E2793A500A129E2 /* cextracttools.h */; };
|
||||
6967AFB51E27940600A129E2 /* ASCConverters.h in Headers */ = {isa = PBXBuildFile; fileRef = 6967AFB31E27940600A129E2 /* ASCConverters.h */; };
|
||||
6967AFDF1E279B3600A129E2 /* libTxtXmlFormatLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6967AFDC1E279B2300A129E2 /* libTxtXmlFormatLib.a */; };
|
||||
6967B0B31E27A07100A129E2 /* libPPTFormatLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6967B0961E27A03800A129E2 /* libPPTFormatLib.a */; };
|
||||
6967B0D41E27A36E00A129E2 /* libHtmlFile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6967B0D11E27A35F00A129E2 /* libHtmlFile.a */; };
|
||||
6967B10A1E27A41B00A129E2 /* libPdfWriter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6967B1091E27A41400A129E2 /* libPdfWriter.a */; };
|
||||
6967B10F1E27A65600A129E2 /* OfficeFileFormatChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 6967B10D1E27A65600A129E2 /* OfficeFileFormatChecker.h */; };
|
||||
@ -242,20 +241,6 @@
|
||||
remoteGlobalIDString = 6967AFBE1E2798B900A129E2;
|
||||
remoteInfo = TxtXmlFormatLib;
|
||||
};
|
||||
6967B0951E27A03800A129E2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 6967B0911E27A03800A129E2 /* PPTFormatLib.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 6967AFFB1E279D3900A129E2;
|
||||
remoteInfo = PPTFormatLib;
|
||||
};
|
||||
6967B0B01E27A06900A129E2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 6967B0911E27A03800A129E2 /* PPTFormatLib.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 6967AFFA1E279D3900A129E2;
|
||||
remoteInfo = PPTFormatLib;
|
||||
};
|
||||
6967B0D01E27A35F00A129E2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 6967B0CC1E27A35E00A129E2 /* HtmlFile.xcodeproj */;
|
||||
@ -474,7 +459,6 @@
|
||||
6967AFAF1E2793A500A129E2 /* cextracttools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cextracttools.h; path = ../../../../src/cextracttools.h; sourceTree = "<group>"; };
|
||||
6967AFB31E27940600A129E2 /* ASCConverters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASCConverters.h; path = ../../../../src/ASCConverters.h; sourceTree = "<group>"; };
|
||||
6967AFD71E279B2300A129E2 /* TxtXmlFormatLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TxtXmlFormatLib.xcodeproj; path = ../../../../ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj; sourceTree = "<group>"; };
|
||||
6967B0911E27A03800A129E2 /* PPTFormatLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PPTFormatLib.xcodeproj; path = ../../../../ASCOfficePPTFile/PPTFormatLib/Mac/PPTFormatLib.xcodeproj; sourceTree = "<group>"; };
|
||||
6967B0CC1E27A35E00A129E2 /* HtmlFile.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = HtmlFile.xcodeproj; path = ../../../../HtmlFile/Mac/HtmlFile/HtmlFile.xcodeproj; sourceTree = "<group>"; };
|
||||
6967B1031E27A41300A129E2 /* PdfWriter.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PdfWriter.xcodeproj; path = ../../../../DesktopEditor/ios_projects/PdfWriter/PdfWriter.xcodeproj; sourceTree = "<group>"; };
|
||||
6967B10D1E27A65600A129E2 /* OfficeFileFormatChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OfficeFileFormatChecker.h; path = ../../../../../Common/OfficeFileFormatChecker.h; sourceTree = "<group>"; };
|
||||
@ -503,7 +487,6 @@
|
||||
6967B1D11E27B9D700A129E2 /* libRtfFormatLib.a in Frameworks */,
|
||||
6967B10A1E27A41B00A129E2 /* libPdfWriter.a in Frameworks */,
|
||||
6967B0D41E27A36E00A129E2 /* libHtmlFile.a in Frameworks */,
|
||||
6967B0B31E27A07100A129E2 /* libPPTFormatLib.a in Frameworks */,
|
||||
6967AFDF1E279B3600A129E2 /* libTxtXmlFormatLib.a in Frameworks */,
|
||||
69EC66D91E01775B003527E2 /* libUnicodeConverter.a in Frameworks */,
|
||||
69DA32F11CEE100E00E10AF0 /* libagg_ios.a in Frameworks */,
|
||||
@ -548,7 +531,6 @@
|
||||
6967B1C91E27B9C400A129E2 /* RtfFormatLib.xcodeproj */,
|
||||
6967B1031E27A41300A129E2 /* PdfWriter.xcodeproj */,
|
||||
6967B0CC1E27A35E00A129E2 /* HtmlFile.xcodeproj */,
|
||||
6967B0911E27A03800A129E2 /* PPTFormatLib.xcodeproj */,
|
||||
6967AFD71E279B2300A129E2 /* TxtXmlFormatLib.xcodeproj */,
|
||||
69EC66CD1E01770C003527E2 /* UnicodeConverter.xcodeproj */,
|
||||
69415FAE1CB5243F003E771B /* mng.xcodeproj */,
|
||||
@ -704,14 +686,6 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6967B0921E27A03800A129E2 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6967B0961E27A03800A129E2 /* libPPTFormatLib.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6967B0CD1E27A35E00A129E2 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -865,7 +839,6 @@
|
||||
6967B1D01E27B9D000A129E2 /* PBXTargetDependency */,
|
||||
6967B10C1E27A42500A129E2 /* PBXTargetDependency */,
|
||||
6967B0D31E27A36800A129E2 /* PBXTargetDependency */,
|
||||
6967B0B11E27A06900A129E2 /* PBXTargetDependency */,
|
||||
6967AFDE1E279B2D00A129E2 /* PBXTargetDependency */,
|
||||
69EC66D81E01774D003527E2 /* PBXTargetDependency */,
|
||||
69DA32F01CEE100700E10AF0 /* PBXTargetDependency */,
|
||||
@ -995,10 +968,6 @@
|
||||
ProductGroup = 69415FB21CB5243F003E771B /* Products */;
|
||||
ProjectRef = 69415FB11CB5243F003E771B /* png.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 6967B0921E27A03800A129E2 /* Products */;
|
||||
ProjectRef = 6967B0911E27A03800A129E2 /* PPTFormatLib.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 69DA325D1CEE09BB00E10AF0 /* Products */;
|
||||
ProjectRef = 69DA325C1CEE09BB00E10AF0 /* PPTXFormatLib.xcodeproj */;
|
||||
@ -1128,13 +1097,6 @@
|
||||
remoteRef = 6967AFDB1E279B2300A129E2 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
6967B0961E27A03800A129E2 /* libPPTFormatLib.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libPPTFormatLib.a;
|
||||
remoteRef = 6967B0951E27A03800A129E2 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
6967B0D11E27A35F00A129E2 /* libHtmlFile.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
@ -1331,11 +1293,6 @@
|
||||
name = TxtXmlFormatLib;
|
||||
targetProxy = 6967AFDD1E279B2D00A129E2 /* PBXContainerItemProxy */;
|
||||
};
|
||||
6967B0B11E27A06900A129E2 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = PPTFormatLib;
|
||||
targetProxy = 6967B0B01E27A06900A129E2 /* PBXContainerItemProxy */;
|
||||
};
|
||||
6967B0D31E27A36800A129E2 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = HtmlFile;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 2.4.464.0
|
||||
VERSION = 2.4.465.0
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
TARGET = x2t
|
||||
|
||||
@ -758,41 +758,41 @@ namespace NExtractTools
|
||||
// ppsx -> pptx
|
||||
int ppsx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring sTempUnpackedPPSX = sTemp + FILE_SEPARATOR_STR + L"ppsx_unpacked";
|
||||
NSDirectory::CreateDirectory(sTempUnpackedPPSX);
|
||||
|
||||
int nRes = ppsx2pptx_dir(sFrom, sTempUnpackedPPSX, params);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPSX, sTo, -1))
|
||||
return 0;
|
||||
}
|
||||
// std::wstring sTempUnpackedPPSX = sTemp + FILE_SEPARATOR_STR + L"ppsx_unpacked";
|
||||
// NSDirectory::CreateDirectory(sTempUnpackedPPSX);
|
||||
//
|
||||
// int nRes = ppsx2pptx_dir(sFrom, sTempUnpackedPPSX, params);
|
||||
// if(SUCCEEDED_X2T(nRes))
|
||||
// {
|
||||
// COfficeUtils oCOfficeUtils(NULL);
|
||||
// if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedPPSX, sTo, -1))
|
||||
// return 0;
|
||||
// }
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int ppsx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
|
||||
{
|
||||
std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + L"[Content_Types].xml";
|
||||
if(NSFile::CFileBinary::Exists(sContentTypesPath))
|
||||
{
|
||||
std::wstring sData;
|
||||
if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
|
||||
{
|
||||
std::wstring sCTFrom = L"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
|
||||
std::wstring sCTTo = L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
||||
|
||||
sData = string_replaceAll(sData, sCTFrom, sCTTo);
|
||||
|
||||
if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// COfficeUtils oCOfficeUtils(NULL);
|
||||
// if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTo, NULL, 0))
|
||||
// {
|
||||
// std::wstring sContentTypesPath = sTo + FILE_SEPARATOR_STR + L"[Content_Types].xml";
|
||||
// if(NSFile::CFileBinary::Exists(sContentTypesPath))
|
||||
// {
|
||||
// std::wstring sData;
|
||||
// if(NSFile::CFileBinary::ReadAllTextUtf8(sContentTypesPath, sData))
|
||||
// {
|
||||
// std::wstring sCTFrom = L"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
|
||||
// std::wstring sCTTo = L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
||||
//
|
||||
// sData = string_replaceAll(sData, sCTFrom, sCTTo);
|
||||
//
|
||||
// if(NSFile::CFileBinary::SaveToFile(sContentTypesPath, sData, true))
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
@ -812,70 +812,76 @@ namespace NExtractTools
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
COfficePPTFile pptFile;
|
||||
|
||||
pptFile.put_TempDirectory(sTemp);
|
||||
return S_OK == pptFile.LoadFromFile(sFrom, sTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
//COfficePPTFile pptFile;
|
||||
|
||||
//pptFile.put_TempDirectory(sTemp);
|
||||
//return S_OK == pptFile.LoadFromFile(sFrom, sTo, params.getPassword()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// ppt -> pptt
|
||||
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + L"pptt_unpacked";
|
||||
std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + L"Editor.bin";
|
||||
//std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + L"pptt_unpacked";
|
||||
//std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + L"Editor.bin";
|
||||
|
||||
NSDirectory::CreateDirectory(sResultPpttDir);
|
||||
//NSDirectory::CreateDirectory(sResultPpttDir);
|
||||
|
||||
int nRes = ppt2pptt_bin(sFrom, sTempPpttFileEditor, sTemp, params);
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
// zip pptt folder to output file
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory (sResultPpttDir, sTo, -1)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return nRes;
|
||||
//int nRes = ppt2pptt_bin(sFrom, sTempPpttFileEditor, sTemp, params);
|
||||
//if (SUCCEEDED_X2T(nRes))
|
||||
//{
|
||||
// // zip pptt folder to output file
|
||||
// COfficeUtils oCOfficeUtils(NULL);
|
||||
// nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory (sResultPpttDir, sTo, -1)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
//}
|
||||
//return nRes;
|
||||
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// ppt -> pptt_bin
|
||||
int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
// unzip pptx to temp folder
|
||||
std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + L"pptx_unpacked"+ FILE_SEPARATOR_STR; // leading slash is very important!
|
||||
|
||||
NSDirectory::CreateDirectory(sTempUnpackedPPTX);
|
||||
|
||||
COfficePPTFile pptFile;
|
||||
|
||||
pptFile.put_TempDirectory(sTemp);
|
||||
|
||||
if ( pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX) != S_OK) return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
// convert unzipped pptx to unzipped pptt
|
||||
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
|
||||
|
||||
int nRes = 0;
|
||||
|
||||
if (pptx_file)
|
||||
{
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
BSTR bstrFontPath = SysAllocString(params.getFontPath().c_str());
|
||||
BSTR bstrTempUnpackedPPTX = SysAllocString(sTempUnpackedPPTX.c_str());
|
||||
BSTR bstrTo = SysAllocString(sTo.c_str());
|
||||
|
||||
pptx_file->SetFontDir (bstrFontPath);
|
||||
nRes = (S_OK == pptx_file->OpenFileToPPTY (bstrTempUnpackedPPTX, bstrTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
SysFreeString(bstrFontPath);
|
||||
SysFreeString(bstrTempUnpackedPPTX);
|
||||
SysFreeString(bstrTo);
|
||||
#else
|
||||
pptx_file->SetFontDir (params.getFontPath());
|
||||
nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
#endif
|
||||
delete pptx_file;
|
||||
}
|
||||
|
||||
return nRes;
|
||||
// std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + L"pptx_unpacked"+ FILE_SEPARATOR_STR; // leading slash is very important!
|
||||
//
|
||||
// NSDirectory::CreateDirectory(sTempUnpackedPPTX);
|
||||
//
|
||||
// COfficePPTFile pptFile;
|
||||
//
|
||||
// pptFile.put_TempDirectory(sTemp);
|
||||
//
|
||||
// if ( pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword()) != S_OK) return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
//
|
||||
// // convert unzipped pptx to unzipped pptt
|
||||
// CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
|
||||
//
|
||||
// int nRes = 0;
|
||||
//
|
||||
// if (pptx_file)
|
||||
// {
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// BSTR bstrFontPath = SysAllocString(params.getFontPath().c_str());
|
||||
// BSTR bstrTempUnpackedPPTX = SysAllocString(sTempUnpackedPPTX.c_str());
|
||||
// BSTR bstrTo = SysAllocString(sTo.c_str());
|
||||
//
|
||||
// pptx_file->SetFontDir (bstrFontPath);
|
||||
// nRes = (S_OK == pptx_file->OpenFileToPPTY (bstrTempUnpackedPPTX, bstrTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
//
|
||||
// SysFreeString(bstrFontPath);
|
||||
// SysFreeString(bstrTempUnpackedPPTX);
|
||||
// SysFreeString(bstrTo);
|
||||
//#else
|
||||
// pptx_file->SetFontDir (params.getFontPath());
|
||||
// nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
//#endif
|
||||
// delete pptx_file;
|
||||
// }
|
||||
//
|
||||
// return nRes;
|
||||
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
// rtf -> docx
|
||||
|
||||
Reference in New Issue
Block a user