mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-25 03:13:02 +08:00
Compare commits
9 Commits
core-win-6
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| b1d406b448 | |||
| ea37eab86e | |||
| d045609523 | |||
| 9336448ca9 | |||
| 5830e7824a | |||
| 821feb51b5 | |||
| 547979cd9b | |||
| c4481eb125 | |||
| ad0f2c89e0 |
@ -35,143 +35,148 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream )
|
||||
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream ) : bStandard(false), bXOR(false), bAES(false)
|
||||
{
|
||||
VirtualStreamReader tStream( tableStream, 0, fib->m_bOlderVersion);
|
||||
|
||||
if (fib->m_FibBase.fObfuscation)
|
||||
if (fib->m_FibBase.fObfuscation || fib->m_bOlderVersion)
|
||||
{
|
||||
//xor
|
||||
return;
|
||||
}
|
||||
unsigned short vMajor = tStream.ReadUInt16();
|
||||
unsigned short vMinor = tStream.ReadUInt16();
|
||||
|
||||
if(0x0001 == vMajor) // RC4 encryption header structure
|
||||
{// fib->m_FibBase.lKey == 52
|
||||
bStandard = true;
|
||||
|
||||
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
|
||||
bXOR = true;
|
||||
|
||||
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
|
||||
crypt_data_xor.key = fib->m_FibBase.lKey >> 16;
|
||||
crypt_data_xor.hash = fib->m_FibBase.lKey - (crypt_data_xor.key << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
bStandard = false;
|
||||
crypt_data_aes.bAgile = false;
|
||||
unsigned short vMajor = tStream.ReadUInt16();
|
||||
unsigned short vMinor = tStream.ReadUInt16();
|
||||
|
||||
unsigned short flags = tStream.ReadUInt32();
|
||||
unsigned char *pDataRead = NULL;
|
||||
if(0x0001 == vMajor) // RC4 encryption header structure
|
||||
{// fib->m_FibBase.lKey == 52
|
||||
bStandard = true;
|
||||
|
||||
bool fCryptoAPI = GETBIT(flags, 1);
|
||||
bool fDocProps = GETBIT(flags, 2);
|
||||
bool fExternal = GETBIT(flags, 3);
|
||||
bool fAES = GETBIT(flags, 4);
|
||||
|
||||
//EncryptionHeader
|
||||
int HeaderSize = tStream.ReadUInt32();
|
||||
int Flags = tStream.ReadUInt32();
|
||||
int SizeExtra = tStream.ReadUInt32();
|
||||
int AlgID = tStream.ReadUInt32();
|
||||
int AlgIDHash = tStream.ReadUInt32();
|
||||
int KeySize = tStream.ReadUInt32();
|
||||
int ProviderType= tStream.ReadUInt32();
|
||||
int Reserved1 = tStream.ReadUInt32();
|
||||
int Reserved2 = tStream.ReadUInt32();
|
||||
|
||||
int pos = tStream.GetPosition();
|
||||
int size = tStream.GetSize();
|
||||
|
||||
std::vector<char> dataCSPName;
|
||||
while(pos < size - 1)
|
||||
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
|
||||
bAES = true;
|
||||
crypt_data_aes.bAgile = false;
|
||||
|
||||
unsigned short flags = tStream.ReadUInt32();
|
||||
unsigned char *pDataRead = NULL;
|
||||
|
||||
bool fCryptoAPI = GETBIT(flags, 1);
|
||||
crypt_data_aes.fDocProps = GETBIT(flags, 2);
|
||||
bool fExternal = GETBIT(flags, 3);
|
||||
bool fAES = GETBIT(flags, 4);
|
||||
|
||||
//EncryptionHeader
|
||||
int HeaderSize = tStream.ReadUInt32();
|
||||
int Flags = tStream.ReadUInt32();
|
||||
int SizeExtra = tStream.ReadUInt32();
|
||||
int AlgID = tStream.ReadUInt32();
|
||||
int AlgIDHash = tStream.ReadUInt32();
|
||||
int KeySize = tStream.ReadUInt32();
|
||||
int ProviderType= tStream.ReadUInt32();
|
||||
int Reserved1 = tStream.ReadUInt32();
|
||||
int Reserved2 = tStream.ReadUInt32();
|
||||
|
||||
int pos = tStream.GetPosition();
|
||||
int size = tStream.GetSize();
|
||||
|
||||
std::vector<char> dataCSPName;
|
||||
while(pos < size - 1)
|
||||
{
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pos+=2;//unicode null-terminate string
|
||||
}
|
||||
//EncryptionVerifier
|
||||
crypt_data_aes.saltSize = tStream.ReadUInt32();
|
||||
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pDataRead = tStream.ReadBytes(0x10, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
crypt_data_aes.hashSize = tStream.ReadUInt32();
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
|
||||
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pos = tStream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
crypt_data_aes.spinCount = 0;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x0000:
|
||||
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;
|
||||
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;
|
||||
crypt_data_aes.keySize = 128 /8;
|
||||
break;
|
||||
case 0x660F:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 192 /8;
|
||||
break;
|
||||
case 0x6610:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 256 /8;
|
||||
break;
|
||||
}
|
||||
pos+=2;//unicode null-terminate string
|
||||
}
|
||||
//EncryptionVerifier
|
||||
crypt_data_aes.saltSize = tStream.ReadUInt32();
|
||||
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pDataRead = tStream.ReadBytes(0x10, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
crypt_data_aes.hashSize = tStream.ReadUInt32();
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
|
||||
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
|
||||
delete pDataRead;
|
||||
//switch(ProviderType)
|
||||
//{
|
||||
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
//}
|
||||
}
|
||||
|
||||
pos = tStream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
crypt_data_aes.spinCount = 0;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x0000:
|
||||
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;
|
||||
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;
|
||||
crypt_data_aes.keySize = 128 /8;
|
||||
break;
|
||||
case 0x660F:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 192 /8;
|
||||
break;
|
||||
case 0x6610:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 256 /8;
|
||||
break;
|
||||
}
|
||||
|
||||
//switch(ProviderType)
|
||||
//{
|
||||
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +52,10 @@ namespace DocFileFormat
|
||||
private:
|
||||
CRYPT::_rc4CryptData crypt_data_rc4;
|
||||
CRYPT::_ecmaCryptData crypt_data_aes;
|
||||
CRYPT::_xorCryptData crypt_data_xor;
|
||||
|
||||
bool bStandard;
|
||||
bool bXOR;
|
||||
bool bAES;
|
||||
};
|
||||
}
|
||||
|
||||
@ -531,7 +531,6 @@ namespace DocFileFormat
|
||||
{
|
||||
if (m_FibBase.nFib > 0 && m_FibBase.nFib <= Fib1995)
|
||||
{
|
||||
m_RgLw97.cbMac = reader.ReadInt32();//32
|
||||
/*m_FibWord97.fcSpare0 = */reader.ReadInt32();
|
||||
/*m_FibWord97.fcSpare1 = */reader.ReadInt32();
|
||||
/*m_FibWord97.fcSpare2 = */reader.ReadInt32();
|
||||
@ -1220,9 +1219,12 @@ namespace DocFileFormat
|
||||
if (m_FibBase.nFib > Fib1995)
|
||||
csw = reader.ReadUInt16(); //32
|
||||
|
||||
if (m_FibBase.nFib > Fib1995 || m_FibBase.nFib == 0)
|
||||
{
|
||||
|
||||
if (m_FibBase.nFib > 0 && m_FibBase.nFib <= Fib1995)
|
||||
{
|
||||
m_RgLw97.cbMac = reader.ReadInt32();//32
|
||||
}
|
||||
else if (m_FibBase.nFib > Fib1995 || m_FibBase.nFib == 0)
|
||||
{
|
||||
//read the RgW97
|
||||
reader.ReadBytes( 26, false ); //34
|
||||
m_RgW97.lidFE = reader.ReadUInt16(); //60
|
||||
@ -1231,7 +1233,7 @@ namespace DocFileFormat
|
||||
|
||||
//read the RgLW97
|
||||
|
||||
m_RgLw97.cbMac = reader.ReadInt32(); //64
|
||||
m_RgLw97.cbMac = reader.ReadInt32(); //64
|
||||
}
|
||||
reset(reader);
|
||||
}
|
||||
|
||||
@ -41,23 +41,20 @@ namespace DocFileFormat
|
||||
|
||||
GeometryBooleanProperties(unsigned int op)
|
||||
{
|
||||
fFillOK = FormatUtils::BitmaskToBool (op, 0x1);
|
||||
fFillShadeShapeOK = FormatUtils::BitmaskToBool (op, 0x2);
|
||||
fGtextOK = FormatUtils::BitmaskToBool (op, 0x4);
|
||||
fLineOK = FormatUtils::BitmaskToBool (op, 0x8);
|
||||
f3DOK = FormatUtils::BitmaskToBool (op, 0x10);
|
||||
fShadowOK = FormatUtils::BitmaskToBool (op, 0x20);
|
||||
|
||||
fUsefFillOK = FormatUtils::BitmaskToBool (op, 0x10000);
|
||||
fUsefFillShadeShapeOK = FormatUtils::BitmaskToBool (op, 0x20000);
|
||||
fUsefGtextOK = FormatUtils::BitmaskToBool (op, 0x40000);
|
||||
fUsefLineOK = FormatUtils::BitmaskToBool (op, 0x80000);
|
||||
fUsef3DOK = FormatUtils::BitmaskToBool (op, 0x100000);
|
||||
fUsefShadowOK = FormatUtils::BitmaskToBool (op, 0x200000);
|
||||
fUsefShadowOK = GETBIT(op, 8);
|
||||
fUsef3DOK = GETBIT(op, 9);
|
||||
fUsefLineOK = GETBIT(op, 10);
|
||||
fUsefGtextOK = GETBIT(op, 11);
|
||||
fUsefFillShadeShapeOK = GETBIT(op, 12);
|
||||
fUsefFillOK = GETBIT(op, 13);
|
||||
|
||||
fShadowOK = GETBIT(op, 22);
|
||||
f3DOK = GETBIT(op, 23);
|
||||
fLineOK = GETBIT(op, 24);
|
||||
fGtextOK = GETBIT(op, 25);
|
||||
fFillShadeShapeOK = GETBIT(op, 26);
|
||||
fFillOK = GETBIT(op, 27);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool fFillOK;
|
||||
bool fFillShadeShapeOK;
|
||||
bool fGtextOK;
|
||||
|
||||
@ -53,7 +53,6 @@ namespace DocFileFormat
|
||||
|
||||
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
|
||||
{
|
||||
int offset = 6;
|
||||
|
||||
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
|
||||
{
|
||||
@ -63,6 +62,7 @@ namespace DocFileFormat
|
||||
|
||||
unsigned short cbElement = 4;
|
||||
|
||||
int offset = 6;
|
||||
if (cb == 0xfff0)
|
||||
cbElement = 2;
|
||||
|
||||
@ -86,24 +86,27 @@ namespace DocFileFormat
|
||||
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
|
||||
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
|
||||
|
||||
unsigned short cbElement = cb;
|
||||
unsigned short cbElement = 4;
|
||||
|
||||
if (cb == 0xfff0)
|
||||
cbElement = 4;
|
||||
cbElement = 2;
|
||||
|
||||
int offset = 6;
|
||||
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
{
|
||||
POINT point;
|
||||
if (cbElement == 4)
|
||||
{
|
||||
point.x = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement), pVerticesSize - offset);
|
||||
point.y = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
|
||||
point.x = FormatUtils::BytesToInt32(pVertices + offset, 0, pVerticesSize - offset);
|
||||
point.y = FormatUtils::BytesToInt32(pVertices + offset + cbElement, 0 , pVerticesSize - offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
point.x = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement), pVerticesSize - offset);
|
||||
point.y = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
|
||||
point.x = FormatUtils::BytesToInt16(pVertices + offset, 0, pVerticesSize - offset);
|
||||
point.y = FormatUtils::BytesToInt16(pVertices + offset + cbElement, 0 , pVerticesSize - offset);
|
||||
}
|
||||
offset += cbElement * 2;
|
||||
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
if (lMinF <= point.x)
|
||||
|
||||
@ -71,7 +71,6 @@ namespace DocFileFormat
|
||||
fUsefLockAgainstUngrouping = FormatUtils::BitmaskToBool(op,0x2000000);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool fLockAgainstGrouping;
|
||||
bool fLockAdjustHandles;
|
||||
|
||||
@ -49,15 +49,15 @@ namespace DocFileFormat
|
||||
PropertyId_fFlipH=63,
|
||||
|
||||
//Protection
|
||||
fLockAgainstUngrouping=118,
|
||||
fLockRotation=119,
|
||||
fLockAspectRatio=120,
|
||||
fLockPosition=121,
|
||||
fLockAgainstSelect=122,
|
||||
fLockCropping=123,
|
||||
fLockVertices=124,
|
||||
fLockText=125,
|
||||
fLockAdjustHandles=126,
|
||||
//fLockAgainstUngrouping=118,
|
||||
//fLockRotation=119,
|
||||
//fLockAspectRatio=120,
|
||||
//fLockPosition=121,
|
||||
//fLockAgainstSelect=122,
|
||||
//fLockCropping=123,
|
||||
//fLockVertices=124,
|
||||
//fLockText=125,
|
||||
//fLockAdjustHandles=126,
|
||||
protectionBooleans=127,
|
||||
|
||||
//Text
|
||||
@ -75,10 +75,7 @@ namespace DocFileFormat
|
||||
txdir=139,
|
||||
ccol=140,
|
||||
dzColMargin=141,
|
||||
fSelectText=187,
|
||||
fAutoTextMargin=188,
|
||||
fRotateText=189,
|
||||
fFitShapeToText=190,
|
||||
|
||||
textBooleanProperties=191,
|
||||
|
||||
//GeoText
|
||||
@ -89,21 +86,21 @@ namespace DocFileFormat
|
||||
gtextSpacing=196,
|
||||
gtextFont=197,
|
||||
gtextCSSFont=198,
|
||||
gtextFReverseRows=240,
|
||||
fGtext=241,
|
||||
gtextFVertical=242,
|
||||
gtextFKern=243,
|
||||
gtextFTight=244,
|
||||
gtextFStretch=245,
|
||||
gtextFShrinkFit=246,
|
||||
gtextFBestFit=247,
|
||||
gtextFNormalize=248,
|
||||
gtextFDxMeasure=249,
|
||||
gtextFBold=250,
|
||||
gtextFItalic=251,
|
||||
gtextFUnderline=252,
|
||||
gtextFShadow=253,
|
||||
gtextFSmallcaps=254,
|
||||
//gtextFReverseRows=240,
|
||||
//fGtext=241,
|
||||
//gtextFVertical=242,
|
||||
//gtextFKern=243,
|
||||
//gtextFTight=244,
|
||||
//gtextFStretch=245,
|
||||
//gtextFShrinkFit=246,
|
||||
//gtextFBestFit=247,
|
||||
//gtextFNormalize=248,
|
||||
//gtextFDxMeasure=249,
|
||||
//gtextFBold=250,
|
||||
//gtextFItalic=251,
|
||||
//gtextFUnderline=252,
|
||||
//gtextFShadow=253,
|
||||
//gtextFSmallcaps=254,
|
||||
geometryTextBooleanProperties=255,
|
||||
|
||||
//BLIP
|
||||
@ -128,10 +125,7 @@ namespace DocFileFormat
|
||||
movie=274,
|
||||
pictureRecolor=282,
|
||||
picturePreserveGrays=313,
|
||||
fRewind=314,
|
||||
fLooping=315,
|
||||
pictureGray=317,
|
||||
pictureBiLevel=318,
|
||||
|
||||
blipBooleanProperties=319,
|
||||
|
||||
//Geometry
|
||||
@ -161,12 +155,7 @@ namespace DocFileFormat
|
||||
pInscribe=343,
|
||||
cxk=344,
|
||||
pFragments=345,
|
||||
fColumnLineOK=377,
|
||||
fShadowOK=378,
|
||||
f3DOK=379,
|
||||
fLineOK=380,
|
||||
fGtextOK=381,
|
||||
fFillShadeShapeOK=382,
|
||||
|
||||
geometryBooleans=383,
|
||||
|
||||
//Fill Style
|
||||
@ -205,12 +194,6 @@ namespace DocFileFormat
|
||||
fillBackColorExt=418,
|
||||
fillBackColorExtMod=420,
|
||||
|
||||
fRecolorFillAsPicture=441,
|
||||
fUseShapeAnchor=442,
|
||||
fFilled=443,
|
||||
fHitTestFill=444,
|
||||
fillShape=445,
|
||||
fillUseRect=446,
|
||||
fillStyleBooleanProperties=447,
|
||||
|
||||
//Line Style
|
||||
@ -238,12 +221,7 @@ namespace DocFileFormat
|
||||
lineEndArrowLength=469,
|
||||
lineJoinStyle=470,
|
||||
lineEndCapStyle=471,
|
||||
fInsetPen=505,
|
||||
fInsetPenOK=506,
|
||||
fArrowheadsOK=507,
|
||||
fLine=508,
|
||||
fHitTestLine=509,
|
||||
lineFillShape=510,
|
||||
|
||||
lineStyleBooleans=511,
|
||||
|
||||
//Shadow Style
|
||||
@ -265,7 +243,7 @@ namespace DocFileFormat
|
||||
shadowWeight=527,
|
||||
shadowOriginX=528,
|
||||
shadowOriginY=529,
|
||||
fShadow=574,
|
||||
|
||||
shadowStyleBooleanProperties=575,
|
||||
|
||||
//Perspective Style
|
||||
@ -281,6 +259,7 @@ namespace DocFileFormat
|
||||
perspectiveWeight=585,
|
||||
perspectiveOriginX=586,
|
||||
perspectiveOriginY=587,
|
||||
|
||||
perspectiveStyleBooleanProperties=639,
|
||||
|
||||
//3D Object
|
||||
@ -293,9 +272,7 @@ namespace DocFileFormat
|
||||
c3DExtrudePlane=646,
|
||||
c3DExtrusionColor=647,
|
||||
c3DCrMod=648,
|
||||
f3D=700,
|
||||
fc3DMetallic=701,
|
||||
fc3DUseExtrusionColor=702,
|
||||
|
||||
threeDObjectBooleanProperties=703,
|
||||
|
||||
//3D Style
|
||||
@ -326,10 +303,7 @@ namespace DocFileFormat
|
||||
c3DFillY=728,
|
||||
c3DFillZ=729,
|
||||
c3DFillIntensity=730,
|
||||
fc3DConstrainRotation=763,
|
||||
fc3DRotationCenterAuto=764,
|
||||
fc3DParallel=765,
|
||||
fc3DKeyHarsh=766,
|
||||
|
||||
threeDStyleBooleanProperties=767,
|
||||
|
||||
//Shape
|
||||
@ -343,14 +317,7 @@ namespace DocFileFormat
|
||||
dgmNodeKind=778,
|
||||
dgmLayoutMRU=779,
|
||||
wzEquationXML=780,
|
||||
fPolicyLabel=822,
|
||||
fPolicyBarcode=823,
|
||||
fFlipHQFE5152=824,
|
||||
fFlipVQFE5152=825,
|
||||
fPreferRelativeResize=827,
|
||||
fLockShapeType=828,
|
||||
fInitiator=829,
|
||||
fDeleteAttachedObject=830,
|
||||
|
||||
shapeBooleans=831,
|
||||
|
||||
//Callout
|
||||
@ -410,16 +377,9 @@ namespace DocFileFormat
|
||||
wzAccessBlob=936,
|
||||
metroBlob=937,
|
||||
dhgt=938,
|
||||
fLayoutInCell=944,
|
||||
fIsBullet=945,
|
||||
fStandardHR=946,
|
||||
fNoshadeHR=947,
|
||||
fHorizRule=948,
|
||||
fUserDrawn=949,
|
||||
fAllowOverlap=950,
|
||||
fReallyHidden=951,
|
||||
fScriptAnchor=952,
|
||||
|
||||
groupShapeBooleans = 959,
|
||||
|
||||
relRotation = 964,
|
||||
|
||||
//Unknown HTML
|
||||
@ -622,7 +582,19 @@ namespace DocFileFormat
|
||||
{
|
||||
if (Options[i]->fComplex && Options[i]->op > 0)
|
||||
{
|
||||
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( Options[i]->op, true ));
|
||||
unsigned int size = Options[i]->op;
|
||||
|
||||
if (Options[i]->pid == 0x0145 ||
|
||||
Options[i]->pid == 0x0146 ||
|
||||
Options[i]->pid == 0x0197 ||
|
||||
Options[i]->pid == 0x0156 ||
|
||||
Options[i]->pid == 0x0155 ||
|
||||
Options[i]->pid == 0x0151 ||
|
||||
Options[i]->pid == 0x0152 ||
|
||||
Options[i]->pid == 0x0157 ||
|
||||
Options[i]->pid == 0x0158)//mso arrays
|
||||
size += 6;
|
||||
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( size, true ));
|
||||
}
|
||||
|
||||
OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* (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
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class ThreeDStyleBooleanProperties
|
||||
{
|
||||
public:
|
||||
ThreeDStyleBooleanProperties(unsigned int op)
|
||||
{
|
||||
fUsefc3DConstrainRotation = GETBIT(op, 0);
|
||||
fUsefc3DRotationCenterAuto = GETBIT(op, 1);
|
||||
fUsefc3DParallel = GETBIT(op, 2);
|
||||
fUsefc3DKeyHarsh = GETBIT(op, 3);
|
||||
fUsefc3DFillHarsh = GETBIT(op, 4);
|
||||
|
||||
fc3DConstrainRotation = GETBIT(op, 16);
|
||||
fc3DRotationCenterAuto = GETBIT(op, 17);
|
||||
fc3DParallel = GETBIT(op, 18);
|
||||
fc3DKeyHarsh = GETBIT(op, 19);
|
||||
fc3DFillHarsh = GETBIT(op, 20);
|
||||
}
|
||||
bool fUsefc3DConstrainRotation;
|
||||
bool fUsefc3DRotationCenterAuto;
|
||||
bool fUsefc3DParallel;
|
||||
bool fUsefc3DKeyHarsh;
|
||||
bool fUsefc3DFillHarsh;
|
||||
|
||||
bool fc3DConstrainRotation;
|
||||
bool fc3DRotationCenterAuto;
|
||||
bool fc3DParallel;
|
||||
bool fc3DKeyHarsh;
|
||||
bool fc3DFillHarsh;
|
||||
};
|
||||
class ThreeDObjectBooleanProperties
|
||||
{
|
||||
public:
|
||||
ThreeDObjectBooleanProperties(unsigned int op)
|
||||
{
|
||||
fUsef3D = GETBIT(op, 0);
|
||||
fUsefc3DMetallic = GETBIT(op, 1);
|
||||
fUsefc3DUseExtrusionColor = GETBIT(op, 2);
|
||||
fUsefc3DLightFace = GETBIT(op, 3);
|
||||
|
||||
// 12 unused
|
||||
|
||||
f3D = GETBIT(op, 16);
|
||||
fc3DMetallic = GETBIT(op, 17);
|
||||
fc3DUseExtrusionColor = GETBIT(op, 18);
|
||||
fc3DLightFace = GETBIT(op, 19);
|
||||
}
|
||||
bool fUsef3D;
|
||||
bool fUsefc3DMetallic;
|
||||
bool fUsefc3DUseExtrusionColor;
|
||||
bool fUsefc3DLightFace;
|
||||
|
||||
bool f3D;
|
||||
bool fc3DMetallic;
|
||||
bool fc3DUseExtrusionColor;
|
||||
bool fc3DLightFace;
|
||||
};
|
||||
}
|
||||
@ -66,25 +66,23 @@ namespace DocFileFormat
|
||||
ole->Program = L"Word.Document";
|
||||
}
|
||||
m_pXmlWriter->WriteNodeBegin( L"o:OLEObject", TRUE );
|
||||
|
||||
int relID = -1;
|
||||
|
||||
if ( ole->bLinked )
|
||||
{
|
||||
int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
|
||||
relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"r:id", ( std::wstring( L"rId" ) + FormatUtils::IntToWideString( relID ) ));
|
||||
m_pXmlWriter->WriteAttribute( L"Type", L"Link" );
|
||||
m_pXmlWriter->WriteAttribute( L"UpdateMode", ole->UpdateMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
int relID = -1;
|
||||
|
||||
{
|
||||
if (ole->isEmbedded)
|
||||
relID = m_context->_docx->RegisterPackage(_caller, ole->ClipboardFormat);
|
||||
else
|
||||
relID = m_context->_docx->RegisterOLEObject(_caller, ole->ClipboardFormat);
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
|
||||
m_pXmlWriter->WriteAttribute( L"Type", L"Embed" );
|
||||
|
||||
copyEmbeddedObject( ole );
|
||||
@ -94,7 +92,8 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"ShapeID", _shapeId);
|
||||
m_pXmlWriter->WriteAttribute( L"DrawAspect", L"Content" );
|
||||
m_pXmlWriter->WriteAttribute( L"ObjectID", ole->ObjectId);
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"o:OLEObject" );
|
||||
}
|
||||
|
||||
@ -165,15 +165,21 @@ namespace DocFileFormat
|
||||
{
|
||||
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
|
||||
|
||||
std::list<std::wstring> entries = storageInp->entries(path);
|
||||
std::list<std::wstring> entries = storageInp->entries_with_prefix(path);
|
||||
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it)
|
||||
{
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ (*it));
|
||||
std::wstring stream_name_open = (*it);
|
||||
std::wstring stream_name_create = (*it);
|
||||
|
||||
if (stream_name_open[0] < 32)
|
||||
stream_name_open = stream_name_open.substr(1);
|
||||
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ stream_name_open);
|
||||
if (stream_inp == NULL)continue;
|
||||
|
||||
POLE::uint64 size = stream_inp->size();
|
||||
|
||||
POLE::Stream *stream_out = new POLE::Stream(storageOut, *it, true, size);
|
||||
POLE::Stream *stream_out = new POLE::Stream(storageOut, stream_name_create, true, size);
|
||||
|
||||
if (stream_out)
|
||||
{
|
||||
|
||||
@ -267,7 +267,6 @@ namespace DocFileFormat
|
||||
}
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"type", std::wstring( L"#" + VMLShapeTypeMapping::GenerateTypeId(&type)));
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
@ -275,15 +274,9 @@ namespace DocFileFormat
|
||||
m_shapeId = L"_x0000_s" + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"type", std::wstring( L"#" + VMLShapeTypeMapping::GenerateTypeId(&type)));
|
||||
|
||||
if (m_isOlePreview)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"o:ole", L"" );
|
||||
}
|
||||
else if (m_isBullete)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"o:bullet", L"1" );
|
||||
}
|
||||
//todooo oбъединить с shape_mapping
|
||||
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
@ -423,6 +416,15 @@ namespace DocFileFormat
|
||||
strStyle += L"width:" + strWidth + L"pt;" + L"height:" + strHeight + L"pt;";
|
||||
m_pXmlWriter->WriteAttribute( L"style", strStyle);
|
||||
|
||||
if (m_isOlePreview)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"o:ole", L"t" );
|
||||
}
|
||||
else if (m_isBullete)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"o:bullet", L"1" );
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if (CopyPicture(pict))
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "OfficeDrawing/Shapetypes/RectangleType.h"
|
||||
#include "OfficeDrawing/Shapetypes/RoundedRectangleType.h"
|
||||
|
||||
#include "OfficeDrawing/threeDBooleanProperties.h"
|
||||
#include "OfficeDrawing/OfficeArtClientTextbox.h"
|
||||
#include "OfficeDrawing/DiagramBooleanProperties.h"
|
||||
#include "OfficeDrawing/GeometryBooleanProperties.h"
|
||||
@ -277,10 +278,13 @@ namespace DocFileFormat
|
||||
double ShadowOriginY = 0;
|
||||
unsigned int xCoord = 0;
|
||||
unsigned int yCoord = 0;
|
||||
bool stroked = true;
|
||||
bool filled = true;
|
||||
|
||||
bool bStroked = true;
|
||||
bool bFilled = true;
|
||||
bool hasTextbox = false;
|
||||
bool layoutInCell = true; //anmeldebogenfos.doc
|
||||
bool b3D = false;
|
||||
bool bShadow = false;
|
||||
|
||||
int ndxTextLeft = -1;
|
||||
int ndyTextTop = -1;
|
||||
@ -292,16 +296,16 @@ namespace DocFileFormat
|
||||
int nAdjValues = 0;
|
||||
int nLTxID = -1;
|
||||
|
||||
std::wstring sTextboxStyle;
|
||||
|
||||
ShadowStyleBooleanProperties shadowBoolean(0);
|
||||
|
||||
std::wstring sTextboxStyle;
|
||||
|
||||
OptionEntryPtr opSegmentInfo;
|
||||
OptionEntryPtr opVerticles;
|
||||
OptionEntryPtr opInscribe;
|
||||
OptionEntryPtr opConnectAngles;
|
||||
OptionEntryPtr opConnectLocs;
|
||||
|
||||
ThreeDStyleBooleanProperties threeDStyleProps_(0);
|
||||
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
OptionEntryPtr & iter = options[i];
|
||||
@ -313,12 +317,19 @@ namespace DocFileFormat
|
||||
GeometryBooleanProperties booleans(iter->op);
|
||||
if (booleans.fUsefLineOK && !booleans.fLineOK)
|
||||
{
|
||||
stroked = false;
|
||||
bStroked = false;
|
||||
}
|
||||
|
||||
if (booleans.fUsefFillOK && !booleans.fFillOK)
|
||||
{
|
||||
filled = false;
|
||||
bFilled = false;
|
||||
}
|
||||
if (booleans.fUsef3DOK && booleans.f3DOK)
|
||||
{
|
||||
b3D = true;
|
||||
}
|
||||
if (booleans.fUsefShadowOK && booleans.fShadowOK)
|
||||
{
|
||||
bShadow = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -327,7 +338,12 @@ namespace DocFileFormat
|
||||
FillStyleBooleanProperties booleans(iter->op);
|
||||
if (booleans.fUsefFilled && !booleans.fFilled)
|
||||
{
|
||||
filled = false;
|
||||
bFilled = false;
|
||||
}
|
||||
|
||||
if (booleans.fUsefUseShapeAnchor && booleans.fUseShapeAnchor)
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"rotate", L"t");
|
||||
}
|
||||
}break;
|
||||
case lineStyleBooleans:
|
||||
@ -335,7 +351,7 @@ namespace DocFileFormat
|
||||
LineStyleBooleanProperties booleans(iter->op);
|
||||
if (booleans.fUsefLine && !booleans.fLine)
|
||||
{
|
||||
stroked = false;
|
||||
bStroked = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -536,6 +552,7 @@ namespace DocFileFormat
|
||||
case fillFocus:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"focus", ( FormatUtils::IntToWideString( iter->op ) + L"%" ));
|
||||
appendValueAttribute(&m_fill, L"focussize", L"");
|
||||
}break;
|
||||
case fillType:
|
||||
{
|
||||
@ -575,7 +592,7 @@ namespace DocFileFormat
|
||||
break;
|
||||
case fillBackOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"opacity2", (FormatUtils::IntToWideString(iter->op) + L"f"));
|
||||
appendValueAttribute(&m_fill, L"o:opacity2", (FormatUtils::IntToWideString(iter->op) + L"f"));
|
||||
}break;
|
||||
// SHADOW
|
||||
case shadowType:
|
||||
@ -620,7 +637,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case shadowStyleBooleanProperties:
|
||||
{
|
||||
shadowBoolean = ShadowStyleBooleanProperties(iter->op);
|
||||
ShadowStyleBooleanProperties props(iter->op);
|
||||
|
||||
}break;
|
||||
// OLE
|
||||
case pictureId:
|
||||
@ -649,11 +667,19 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name));
|
||||
}break;
|
||||
// 3D STYLE
|
||||
case f3D:
|
||||
case threeDStyleBooleanProperties:
|
||||
{
|
||||
threeDStyleProps_ = ThreeDStyleBooleanProperties(iter->op);
|
||||
}break;
|
||||
case threeDObjectBooleanProperties:
|
||||
break;
|
||||
{
|
||||
ThreeDObjectBooleanProperties booleans(iter->op);
|
||||
|
||||
if (booleans.fUsef3D && !booleans.f3D) b3D = false;
|
||||
}break;
|
||||
case c3DRenderMode:
|
||||
{
|
||||
}break;
|
||||
case c3DExtrudeBackward:
|
||||
{
|
||||
EmuValue backwardValue( (int)iter->op );
|
||||
@ -686,28 +712,34 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_3dstyle, L"color", color);
|
||||
}break;
|
||||
case c3DSkewAngle:
|
||||
if (threeDStyleProps_.fUsefc3DParallel && threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
FixedPointNumber skewAngle( iter->op );
|
||||
appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString( skewAngle.ToAngle() ));
|
||||
}break;
|
||||
case c3DXViewpoint:
|
||||
if (threeDStyleProps_.fUsefc3DParallel && !threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
ViewPointX = EmuValue( FixedPointNumber( iter->op ).Integral );
|
||||
}break;
|
||||
case c3DYViewpoint:
|
||||
{
|
||||
if (threeDStyleProps_.fUsefc3DParallel && !threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
ViewPointY = EmuValue( FixedPointNumber( iter->op ).Integral );
|
||||
}break;
|
||||
case c3DZViewpoint:
|
||||
if (threeDStyleProps_.fUsefc3DParallel && !threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
ViewPointZ = EmuValue( FixedPointNumber( iter->op ).Integral );
|
||||
}break;
|
||||
case c3DOriginX:
|
||||
if (threeDStyleProps_.fUsefc3DParallel && !threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
FixedPointNumber dOriginX( iter->op );
|
||||
viewPointOriginX = ( dOriginX.Integral / 65536.0 );
|
||||
}break;
|
||||
case c3DOriginY:
|
||||
if (threeDStyleProps_.fUsefc3DParallel && !threeDStyleProps_.fc3DParallel)
|
||||
{
|
||||
FixedPointNumber dOriginY( iter->op );
|
||||
viewPointOriginY = (dOriginY.Integral / 65536.0 );
|
||||
@ -831,12 +863,12 @@ namespace DocFileFormat
|
||||
xCoord = 21600;
|
||||
yCoord = 21600;
|
||||
}
|
||||
if ( !filled )
|
||||
if ( !bFilled )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"filled", L"f" );
|
||||
}
|
||||
|
||||
if ( !stroked )
|
||||
if ( !bStroked )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"stroked", L"f" );
|
||||
}
|
||||
@ -927,60 +959,59 @@ namespace DocFileFormat
|
||||
// write shadow
|
||||
if (m_shadow.GetAttributeCount() > 0)
|
||||
{
|
||||
if (shadowBoolean.fShadow)
|
||||
{
|
||||
appendValueAttribute(&m_shadow, L"on", L"t" );
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_shadow, L"on", bShadow ? L"t" : L"f" );
|
||||
m_pXmlWriter->WriteString(m_shadow.GetXMLString());
|
||||
}
|
||||
|
||||
//write the viewpoint
|
||||
if ( ( ViewPointX != 0 ) || ( ViewPointY != 0 ) || ( ViewPointZ != 0 ) )
|
||||
{
|
||||
std::wstring viewPoint;
|
||||
|
||||
if ( ViewPointX != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointX ) + L"pt";
|
||||
}
|
||||
viewPoint += L",";
|
||||
if ( ViewPointY != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointY ) + L"pt";
|
||||
}
|
||||
viewPoint += L",";
|
||||
if ( ViewPointZ != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointZ ) + L"pt";
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_3dstyle, L"viewpoint", viewPoint);
|
||||
}
|
||||
// write the viewpointorigin
|
||||
if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) )
|
||||
{
|
||||
std::wstring viewPointOrigin;
|
||||
|
||||
if ( viewPointOriginX != 0 )
|
||||
{
|
||||
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginX, L"%.2f" );
|
||||
}
|
||||
|
||||
if ( viewPointOriginY != 0 )
|
||||
{
|
||||
viewPointOrigin += L",";
|
||||
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, L"%.2f" );
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_3dstyle, L"viewpointorigin", viewPointOrigin);
|
||||
}
|
||||
|
||||
//write 3d style
|
||||
if (m_3dstyle.GetAttributeCount() > 0)
|
||||
{
|
||||
appendValueAttribute(&m_3dstyle, L"v:ext", L"view" );
|
||||
appendValueAttribute(&m_3dstyle, L"on", L"t" );
|
||||
|
||||
//write the viewpoint
|
||||
if ( ( ViewPointX != 0 ) || ( ViewPointY != 0 ) || ( ViewPointZ != 0 ) )
|
||||
if (b3D)
|
||||
{
|
||||
std::wstring viewPoint;
|
||||
|
||||
if ( ViewPointX != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointX ) + L"pt";
|
||||
}
|
||||
viewPoint += L",";
|
||||
if ( ViewPointY != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointY ) + L"pt";
|
||||
}
|
||||
viewPoint += L",";
|
||||
if ( ViewPointZ != 0 )
|
||||
{
|
||||
viewPoint += FormatUtils::IntToWideString( ViewPointZ ) + L"pt";
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_3dstyle, L"viewpoint", viewPoint);
|
||||
appendValueAttribute(&m_3dstyle, L"v:ext", L"view" ); //??? вытащить
|
||||
}
|
||||
// write the viewpointorigin
|
||||
if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) )
|
||||
{
|
||||
std::wstring viewPointOrigin;
|
||||
|
||||
if ( viewPointOriginX != 0 )
|
||||
{
|
||||
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginX, L"%.2f" );
|
||||
}
|
||||
|
||||
if ( viewPointOriginY != 0 )
|
||||
{
|
||||
viewPointOrigin += L",";
|
||||
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, L"%.2f" );
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_3dstyle, L"viewpointorigin", viewPointOrigin);
|
||||
}
|
||||
|
||||
appendValueAttribute(&m_3dstyle, L"on", b3D ? L"t" : L"f" );
|
||||
m_pXmlWriter->WriteString(m_3dstyle.GetXMLString());
|
||||
}
|
||||
// write wrap
|
||||
|
||||
@ -134,10 +134,11 @@ namespace DocFileFormat
|
||||
|
||||
// Path
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:path", true );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"o:extrusionok", L"f");
|
||||
|
||||
if (_isInlineShape)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"o:extrusionok", L"f");
|
||||
m_pXmlWriter->WriteAttribute( L"gradientshapeok", L"t" );
|
||||
m_pXmlWriter->WriteAttribute( L"o:connecttype", L"rect" );
|
||||
}
|
||||
|
||||
@ -174,11 +174,24 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (FIB->m_FibBase.fEncrypted && !FIB->m_bOlderVersion)
|
||||
if (FIB->m_FibBase.fEncrypted)
|
||||
{
|
||||
encryptionHeader = new EncryptionHeader (FIB, TableStream);
|
||||
encryptionHeader = new EncryptionHeader (FIB, TableStream);
|
||||
|
||||
if (encryptionHeader->bStandard)
|
||||
if (encryptionHeader->bXOR)
|
||||
{
|
||||
CRYPT::XORDecryptor Decryptor(1, encryptionHeader->crypt_data_xor.key, encryptionHeader->crypt_data_xor.hash, m_sPassword);
|
||||
|
||||
if (Decryptor.IsVerify() == false)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (m_sPassword.empty() ) return AVS_ERROR_DRM;
|
||||
else return AVS_ERROR_PASSWORD;
|
||||
}
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
}
|
||||
else if (encryptionHeader->bStandard)
|
||||
{
|
||||
CRYPT::RC4Decryptor Decryptor(encryptionHeader->crypt_data_rc4, m_sPassword);
|
||||
|
||||
@ -192,7 +205,7 @@ namespace DocFileFormat
|
||||
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
}
|
||||
else
|
||||
else if (encryptionHeader->bAES)
|
||||
{
|
||||
CRYPT::ECMADecryptor Decryptor;
|
||||
|
||||
@ -208,9 +221,8 @@ namespace DocFileFormat
|
||||
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
|
||||
}
|
||||
|
||||
FIB->reset(VirtualStreamReader(WordDocumentStream, 68, false));
|
||||
FIB->reset(VirtualStreamReader(WordDocumentStream, bOlderVersion ? 36 : 68, false));
|
||||
}
|
||||
else if (FIB->m_FibBase.fEncrypted) return AVS_ERROR_DRM;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
POLE::Stream * Summary = NULL;
|
||||
@ -629,19 +641,37 @@ namespace DocFileFormat
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); ++it )
|
||||
{
|
||||
std::wstring fullname = path + *it;
|
||||
DecryptStream(fullname, storageIn, storageOut, Decryptor );
|
||||
std::wstring fullname_create = path + *it;
|
||||
|
||||
if (it->at(0) < 32)
|
||||
{
|
||||
*it = it->substr(1); // without prefix
|
||||
}
|
||||
std::wstring fullname_open = path + *it;
|
||||
|
||||
bool bDecrypt = false;
|
||||
|
||||
if ( std::wstring::npos != fullname_open.find(L"WordDocument") ||
|
||||
std::wstring::npos != fullname_open.find(L"Data") ||
|
||||
std::wstring::npos != fullname_open.find(L"Table") ||
|
||||
(std::wstring::npos != fullname_open.find(L"SummaryInformation") &&
|
||||
encryptionHeader->bAES && encryptionHeader->crypt_data_aes.fDocProps)
|
||||
)
|
||||
{
|
||||
bDecrypt = true;
|
||||
}
|
||||
DecryptStream(fullname_open, storageIn, fullname_create, storageOut, Decryptor, bDecrypt);
|
||||
}
|
||||
}
|
||||
bool WordDocument::DecryptStream(std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
bool WordDocument::DecryptStream(std::wstring streamName_open, POLE::Storage * storageIn, std::wstring streamName_create, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor, bool bDecrypt)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName_open);
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
POLE::uint64 size_stream = stream->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName_create, true, size_stream);
|
||||
if (!streamNew) return false;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[size_stream];
|
||||
@ -650,9 +680,9 @@ namespace DocFileFormat
|
||||
unsigned char* data_store = NULL;
|
||||
int size_data_store = 0;
|
||||
|
||||
if ( std::wstring::npos != streamName.find(L"WordDocument") )
|
||||
if ( std::wstring::npos != streamName_open.find(L"WordDocument") )
|
||||
{
|
||||
size_data_store = 68;
|
||||
size_data_store = bOlderVersion ? 36 : 68;
|
||||
data_store = new unsigned char[size_data_store];
|
||||
}
|
||||
|
||||
@ -662,14 +692,16 @@ namespace DocFileFormat
|
||||
size_t size_block = 0x200;
|
||||
unsigned long block = 0;
|
||||
|
||||
for (POLE::uint64 pos = 0; pos < size_stream; pos += size_block, block++)
|
||||
for (POLE::uint64 pos = /*bOlderVersion ? size_data_store :*/ 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);
|
||||
if (bDecrypt)
|
||||
{
|
||||
Decryptor->Decrypt((char*)data_stream + pos, size_block, block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_stream, data_store, size_data_store);
|
||||
|
||||
@ -107,7 +107,7 @@ namespace DocFileFormat
|
||||
private:
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
|
||||
bool DecryptStream (std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
bool DecryptStream (std::wstring streamName_open, POLE::Storage * storageIn, std::wstring streamName_create, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor, bool bDecrypt);
|
||||
void DecryptStream (int level, std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
|
||||
inline OfficeArtContent* GetOfficeArt ()
|
||||
|
||||
@ -235,6 +235,7 @@ HEADERS += \
|
||||
../../DocDocxConverter/OfficeDrawing/RecordFactory.h \
|
||||
../../DocDocxConverter/OfficeDrawing/RegularContainer.h \
|
||||
../../DocDocxConverter/OfficeDrawing/ShadowStyleBooleanProperties.h \
|
||||
../../DocDocxConverter/OfficeDrawing/threeDBooleanProperties.h \
|
||||
../../DocDocxConverter/OfficeDrawing/Shape.h \
|
||||
../../DocDocxConverter/OfficeDrawing/ShapeContainer.h \
|
||||
../../DocDocxConverter/OfficeDrawing/ShapeOptions.h \
|
||||
|
||||
@ -895,6 +895,10 @@
|
||||
RelativePath="..\..\DocDocxConverter\OfficeDrawing\SplitMenuColorContainer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\DocDocxConverter\OfficeDrawing\threeDBooleanProperties.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\DocDocxConverter\OfficeDrawing\UnknownRecord.h"
|
||||
>
|
||||
|
||||
@ -57,7 +57,7 @@ namespace PPTX
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
|
||||
Color.fromXML(oReader);
|
||||
}
|
||||
}
|
||||
virtual OOX::EElementType getType () const
|
||||
|
||||
@ -115,10 +115,14 @@ namespace PPTX
|
||||
}
|
||||
else
|
||||
{
|
||||
Logic::BuClr* pClr = new Logic::BuClr();
|
||||
pReader->Skip(5); // len + type(0)
|
||||
pClr->Color.fromPPTY(pReader);
|
||||
m_Color.reset(pClr);
|
||||
LONG len = pReader->GetLong();
|
||||
if(len > 0)
|
||||
{
|
||||
Logic::BuClr* pClr = new Logic::BuClr();
|
||||
pReader->Skip(1); // type(0)
|
||||
pClr->Color.fromPPTY(pReader);
|
||||
m_Color.reset(pClr);
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
|
||||
@ -120,7 +120,7 @@ namespace PPTX
|
||||
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
std::wstring strNamespace = XmlUtils::GetNamespace(oReader.GetName());
|
||||
|
||||
if (L"xfrm" == strName && strNamespace != L"xdr")
|
||||
if (L"xfrm" == strName)
|
||||
xfrm = oReader;
|
||||
else if (L"cNvGraphicFramePr" == strName)
|
||||
nvGraphicFramePr.cNvGraphicFramePr.fromXML( oReader );
|
||||
@ -320,7 +320,7 @@ namespace PPTX
|
||||
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
|
||||
std::wstring strNamespace = XmlUtils::GetNamespace(oNode.GetName());
|
||||
|
||||
if (L"xfrm" == strName && strNamespace != L"xdr")
|
||||
if (L"xfrm" == strName)
|
||||
xfrm = oNode;
|
||||
else if (L"nvGraphicFramePr" == strName)
|
||||
nvGraphicFramePr = oNode;
|
||||
|
||||
@ -60,7 +60,7 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
std::wstring dstPath;
|
||||
|
||||
bool bMacros = true;
|
||||
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", L"C:\\Windows\\Temp", NULL, bMacros);
|
||||
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"2222", L"C:\\Windows\\Fonts", L"C:\\Windows\\Temp", NULL, bMacros);
|
||||
|
||||
if (bMacros)
|
||||
{
|
||||
|
||||
@ -56,6 +56,8 @@ CFRecord::CFRecord(CFStreamPtr stream, GlobalWorkbookInfoPtr global_info)
|
||||
stream->read(data_, size_);
|
||||
if(global_info->decryptor && 0 != size_)
|
||||
{
|
||||
size_t block_size = global_info->Version == 0x0500 ? 16 : 1024;
|
||||
|
||||
switch (type_id_) // this would decrease number of checks
|
||||
{
|
||||
case rt_BOF:
|
||||
@ -67,11 +69,16 @@ CFRecord::CFRecord(CFStreamPtr stream, GlobalWorkbookInfoPtr global_info)
|
||||
case rt_RRDHead:
|
||||
break;
|
||||
case rt_BoundSheet8:
|
||||
global_info->decryptor->Decrypt(data_ + sizeof(unsigned int), size_ - sizeof(unsigned int), rec_data_pos + sizeof(unsigned int), 1024);
|
||||
break;
|
||||
{
|
||||
if (global_info->Version == 0x0500)
|
||||
global_info->decryptor->Decrypt(data_/* + sizeof(unsigned int)*/, size_/* - sizeof(unsigned int)*/, rec_data_pos, block_size);
|
||||
else
|
||||
global_info->decryptor->Decrypt(data_ + sizeof(unsigned int), size_ - sizeof(unsigned int), rec_data_pos + sizeof(unsigned int), block_size);
|
||||
}break;
|
||||
default:
|
||||
global_info->decryptor->Decrypt(data_, size_, rec_data_pos, 1024);
|
||||
break;
|
||||
{
|
||||
global_info->decryptor->Decrypt(data_, size_, rec_data_pos, block_size);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,20 +64,21 @@ namespace CRYPT
|
||||
} EncryptedVerifierHash;
|
||||
};
|
||||
|
||||
struct _xorCryptData
|
||||
{
|
||||
unsigned short key;
|
||||
unsigned short hash;
|
||||
};
|
||||
|
||||
class Crypt
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Init(const unsigned long val) = 0;
|
||||
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size) = 0;
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index) = 0;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RC4,
|
||||
RC4CryptoAPI,
|
||||
XOR
|
||||
} crypt_type;
|
||||
|
||||
virtual bool IsVerify() = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "Decryptor.h"
|
||||
#include "RC4Crypt.h"
|
||||
#include "XORCrypt.h"
|
||||
#include <Logic/Biff_structures/RC4EncryptionHeader.h>
|
||||
|
||||
namespace CRYPT
|
||||
@ -64,6 +65,43 @@ namespace CRYPT
|
||||
if (crypt) return crypt->IsVerify();
|
||||
else return false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
XORDecryptor::XORDecryptor(int type, unsigned short key, unsigned short hash, std::wstring password) :
|
||||
crypt(new XORCrypt(type, key, hash, password))
|
||||
{
|
||||
nKey = key;
|
||||
nHash = hash;
|
||||
nType = type;
|
||||
}
|
||||
|
||||
void XORDecryptor::Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size)
|
||||
{
|
||||
crypt->Decrypt(data, size, stream_pos, block_size);
|
||||
}
|
||||
void XORDecryptor::Decrypt(char* data, const size_t size, const unsigned long block_index)
|
||||
{
|
||||
crypt->Decrypt(data, size, block_index);
|
||||
}
|
||||
bool XORDecryptor::IsVerify()
|
||||
{
|
||||
return crypt->IsVerify();
|
||||
}
|
||||
|
||||
bool XORDecryptor::SetPassword(std::wstring password)
|
||||
{
|
||||
crypt.reset();
|
||||
crypt = CryptPtr(new XORCrypt(nType, nKey, nHash, password));
|
||||
|
||||
if (crypt) return crypt->IsVerify();
|
||||
else return false;
|
||||
}
|
||||
|
||||
void XORDecryptor::Init(const unsigned long val)
|
||||
{
|
||||
crypt->Init(val);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -37,11 +37,36 @@
|
||||
|
||||
namespace CRYPT
|
||||
{
|
||||
class XORDecryptor : public Decryptor
|
||||
{
|
||||
public:
|
||||
XORDecryptor(int type, unsigned short key, unsigned short hash, std::wstring password);
|
||||
|
||||
virtual void Init(const unsigned long val);
|
||||
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size);
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index);
|
||||
|
||||
virtual bool SetPassword(std::wstring password);
|
||||
|
||||
virtual bool IsVerify();
|
||||
|
||||
private:
|
||||
CryptPtr crypt;
|
||||
unsigned short nKey;
|
||||
unsigned short nHash;
|
||||
unsigned short nType;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<XORDecryptor> XORDecryptorPtr;
|
||||
|
||||
class RC4Decryptor : public Decryptor
|
||||
{
|
||||
public:
|
||||
RC4Decryptor(_rc4CryptData & header, std::wstring password);
|
||||
|
||||
virtual void Init(const unsigned long val){}
|
||||
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size);
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index);
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ class RC4Crypt : public Crypt
|
||||
public:
|
||||
RC4Crypt(CRYPT::_rc4CryptData & data, std::wstring password);
|
||||
|
||||
virtual void Init(const unsigned long val){}
|
||||
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size);
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index);
|
||||
|
||||
|
||||
254
ASCOfficeXlsFile2/source/XlsFormat/Crypt/XORCrypt.cpp
Normal file
254
ASCOfficeXlsFile2/source/XlsFormat/Crypt/XORCrypt.cpp
Normal file
@ -0,0 +1,254 @@
|
||||
/*
|
||||
* (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 "XORCrypt.h"
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
typedef unsigned char SVBT16[2];
|
||||
inline void ShortToSVBT16( unsigned short n, SVBT16 p ) { p[0] = (unsigned char) n;
|
||||
p[1] = (unsigned char)(n >> 8); }
|
||||
|
||||
template< typename Type >
|
||||
inline void lclRotateLeft( Type& rnValue, int nBits )
|
||||
{
|
||||
//OSL_ASSERT(
|
||||
// nBits >= 0 &&
|
||||
// sal::static_int_cast< unsigned int >(nBits) < sizeof( Type ) * 8 );
|
||||
rnValue = static_cast< Type >( (rnValue << nBits) | (rnValue >> (sizeof( Type ) * 8 - nBits)) );
|
||||
}
|
||||
|
||||
template< typename Type >
|
||||
inline void lclRotateLeft( Type& rnValue, unsigned char nBits, unsigned char nWidth )
|
||||
{
|
||||
//OSL_ASSERT( (nBits < nWidth) && (nWidth < sizeof( Type ) * 8) );
|
||||
Type nMask = static_cast< Type >( (1UL << nWidth) - 1 );
|
||||
rnValue = static_cast< Type >(
|
||||
((rnValue << nBits) | ((rnValue & nMask) >> (nWidth - nBits))) & nMask );
|
||||
}
|
||||
namespace CRYPT
|
||||
{
|
||||
size_t lclGetLen( const unsigned char* pnPassData, size_t nBufferSize )
|
||||
{
|
||||
size_t nLen = 0;
|
||||
while( (nLen < nBufferSize) && pnPassData[ nLen ] ) ++nLen;
|
||||
return nLen;
|
||||
}
|
||||
|
||||
unsigned short lclGetKey( const unsigned char* pnPassData, size_t nBufferSize )
|
||||
{
|
||||
size_t nLen = lclGetLen( pnPassData, nBufferSize );
|
||||
if( !nLen ) return 0;
|
||||
|
||||
unsigned short nKey = 0;
|
||||
unsigned short nKeyBase = 0x8000;
|
||||
unsigned short nKeyEnd = 0xFFFF;
|
||||
|
||||
const unsigned char* pnChar = pnPassData + nLen - 1;
|
||||
for( size_t nIndex = 0; nIndex < nLen; ++nIndex, --pnChar )
|
||||
{
|
||||
unsigned char cChar = *pnChar & 0x7F;
|
||||
for( unsigned char nBit = 0; nBit < 8; ++nBit )
|
||||
{
|
||||
lclRotateLeft( nKeyBase, 1 );
|
||||
if( nKeyBase & 1 ) nKeyBase ^= 0x1020;
|
||||
if( cChar & 1 ) nKey ^= nKeyBase;
|
||||
cChar >>= 1;
|
||||
lclRotateLeft( nKeyEnd, 1 );
|
||||
if( nKeyEnd & 1 ) nKeyEnd ^= 0x1020;
|
||||
}
|
||||
}
|
||||
return nKey ^ nKeyEnd;
|
||||
}
|
||||
|
||||
unsigned short lclGetHash( const unsigned char* pnPassData, size_t nBufferSize )
|
||||
{
|
||||
size_t nLen = lclGetLen( pnPassData, nBufferSize );
|
||||
|
||||
unsigned short nHash = static_cast< unsigned short >( nLen );
|
||||
if( nLen )
|
||||
nHash ^= 0xCE4B;
|
||||
|
||||
const unsigned char* pnChar = pnPassData;
|
||||
for( size_t nIndex = 0; nIndex < nLen; ++nIndex, ++pnChar )
|
||||
{
|
||||
unsigned short cChar = *pnChar;
|
||||
unsigned char nRot = static_cast< unsigned char >( (nIndex + 1) % 15 );
|
||||
lclRotateLeft( cChar, nRot, 15 );
|
||||
nHash ^= cChar;
|
||||
}
|
||||
return nHash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
XORCrypt::XORCrypt(int type, unsigned short key, unsigned short hash, std::wstring password) :
|
||||
m_nOffset(0),
|
||||
m_nKey(0),
|
||||
m_nHash(0)
|
||||
{
|
||||
if (type == 1) m_nRotateDistance = 7; //doc
|
||||
else if (type == 2) m_nRotateDistance = 2; //xls
|
||||
|
||||
memset( m_pnKey, 0, sizeof( m_pnKey ) );
|
||||
|
||||
m_VerifyPassword = false;
|
||||
|
||||
size_t nLen = password.length();
|
||||
if (nLen > 16) return;
|
||||
|
||||
m_sPassword = std::string(password.begin(), password.end());
|
||||
|
||||
unsigned char* pnPassData = (unsigned char*)m_sPassword.c_str();
|
||||
|
||||
m_nKey = lclGetKey( pnPassData, 16 );
|
||||
m_nHash = lclGetHash( pnPassData, 16 );
|
||||
|
||||
memcpy( m_pnKey, pnPassData, 16 );
|
||||
|
||||
static const unsigned char spnFillChars[] =
|
||||
{
|
||||
0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00
|
||||
};
|
||||
|
||||
nLen = lclGetLen( pnPassData, 16 );
|
||||
|
||||
const unsigned char* pnFillChar = spnFillChars;
|
||||
|
||||
for ( size_t nIndex = nLen; nIndex < sizeof( m_pnKey ); ++nIndex, ++pnFillChar )
|
||||
m_pnKey[ nIndex ] = *pnFillChar;
|
||||
|
||||
SVBT16 pnOrigKey;
|
||||
ShortToSVBT16( m_nKey, pnOrigKey );
|
||||
|
||||
unsigned char* pnKeyChar = m_pnKey;
|
||||
for ( size_t nIndex = 0; nIndex < sizeof( m_pnKey ); ++nIndex, ++pnKeyChar )
|
||||
{
|
||||
*pnKeyChar ^= pnOrigKey[ nIndex & 0x01 ];
|
||||
lclRotateLeft( *pnKeyChar, m_nRotateDistance );
|
||||
}
|
||||
|
||||
m_VerifyPassword = (key == m_nKey) && (hash == m_nHash);
|
||||
}
|
||||
|
||||
|
||||
bool XORCrypt::IsVerify()
|
||||
{
|
||||
return m_VerifyPassword;
|
||||
}
|
||||
void XORCrypt::Init(const unsigned long val)
|
||||
{
|
||||
m_nOffset = val & 0x0F;
|
||||
}
|
||||
void XORCrypt::Decrypt(char* data, const size_t size, const unsigned long block_index)
|
||||
{
|
||||
unsigned char* pnData = (unsigned char*)data;
|
||||
|
||||
const unsigned char* pnCurrKey = m_pnKey + m_nOffset;
|
||||
const unsigned char* pnKeyLast = m_pnKey + 0x0F;
|
||||
|
||||
if (m_nRotateDistance == 7)
|
||||
{
|
||||
for( const unsigned char* pnDataEnd = pnData + size; pnData < pnDataEnd; ++pnData )
|
||||
{
|
||||
const unsigned char cChar = *pnData ^ *pnCurrKey;
|
||||
if (*pnData && cChar)
|
||||
*pnData = cChar;
|
||||
|
||||
if( pnCurrKey < pnKeyLast )
|
||||
++pnCurrKey;
|
||||
else
|
||||
pnCurrKey = m_pnKey;
|
||||
}
|
||||
}
|
||||
if (m_nRotateDistance == 2)
|
||||
{
|
||||
for( const unsigned char* pnDataEnd = pnData + size; pnData < pnDataEnd; ++pnData )
|
||||
{
|
||||
lclRotateLeft( *pnData, 3 );
|
||||
*pnData ^= *pnCurrKey;
|
||||
|
||||
if( pnCurrKey < pnKeyLast )
|
||||
++pnCurrKey;
|
||||
else
|
||||
pnCurrKey = m_pnKey;
|
||||
}
|
||||
}
|
||||
|
||||
Skip(size);
|
||||
}
|
||||
void XORCrypt::Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size)
|
||||
{
|
||||
Init(stream_pos + size);
|
||||
|
||||
unsigned char* pnData = (unsigned char*)data;
|
||||
|
||||
const unsigned char* pnCurrKey = m_pnKey + m_nOffset;
|
||||
const unsigned char* pnKeyLast = m_pnKey + 0x0F;
|
||||
|
||||
if (m_nRotateDistance == 7)
|
||||
{
|
||||
for( const unsigned char* pnDataEnd = pnData + size; pnData < pnDataEnd; ++pnData )
|
||||
{
|
||||
const unsigned char cChar = *pnData ^ *pnCurrKey;
|
||||
if (*pnData && cChar)
|
||||
*pnData = cChar;
|
||||
|
||||
if( pnCurrKey < pnKeyLast )
|
||||
++pnCurrKey;
|
||||
else
|
||||
pnCurrKey = m_pnKey;
|
||||
}
|
||||
}
|
||||
if (m_nRotateDistance == 2)
|
||||
{
|
||||
for( const unsigned char* pnDataEnd = pnData + size; pnData < pnDataEnd; ++pnData )
|
||||
{
|
||||
lclRotateLeft( *pnData, 3 );
|
||||
*pnData ^= *pnCurrKey;
|
||||
|
||||
if( pnCurrKey < pnKeyLast )
|
||||
++pnCurrKey;
|
||||
else
|
||||
pnCurrKey = m_pnKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
void XORCrypt::Skip( size_t size )
|
||||
{
|
||||
m_nOffset = (m_nOffset + size) & 0x0F;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
68
ASCOfficeXlsFile2/source/XlsFormat/Crypt/XORCrypt.h
Normal file
68
ASCOfficeXlsFile2/source/XlsFormat/Crypt/XORCrypt.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* (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 "Crypt.h"
|
||||
#include <Logic/Biff_structures/RC4EncryptionHeader.h>
|
||||
#include "BiffDecoder_RCF.h"
|
||||
|
||||
namespace CRYPT
|
||||
{
|
||||
|
||||
class XORCrypt : public Crypt
|
||||
{
|
||||
public:
|
||||
XORCrypt(int type, unsigned short key, unsigned short hash, std::wstring password);
|
||||
|
||||
virtual void Init(const unsigned long val);
|
||||
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size);
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index);
|
||||
|
||||
virtual bool IsVerify();
|
||||
|
||||
private:
|
||||
void Skip( size_t size );
|
||||
|
||||
unsigned short m_nKey;
|
||||
unsigned short m_nHash;
|
||||
|
||||
std::string m_sPassword;
|
||||
bool m_VerifyPassword;
|
||||
|
||||
unsigned char m_pnKey[ 16 ]; // Encryption key.
|
||||
size_t m_nOffset; // Key offset.
|
||||
int m_nRotateDistance;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CRYPT
|
||||
@ -54,48 +54,51 @@ BaseObjectPtr FilePass::clone()
|
||||
|
||||
void FilePass::readFields(CFRecord& record)
|
||||
{
|
||||
bool bEnabled = false;
|
||||
|
||||
record >> wEncryptionType;
|
||||
|
||||
if(wEncryptionType == 0)
|
||||
if (record.getGlobalWorkbookInfo()->Version == 0x0500)
|
||||
{
|
||||
record >> key;
|
||||
Log::info("FilePass: Encryption type: XOR");
|
||||
return;
|
||||
record >> key.key >> key.verificationBytes;
|
||||
|
||||
record.getGlobalWorkbookInfo()->decryptor =
|
||||
CRYPT::DecryptorPtr(new CRYPT::XORDecryptor(2, key.key, key.verificationBytes, record.getGlobalWorkbookInfo()->password));
|
||||
}
|
||||
else
|
||||
{
|
||||
bEnabled = true;
|
||||
|
||||
majorVer = *record.getCurData<unsigned short>();
|
||||
|
||||
cryptHeaderPtr = CRYPTO::RC4EncryptionHeaderPtr(new CRYPTO::RC4EncryptionHeader());
|
||||
|
||||
cryptHeaderPtr->bStandard = 0x0001 == majorVer ? true : false; // _S2dvT1xU_R3bOPwre4_.xls
|
||||
|
||||
cryptHeaderPtr->load (record);
|
||||
record >> wEncryptionType;
|
||||
|
||||
if (cryptHeaderPtr->bStandard)
|
||||
if(wEncryptionType == 0)
|
||||
{
|
||||
record >> key;
|
||||
|
||||
record.getGlobalWorkbookInfo()->decryptor =
|
||||
CRYPT::DecryptorPtr(new CRYPT::RC4Decryptor(cryptHeaderPtr->crypt_data_rc4, record.getGlobalWorkbookInfo()->password));
|
||||
CRYPT::DecryptorPtr(new CRYPT::XORDecryptor(2, key.key, key.verificationBytes, record.getGlobalWorkbookInfo()->password));
|
||||
}
|
||||
else
|
||||
{
|
||||
record.getGlobalWorkbookInfo()->decryptor =
|
||||
CRYPT::DecryptorPtr(new CRYPT::ECMADecryptor());
|
||||
|
||||
CRYPT::ECMADecryptor *crypter = dynamic_cast<CRYPT::ECMADecryptor *>(record.getGlobalWorkbookInfo()->decryptor.get());
|
||||
majorVer = *record.getCurData<unsigned short>();
|
||||
|
||||
crypter->SetCryptData(cryptHeaderPtr->crypt_data_aes);
|
||||
crypter->SetPassword(record.getGlobalWorkbookInfo()->password);
|
||||
cryptHeaderPtr = CRYPTO::RC4EncryptionHeaderPtr(new CRYPTO::RC4EncryptionHeader());
|
||||
|
||||
cryptHeaderPtr->bStandard = 0x0001 == majorVer ? true : false; // _S2dvT1xU_R3bOPwre4_.xls
|
||||
|
||||
cryptHeaderPtr->load (record);
|
||||
|
||||
if (cryptHeaderPtr->bStandard)
|
||||
{
|
||||
record.getGlobalWorkbookInfo()->decryptor =
|
||||
CRYPT::DecryptorPtr(new CRYPT::RC4Decryptor(cryptHeaderPtr->crypt_data_rc4, record.getGlobalWorkbookInfo()->password));
|
||||
}
|
||||
else
|
||||
{
|
||||
record.getGlobalWorkbookInfo()->decryptor =
|
||||
CRYPT::DecryptorPtr(new CRYPT::ECMADecryptor());
|
||||
|
||||
CRYPT::ECMADecryptor *crypter = dynamic_cast<CRYPT::ECMADecryptor *>(record.getGlobalWorkbookInfo()->decryptor.get());
|
||||
|
||||
crypter->SetCryptData(cryptHeaderPtr->crypt_data_aes);
|
||||
crypter->SetPassword(record.getGlobalWorkbookInfo()->password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bEnabled == false && record.getGlobalWorkbookInfo()->decryptor)
|
||||
record.getGlobalWorkbookInfo()->decryptor.reset();
|
||||
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -515,6 +515,7 @@ void FillStyleBooleanProperties::load(XLS::CFRecord& record)
|
||||
fillShape = GETBIT(op, 2);
|
||||
fHitTestFill = GETBIT(op, 3);
|
||||
fFilled = GETBIT(op, 4);
|
||||
|
||||
fUseShapeAnchor = GETBIT(op, 5);
|
||||
fRecolorFillAsPicture = GETBIT(op, 6);
|
||||
fUsefNoFillHitTest = GETBIT(op, 16);
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
//#include <Logic/Biff_structures/Phs.h>
|
||||
//#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -822,6 +822,7 @@ SOURCES += \
|
||||
../XlsFormat/Crypt/BinaryCodec_RCF.cpp \
|
||||
../XlsFormat/Crypt/Decryptor.cpp \
|
||||
../XlsFormat/Crypt/RC4Crypt.cpp \
|
||||
../XlsFormat/Crypt/XORCrypt.cpp \
|
||||
../XlsFormat/Logging/Log.cpp \
|
||||
../XlsFormat/Logging/Logger.cpp \
|
||||
../Common/utils.cpp \
|
||||
@ -1179,6 +1180,7 @@ HEADERS += \
|
||||
../XlsFormat/Crypt/Crypt.h \
|
||||
../XlsFormat/Crypt/Decryptor.h \
|
||||
../XlsFormat/Crypt/RC4Crypt.h \
|
||||
../XlsFormat/Crypt/XORCrypt.h \
|
||||
../XlsFormat/Logging/Log.h \
|
||||
../XlsFormat/Logging/Logger.h \
|
||||
../XlsFormat/Logic/Biff_structures/AddinUdf.h \
|
||||
|
||||
@ -6612,6 +6612,14 @@
|
||||
RelativePath="..\XlsFormat\Crypt\RC4Crypt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Crypt\XORCrypt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Crypt\XORCrypt.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="rtl"
|
||||
>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
VERSION = 2.4.515.0
|
||||
VERSION = 2.4.516.0
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
# CONFIGURATION
|
||||
|
||||
@ -65,6 +65,7 @@ class Decryptor
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long stream_pos, const size_t block_size) = 0;
|
||||
virtual void Decrypt(char* data, const size_t size, const unsigned long block_index) = 0;
|
||||
virtual bool SetPassword(std::wstring password) = 0;
|
||||
virtual void Init(const unsigned long val) = 0;
|
||||
virtual bool IsVerify() = 0;
|
||||
|
||||
};
|
||||
@ -73,21 +74,21 @@ typedef boost::shared_ptr<Decryptor> DecryptorPtr;
|
||||
struct _ecmaCryptData
|
||||
{
|
||||
//default ms2010
|
||||
_ecmaCryptData() : cipherAlgorithm(CRYPT_METHOD::AES_CBC), hashAlgorithm(CRYPT_METHOD::SHA1), spinCount(100000),
|
||||
keySize(0x10), hashSize(0x14), blockSize(0x10), saltSize(0x10), bAgile(true)
|
||||
//_ecmaCryptData() : cipherAlgorithm(), hashAlgorithm(), spinCount(100000),
|
||||
// keySize(0x10), hashSize(), blockSize(0x10), saltSize(0x10), bAgile(true)
|
||||
//default ms2013/ms2016
|
||||
//_cryptData(): cipherAlgorithm(CRYPT_METHOD::AES_CBC), hashAlgorithm(CRYPT_METHOD::SHA256), spinCount(100000),
|
||||
// keySize(0x20), hashSize(0x40), blockSize(0x10), saltSize(0x10), bAgile(true)
|
||||
{
|
||||
}
|
||||
CRYPT_METHOD::_cipherAlgorithm cipherAlgorithm;
|
||||
CRYPT_METHOD::_hashAlgorithm hashAlgorithm;
|
||||
//{
|
||||
//}
|
||||
CRYPT_METHOD::_cipherAlgorithm cipherAlgorithm = CRYPT_METHOD::AES_CBC;
|
||||
CRYPT_METHOD::_hashAlgorithm hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
|
||||
int spinCount;
|
||||
int keySize;
|
||||
int hashSize;
|
||||
int blockSize;
|
||||
int saltSize;
|
||||
int spinCount = 100000;
|
||||
int keySize = 0x10;
|
||||
int hashSize = 0x14;
|
||||
int blockSize = 0x10;
|
||||
int saltSize = 0x10;
|
||||
|
||||
std::string dataSaltValue;
|
||||
std::string saltValue;
|
||||
@ -98,10 +99,12 @@ struct _ecmaCryptData
|
||||
std::string encryptedHmacKey;
|
||||
std::string encryptedHmacValue;
|
||||
|
||||
bool bAgile;
|
||||
bool bAgile = true;
|
||||
|
||||
//..........
|
||||
|
||||
bool fDocProps = true;
|
||||
|
||||
};
|
||||
class ECMAEncryptor
|
||||
{
|
||||
@ -129,6 +132,7 @@ public:
|
||||
ECMADecryptor();
|
||||
virtual ~ECMADecryptor();
|
||||
|
||||
virtual void Init(const unsigned long val) {}
|
||||
|
||||
virtual void Decrypt (char* data, const size_t size, const unsigned long stream_pos, const size_t block_size);
|
||||
virtual void Decrypt (char* data, const size_t size, const unsigned long start_iv_block);
|
||||
|
||||
@ -338,10 +338,10 @@ namespace CSVReader
|
||||
|
||||
size_t nSize = sFileDataW.length();
|
||||
|
||||
if (nSize < 1 && nInputBufferSize > 0)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_ICU;
|
||||
}
|
||||
//if (nSize < 1 && nInputBufferSize > 0)
|
||||
//{
|
||||
// return AVS_FILEUTILS_ERROR_CONVERT_ICU;
|
||||
//}
|
||||
const WCHAR *pTemp = sFileDataW.c_str();
|
||||
|
||||
WCHAR wcDelimiterLeading = L'\0';
|
||||
|
||||
@ -2455,7 +2455,7 @@ namespace BinXlsxRW
|
||||
{
|
||||
m_pCurWorksheet = new OOX::Spreadsheet::CWorksheet(NULL);
|
||||
m_pCurSheet = new OOX::Spreadsheet::CSheet();
|
||||
m_pCurVmlDrawing = new OOX::CVmlDrawing(false);
|
||||
m_pCurVmlDrawing = new OOX::CVmlDrawing(NULL, false);
|
||||
|
||||
m_pCurVmlDrawing->m_lObjectIdVML = (long)(1024 * (m_oWorkbook.m_oSheets->m_arrItems.size() + 1) + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user