mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-08 14:30:11 +08:00
Compare commits
7 Commits
v4.4.0.220
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| ee577e629a | |||
| f230dc2555 | |||
| 11c9d74e68 | |||
| d61a955c38 | |||
| acfb96e3c3 | |||
| d2e3cc47f2 | |||
| 4f2f164af9 |
@ -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();
|
||||
|
||||
@ -544,6 +544,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" ));
|
||||
|
||||
@ -64,7 +64,8 @@ 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_strFileDirectory = GetDirectory(sFileName.c_str());
|
||||
pptReader->m_oDocumentInfo.m_strPassword = password;
|
||||
|
||||
if (pptReader->IsPowerPoint() == false)
|
||||
{
|
||||
@ -73,14 +74,14 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
|
||||
if (pptReader->ReadPersistDirectory() == false)
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
|
||||
if (pptReader->ReadPersists() == false)
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
|
||||
if (pptReader->IsEncrypted())
|
||||
{
|
||||
CEncryptionHeader *pEncryptionHeader = pptReader->GetEncryptionHeader();
|
||||
if (password.empty()) return AVS_ERROR_DRM;
|
||||
if (!pEncryptionHeader) return AVS_ERROR_FILEFORMAT;
|
||||
if (password.empty()) return AVS_ERROR_DRM;
|
||||
|
||||
if (pEncryptionHeader->bStandard)
|
||||
{
|
||||
@ -92,7 +93,8 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
|
||||
}
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
|
||||
return OpenFile(m_sTempDecryptFileName, L"");
|
||||
return AVS_ERROR_PASSWORD;
|
||||
//return OpenFile(m_sTempDecryptFileName, L"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -106,12 +108,15 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
|
||||
}
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
|
||||
return OpenFile(m_sTempDecryptFileName, L"");
|
||||
return AVS_ERROR_PASSWORD;
|
||||
pptReader->ReadDocument(&Decryptor);
|
||||
//return OpenFile(m_sTempDecryptFileName, L"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pptReader->ReadSlideList();
|
||||
pptReader->ReadDocument(NULL);
|
||||
|
||||
m_Status = READMODE;
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ public:
|
||||
std::vector<CPPTUserInfo*> m_arUsers;
|
||||
std::wstring m_strFileDirectory;
|
||||
std::map<int, std::wstring> m_mapStoreImageFile;
|
||||
std::wstring m_strPassword;
|
||||
|
||||
CPPTDocumentInfo() : m_oCurrentUser(), m_arUsers()
|
||||
{
|
||||
@ -63,7 +64,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream, std::wstring strFolderMem)
|
||||
bool ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream)
|
||||
{
|
||||
m_oCurrentUser.FromAtom(pCurrentUser);
|
||||
|
||||
@ -86,8 +87,9 @@ public:
|
||||
|
||||
pInfo->m_strFileDirectory = m_strFileDirectory;
|
||||
pInfo->m_bEncrypt = m_oCurrentUser.m_bIsEncrypt;
|
||||
pInfo->m_strPassword = m_strPassword;
|
||||
|
||||
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream, strFolderMem);
|
||||
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
|
||||
|
||||
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
|
||||
|
||||
@ -104,13 +106,16 @@ public:
|
||||
|
||||
pInfo = NULL;
|
||||
}
|
||||
if (m_arUsers.empty() == false)
|
||||
{
|
||||
if (m_arUsers[0]->m_bEncrypt == false)
|
||||
{
|
||||
m_arUsers[0]->FromDocument();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool LoadDocument(std::wstring strFolderMem)
|
||||
{
|
||||
if (m_arUsers.empty()) return false;
|
||||
|
||||
m_arUsers[0]->ReadExtenalObjects(strFolderMem);
|
||||
m_arUsers[0]->FromDocument();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -47,6 +47,7 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
|
||||
m_mapMasters(),
|
||||
m_mapNotes(),
|
||||
m_mapSlides(),
|
||||
m_bEncrypt(false),
|
||||
m_arOffsetPictures()
|
||||
{
|
||||
m_pDocumentInfo = NULL;
|
||||
@ -128,7 +129,7 @@ void CPPTUserInfo::Clear()
|
||||
m_arOffsetPictures.clear();
|
||||
}
|
||||
|
||||
bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream, std::wstring strFolderMem)
|
||||
bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream)
|
||||
{
|
||||
m_oUser.FromAtom(pUser);
|
||||
|
||||
@ -149,8 +150,9 @@ 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())
|
||||
{
|
||||
StreamUtils::StreamSeek(pPair->second, pStream);
|
||||
@ -161,7 +163,17 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
m_bEncrypt = true;
|
||||
m_oEncryptionHeader.ReadFromStream(oHeader, pStream);
|
||||
|
||||
return true;
|
||||
pDecryptor = new CRYPT::ECMADecryptor();
|
||||
pDecryptor->SetCryptData(m_oEncryptionHeader.crypt_data_aes);
|
||||
|
||||
if (pDecryptor->SetPassword(m_strPassword) == false)
|
||||
{
|
||||
delete pDecryptor;
|
||||
pDecryptor = NULL;
|
||||
|
||||
//return true;
|
||||
}
|
||||
return true;//read persis decrypt
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -170,15 +182,45 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
if (pPair == m_mapOffsetInPIDs.end())
|
||||
return false;
|
||||
|
||||
StreamUtils::StreamSeek(pPair->second, pStream);
|
||||
DWORD offset_stream = pPair->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
if (RECORD_TYPE_DOCUMENT != oHeader.RecType)
|
||||
if (pDecryptor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
POLE::Storage *pStorageOut = NULL;
|
||||
POLE::Stream *pStreamTmp = NULL;
|
||||
|
||||
m_oDocument.ReadFromStream(oHeader, pStream);
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RECORD_TYPE_DOCUMENT != oHeader.RecType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_oDocument.ReadFromStream(oHeader, pStream);
|
||||
}
|
||||
|
||||
Clear();
|
||||
|
||||
@ -190,11 +232,12 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
if (nIndexPsrRef != m_mapOffsetInPIDs.end())
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->m_oPersist = m_oDocument.m_arMasterPersists[index];
|
||||
@ -215,8 +258,8 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
@ -240,9 +283,9 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
offset_stream = (long)nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
@ -283,9 +326,9 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
@ -300,9 +343,9 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
offset_stream = nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
@ -314,7 +357,11 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
m_mapHandoutMasters.insert( std::pair<DWORD, CRecordSlide*>(0, pSlide ));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
void CPPTUserInfo::ReadExtenalObjects(std::wstring strFolderMem)
|
||||
{
|
||||
// так... теперь берем всю инфу о ExObject -----------------------------
|
||||
m_oExMedia.m_strPresentationDirectory = strFolderMem;
|
||||
m_oExMedia.m_strSourceDirectory = m_strFileDirectory;
|
||||
@ -364,20 +411,12 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
m_arrFonts.push_back(oFont);
|
||||
}
|
||||
|
||||
//FromDocument();
|
||||
// FromDocument - должен вызываться после того, как загрузятся все (!!!) юзеры
|
||||
|
||||
// теперь заполним пустые картинки
|
||||
//std::vector<CRecordBlipStoreContainer*> oArray;
|
||||
m_oDocument.GetRecordsByType(&m_arrBlipStore, true, true);
|
||||
if (0 < m_arrBlipStore.size())
|
||||
{
|
||||
m_bIsSetupEmpty = TRUE;
|
||||
m_arrBlipStore[0]->SetUpPicturesInfos(&m_arOffsetPictures);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CPPTUserInfo::FromDocument()
|
||||
|
||||
@ -50,6 +50,7 @@ public:
|
||||
|
||||
CEncryptionHeader m_oEncryptionHeader;
|
||||
bool m_bEncrypt;
|
||||
std::wstring m_strPassword;
|
||||
|
||||
std::map<DWORD, CRecordSlide*> m_mapSlides;
|
||||
std::map<DWORD, CRecordSlide*> m_mapMasters;
|
||||
@ -122,7 +123,8 @@ public:
|
||||
|
||||
void Clear();
|
||||
|
||||
bool ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream, std::wstring strFolderMem);
|
||||
bool ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream);
|
||||
void ReadExtenalObjects(std::wstring strFolderMem);
|
||||
void FromDocument();
|
||||
|
||||
void NormalizeCoords(long lWidth, long lHeight);
|
||||
|
||||
@ -56,7 +56,6 @@ public:
|
||||
m_bIsPPTFile(false),
|
||||
m_pDocStream(NULL),
|
||||
m_pPictureStream(NULL),
|
||||
m_lImagesCount(0),
|
||||
m_strMemoryForder(strTemp),
|
||||
m_oDocumentInfo()
|
||||
{
|
||||
@ -114,7 +113,7 @@ public:
|
||||
if (m_oDocumentInfo.m_arUsers.empty())
|
||||
return m_oDocumentInfo.m_oCurrentUser.m_bIsEncrypt; //wps не выставляет флаг!
|
||||
|
||||
return &m_oDocumentInfo.m_arUsers[0]->m_bEncrypt;
|
||||
return m_oDocumentInfo.m_arUsers[0]->m_bEncrypt;
|
||||
}
|
||||
CEncryptionHeader* GetEncryptionHeader()
|
||||
{
|
||||
@ -122,26 +121,14 @@ public:
|
||||
|
||||
return &m_oDocumentInfo.m_arUsers[0]->m_oEncryptionHeader;
|
||||
}
|
||||
bool ReadPersistDirectory()
|
||||
bool ReadPersists()
|
||||
{
|
||||
// нужно вызывать РОВНО один раз...
|
||||
bool bRes = SavePictures();
|
||||
|
||||
return m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, GetDocStream(), m_strMemoryForder);
|
||||
return m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, GetDocStream());
|
||||
}
|
||||
|
||||
void ReadSlideList()
|
||||
void ReadDocument(CRYPT::ECMADecryptor *pDecryptor)
|
||||
{
|
||||
if (m_oDocumentInfo.m_arUsers.size() > 0)
|
||||
{
|
||||
DWORD nPID = m_oDocumentInfo.m_arUsers[0]->m_oUser.m_nDocumentRef;
|
||||
std::map<DWORD, DWORD>::iterator pPair = m_oDocumentInfo.m_arUsers[0]->m_mapOffsetInPIDs.find(nPID);
|
||||
|
||||
if (pPair == m_oDocumentInfo.m_arUsers[0]->m_mapOffsetInPIDs.end()) return;
|
||||
|
||||
DWORD offset = pPair->second;
|
||||
StreamUtils::StreamSeek((long)offset, GetDocStream());
|
||||
}
|
||||
ReadPictures(pDecryptor);
|
||||
m_oDocumentInfo.LoadDocument(m_strMemoryForder);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -194,20 +181,13 @@ protected:
|
||||
return m_pPictureStream;
|
||||
}
|
||||
|
||||
bool SavePictures()
|
||||
void ReadPictures(CRYPT::ECMADecryptor *pDecryptor)
|
||||
{
|
||||
POLE::Stream* pStream = GetPictureStream();
|
||||
if (NULL == pStream) return;
|
||||
|
||||
if (NULL == pStream)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SRecordHeader oHeader;
|
||||
ULONG nRd = 0;
|
||||
m_lImagesCount = 0;
|
||||
|
||||
// удаление картинок при завершении программы
|
||||
|
||||
while (true)
|
||||
{
|
||||
@ -220,11 +200,39 @@ protected:
|
||||
art_blip.m_strMemoryForder = m_strMemoryForder;
|
||||
art_blip.m_oDocumentInfo = &m_oDocumentInfo;
|
||||
|
||||
art_blip.ReadFromStream(oHeader, pStream);
|
||||
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);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_bDualStorage;
|
||||
@ -239,7 +247,6 @@ public:
|
||||
std::wstring m_strMemoryForder;
|
||||
|
||||
std::vector<bool> m_arLoadImageFlags;
|
||||
DWORD m_lImagesCount;
|
||||
|
||||
CPPTDocumentInfo m_oDocumentInfo;
|
||||
};
|
||||
|
||||
@ -35,11 +35,13 @@
|
||||
#include "../Reader/ReadStructures.h"
|
||||
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Enums.h"
|
||||
#include "../../../Common/3dParty/pole/pole.h"
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
using namespace NSPresentationEditor;
|
||||
|
||||
struct SRecordHeader
|
||||
class SRecordHeader
|
||||
{
|
||||
public:
|
||||
BYTE RecVersion;
|
||||
USHORT RecInstance;
|
||||
USHORT RecType;
|
||||
@ -48,7 +50,8 @@ struct SRecordHeader
|
||||
SRecordHeader()
|
||||
{
|
||||
RecVersion = 0;
|
||||
RecInstance = RecType = 0;
|
||||
RecInstance = 0;
|
||||
RecType = 0;
|
||||
RecLen = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1155,8 +1155,8 @@ namespace NSBinPptxRW
|
||||
str = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide" +
|
||||
std::to_wstring(nIndexNotes + 1) + L".xml\"/>";
|
||||
m_pWriter->WriteString(str);
|
||||
}
|
||||
m_pWriter->WriteString(str);
|
||||
}
|
||||
void CRelsGenerator::StartNotes(int nIndexSlide)
|
||||
{
|
||||
@ -1209,7 +1209,7 @@ namespace NSBinPptxRW
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::EndPresentationRels(const bool& bIsCommentsAuthors = false, const bool& bIsNotesMaster = false)
|
||||
void CRelsGenerator::EndPresentationRels(const bool& bIsCommentsAuthors = false, const bool& bIsNotesMaster)
|
||||
{
|
||||
if (bIsNotesMaster)
|
||||
{
|
||||
|
||||
@ -56,11 +56,6 @@ void CrtMlFrt::readFields(CFRecord& record)
|
||||
Log::error("CrtMlFrt record is not implemented.");
|
||||
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
//
|
||||
// if (cb > 0)
|
||||
// {
|
||||
// //XmlTkChain
|
||||
// }
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -54,7 +54,6 @@ void DBQueryExt::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### DBQueryExt record is not implemented")
|
||||
Log::error("DBQueryExt record is not implemented.");
|
||||
//record >> some_value;
|
||||
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
}
|
||||
|
||||
@ -52,8 +52,7 @@ BaseObjectPtr DCon::clone()
|
||||
|
||||
void DCon::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### DCon record is not implemented")
|
||||
//record >> iiftab >> fLeftCat >> fTopCat >> fLinkConsole;
|
||||
record >> iiftab >> fLeftCat >> fTopCat >> fLinkConsole;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DCon record in BIFF8
|
||||
class DCon: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(DCon)
|
||||
|
||||
@ -53,9 +53,17 @@ BaseObjectPtr DConBin::clone()
|
||||
|
||||
void DConBin::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### DConBin record is not implemented")
|
||||
Log::error("DConBin record is not implemented.");
|
||||
//record >> some_value;
|
||||
unsigned short reserved1;
|
||||
unsigned char reserved2;
|
||||
record >> nBuiltin >> reserved1 >> reserved2 >> cchFile;
|
||||
|
||||
if (cchFile > 0 && cchFile < 0xffff)
|
||||
{
|
||||
stFile.setSize(cchFile);
|
||||
record >> stFile;
|
||||
}
|
||||
|
||||
// skip unused
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
}
|
||||
|
||||
|
||||
@ -32,12 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DConBin record in BIFF8
|
||||
class DConBin: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(DConBin)
|
||||
@ -48,11 +47,13 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeDConBin;
|
||||
static const ElementType type = typeDConBin;
|
||||
|
||||
unsigned char nBuiltin;
|
||||
unsigned short cchFile;
|
||||
XLUnicodeStringNoCch stFile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -54,7 +54,6 @@ void DbOrParamQry::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### DbOrParamQry record is not implemented")
|
||||
Log::error("DbOrParamQry record is not implemented.");
|
||||
//record >> some_value;
|
||||
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr FnGrp12::clone()
|
||||
void FnGrp12::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> astFnGrp;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr ForceFullCalculation::clone()
|
||||
void ForceFullCalculation::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
|
||||
_UINT32 temp;
|
||||
record >> temp;
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr GUIDTypeLib::clone()
|
||||
void GUIDTypeLib::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
_GUID_ guid_num;
|
||||
record >> guid_num;
|
||||
guid = STR::guid2bstr(guid_num);
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr MDB::clone()
|
||||
void MDB::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
while(!record.isEOF())
|
||||
{
|
||||
MDirPtr element(new MDir);
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr MDTInfo::clone()
|
||||
void MDTInfo::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
|
||||
_UINT32 flags;
|
||||
record >> flags;
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr MDXKPI::clone()
|
||||
void MDXKPI::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> istrConnName >> tfnSrc >> kpiprop >> istrKPIName >> istrMbrKPI;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ BaseObjectPtr MDXProp::clone()
|
||||
void MDXProp::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> istrConnName >> tfnSrc >> istrMbr >> istrProp;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ BaseObjectPtr MDXSet::clone()
|
||||
void MDXSet::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> istrConnName >> tfnSrc >> sso >> istrSetDef >> cistr;
|
||||
while(!record.isEOF())
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ BaseObjectPtr MDXStr::clone()
|
||||
void MDXStr::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> st;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ BaseObjectPtr MDXTuple::clone()
|
||||
void MDXTuple::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> istrConnName >> tfnSrc >> cistr;
|
||||
while(!record.isEOF())
|
||||
{
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr NameFnGrp12::clone()
|
||||
void NameFnGrp12::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> cachName >> fgrp >> rgach;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr NamePublish::clone()
|
||||
void NamePublish::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
unsigned short flags;
|
||||
record >> flags >> strName;
|
||||
fPublished = GETBIT(flags, 0);
|
||||
|
||||
@ -52,9 +52,20 @@ BaseObjectPtr Qsir::clone()
|
||||
|
||||
void Qsir::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### Qsir record is not implemented")
|
||||
Log::error("Qsir record is not implemented.");
|
||||
//record >> some_value;
|
||||
_UINT32 flags;
|
||||
|
||||
record >> frtRefHeaderU >> cbQsirSaved >> cbQsifSaved >> flags >> iSortCustom >> cQsif >> cpstDeleted >> idFieldNext >> ccolExtraLeft >> ccolExtraRight;
|
||||
record >> idList >> rgbTitle;
|
||||
|
||||
fPersist = GETBIT(flags, 0);
|
||||
fPersistSort = GETBIT(flags, 1);
|
||||
fPersistAutoFilter = GETBIT(flags, 2);
|
||||
fSorted = GETBIT(flags, 20);
|
||||
fCaseSensSort = GETBIT(flags, 21);
|
||||
fHdrRowSort = GETBIT(flags, 22);
|
||||
fidWrapped = GETBIT(flags, 23);
|
||||
fTitlesOld = GETBIT(flags, 25);
|
||||
wVerBeforeRefreshAlert = GETBITS(flags, 26, 30);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,12 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/FrtRefHeaderU.h"
|
||||
#include "../Biff_structures/BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Qsir record in BIFF8
|
||||
class Qsir: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Qsir)
|
||||
@ -47,11 +47,32 @@ public:
|
||||
~Qsir();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeQsir;
|
||||
static const ElementType type = typeQsir;
|
||||
|
||||
FrtRefHeaderU frtRefHeaderU;
|
||||
unsigned short cbQsirSaved;
|
||||
unsigned short cbQsifSaved;
|
||||
bool fPersist;
|
||||
bool fPersistSort;
|
||||
bool fPersistAutoFilter;
|
||||
bool fSorted;
|
||||
bool fCaseSensSort;
|
||||
bool fHdrRowSort;
|
||||
bool fidWrapped;
|
||||
bool fTitlesOld;
|
||||
unsigned char wVerBeforeRefreshAlert;
|
||||
_UINT32 iSortCustom;
|
||||
_UINT32 cQsif;
|
||||
_UINT32 cpstDeleted;
|
||||
_UINT32 idFieldNext;
|
||||
unsigned short ccolExtraLeft;
|
||||
unsigned short ccolExtraRight;
|
||||
_UINT32 idList; //options
|
||||
|
||||
XLUnicodeString rgbTitle;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -52,7 +52,7 @@ BaseObjectPtr SortData::clone()
|
||||
void SortData::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr StyleExt::clone()
|
||||
void StyleExt::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
unsigned char flags;
|
||||
record >> flags;
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr TableStyle::clone()
|
||||
void TableStyle::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
fIsPivot = GETBIT(flags, 1);
|
||||
|
||||
@ -54,7 +54,7 @@ BaseObjectPtr TableStyleElement::clone()
|
||||
void TableStyleElement::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> tseType >> size >> index;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr TableStyles::clone()
|
||||
void TableStyles::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
|
||||
unsigned short cchDefTableStyle;
|
||||
unsigned short cchDefPivotStyle;
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/Biff_structures/FrtHeader.h>
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/FrtHeader.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -55,7 +55,7 @@ BaseObjectPtr Theme::clone()
|
||||
void Theme::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record >> dwThemeVersion;
|
||||
|
||||
if(!dwThemeVersion)
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr XFCRC::clone()
|
||||
void XFCRC::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record.skipNunBytes(2); // reserved
|
||||
record >> cxfs >> crc;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr XFExt::clone()
|
||||
void XFExt::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(12);
|
||||
#pragma message("############################ frtHeader skipped here")
|
||||
#pragma message(">>>>>>>>>>> frtHeader skipped here")
|
||||
record.skipNunBytes(2); // reserved
|
||||
record >> ixfe;
|
||||
record.skipNunBytes(2); // reserved
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* (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 "HiddenMemberSet.h"
|
||||
#include "BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
BiffStructurePtr HiddenMemberSet::clone()
|
||||
{
|
||||
return BiffStructurePtr(new HiddenMemberSet(*this));
|
||||
}
|
||||
|
||||
|
||||
void HiddenMemberSet::load(CFRecord& record)
|
||||
{
|
||||
record >> cMemberName;
|
||||
|
||||
for (_UINT32 i = 0; i < cMemberName; i++)
|
||||
{
|
||||
XLUnicodeString val;
|
||||
record >> val;
|
||||
|
||||
rgMemberName.push_back(val.value());
|
||||
}
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (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 "BiffStructure.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class HiddenMemberSet : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(HiddenMemberSet)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
static const ElementType type = typeHiddenMemberSet;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
_UINT32 cMemberName;
|
||||
std::vector<std::wstring> rgMemberName;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* (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 "SXVIFlags.h"
|
||||
#include "BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
BiffStructurePtr SXVIFlags::clone()
|
||||
{
|
||||
return BiffStructurePtr(new SXVIFlags(*this));
|
||||
}
|
||||
|
||||
|
||||
void SXVIFlags::load(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
|
||||
fDrilledMember = GETBIT(flags, 0);
|
||||
fHasChildren = GETBIT(flags, 1);
|
||||
fCollapsedMember = GETBIT(flags, 2);
|
||||
fHasChildrenEst = GETBIT(flags, 3);
|
||||
fOlapFilterSelected = GETBIT(flags, 4);
|
||||
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (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 "BiffStructure.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class SXVIFlags : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(SXVIFlags)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
static const ElementType type = typeSXVIFlags;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
bool fDrilledMember;
|
||||
bool fHasChildren;
|
||||
bool fCollapsedMember;
|
||||
bool fHasChildrenEst;
|
||||
bool fOlapFilterSelected;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -124,104 +124,6 @@ CHARTSHEETCONTENT = [WriteProtect] [SheetExt] [WebPub] *HFPicture PAGESETUP Prin
|
||||
*/
|
||||
const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
{
|
||||
// pGlobalWorkbookInfo = proc.getGlobalWorkbookInfo();
|
||||
//
|
||||
// if(!proc.mandatory<BOF>())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// int count = 0 ;
|
||||
//
|
||||
// proc.optional<WriteProtect>();
|
||||
// proc.optional<SheetExt>();
|
||||
// proc.optional<WebPub>();
|
||||
// proc.repeated<HFPicture>(0, 0);
|
||||
// proc.mandatory<PAGESETUP>();
|
||||
// proc.mandatory<PrintSize>();
|
||||
// proc.optional<HeaderFooter>();
|
||||
//
|
||||
// if (proc.optional<BACKGROUND>())
|
||||
// {
|
||||
// m_BACKGROUND = elements_.back();
|
||||
// elements_.pop_back();
|
||||
// }
|
||||
//
|
||||
// count = proc.repeated<Fbi>(0, 0);
|
||||
// while(count > 0)
|
||||
// {
|
||||
// m_arFbi.insert(m_arFbi.begin(), elements_.back());
|
||||
// elements_.pop_back();
|
||||
// count--;
|
||||
// }
|
||||
// count = proc.repeated<Fbi2>(0, 0);
|
||||
//
|
||||
// while(count > 0 && m_arFbi.empty())//??? разделить
|
||||
// {
|
||||
// m_arFbi.insert(m_arFbi.begin(), elements_.back());
|
||||
// elements_.pop_back();
|
||||
// count--;
|
||||
// }
|
||||
//
|
||||
// proc.optional<ClrtClient>();
|
||||
// proc.optional<PROTECTION_COMMON>();
|
||||
// proc.optional<Palette>();
|
||||
// proc.optional<SXViewLink>();
|
||||
// proc.optional<PivotChartBits>();
|
||||
// proc.optional<SBaseRef>();
|
||||
//
|
||||
// MsoDrawingGroup mso_drawing_group(true);
|
||||
// proc.optional(mso_drawing_group);
|
||||
//
|
||||
// OBJECTS objects(true);
|
||||
// if (proc.mandatory(objects))
|
||||
// {
|
||||
// m_OBJECTSCHART = elements_.back();
|
||||
// elements_.pop_back();
|
||||
// }
|
||||
//
|
||||
// proc.mandatory<Units>();
|
||||
// if ( proc.mandatory<CHARTFORMATS>() )
|
||||
// {
|
||||
// m_CHARTFORMATS = elements_.back();
|
||||
// elements_.pop_back();
|
||||
//
|
||||
// recalc((CHARTFORMATS*)m_CHARTFORMATS.get());
|
||||
// }
|
||||
// if ( proc.mandatory<SERIESDATA>() )
|
||||
// {
|
||||
// m_SERIESDATA = elements_.back();
|
||||
// elements_.pop_back();
|
||||
//
|
||||
// recalc((SERIESDATA*)m_SERIESDATA.get());
|
||||
// }
|
||||
//
|
||||
// count = proc.repeated<WINDOW>(0, 0);
|
||||
// while(count > 0)
|
||||
// {
|
||||
// m_arWINDOW.insert(m_arWINDOW.begin(), elements_.back());
|
||||
// elements_.pop_back();
|
||||
// count--;
|
||||
// }
|
||||
//
|
||||
// count = proc.repeated<CUSTOMVIEW>(0, 0);
|
||||
// while(count > 0)
|
||||
// {
|
||||
// m_arCUSTOMVIEW.insert(m_arCUSTOMVIEW.begin(), elements_.back());
|
||||
// elements_.pop_back();
|
||||
// count--;
|
||||
// }
|
||||
//
|
||||
// proc.optional<CodeName>();
|
||||
// proc.optional<CRTMLFRT>();
|
||||
//
|
||||
//#pragma message("####################### Some trash records may be skipped here")
|
||||
// proc.SeekToEOF(); // Thus we skip problems with the trash at the end of the stream (found in Domens.xls)
|
||||
//
|
||||
// proc.mandatory<EOF_T>();
|
||||
//
|
||||
// return true;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
pGlobalWorkbookInfo = proc.getGlobalWorkbookInfo();
|
||||
|
||||
int count = 0 ;
|
||||
|
||||
@ -41,7 +41,7 @@ protected:
|
||||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms);
|
||||
virtual unsigned int GetDefaultDiscardBytes() const {return 0;}
|
||||
|
||||
FixedSizeSecBlock<byte, 512> m_state;
|
||||
FixedSizeSecBlock<byte, 256> m_state;
|
||||
byte m_x, m_y;
|
||||
};
|
||||
|
||||
|
||||
@ -381,8 +381,8 @@ bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYP
|
||||
|
||||
return true;
|
||||
}
|
||||
ARC4::Decryption rc4Decryption;
|
||||
//CipherARCFOUR rc4Decryption;
|
||||
//ARC4::Decryption rc4Decryption;
|
||||
CipherARCFOUR rc4Decryption;
|
||||
|
||||
bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYPT_METHOD::_cipherAlgorithm algorithm,
|
||||
StreamTransformationFilter::BlockPaddingScheme padding = StreamTransformationFilter::NO_PADDING)
|
||||
@ -398,8 +398,8 @@ 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);
|
||||
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,7 +485,10 @@ 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);
|
||||
{
|
||||
//rc4Decryption.SetKey(verifierKey.ptr, verifierKey.size);
|
||||
rc4Decryption.Init(CipherARCFOUR::rtl_Cipher_DirectionDecode, verifierKey.ptr, verifierKey.size, 0, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes;
|
||||
@ -512,12 +515,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,7 +568,7 @@ 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_ptr, int data_size, unsigned char*& data_out, int start_iv_block)
|
||||
{
|
||||
data_out = NULL;
|
||||
|
||||
@ -592,7 +595,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;
|
||||
|
||||
while (pos < size)
|
||||
{
|
||||
@ -611,50 +614,34 @@ 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
|
||||
{
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
int i = 0, sz = 512, pos = 0;
|
||||
|
||||
int i = start_iv_block, sz = 512, pos = 0;
|
||||
|
||||
_buf pHashBuf = HashAppend(pSalt, pPassword, cryptData.hashAlgorithm);
|
||||
|
||||
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);
|
||||
_buf block ((unsigned char*)&i, 4, false);
|
||||
|
||||
DecryptCipher(empty, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
_buf pDecryptedKey = HashAppend( pHashBuf, block, cryptData.hashAlgorithm);
|
||||
|
||||
CorrectHashSize(pDecryptedKey, cryptData.keySize, 0);
|
||||
if (cryptData.keySize == 5)
|
||||
CorrectHashSize(pDecryptedKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
pos += sz; i++;
|
||||
CipherARCFOUR rc4;
|
||||
|
||||
rc4.Init(CipherARCFOUR::rtl_Cipher_DirectionDecode, pDecryptedKey.ptr, pDecryptedKey.size, 0, 0);
|
||||
rc4.Decode(data_inp + pos, sz, data_out + pos, sz);
|
||||
|
||||
pos += sz, i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
//using Microsoft.Office.Interop.Word;
|
||||
|
||||
namespace WindowsFormsApplication1
|
||||
{
|
||||
@ -149,7 +149,17 @@ namespace WindowsFormsApplication1
|
||||
}
|
||||
numBytesToRead = bytes.Length;
|
||||
|
||||
textBox2.Text = Convert.ToBase64String(bytes, Base64FormattingOptions.None);
|
||||
//textBox2.Text = Convert.ToBase64String(bytes, Base64FormattingOptions.None);
|
||||
string s = "static const unsigned char c_res[" + Convert.ToString(bytes.Length) + "] = {";
|
||||
int nLen = bytes.Length;
|
||||
for (int i = 0; i < nLen; i++)
|
||||
{
|
||||
s += Convert.ToString(bytes[i]);
|
||||
if (i != (nLen - 1))
|
||||
s += ",";
|
||||
}
|
||||
s += "};";
|
||||
textBox2.Text = s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user