mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-18 05:46:08 +08:00
Compare commits
39 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 32b59120aa | |||
| 7186b56b64 | |||
| 6247490047 | |||
| f30e14c421 | |||
| e340a2af22 | |||
| 6a5cddf0ce | |||
| 312728fe9a | |||
| 182da130da | |||
| eb3ba8c42e | |||
| dec099b19b | |||
| 21762360ac | |||
| 563fe88842 | |||
| 0e085fbb13 | |||
| ed409e745a | |||
| 4bc58482b3 | |||
| 89ee039a05 | |||
| 5d5b1202c7 | |||
| c7646fd813 | |||
| b1d406b448 | |||
| ea37eab86e | |||
| d045609523 | |||
| 9336448ca9 | |||
| 5830e7824a | |||
| 821feb51b5 | |||
| 547979cd9b | |||
| c4481eb125 | |||
| ad0f2c89e0 | |||
| e15c75b6aa | |||
| b2fb7f0fe7 | |||
| 410e5ebd75 | |||
| 9c57088ef1 | |||
| 24230e12a3 | |||
| 2acef0d4a2 | |||
| aca5ffa36f | |||
| 4fc3726f37 | |||
| 2682e1fbac | |||
| f5c3ae779b | |||
| 068c60afa0 | |||
| 5b8ca5b417 |
@ -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)
|
||||
{
|
||||
|
||||
@ -171,7 +171,7 @@ namespace DocFileFormat
|
||||
if ( (*iter)->tapx != NULL )
|
||||
{
|
||||
std::vector<short> tableGrid;
|
||||
TablePropertiesMapping* tpMapping = new TablePropertiesMapping (m_pXmlWriter, sheet, &tableGrid, false);
|
||||
TablePropertiesMapping* tpMapping = new TablePropertiesMapping (m_pXmlWriter, sheet, &tableGrid, NULL, false);
|
||||
(*iter)->tapx->Convert( tpMapping );
|
||||
RELEASEOBJECT( tpMapping );
|
||||
}
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -85,7 +85,7 @@ namespace BinXlsxRW{
|
||||
sMediaPath = pathMediaDir.GetPath();
|
||||
sEmbedPath = pathEmbedDir.GetPath();
|
||||
}
|
||||
bool CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
int CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
@ -97,11 +97,10 @@ namespace BinXlsxRW{
|
||||
oDrawingConverter.SetMediaDstPath(sMediaDir);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedDir);
|
||||
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
return true;
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
}
|
||||
bool CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
int CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
|
||||
pFontPicker->Init(m_sFontDir);
|
||||
@ -137,7 +136,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
bool result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
int result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return result;
|
||||
|
||||
@ -62,8 +62,8 @@ namespace BinXlsxRW {
|
||||
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
int loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
int saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
|
||||
@ -1170,7 +1170,7 @@ void docx_conversion_context::docx_convert_delayed()
|
||||
{
|
||||
odf_reader::office_element * elm = delayed_elements_.front();
|
||||
elm->docx_convert(*this);
|
||||
delayed_elements_.pop_front();
|
||||
delayed_elements_.erase(delayed_elements_.begin(), delayed_elements_.begin() + 1);
|
||||
}
|
||||
delayed_converting_=false;
|
||||
}
|
||||
|
||||
@ -763,7 +763,7 @@ private:
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
std::list<std::wstring> list_style_stack_;
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
@ -781,9 +781,9 @@ private:
|
||||
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
NoteType process_note_;
|
||||
std::list<odf_reader::office_element *> delayed_elements_;
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
std::list< const odf_reader::style_text_properties * > text_properties_stack_;
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
|
||||
};
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
private:
|
||||
docx_conversion_context & context_;
|
||||
std::wstring table_style_;
|
||||
std::list<std::wstring> table_row_style_stack_;
|
||||
std::vector<std::wstring> table_row_style_stack_;
|
||||
std::wstring default_row_cell_style_name_;
|
||||
int current_table_column_;
|
||||
unsigned int columns_spanned_num_;
|
||||
@ -188,7 +188,7 @@ public:
|
||||
|
||||
private:
|
||||
docx_conversion_context & context_;
|
||||
std::list<docx_table_state> table_states_;
|
||||
std::vector<docx_table_state> table_states_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ private:
|
||||
|
||||
std::wstring table_style_;
|
||||
|
||||
std::list<std::wstring> table_row_style_stack_;
|
||||
std::vector<std::wstring> table_row_style_stack_;
|
||||
|
||||
std::wstring default_row_cell_style_name_;
|
||||
int current_table_column_;
|
||||
@ -214,7 +214,7 @@ public:
|
||||
private:
|
||||
std::wstringstream output_stream_;
|
||||
pptx_conversion_context & context_;
|
||||
std::list<pptx_table_state> table_states_;
|
||||
std::vector<pptx_table_state> table_states_;
|
||||
};
|
||||
|
||||
void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::style_instance *> & style_inst, oox::pptx_conversion_context & Context);
|
||||
|
||||
@ -126,13 +126,13 @@ private:
|
||||
|
||||
std::wstring base_style_name_;
|
||||
odf_types::style_family::type base_style_family_;//Presentation Or SpreadSheet
|
||||
/////////////lists////////////
|
||||
std::list<std::wstring> list_style_stack_;
|
||||
//-------------------------------------------------------------------------------
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
bool first_element_list_item_;
|
||||
// счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
int new_list_style_number_;
|
||||
// цепочки переименований нумераций
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;
|
||||
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_; // цепочки переименований нумераций
|
||||
|
||||
void write_list_styles(std::wostream & strm);
|
||||
//void write_list_properties(std::wostream & strm);
|
||||
|
||||
@ -82,11 +82,11 @@ void chart_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
//CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_validations_);
|
||||
//CP_CREATE_ELEMENT(content_validations_);
|
||||
}
|
||||
else
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
|
||||
@ -1624,9 +1624,9 @@ void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring>
|
||||
ref1 = std::wstring(L"local-table.") + utils::getColAddress(start_col) + boost::lexical_cast<std::wstring>(start_row);
|
||||
//
|
||||
if (by_row)
|
||||
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col) + boost::lexical_cast<std::wstring>(start_row + count_cash_values);
|
||||
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col) + std::to_wstring(start_row + count_cash_values);
|
||||
else
|
||||
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col + count_cash_values) + boost::lexical_cast<std::wstring>(start_row);
|
||||
ref2 = std::wstring(L"local-table.") + utils::getColAddress(start_col + count_cash_values) + std::to_wstring(start_row);
|
||||
|
||||
ref = ref1 + L":" + ref2;
|
||||
}
|
||||
|
||||
@ -313,25 +313,25 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
|
||||
|
||||
default:
|
||||
/////////////////////////////////// с неопределенным formatCode .. он задается в файле
|
||||
if (oox_num_fmt >=5 && oox_num_fmt <=8)state.ods_type =office_value_type::Currency;
|
||||
if (oox_num_fmt >=43 && oox_num_fmt <=44)state.ods_type =office_value_type::Currency;
|
||||
if (oox_num_fmt >=5 && oox_num_fmt <=8) state.ods_type =office_value_type::Currency;
|
||||
if (oox_num_fmt >=43 && oox_num_fmt <=44) state.ods_type =office_value_type::Currency;
|
||||
|
||||
if (oox_num_fmt >=27 && oox_num_fmt <=31)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=50 && oox_num_fmt <=54)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=57 && oox_num_fmt <=58)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt ==36)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=27 && oox_num_fmt <=31) state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=50 && oox_num_fmt <=54) state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=57 && oox_num_fmt <=58) state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt ==36) state.ods_type =office_value_type::Date;
|
||||
|
||||
if (oox_num_fmt >=32 && oox_num_fmt <=35)state.ods_type =office_value_type::Time;
|
||||
if (oox_num_fmt >=55 && oox_num_fmt <=56)state.ods_type =office_value_type::Time;
|
||||
if (oox_num_fmt >=32 && oox_num_fmt <=35) state.ods_type =office_value_type::Time;
|
||||
if (oox_num_fmt >=55 && oox_num_fmt <=56) state.ods_type =office_value_type::Time;
|
||||
|
||||
if (oox_num_fmt >=60 && oox_num_fmt <=62)state.ods_type =office_value_type::Float;
|
||||
if (oox_num_fmt >=69 && oox_num_fmt <=70)state.ods_type =office_value_type::Float;
|
||||
if (oox_num_fmt >=60 && oox_num_fmt <=62) state.ods_type =office_value_type::Float;
|
||||
if (oox_num_fmt >=69 && oox_num_fmt <=70) state.ods_type =office_value_type::Float;
|
||||
|
||||
if (oox_num_fmt >=67 && oox_num_fmt <=68)state.ods_type =office_value_type::Percentage;
|
||||
if (oox_num_fmt >=67 && oox_num_fmt <=68) state.ods_type =office_value_type::Percentage;
|
||||
|
||||
if (oox_num_fmt >=71 && oox_num_fmt <=74)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=75 && oox_num_fmt <=80)state.ods_type =office_value_type::Time;
|
||||
if (oox_num_fmt ==81)state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=71 && oox_num_fmt <=74) state.ods_type =office_value_type::Date;
|
||||
if (oox_num_fmt >=75 && oox_num_fmt <=80) state.ods_type =office_value_type::Time;
|
||||
if (oox_num_fmt ==81) state.ods_type =office_value_type::Date;
|
||||
}
|
||||
boost::algorithm::split(state.format_code, formatCode, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
@ -402,53 +402,122 @@ void odf_number_styles_context::create_number_style(number_format_state & state,
|
||||
{
|
||||
office_element_ptr elm;
|
||||
|
||||
create_numbers(state, elm);
|
||||
root_elm->add_child_element(elm);
|
||||
create_numbers(state, elm, root_elm);
|
||||
}
|
||||
}
|
||||
void odf_number_styles_context::create_numbers(number_format_state & state, office_element_ptr & elm)
|
||||
void odf_number_styles_context::create_numbers(number_format_state & state, office_element_ptr & elm, office_element_ptr & root_elm)
|
||||
{
|
||||
optional< int>::Type min_digit, min_decimal;
|
||||
|
||||
create_element(L"number", L"number", elm, odf_context_);
|
||||
styles_elments.push_back(elm);
|
||||
|
||||
office_element_ptr elm_text;
|
||||
|
||||
number_number* number_number_ = dynamic_cast<number_number*>(elm.get());
|
||||
if (!number_number_) return;
|
||||
|
||||
if (number_number_)
|
||||
bool bText = false;
|
||||
int indText = -1;
|
||||
int indNumber = -1;
|
||||
|
||||
if (state.format_code[0].empty())
|
||||
{
|
||||
if (state.format_code[0].length()>0)
|
||||
//формат не определен .. дефолтный
|
||||
min_digit =1;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::wstring> splits;
|
||||
boost::algorithm::split(splits, state.format_code[0], boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < splits.size(); i++)
|
||||
{
|
||||
std::wstring str1,str2;
|
||||
boost::wregex re1(L"([^0-9.,]+)");
|
||||
boost::wsmatch result;
|
||||
boost::wregex re2(L"([^#.,]+)");
|
||||
str1 = boost::regex_replace(state.format_code[0], re1, L"",boost::match_default | boost::format_all);
|
||||
str2 = boost::regex_replace(state.format_code[0], re2, L"",boost::match_default | boost::format_all);
|
||||
|
||||
if (str1.length()<str2.length())str1=str2;
|
||||
|
||||
std::vector<std::wstring> numbers;
|
||||
|
||||
boost::algorithm::split(numbers, str1, boost::algorithm::is_any_of(L".,"), boost::algorithm::token_compress_on);
|
||||
int ind=1;//
|
||||
for (size_t i = 0;i < numbers.size(); i++)
|
||||
if (std::wstring::npos != splits[i].find(L"\""))
|
||||
{
|
||||
if (numbers[i].length()<1)continue;
|
||||
if (ind==1)min_digit= numbers[i].length();
|
||||
if (ind==2)min_decimal= numbers[i].length();
|
||||
ind++;
|
||||
bText = true;
|
||||
indText = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < splits.size(); i++)
|
||||
{
|
||||
if (i != indText)
|
||||
{
|
||||
indNumber = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring str1,str2;
|
||||
boost::wregex re1(L"([^0-9.,]+)");
|
||||
boost::wsmatch result;
|
||||
boost::wregex re2(L"([^#.,]+)");
|
||||
|
||||
str1 = boost::regex_replace(splits[indNumber], re1, L"", boost::match_default | boost::format_all);
|
||||
str2 = boost::regex_replace(splits[indNumber], re2, L"", boost::match_default | boost::format_all);
|
||||
|
||||
if (str1.length() < str2.length()) str1 = str2;
|
||||
|
||||
std::vector<std::wstring> numbers;
|
||||
boost::algorithm::split(numbers, str1, boost::algorithm::is_any_of(L".,"), boost::algorithm::token_compress_on);
|
||||
|
||||
int ind = 1;//
|
||||
for (size_t i = 0; i < numbers.size(); i++)
|
||||
{
|
||||
if (numbers[i].empty())continue;
|
||||
|
||||
if (ind == 1) min_digit= numbers[i].length();
|
||||
if (ind == 2) min_decimal= numbers[i].length();
|
||||
ind++;
|
||||
}
|
||||
|
||||
if (bText && root_elm)
|
||||
{
|
||||
int res1 = (int) splits[indText].find(L"\"");
|
||||
int res2 = (int) splits[indText].find(L"\"", res1 + 1);
|
||||
|
||||
if (res2 > 0)
|
||||
{
|
||||
std::wstring text = splits[indText].substr(res1 + 1, res2 - res1 - 1);
|
||||
|
||||
if (!text.empty())
|
||||
{
|
||||
if (indText < indNumber) text = text + L" ";
|
||||
else text = L" " + text;
|
||||
|
||||
create_element(L"number", L"text", elm_text, odf_context_);
|
||||
number_text* number_text_ = dynamic_cast<number_text*>(elm_text.get());
|
||||
|
||||
if (number_text_)
|
||||
number_text_->add_text(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
number_number_->number_min_integer_digits_ = min_digit;
|
||||
number_number_->number_decimal_places_ = min_decimal;
|
||||
|
||||
if (root_elm)
|
||||
{
|
||||
if (bText)
|
||||
{
|
||||
number_number_->number_grouping_ = true;
|
||||
|
||||
if (indText < indNumber)
|
||||
{
|
||||
root_elm->add_child_element(elm_text);
|
||||
root_elm->add_child_element(elm);
|
||||
}
|
||||
else
|
||||
{
|
||||
root_elm->add_child_element(elm);
|
||||
root_elm->add_child_element(elm_text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//формат не определен .. дефолтный
|
||||
min_digit =1;
|
||||
root_elm->add_child_element(elm);
|
||||
}
|
||||
|
||||
number_number_->number_min_integer_digits_= min_digit;
|
||||
number_number_->number_decimal_places_= min_decimal;
|
||||
//number_number_->number_grouping_ = true;
|
||||
}
|
||||
}
|
||||
void odf_number_styles_context::create_percentage_style(number_format_state & state, office_element_ptr & root_elm)
|
||||
@ -457,7 +526,8 @@ void odf_number_styles_context::create_percentage_style(number_format_state & st
|
||||
|
||||
office_element_ptr elm;
|
||||
|
||||
create_numbers(state, elm);
|
||||
office_element_ptr empty;
|
||||
create_numbers(state, elm, empty);
|
||||
root_elm->add_child_element(elm);
|
||||
|
||||
create_element(L"number", L"text", elm, odf_context_);
|
||||
@ -472,9 +542,9 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
|
||||
{
|
||||
create_element(L"number", L"currency-style", root_elm, odf_context_);
|
||||
{
|
||||
int res1= state.format_code[0].rfind(L"]");
|
||||
int res2= state.format_code[0].rfind(L"#");
|
||||
int res3= state.format_code[0].rfind(L"0");
|
||||
int res1 = state.format_code[0].rfind(L"]");
|
||||
int res2 = state.format_code[0].rfind(L"#");
|
||||
int res3 = state.format_code[0].rfind(L"0");
|
||||
|
||||
office_element_ptr elm_symbol;
|
||||
create_element(L"number", L"currency-symbol", elm_symbol, odf_context_);
|
||||
@ -485,7 +555,7 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
|
||||
{
|
||||
std::wstring number_country,number_language;
|
||||
|
||||
for (long i=0; state.language_code >0 && i < sizeof(LanguageCodeTable)/sizeof(def_language_code); i++)
|
||||
for (long i = 0; state.language_code > 0 && i < sizeof(LanguageCodeTable)/sizeof(def_language_code); i++)
|
||||
{
|
||||
if (LanguageCodeTable[i].id == state.language_code)
|
||||
{
|
||||
@ -507,11 +577,12 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
|
||||
}
|
||||
///////////////////
|
||||
office_element_ptr elm_number;
|
||||
create_numbers(state, elm_number);
|
||||
office_element_ptr empty;
|
||||
create_numbers(state, elm_number, empty);
|
||||
//////////////////////////////////////////
|
||||
office_element_ptr elm_text;
|
||||
create_element(L"number", L"text", elm_text, odf_context_);
|
||||
number_text* number_text_ = dynamic_cast<number_text*>(elm_text.get());
|
||||
number_text* number_text_ = dynamic_cast<number_text*>(elm_text.get());
|
||||
if (number_text_)number_text_->add_text(L" ");
|
||||
styles_elments.push_back(elm_text);
|
||||
////////////////////////////////////////////
|
||||
@ -540,6 +611,7 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
|
||||
boost::algorithm::to_lower(s);
|
||||
|
||||
boost::wregex re(L"([a-zA-Z]+)(\\W+)");//(L"(\\w+)");
|
||||
|
||||
std::list<std::wstring> result;
|
||||
bool b = boost::regex_split(std::back_inserter(result),s, re);
|
||||
result.push_back(s);//последний ..выносится - так уж работает boost.regex_split
|
||||
@ -594,7 +666,7 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
|
||||
}
|
||||
else
|
||||
{ //////////////////// делитель ////////////////////
|
||||
if(sz>1)
|
||||
if(sz > 1)
|
||||
{
|
||||
//выкинем "лишние" слэши
|
||||
XmlUtils::replace_all( s, L"\\", L"");
|
||||
@ -627,12 +699,12 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
|
||||
|
||||
int res;
|
||||
int sz=0;
|
||||
for (std::list<std::wstring>::iterator i=result.begin(); i!=result.end(); ++i)
|
||||
for (std::list<std::wstring>::iterator it = result.begin(); it != result.end(); ++it)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
s = *i;
|
||||
s = *it;
|
||||
sz = s.length();
|
||||
if ((res=s.find(L"h")) >=0)
|
||||
if ((res=s.find(L"h")) >= 0)
|
||||
{
|
||||
create_element(L"number", L"hours", elm, odf_context_);
|
||||
number_hours* number_hours_ = dynamic_cast<number_hours*>(elm.get());
|
||||
@ -670,7 +742,7 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
|
||||
else if((res=s.find(L"pm")) <0)//так уж формат делится .. а этот текст нам не нужен
|
||||
{
|
||||
//////////////////// делитель ////////////////////
|
||||
if(sz>1)
|
||||
if(sz > 1)
|
||||
{
|
||||
//выкинем "лишние" слэши
|
||||
XmlUtils::replace_all( s, L"\\", L"");
|
||||
@ -700,14 +772,14 @@ void odf_number_styles_context::create_text_style(number_format_state & state, o
|
||||
void odf_number_styles_context::detect_format(number_format_state & state)
|
||||
{
|
||||
if (state.ods_type != office_value_type::Custom)return;
|
||||
if (state.format_code.size()<1)return;
|
||||
if (state.format_code.empty())return;
|
||||
|
||||
//find [$<Currency String>-<language info>].
|
||||
boost::wregex re(L"(?:\\[)(?:\\$)(\\S+)?\-(\\S+)(?:\\])");
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(state.format_code[0], result, re);
|
||||
|
||||
if (b && result.size()==3)
|
||||
if (b && result.size() == 3)
|
||||
{
|
||||
state.currency_str=result[1];
|
||||
int code = -1;
|
||||
@ -720,48 +792,58 @@ void odf_number_styles_context::detect_format(number_format_state & state)
|
||||
|
||||
//state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
}
|
||||
if (state.currency_str.length()>0)
|
||||
if (!state.currency_str.empty() && state.language_code != 0xF400 && state.language_code != 0xF800)
|
||||
{
|
||||
state.ods_type = office_value_type::Currency;
|
||||
return;
|
||||
}
|
||||
std::wstring tmp = state.format_code[0];
|
||||
XmlUtils::GetLower(tmp);
|
||||
if (state.format_code.size() == 1)//any
|
||||
|
||||
//if (state.format_code.size() == 2)//>0, <0
|
||||
//{
|
||||
|
||||
//}
|
||||
//else if (state.format_code.size() == 3)//>0, <0, ==0
|
||||
//{
|
||||
//}
|
||||
|
||||
if (state.format_code.size() > 0) //any
|
||||
{
|
||||
int res=0;
|
||||
if ((res=tmp.find(L"at"))>=0 || (res=tmp.find(L"pm"))>=0 ||
|
||||
(res=tmp.find(L"h"))>=0 || (res=tmp.find(L"s"))>=0 || state.language_code == 0xF400)
|
||||
std::wstring tmp = state.format_code[0];
|
||||
XmlUtils::GetLower(tmp);
|
||||
|
||||
if (std::wstring::npos != tmp.find(L"at") ||
|
||||
std::wstring::npos != tmp.find(L"pm") ||
|
||||
std::wstring::npos != tmp.find(L"h") ||
|
||||
std::wstring::npos != tmp.find(L"s") || state.language_code == 0xF400)
|
||||
{
|
||||
state.ods_type = office_value_type::Time;
|
||||
if (b)state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
if (b)
|
||||
state.format_code[0] = boost::regex_replace( state.format_code[0], re, L"");
|
||||
return;
|
||||
}
|
||||
if ((res=tmp.find(L"y"))>=0 || (res=tmp.find(L"d"))>=0 || (res=tmp.find(L"m"))>=0)//minutes отсеялись выше
|
||||
if (std::wstring::npos != tmp.find(L"y") ||
|
||||
std::wstring::npos != tmp.find(L"d") ||
|
||||
std::wstring::npos != tmp.find(L"m") || state.language_code == 0xF800)//minutes отсеялись выше
|
||||
{
|
||||
state.ods_type = office_value_type::Date;
|
||||
|
||||
if (b)state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
if (b)
|
||||
state.format_code[0] = boost::regex_replace( state.format_code[0], re, L"");
|
||||
return;
|
||||
}
|
||||
if ((res=tmp.find(L"%"))>=0)
|
||||
if (std::wstring::npos != tmp.find(L"%"))
|
||||
{
|
||||
state.ods_type = office_value_type::Percentage;
|
||||
return;
|
||||
}
|
||||
|
||||
state.ods_type = office_value_type::Float;
|
||||
return;
|
||||
if (std::wstring::npos != tmp.find(L"#") ||
|
||||
std::wstring::npos != tmp.find(L"?") ||
|
||||
std::wstring::npos != tmp.find(L"0"))
|
||||
{
|
||||
state.ods_type = office_value_type::Float;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (state.format_code.size() == 2)//>0, <0
|
||||
{
|
||||
|
||||
}
|
||||
else if (state.format_code.size() == 3)//>0, <0, ==0
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ private:
|
||||
void create_text_style (number_format_state & state, office_element_ptr & root_elm);
|
||||
void create_percentage_style(number_format_state & state, office_element_ptr & root_elm);
|
||||
|
||||
void create_numbers(number_format_state & state, office_element_ptr & elm);
|
||||
void create_numbers(number_format_state & state, office_element_ptr & elm, office_element_ptr & root_elm);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -90,6 +90,11 @@ void odp_conversion_context::end_document()
|
||||
{
|
||||
odf_conversion_context::end_document();
|
||||
}
|
||||
|
||||
size_t odp_conversion_context::get_pages_count()
|
||||
{
|
||||
return root_presentation_->pages_.size();
|
||||
}
|
||||
void odp_conversion_context::start_slide()
|
||||
{
|
||||
slide_context_.set_styles_context(styles_context());
|
||||
|
||||
@ -52,6 +52,8 @@ public:
|
||||
void start_slide();
|
||||
void end_slide();
|
||||
|
||||
size_t get_pages_count();
|
||||
|
||||
void start_master_slide(std::wstring name);
|
||||
void end_master_slide();
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "odp_page_state.h"
|
||||
|
||||
#include "odf_table_context.h"
|
||||
@ -83,7 +83,7 @@ private:
|
||||
odf_table_context table_context_;
|
||||
odf_comment_context comment_context_;
|
||||
|
||||
std::list<odp_page_state> page_state_list_;
|
||||
std::vector<odp_page_state> page_state_list_;
|
||||
int count_slides_;
|
||||
|
||||
friend class odp_conversion_context;
|
||||
|
||||
@ -115,6 +115,10 @@ void ods_conversion_context::set_table_part_autofilter(bool val)
|
||||
{
|
||||
table_context_.set_table_part_autofilter(val);
|
||||
}
|
||||
void ods_conversion_context::add_table_part_column(std::wstring name)
|
||||
{
|
||||
table_context_.add_table_part_column(name);
|
||||
}
|
||||
void ods_conversion_context::end_table_part()
|
||||
{
|
||||
table_context_.end_table_part();
|
||||
|
||||
@ -110,6 +110,7 @@ public:
|
||||
void start_table_part (std::wstring name, std::wstring ref);
|
||||
void end_table_part ();
|
||||
void set_table_part_autofilter(bool val);
|
||||
void add_table_part_column(std::wstring name);
|
||||
|
||||
void start_conditional_formats();
|
||||
void end_conditional_formats(){}
|
||||
|
||||
@ -78,8 +78,36 @@ void ods_table_context::start_table_part(std::wstring name, std::wstring ref)
|
||||
|
||||
table_database_ranges_.root->add_child_element(elm);
|
||||
table_database_ranges_.elements.push_back(elm);
|
||||
|
||||
table_part_state part_state;
|
||||
part_state.name = name;
|
||||
part_state.ref = ref;
|
||||
|
||||
int r = ref.rfind(L":");
|
||||
if (r < 0) return;//тута однозначно .. по правилам оох
|
||||
|
||||
utils::parsing_ref (ref.substr(0, r), part_state.col_start, part_state.row_start);
|
||||
utils::parsing_ref (ref.substr(r + 1, ref.size() - r), part_state.col_end, part_state.row_end);
|
||||
|
||||
state().table_parts_.push_back(part_state);
|
||||
}
|
||||
|
||||
void ods_table_context::add_table_part_column(std::wstring name)
|
||||
{
|
||||
if (state().table_parts_.empty()) return;
|
||||
|
||||
size_t column = state().table_parts_.back().columns.size();
|
||||
|
||||
std::wstring sCol = utils::getColAddress(state().table_parts_.back().col_start + column - 1);
|
||||
|
||||
std::wstring ref;//table name ????
|
||||
|
||||
ref += sCol + std::to_wstring(state().table_parts_.back().row_start);
|
||||
ref += L":";
|
||||
ref += sCol + std::to_wstring(state().table_parts_.back().row_end);
|
||||
|
||||
state().table_parts_.back().columns.push_back(std::make_pair(name, ref));
|
||||
}
|
||||
void ods_table_context::set_table_part_autofilter(bool val)
|
||||
{
|
||||
if (!val) return;
|
||||
@ -152,15 +180,13 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
|
||||
|
||||
if (sheet_id >=0)
|
||||
{
|
||||
int i=0;
|
||||
for (std::list<ods_table_state>::iterator iter = table_state_list_.begin(); iter != table_state_list_.end(); iter++)
|
||||
for (size_t i = 0; i < table_state_list_.size(); ++i)
|
||||
{
|
||||
if (i == sheet_id)
|
||||
{
|
||||
iter->add_definded_expression(elm);
|
||||
table_state_list_[i].add_definded_expression(elm);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -187,31 +213,23 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
|
||||
named_expression->table_name_ = name;
|
||||
named_expression->table_expression_ = odf_value;
|
||||
|
||||
if (sheet_id >=0)
|
||||
if (sheet_id >=0 && sheet_id < table_state_list_.size())
|
||||
{
|
||||
int i=0;
|
||||
for (std::list<ods_table_state>::iterator iter = table_state_list_.begin(); iter != table_state_list_.end(); iter++)
|
||||
odf_base_cell = table_state_list_[sheet_id].office_table_name_ + L".$A$1";
|
||||
table_state_list_[sheet_id].add_definded_expression(elm);
|
||||
|
||||
if ( printable)
|
||||
{
|
||||
if (i == sheet_id)
|
||||
{
|
||||
odf_base_cell = iter->office_table_name_ + L".$A$1";
|
||||
iter->add_definded_expression(elm);
|
||||
if ( printable)
|
||||
{
|
||||
XmlUtils::replace_all( odf_value, L"[", L"");
|
||||
XmlUtils::replace_all( odf_value, L"]", L"");
|
||||
XmlUtils::replace_all( odf_value, L";", L" ");
|
||||
XmlUtils::replace_all( odf_value, L"[", L"");
|
||||
XmlUtils::replace_all( odf_value, L"]", L"");
|
||||
XmlUtils::replace_all( odf_value, L";", L" ");
|
||||
|
||||
iter->set_print_range(odf_value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
table_state_list_[sheet_id].set_print_range(odf_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!table_defined_expressions_.root)create_element(L"table", L"named-expressions",table_defined_expressions_.root,&context_);
|
||||
if (!table_defined_expressions_.root)create_element(L"table", L"named-expressions", table_defined_expressions_.root,&context_);
|
||||
table_defined_expressions_.root->add_child_element(elm);
|
||||
}
|
||||
|
||||
|
||||
@ -52,8 +52,6 @@ struct table_additional_elements_state
|
||||
std::vector<office_element_ptr> elements;
|
||||
};
|
||||
|
||||
|
||||
/// \class ods_table_context
|
||||
class ods_table_context
|
||||
{
|
||||
public:
|
||||
@ -76,13 +74,14 @@ public:
|
||||
|
||||
void start_table_part(std::wstring name, std::wstring ref);
|
||||
void set_table_part_autofilter(bool val);
|
||||
void add_table_part_column(std::wstring name);
|
||||
void end_table_part();
|
||||
|
||||
private:
|
||||
|
||||
ods_conversion_context & context_;
|
||||
|
||||
std::list<ods_table_state> table_state_list_;
|
||||
std::vector<ods_table_state> table_state_list_;
|
||||
|
||||
table_additional_elements_state table_defined_expressions_;
|
||||
table_additional_elements_state table_database_ranges_;
|
||||
|
||||
@ -634,15 +634,15 @@ void ods_table_state::set_merge_cells(int start_col, int start_row, int end_col,
|
||||
|
||||
if (spanned_cols > 10000)spanned_cols = 1024;
|
||||
|
||||
for (std::list<ods_cell_state>::iterator cell = cells_.begin(); cell != cells_.end(); cell++)
|
||||
for (size_t i = 0; i < cells_.size(); ++i)
|
||||
{
|
||||
if (cell->row > end_row) break;
|
||||
if (cells_[i].row > end_row) break;
|
||||
|
||||
if (cell->row >= start_row)
|
||||
if (cells_[i].row >= start_row)
|
||||
{
|
||||
if (cell->col >= start_col)
|
||||
if (cells_[i].col >= start_col)
|
||||
{
|
||||
table_table_cell* cell_elm = dynamic_cast<table_table_cell*>(cell->elm.get());
|
||||
table_table_cell* cell_elm = dynamic_cast<table_table_cell*>(cells_[i].elm.get());
|
||||
if (cell_elm == NULL)return;
|
||||
|
||||
cell_elm->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
|
||||
@ -668,6 +668,24 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
|
||||
}
|
||||
|
||||
std::wstring odfFormula = formulas_converter_table.convert_formula(formula);
|
||||
|
||||
if (std::wstring::npos != odfFormula.find(L"["))
|
||||
{
|
||||
for (size_t i = 0; i < table_parts_.size(); i++)
|
||||
{
|
||||
if (table_parts_[i].in_ref(current_table_column_, current_table_row_))
|
||||
{
|
||||
for (size_t j = 0; j < table_parts_[i].columns.size(); j ++)
|
||||
{
|
||||
std::wstring name = table_parts_[i].name + L"[" + table_parts_[i].columns[j].first + L"]";
|
||||
//Таблица1[ Сумма за кв. 3 ]
|
||||
|
||||
XmlUtils::replace_all(odfFormula, name, table_parts_[i].columns[j].second);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell == NULL)return;
|
||||
@ -684,7 +702,7 @@ std::wstring ods_table_state::replace_cell_row(boost::wsmatch const & what)
|
||||
int col_formula=0, row_formula=0;
|
||||
utils::parsing_ref(ref_formula, col_formula, row_formula);col_formula--;//инче отсчет с 1
|
||||
|
||||
ref_formula = utils::getColAddress(col_formula)+boost::lexical_cast<std::wstring>(row_formula+current_table_row_ -tmp_row_);
|
||||
ref_formula = utils::getColAddress(col_formula) + std::to_wstring(row_formula +current_table_row_ - tmp_row_);
|
||||
|
||||
|
||||
return ref_formula;
|
||||
|
||||
@ -69,7 +69,8 @@ class odf_text_context;
|
||||
class table_table;
|
||||
class style;
|
||||
|
||||
namespace utils {
|
||||
namespace utils
|
||||
{
|
||||
static std::wstring getColAddress(size_t col)
|
||||
{
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
@ -78,8 +79,8 @@ namespace utils {
|
||||
|
||||
if (r0 > 0)
|
||||
{
|
||||
const std::wstring rest = getColAddress(col - r*r0);
|
||||
const std::wstring res = getColAddress(r0-1) + rest;
|
||||
const std::wstring rest = getColAddress(col - r * r0);
|
||||
const std::wstring res = getColAddress(r0 - 1) + rest;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
@ -210,6 +211,24 @@ struct ods_shared_formula_state
|
||||
int moving_type; //1 - col, 2 - row
|
||||
};
|
||||
|
||||
struct table_part_state
|
||||
{
|
||||
std::wstring name;
|
||||
std::wstring ref;
|
||||
|
||||
int col_start = 0;
|
||||
int row_start = 0;
|
||||
|
||||
int col_end = 0;
|
||||
int row_end = 0;
|
||||
|
||||
bool in_ref(int col, int row)
|
||||
{
|
||||
return (col >= col_start && col <= col_end && row >= row_start && row <= row_end);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::wstring, std::wstring>> columns; //name, odf_ref
|
||||
};
|
||||
struct ods_array_formula_state
|
||||
{
|
||||
std::wstring formula;
|
||||
@ -341,12 +360,14 @@ private:
|
||||
|
||||
std::vector<office_element_ptr> current_level_;//постоянно меняющийся список уровней ("0-й элемент - сама таблица)
|
||||
|
||||
std::list<ods_cell_state> cells_;
|
||||
std::vector<ods_cell_state> cells_;
|
||||
long cells_size_;
|
||||
|
||||
std::vector<ods_hyperlink_state> hyperlinks_;
|
||||
std::vector<ods_shared_formula_state> shared_formulas_;
|
||||
|
||||
std::vector<table_part_state> table_parts_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
|
||||
friend class ods_table_context;
|
||||
|
||||
@ -1329,8 +1329,17 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
if (current_theme && current_clrMap)
|
||||
current_theme->SetColorMap(*current_clrMap);
|
||||
|
||||
std::wstring page_name;
|
||||
if (oox_slide->attrName.IsInit())
|
||||
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
|
||||
page_name = oox_slide->attrName.get();
|
||||
|
||||
|
||||
if (page_name.empty())
|
||||
{
|
||||
if (type == Slide)
|
||||
page_name = L"Slide_" + std::to_wstring(odp_context->get_pages_count());
|
||||
}
|
||||
odp_context->current_slide().set_page_name(page_name);
|
||||
|
||||
if (type != Notes && type != NotesMaster)
|
||||
{
|
||||
|
||||
@ -268,6 +268,30 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
pos++;
|
||||
}
|
||||
//todooo для оптимизации - перенести мержи в начало
|
||||
|
||||
//выносные части таблицы
|
||||
if (oox_sheet->m_oTableParts.IsInit())
|
||||
{
|
||||
for (size_t i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CTablePart *oox_table_part = oox_sheet->m_oTableParts->m_arrItems[i];
|
||||
if (!oox_table_part)continue;
|
||||
if (!oox_table_part->m_oRId.IsInit())continue;
|
||||
|
||||
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_table_part->m_oRId->GetValue());
|
||||
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Table == oFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CTableFile* pTableFile = (OOX::Spreadsheet::CTableFile*)oFile.operator->();
|
||||
|
||||
if ((pTableFile) && (pTableFile->m_oTable.IsInit()))
|
||||
{
|
||||
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(pTableFile);
|
||||
convert(pTableFile->m_oTable.GetPointer());
|
||||
oox_current_child_document = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//колонки
|
||||
ods_context->start_columns();
|
||||
@ -328,29 +352,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
}
|
||||
ods_context->end_conditional_formats();
|
||||
}
|
||||
//выносные части таблицы
|
||||
if (oox_sheet->m_oTableParts.IsInit())
|
||||
{
|
||||
for (size_t i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CTablePart *oox_table_part = oox_sheet->m_oTableParts->m_arrItems[i];
|
||||
if (!oox_table_part)continue;
|
||||
if (!oox_table_part->m_oRId.IsInit())continue;
|
||||
|
||||
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_table_part->m_oRId->GetValue());
|
||||
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Table == oFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CTableFile* pTableFile = (OOX::Spreadsheet::CTableFile*)oFile.operator->();
|
||||
|
||||
if ((pTableFile) && (pTableFile->m_oTable.IsInit()))
|
||||
{
|
||||
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(pTableFile);
|
||||
convert(pTableFile->m_oTable.GetPointer());
|
||||
oox_current_child_document = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
convert(oox_sheet->m_oSheetViews.GetPointer());
|
||||
convert(oox_sheet->m_oHeaderFooter.GetPointer());
|
||||
@ -418,11 +420,27 @@ void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
|
||||
if (oox_table_part->m_oAutoFilter.IsInit())
|
||||
ods_context->set_table_part_autofilter(true);
|
||||
|
||||
convert(oox_table_part->m_oTableColumns.GetPointer());
|
||||
OoxConverter::convert(oox_table_part->m_oExtLst.GetPointer());
|
||||
|
||||
ods_context->end_table_part();
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CTableColumns *oox_table_part_columns)
|
||||
{
|
||||
if (!oox_table_part_columns) return;
|
||||
|
||||
for (size_t i = 0; i < oox_table_part_columns->m_arrItems.size(); i++)
|
||||
{
|
||||
std::wstring name;
|
||||
if (oox_table_part_columns->m_arrItems[i]->m_oName.IsInit())
|
||||
name = oox_table_part_columns->m_arrItems[i]->m_oName.get2();
|
||||
|
||||
ods_context->add_table_part_column(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
|
||||
{
|
||||
if (!oox_comment) return;
|
||||
@ -538,7 +556,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCell *oox_cell)
|
||||
|
||||
int ifx_style = oox_cell->m_oStyle.IsInit() ? oox_cell->m_oStyle->GetValue() : -1;
|
||||
|
||||
ods_context->start_cell(ref,ifx_style);
|
||||
ods_context->start_cell(ref, ifx_style);
|
||||
|
||||
int value_type = -1;//not defined
|
||||
if (oox_cell->m_oType.IsInit())
|
||||
@ -1618,7 +1636,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
|
||||
{
|
||||
if (!color)return;
|
||||
|
||||
unsigned char ucA=0, ucR=0, ucG=0, ucB=0;
|
||||
unsigned char ucA = 0, ucR =0, ucG =0, ucB = 0;
|
||||
bool result = false;
|
||||
|
||||
if(color->m_oRgb.IsInit())//easy, faster,realy !!
|
||||
@ -1630,18 +1648,18 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
|
||||
result = true;
|
||||
}
|
||||
|
||||
if(color->m_oThemeColor.IsInit())
|
||||
if(color->m_oThemeColor.IsInit() && xlsx_document->m_pTheme.IsInit())
|
||||
{
|
||||
std::wstring sColor = color->m_oThemeColor->ToString();
|
||||
|
||||
DWORD argb = 0;
|
||||
result = OoxConverter::convert(sColor, argb) ;
|
||||
DWORD argb = xlsx_document->m_pTheme->themeElements.clrScheme.GetARGBFromScheme(color->m_oThemeColor->ToString());
|
||||
|
||||
ucR = (argb & 0x0000FF);
|
||||
ucB = (argb & 0x00FF00) >> 8;
|
||||
ucG = (argb & 0xFF0000) >> 16;
|
||||
ucA = argb >> 24;
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
if(color->m_oIndexed.IsInit())
|
||||
{
|
||||
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->m_pStyles;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace OOX
|
||||
|
||||
class CWorksheet;
|
||||
class CTable;
|
||||
class CTableColumns;
|
||||
class CCol;
|
||||
class CRow;
|
||||
class CCell;
|
||||
@ -157,6 +158,7 @@ namespace Oox2Odf
|
||||
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
|
||||
void convert(OOX::Spreadsheet::CDefinedName *oox_defined);
|
||||
void convert(OOX::Spreadsheet::CTable *oox_table_part);
|
||||
void convert(OOX::Spreadsheet::CTableColumns *oox_table_part_columns);
|
||||
void convert(OOX::Spreadsheet::CPictureWorksheet *oox_background);
|
||||
void convert(OOX::Spreadsheet::CHeaderFooter *oox_header_footer);
|
||||
|
||||
|
||||
@ -187,12 +187,12 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
|
||||
{
|
||||
std::wstring strContentTypes = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\
|
||||
<Default Extension=\"bmp\" ContentType=\"image/bmp\" />\
|
||||
<Default Extension=\"png\" ContentType=\"image/png\" />\
|
||||
<Default Extension=\"jpeg\" ContentType=\"image/jpeg\" />\
|
||||
<Default Extension=\"wmf\" ContentType=\"image/x-wmf\" />\
|
||||
<Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\" />\
|
||||
<Default Extension=\"xml\" ContentType=\"application/xml\" />\
|
||||
<Default Extension=\"bmp\" ContentType=\"image/bmp\"/>\
|
||||
<Default Extension=\"png\" ContentType=\"image/png\"/>\
|
||||
<Default Extension=\"jpeg\" ContentType=\"image/jpeg\"/>\
|
||||
<Default Extension=\"wmf\" ContentType=\"image/x-wmf\"/>\
|
||||
<Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>\
|
||||
<Default Extension=\"xml\" ContentType=\"application/xml\"/>\
|
||||
<Default Extension=\"gif\" ContentType=\"image/gif\"/>\
|
||||
<Default Extension=\"emf\" ContentType=\"image/x-emf\"/>\
|
||||
<Default Extension=\"wav\" ContentType=\"audio/wav\"/>\
|
||||
@ -207,7 +207,7 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
|
||||
<Default Extension=\"xls\" ContentType=\"application/vnd.ms-excel\"/>\
|
||||
<Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>\
|
||||
<Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\" />\
|
||||
<Default Extension=\"jpg\" ContentType=\"application/octet-stream\"/>";
|
||||
<Default Extension=\"jpg\" ContentType=\"image/jpeg\"/>";
|
||||
|
||||
if (m_pDocument->m_bMacros)
|
||||
{
|
||||
|
||||
@ -3986,8 +3986,19 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
nullable_string sRid;
|
||||
oNodeFill.ReadAttributeBase(L"r:id", sRid);
|
||||
if (sRid.is_init())
|
||||
{
|
||||
PPTX::Logic::BlipFill* pBlipFill = new PPTX::Logic::BlipFill();
|
||||
{
|
||||
PPTX::Logic::BlipFill* pBlipFill = NULL;
|
||||
if (pPicture)
|
||||
{
|
||||
pBlipFill = &pPicture->blipFill;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBlipFill = new PPTX::Logic::BlipFill();
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
|
||||
pSpPr->Fill.Fill = pBlipFill;
|
||||
}
|
||||
pBlipFill->m_namespace = L"a";
|
||||
pBlipFill->blip = new PPTX::Logic::Blip();
|
||||
pBlipFill->blip->embed = new OOX::RId(*sRid);
|
||||
@ -4000,9 +4011,6 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
{
|
||||
pBlipFill->stretch = new PPTX::Logic::Stretch();
|
||||
}
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
|
||||
pSpPr->Fill.Fill = pBlipFill;
|
||||
}
|
||||
nullable_string sRotate;
|
||||
oNodeFill.ReadAttributeBase(L"rotate", sRotate);
|
||||
@ -4129,7 +4137,19 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
nullable_string sType;
|
||||
oNodeFillID.ReadAttributeBase(L"type", sType);
|
||||
|
||||
PPTX::Logic::BlipFill* pBlipFill = new PPTX::Logic::BlipFill();
|
||||
PPTX::Logic::BlipFill* pBlipFill = NULL;
|
||||
|
||||
if (pPicture)
|
||||
{
|
||||
pBlipFill = &pPicture->blipFill;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBlipFill = new PPTX::Logic::BlipFill();
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
|
||||
pSpPr->Fill.Fill = pBlipFill;
|
||||
}
|
||||
pBlipFill->m_namespace = L"a";
|
||||
pBlipFill->blip = new PPTX::Logic::Blip();
|
||||
|
||||
@ -4181,51 +4201,50 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
else
|
||||
pBlipFill->srcRect->b = str0;
|
||||
}
|
||||
|
||||
if (pShape)
|
||||
{
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
|
||||
pSpPr->Fill.Fill = pBlipFill;
|
||||
}
|
||||
if (pPicture)
|
||||
{
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::notInit;
|
||||
pPicture->blipFill = *pBlipFill;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default params
|
||||
if (!pSpPr->Fill.Fill.is_init())
|
||||
if (pPicture)
|
||||
{
|
||||
if (pPPTShape->IsWordArt())
|
||||
{
|
||||
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
|
||||
pNoFill->m_namespace = L"a";
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::notInit;
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
|
||||
pSpPr->Fill.Fill = pNoFill;
|
||||
if (false == pPicture->blipFill.blip.is_init())
|
||||
{//MSF_Lec3-4.docx
|
||||
oElem->InitElem(NULL);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// default params for fill shape
|
||||
if (!pSpPr->Fill.Fill.is_init())
|
||||
{
|
||||
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
||||
pSolid->m_namespace = L"a";
|
||||
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
|
||||
pSolid->Color.Color->SetRGB(0xFF, 0xFF, 0xFF);
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
||||
pSpPr->Fill.Fill = pSolid;
|
||||
|
||||
if (sOpacity.is_init())
|
||||
if (pPPTShape->IsWordArt())
|
||||
{
|
||||
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||
PPTX::Logic::ColorModifier oMod;
|
||||
oMod.name = L"alpha";
|
||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod.val = nA;
|
||||
pSolid->Color.Color->Modifiers.push_back(oMod);
|
||||
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
|
||||
pNoFill->m_namespace = L"a";
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
|
||||
pSpPr->Fill.Fill = pNoFill;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
||||
pSolid->m_namespace = L"a";
|
||||
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
|
||||
pSolid->Color.Color->SetRGB(0xFF, 0xFF, 0xFF);
|
||||
|
||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
||||
pSpPr->Fill.Fill = pSolid;
|
||||
|
||||
if (sOpacity.is_init())
|
||||
{
|
||||
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||
PPTX::Logic::ColorModifier oMod;
|
||||
oMod.name = L"alpha";
|
||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod.val = nA;
|
||||
pSolid->Color.Color->Modifiers.push_back(oMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,14 +486,14 @@ namespace PPTX
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
nullable<PrstTxWarp> prstTxWarp;
|
||||
TextFit Fit;
|
||||
nullable<Scene3d> scene3d;
|
||||
nullable_int flatTx;
|
||||
nullable<Sp3d> sp3d;
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
nullable_limit<Limit::TextAnchor> anchor;
|
||||
nullable_bool anchorCtr;
|
||||
nullable_int bIns;
|
||||
@ -513,9 +513,8 @@ namespace PPTX
|
||||
nullable_limit<Limit::TextVerticalType> vert;
|
||||
nullable_limit<Limit::VertOverflow> vertOverflow;
|
||||
nullable_limit<Limit::TextWrap> wrap;
|
||||
//private:
|
||||
public:
|
||||
mutable std::wstring m_namespace;
|
||||
|
||||
mutable std::wstring m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -162,7 +162,17 @@ namespace PPTX
|
||||
else if(parentFileIs<TableStyles>())
|
||||
RGB = parentFileAs<TableStyles>().GetARGBFromMap(str);
|
||||
else if(parentFileIs<Theme>())
|
||||
RGB = parentFileAs<Theme>().GetARGBFromMap(str);
|
||||
{
|
||||
Theme & theme = parentFileAs<Theme>();
|
||||
if (theme.isMapPresent())
|
||||
{
|
||||
RGB = parentFileAs<Theme>().GetARGBFromMap(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
RGB = parentFileAs<Theme>().GetABGRFromScheme(str);
|
||||
}
|
||||
}
|
||||
else if(parentFileIs<Presentation>())
|
||||
RGB = parentFileAs<Presentation>().GetARGBFromMap(str);
|
||||
//{
|
||||
|
||||
@ -40,7 +40,6 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class SolidFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
@ -127,10 +126,8 @@ namespace PPTX
|
||||
if(Color.is_init())
|
||||
fill.Color = Color;
|
||||
}
|
||||
public:
|
||||
UniColor Color;
|
||||
|
||||
std::wstring m_namespace;
|
||||
UniColor Color;
|
||||
std::wstring m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -140,14 +140,11 @@ namespace PPTX
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
UniColor Color;
|
||||
nullable_limit<Limit::FontStyleIndex> idx;
|
||||
|
||||
public:
|
||||
UniColor Color;
|
||||
// Attributes
|
||||
nullable_limit<Limit::FontStyleIndex> idx;
|
||||
//private:
|
||||
public:
|
||||
std::wstring m_name;
|
||||
std::wstring m_name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -288,7 +288,7 @@ namespace PPTX
|
||||
}
|
||||
else if (7 == _at)//OleObject Binary FileName (bin, xls, doc, ... other stream file)
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
std::wstring strOlePath = pReader->GetString2();
|
||||
m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name
|
||||
}
|
||||
@ -297,8 +297,9 @@ namespace PPTX
|
||||
}
|
||||
|
||||
if (m_sData.IsInit() && m_OleObjectFile.IsInit() == false)
|
||||
m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
{
|
||||
m_OleObjectFile = new OOX::OleObject(NULL, false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
}
|
||||
|
||||
BYTE embedded_type = 0;
|
||||
|
||||
@ -874,7 +875,7 @@ namespace PPTX
|
||||
if(oleObject.IsInit() && blipFill.blip.IsInit())
|
||||
{
|
||||
if (oleObject->m_OleObjectFile.IsInit() == false)
|
||||
oleObject->m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
oleObject->m_OleObjectFile = new OOX::OleObject(NULL, false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
|
||||
|
||||
@ -958,7 +959,7 @@ namespace PPTX
|
||||
|
||||
if (oleObject->m_OleObjectFile.IsInit() == false)
|
||||
{
|
||||
oleObject->m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
oleObject->m_OleObjectFile = new OOX::OleObject(NULL, false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin, false);
|
||||
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
|
||||
|
||||
@ -324,15 +324,18 @@ namespace PPTX
|
||||
}
|
||||
DWORD GetARGBFromMap(const std::wstring& str)const
|
||||
{
|
||||
return GetARGBFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
if (m_map) return GetARGBFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
else return 0;
|
||||
}
|
||||
DWORD GetBGRAFromMap(const std::wstring& str)const
|
||||
{
|
||||
return GetBGRAFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
if (m_map) return GetBGRAFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
else return 0;
|
||||
}
|
||||
DWORD GetABGRFromMap(const std::wstring& str)const
|
||||
{
|
||||
return GetABGRFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
if (m_map) return GetABGRFromScheme(m_map->GetColorSchemeIndex(str));
|
||||
else return 0;
|
||||
}
|
||||
void GetLineStyle(int number, Logic::Ln& lnStyle)const
|
||||
{
|
||||
@ -357,6 +360,7 @@ namespace PPTX
|
||||
|
||||
void SetColorMap(const Logic::ClrMap& map){m_map = ↦};
|
||||
|
||||
bool isMapPresent() {return (m_map != NULL);}
|
||||
private:
|
||||
Logic::ClrMap const* m_map;
|
||||
};
|
||||
|
||||
@ -47,7 +47,6 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(ThemeElements)
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
clrScheme = node.ReadNode(_T("a:clrScheme"));
|
||||
@ -117,7 +116,6 @@ namespace PPTX
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
public:
|
||||
ClrScheme clrScheme;
|
||||
FontScheme fontScheme;
|
||||
FmtScheme fmtScheme;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "ConvertationManager.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "../../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
{
|
||||
@ -46,55 +47,69 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
|
||||
if (ole1Reader.NativeDataSize > 0)
|
||||
{
|
||||
POLE::Storage * storageOut = new POLE::Storage(sOle2Name.c_str());
|
||||
if ( (storageOut) && (storageOut->open(true, true)))
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
file.CloseFile();
|
||||
|
||||
POLE::Storage * storageIn = new POLE::Storage(sOle2Name.c_str());
|
||||
if ( (storageIn) && (storageIn->open(false, false))) //storage in storage
|
||||
{
|
||||
_UINT32 tmp = 0;
|
||||
std::string name = ole1Reader.Header.ClassName.val;
|
||||
_UINT32 name_size = name.length() + 1;
|
||||
//Ole
|
||||
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream3(storageOut, L"\001Ole", true, 20);
|
||||
oStream3.write(dataOleInfo, 20);
|
||||
oStream3.flush();
|
||||
//CompObj
|
||||
BYTE dataCompObjHeader[28] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0a,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
|
||||
POLE::Stream oStream1(storageOut, L"\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
oStream1.write(dataCompObjHeader, 28);
|
||||
storageIn->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
POLE::Storage * storageOut = new POLE::Storage(sOle2Name.c_str());
|
||||
if ( (storageOut) && (storageOut->open(true, true)))
|
||||
{
|
||||
_UINT32 tmp = 0;
|
||||
std::string name = ole1Reader.Header.ClassName.val;
|
||||
_UINT32 name_size = name.length() + 1;
|
||||
//Ole
|
||||
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream3(storageOut, L"\001Ole", true, 20);
|
||||
oStream3.write(dataOleInfo, 20);
|
||||
oStream3.flush();
|
||||
//CompObj
|
||||
BYTE dataCompObjHeader[28] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0a,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
|
||||
POLE::Stream oStream1(storageOut, L"\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
oStream1.write(dataCompObjHeader, 28);
|
||||
|
||||
oStream1.write((BYTE*)&name_size, 4);
|
||||
oStream1.write((BYTE*)name.c_str(), name_size);
|
||||
oStream1.write((BYTE*)&name_size, 4);
|
||||
oStream1.write((BYTE*)name.c_str(), name_size);
|
||||
|
||||
//oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
//oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
//oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
//oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
tmp = 0x71B239F4;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeMarker
|
||||
tmp = 0x71B239F4;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeMarker
|
||||
|
||||
tmp = 0;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeUserType
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeClipboardFormat
|
||||
oStream1.write((BYTE*)&tmp, 4); //
|
||||
oStream1.flush();
|
||||
tmp = 0;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeUserType
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeClipboardFormat
|
||||
oStream1.write((BYTE*)&tmp, 4); //
|
||||
oStream1.flush();
|
||||
|
||||
//ObjInfo
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x04,0x00};
|
||||
POLE::Stream oStream2(storageOut, L"\003ObjInfo", true, 6);
|
||||
oStream2.write(dataObjInfo, 6);
|
||||
oStream2.flush();
|
||||
//Ole10Native
|
||||
POLE::Stream streamData(storageOut, L"\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
streamData.write((BYTE*)&ole1Reader.NativeDataSize, 4);
|
||||
streamData.write(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
streamData.flush();
|
||||
//ObjInfo
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x04,0x00};
|
||||
POLE::Stream oStream2(storageOut, L"\003ObjInfo", true, 6);
|
||||
oStream2.write(dataObjInfo, 6);
|
||||
oStream2.flush();
|
||||
//Ole10Native
|
||||
POLE::Stream streamData(storageOut, L"\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
streamData.write((BYTE*)&ole1Reader.NativeDataSize, 4);
|
||||
streamData.write(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
streamData.flush();
|
||||
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
else //conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
@ -1168,26 +1183,28 @@ bool RtfTableCellPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
|
||||
COMMAND_RTF_BOOL( "clmgf", cellProps->m_bMergeFirst, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clmrg", cellProps->m_bMerge, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clvmgf", cellProps->m_bMergeFirstVertical, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clvmrg", cellProps->m_bMergeVertical, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clFitText", cellProps->m_bFitText, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clvmgf", cellProps->m_bMergeFirstVertical, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clvmrg", cellProps->m_bMergeVertical, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clFitText", cellProps->m_bFitText, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clNoWrap", cellProps->m_bNoWrap, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "clpadfl", cellProps->m_nIsPaddingLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadl", cellProps->m_nPaddingLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadft", cellProps->m_nIsPaddingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadt", cellProps->m_nPaddingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadfr", cellProps->m_nIsPaddingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadr", cellProps->m_nPaddingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadfb", cellProps->m_nIsPaddingBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadb", cellProps->m_nPaddingBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspfl", cellProps->m_nIsSpacingLeft, sCommand, hasParameter, parameter )
|
||||
//https://www.office-forums.com/threads/rtf-file-weirdness-clpadt-vs-clpadl.2163500/
|
||||
COMMAND_RTF_INT ( "clpadft", cellProps->m_ePaddingLeftUnit, sCommand, hasParameter, parameter ) //перепутаны top & left
|
||||
COMMAND_RTF_INT ( "clpadt", cellProps->m_nPaddingLeft, sCommand, hasParameter, parameter ) //перепутаны top & left
|
||||
COMMAND_RTF_INT ( "clpadfl", cellProps->m_ePaddingTopUnit, sCommand, hasParameter, parameter ) //перепутаны top & left
|
||||
COMMAND_RTF_INT ( "clpadl", cellProps->m_nPaddingTop, sCommand, hasParameter, parameter ) //перепутаны top & left
|
||||
COMMAND_RTF_INT ( "clpadfr", cellProps->m_ePaddingRightUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadr", cellProps->m_nPaddingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadfb", cellProps->m_ePaddingBottomUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clpadb", cellProps->m_nPaddingBottom, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "clspfl", cellProps->m_eSpacingLeftUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspl", cellProps->m_nSpacingLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspft", cellProps->m_nIsSpacingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspft", cellProps->m_eSpacingTopUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspt", cellProps->m_nSpacingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspfr", cellProps->m_nIsSpacingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspfr", cellProps->m_eSpacingRightUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspr", cellProps->m_nSpacingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspfb", cellProps->m_nIsSpacingBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspfb", cellProps->m_eSpacingBottomUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clspb", cellProps->m_nSpacingBottom, sCommand, hasParameter, parameter )
|
||||
|
||||
else if ( "clftsWidth" == sCommand )
|
||||
@ -1196,10 +1213,12 @@ bool RtfTableCellPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
{
|
||||
switch( parameter )
|
||||
{
|
||||
case 0:cellProps->m_eWidthUnits = mu_none;break;
|
||||
case 1:cellProps->m_eWidthUnits = mu_Auto;break;
|
||||
case 2:cellProps->m_eWidthUnits = mu_Percent;break;
|
||||
case 3:cellProps->m_eWidthUnits = mu_Twips;break;
|
||||
case 0: cellProps->m_eWidthUnit = mu_none; break;
|
||||
case 1: cellProps->m_eWidthUnit = mu_Auto; break;
|
||||
case 2: cellProps->m_eWidthUnit = mu_Percent; break;
|
||||
case 3: cellProps->m_eWidthUnit = mu_Twips; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1215,13 +1234,13 @@ bool RtfTableCellPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
COMMAND_RTF_INT ( "cltxtbrlv", cellProps->m_oCellFlow, sCommand, true, RtfCellProperty::cf_tbrlv )
|
||||
|
||||
//table style
|
||||
COMMAND_RTF_INT ( "tscellpaddfl", cellProps->m_nIsPaddingLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddfl", cellProps->m_ePaddingLeftUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddl", cellProps->m_nPaddingLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddft", cellProps->m_nIsPaddingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddft", cellProps->m_ePaddingTopUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddt", cellProps->m_nPaddingTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddfr", cellProps->m_nIsPaddingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddfr", cellProps->m_ePaddingRightUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddr", cellProps->m_nPaddingRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddfb", cellProps->m_nIsPaddingBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddfb", cellProps->m_ePaddingBottomUnit,sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tscellpaddb", cellProps->m_nPaddingBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "tsnowrap", cellProps->m_bNoWrap, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tsvertalt", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Top )
|
||||
@ -1255,55 +1274,22 @@ bool RtfTableRowPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
COMMAND_RTF_INT ( "trqr", rowProps->m_eJust, sCommand, true, RtfRowProperty::rj_trqr )
|
||||
COMMAND_RTF_INT ( "trqc", rowProps->m_eJust, sCommand, true, RtfRowProperty::rj_trqc )
|
||||
|
||||
COMMAND_RTF_INT ( "trrh", rowProps->m_nHeight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trrh", rowProps->m_nHeight, sCommand, hasParameter, parameter )
|
||||
|
||||
else if ( "trftsWidth" == sCommand )
|
||||
{
|
||||
if ( hasParameter )
|
||||
{
|
||||
switch( parameter )
|
||||
{
|
||||
case 0: rowProps->m_eMUWidth = mu_none; break;
|
||||
case 1: rowProps->m_eMUWidth = mu_Auto; break;
|
||||
case 2: rowProps->m_eMUWidth = mu_Percent; break;
|
||||
case 3: rowProps->m_eMUWidth = mu_Twips; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_INT ( "trwWidth", rowProps->m_nWidth, sCommand, hasParameter, parameter )
|
||||
else if ( "trftsWidthB" == sCommand )
|
||||
{
|
||||
if ( hasParameter )
|
||||
{
|
||||
switch( parameter )
|
||||
{
|
||||
case 0: rowProps->m_eMUStartInvCell = mu_none; break;
|
||||
case 1: rowProps->m_eMUStartInvCell = mu_Auto; break;
|
||||
case 2: rowProps->m_eMUStartInvCell = mu_Percent; break;
|
||||
case 3: rowProps->m_eMUStartInvCell = mu_Twips; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_INT ( "trwWidthB", rowProps->m_nWidthStartInvCell, sCommand, hasParameter, parameter )
|
||||
else if ( "trftsWidthA" == sCommand )
|
||||
{
|
||||
if ( hasParameter )
|
||||
{
|
||||
switch( parameter )
|
||||
{
|
||||
case 0: rowProps->m_eMUEndInvCell = mu_none; break;
|
||||
case 1: rowProps->m_eMUEndInvCell = mu_Auto; break;
|
||||
case 2: rowProps->m_eMUEndInvCell = mu_Percent; break;
|
||||
case 3: rowProps->m_eMUEndInvCell = mu_Twips; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_INT ( "trwWidthA", rowProps->m_nWidthEndInvCell, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "taprtl", rowProps->m_bBidi, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trftsWidth", rowProps->m_eWidthUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trwWidth", rowProps->m_nWidth, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "trftsWidthB", rowProps->m_eWidthStartInvCellUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trwWidthB", rowProps->m_nWidthStartInvCell, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "trftsWidthA", rowProps->m_eWidthEndInvCellUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trwWidthA", rowProps->m_nWidthEndInvCell, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_BOOL( "taprtl", rowProps->m_bBidi, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trautofit", rowProps->m_nAutoFit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trgaph", rowProps->m_nGraph, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tblind", rowProps->nTableIndent, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tblindtype", rowProps->nTableIndentUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trgaph", rowProps->m_nGraph, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tblind", rowProps->nTableIndent, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tblindtype", rowProps->eTableIndentUnit, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "tdfrmtxtLeft", rowProps->m_nWrapLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tdfrmtxtRight", rowProps->m_nWrapRight, sCommand, hasParameter, parameter )
|
||||
@ -1311,26 +1297,26 @@ bool RtfTableRowPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
COMMAND_RTF_INT ( "tdfrmtxtBottom", rowProps->m_nWrapBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "tabsnoovrlp", rowProps->m_bOverlap, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "tphmrg", rowProps->m_eHRef, sCommand, true, RtfTableProperty::hr_phmrg )
|
||||
COMMAND_RTF_INT ( "tphmrg", rowProps->m_eHRef, sCommand, true, RtfTableProperty::hr_phmrg )
|
||||
COMMAND_RTF_INT ( "tphpg", rowProps->m_eHRef, sCommand, true, RtfTableProperty::hr_phpg )
|
||||
COMMAND_RTF_INT ( "tphcol", rowProps->m_eHRef, sCommand, true, RtfTableProperty::hr_phcol )
|
||||
COMMAND_RTF_INT ( "tphcol", rowProps->m_eHRef, sCommand, true, RtfTableProperty::hr_phcol )
|
||||
COMMAND_RTF_INT ( "tposx", rowProps->m_nHPos, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tposnegx", rowProps->m_nHPos, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tposxc", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxc )
|
||||
COMMAND_RTF_INT ( "tposxi", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxi )
|
||||
COMMAND_RTF_INT ( "tposxo", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxo )
|
||||
COMMAND_RTF_INT ( "tposxl", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxl )
|
||||
COMMAND_RTF_INT ( "tposxr", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxr )
|
||||
COMMAND_RTF_INT ( "tposxc", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxc )
|
||||
COMMAND_RTF_INT ( "tposxi", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxi )
|
||||
COMMAND_RTF_INT ( "tposxo", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxo )
|
||||
COMMAND_RTF_INT ( "tposxl", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxl )
|
||||
COMMAND_RTF_INT ( "tposxr", rowProps->m_eHPos, sCommand, true, RtfTableProperty::hp_posxr )
|
||||
|
||||
COMMAND_RTF_INT ( "tpvmrg", rowProps->m_eVRef, sCommand, true, RtfTableProperty::vr_pvmrg )
|
||||
COMMAND_RTF_INT ( "tpvmrg", rowProps->m_eVRef, sCommand, true, RtfTableProperty::vr_pvmrg )
|
||||
COMMAND_RTF_INT ( "tpvpg", rowProps->m_eVRef, sCommand, true, RtfTableProperty::vr_pvpg )
|
||||
COMMAND_RTF_INT ( "tpvpara", rowProps->m_eVRef, sCommand, true, RtfTableProperty::vr_pvpara )
|
||||
COMMAND_RTF_INT ( "tposy", rowProps->m_nVPos, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tposnegy", rowProps->m_nVPos, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tposyt", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyt )
|
||||
COMMAND_RTF_INT ( "tposyt", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyt )
|
||||
COMMAND_RTF_INT ( "tposyil", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyil )
|
||||
COMMAND_RTF_INT ( "tposyb", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyb )
|
||||
COMMAND_RTF_INT ( "tposyc", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyc )
|
||||
COMMAND_RTF_INT ( "tposyb", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyb )
|
||||
COMMAND_RTF_INT ( "tposyc", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyc )
|
||||
COMMAND_RTF_INT ( "tposyin", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyin )
|
||||
COMMAND_RTF_INT ( "tposyout", rowProps->m_eVPos, sCommand, true, RtfTableProperty::vp_posyout )
|
||||
|
||||
@ -1342,21 +1328,25 @@ bool RtfTableRowPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
if ( PROP_DEF == rowProps->nTableIndent )
|
||||
{
|
||||
rowProps->nTableIndent = parameter;
|
||||
rowProps->nTableIndentUnits = 3;
|
||||
|
||||
if ( PROP_DEF == rowProps->eTableIndentUnit )
|
||||
rowProps->eTableIndentUnit = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_INT ( "trwWidth", rowProps->m_nWidth, sCommand, hasParameter, parameter )
|
||||
else if ( "trleft" == sCommand )
|
||||
else if ( "trftsWidth" == sCommand )
|
||||
{
|
||||
if ( hasParameter )
|
||||
{
|
||||
switch( parameter )
|
||||
{
|
||||
case 0: rowProps->m_eMUWidth = mu_none; break;
|
||||
case 1: rowProps->m_eMUWidth = mu_Auto; break;
|
||||
case 2: rowProps->m_eMUWidth = mu_Percent; break;
|
||||
case 3: rowProps->m_eMUWidth = mu_Twips; break;
|
||||
case 0: rowProps->m_eWidthUnit = mu_none; break;
|
||||
case 1: rowProps->m_eWidthUnit = mu_Auto; break;
|
||||
case 2: rowProps->m_eWidthUnit = mu_Percent; break;
|
||||
case 3: rowProps->m_eWidthUnit = mu_Twips; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1364,20 +1354,21 @@ bool RtfTableRowPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
COMMAND_RTF_INT ( "trpaddl", rowProps->m_nDefCellMarLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddr", rowProps->m_nDefCellMarRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddt", rowProps->m_nDefCellMarTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfb", rowProps->m_nDefCellMarBottomUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfl", rowProps->m_nDefCellMarLeftUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfr", rowProps->m_nDefCellMarRightUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddft", rowProps->m_nDefCellMarTopUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfb", rowProps->m_eDefCellMarBottomUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfl", rowProps->m_eDefCellMarLeftUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddfr", rowProps->m_eDefCellMarRightUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trpaddft", rowProps->m_eDefCellMarTopUnit, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "trspdb", rowProps->m_nDefCellSpBottom, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdl", rowProps->m_nDefCellSpLeft, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdr", rowProps->m_nDefCellSpRight, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdt", rowProps->m_nDefCellSpTop, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfb", rowProps->m_nDefCellSpBottomUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfl", rowProps->m_nDefCellSpLeftUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfr", rowProps->m_nDefCellSpRightUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdft", rowProps->m_nDefCellSpTopUnits, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfb", rowProps->m_eDefCellSpBottomUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfl", rowProps->m_eDefCellSpLeftUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdfr", rowProps->m_eDefCellSpRightUnit, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "trspdft", rowProps->m_eDefCellSpTopUnit, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "ts", rowProps->m_nStyle, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "ts", rowProps->m_nStyle, sCommand, hasParameter, parameter )
|
||||
|
||||
COMMAND_RTF_INT ( "tbllkhdrrows", rowProps->m_bAutoFirstRow, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "tbllklastrow", rowProps->m_bAutoLastRow, sCommand, hasParameter, parameter )
|
||||
@ -1926,6 +1917,9 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
|
||||
else if ( L"posrelv" == m_sPropName ) m_oShape.m_nPositionVRelative = nValue;
|
||||
else if ( L"fLayoutInCell" == m_sPropName ) m_oShape.m_bLayoutInCell = nValue;
|
||||
else if ( L"fAllowOverlap" == m_sPropName ) m_oShape.m_bAllowOverlap = nValue;
|
||||
else if ( L"fLockPosition" == m_sPropName ) m_oShape.m_nLockPosition = nValue;
|
||||
else if ( L"fLockRotation" == m_sPropName ) m_oShape.m_nLockRotation = nValue;
|
||||
|
||||
//Position relative
|
||||
else if ( L"pctHorizPos" == m_sPropName ) m_oShape.m_nPositionHPct = nValue;
|
||||
else if ( L"pctVertPos" == m_sPropName ) m_oShape.m_nPositionVPct = nValue;
|
||||
@ -2032,6 +2026,13 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
|
||||
else if ( L"dxTextRight" == m_sPropName ) m_oShape.m_nTexpRight = nValue;
|
||||
else if ( L"dyTextBottom" == m_sPropName ) m_oShape.m_nTexpBottom = nValue;
|
||||
else if ( L"anchorText" == m_sPropName ) m_oShape.m_nAnchorText = nValue;
|
||||
else if ( L"WrapText" == m_sPropName ) m_oShape.m_nWrapText = nValue;
|
||||
else if ( L"txflTextFlow" == m_sPropName ) m_oShape.m_nTxflTextFlow = nValue;
|
||||
else if ( L"ccol" == m_sPropName ) m_oShape.m_nCcol = nValue;
|
||||
else if ( L"txdir" == m_sPropName ) m_oShape.m_nTxdir = nValue;
|
||||
else if ( L"fFitShapeToText"== m_sPropName ) m_oShape.m_bFitShapeToText = nValue;
|
||||
else if ( L"fFitTextToShape"== m_sPropName ) m_oShape.m_bFitTextToShape = nValue;
|
||||
else if ( L"fRotateText" == m_sPropName ) m_oShape.m_fRotateText = nValue;
|
||||
|
||||
//Geometry
|
||||
else if ( L"adjustValue" == m_sPropName ) m_oShape.m_nAdjustValue[0] = nValue;
|
||||
@ -2152,8 +2153,8 @@ bool RtfTrackerChangesReader::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
else if ( "clbrdrr" == sCommand ) m_eInternalState = is_borderCellRight;
|
||||
else if ( "clbrdrb" == sCommand ) m_eInternalState = is_borderCellBottom;
|
||||
|
||||
else if ( "tsbrdrdgl" == sCommand ) m_eInternalState = is_borderCellLR;
|
||||
else if ( "tsbrdrdgr" == sCommand ) m_eInternalState = is_borderCellRL;
|
||||
else if ( "tsbrdrdgl" == sCommand ) m_eInternalState = is_borderCellLR;
|
||||
else if ( "tsbrdrdgr" == sCommand ) m_eInternalState = is_borderCellRL;
|
||||
|
||||
else if ( "trbrdrl" == sCommand ) m_eInternalState = is_borderRowLeft;
|
||||
else if ( "trbrdrr" == sCommand ) m_eInternalState = is_borderRowRight;
|
||||
@ -2161,7 +2162,8 @@ bool RtfTrackerChangesReader::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
else if ( "trbrdrb" == sCommand ) m_eInternalState = is_borderRowBottom;
|
||||
else if ( "trbrdrv" == sCommand ) m_eInternalState = is_borderRowVer;
|
||||
else if ( "trbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
else if ( "tsbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
|
||||
else if ( "tsbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
else if ( "tsbrdrv" == sCommand ) m_eInternalState = is_borderRowVer;
|
||||
else if ( "tsbrdrl" == sCommand ) m_eInternalState = is_borderRowLeft;
|
||||
else if ( "tsbrdrt" == sCommand ) m_eInternalState = is_borderRowTop;
|
||||
@ -2197,6 +2199,8 @@ bool RtfTrackerChangesReader::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
case is_borderTop:
|
||||
bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, m_pParagraphProps->m_oBorderTop );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (bResult) return true;
|
||||
|
||||
@ -2229,6 +2233,8 @@ bool RtfTrackerChangesReader::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
case is_borderRowVer :
|
||||
bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, m_pTableRowProps->m_oBorderVert );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( bResult ) return true;
|
||||
|
||||
@ -2932,9 +2938,9 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
|
||||
else if ( "brdrb" == sCommand ) m_eInternalState = is_borderBottom;
|
||||
else if ( "brdrl" == sCommand ) m_eInternalState = is_borderLeft;
|
||||
else if ( "brdrr" == sCommand ) m_eInternalState = is_borderRight;
|
||||
//else if ( "brdrbtw" == sCommand ) m_eInternalState = is_borderRight;
|
||||
//else if ( "brdrbtw" == sCommand ) m_eInternalState = is_borderRight;
|
||||
else if ( "brdrbar" == sCommand ) m_eInternalState = is_borderBar;
|
||||
else if ( "box" == sCommand ) m_eInternalState = is_borderBox;
|
||||
else if ( "box" == sCommand ) m_eInternalState = is_borderBox;
|
||||
|
||||
else if ( "cldglu" == sCommand ) m_eInternalState = is_borderCellLR;
|
||||
else if ( "cldgll" == sCommand ) m_eInternalState = is_borderCellRL;
|
||||
@ -2952,7 +2958,8 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
|
||||
else if ( "trbrdrb" == sCommand ) m_eInternalState = is_borderRowBottom;
|
||||
else if ( "trbrdrv" == sCommand ) m_eInternalState = is_borderRowVer;
|
||||
else if ( "trbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
else if ( "tsbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
|
||||
else if ( "tsbrdrh" == sCommand ) m_eInternalState = is_borderRowHor;
|
||||
else if ( "tsbrdrv" == sCommand ) m_eInternalState = is_borderRowVer;
|
||||
else if ( "tsbrdrl" == sCommand ) m_eInternalState = is_borderRowLeft;
|
||||
else if ( "tsbrdrt" == sCommand ) m_eInternalState = is_borderRowTop;
|
||||
@ -3020,6 +3027,8 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
|
||||
case is_borderRowVer :
|
||||
bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, oReader.m_oState->m_oRowProperty.m_oBorderVert );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( bResult ) return true;
|
||||
|
||||
|
||||
@ -67,10 +67,11 @@ public:
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithSpace = m_ooxApp->m_nCharactersWithSpaces.get2();
|
||||
}
|
||||
if(m_ooxApp->m_sAppVersion.IsInit())
|
||||
|
||||
if (m_ooxApp->m_sApplication.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nVersion= Strings::ToInteger( m_ooxApp->m_sAppVersion.get2() );
|
||||
}
|
||||
oParam.oRtf->m_oInformation.m_sApplication = m_ooxApp->m_sApplication.get2();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1427,7 +1427,7 @@ bool OOXrPrReader::Parse( ReaderParameter oParam, RtfCharProperty& oOutputProper
|
||||
|
||||
if (m_ooxRunProps->m_oPosition.IsInit() && m_ooxRunProps->m_oPosition->m_oVal.IsInit())
|
||||
{
|
||||
int nValue = m_ooxRunProps->m_oPosition->m_oVal->ToTwips();
|
||||
int nValue = m_ooxRunProps->m_oPosition->m_oVal->ToTwips() / 10;
|
||||
if( nValue >= 0 )
|
||||
oOutputProperty.m_nUp = nValue;
|
||||
else
|
||||
@ -1518,6 +1518,27 @@ bool OOXrPrReader::Parse( ReaderParameter oParam, RtfCharProperty& oOutputProper
|
||||
m_ooxRunProps->m_oHighlight->m_oVal->Get_G(),
|
||||
m_ooxRunProps->m_oHighlight->m_oVal->Get_B()));
|
||||
}
|
||||
if ( m_ooxRunProps->m_oTextOutline.IsInit())
|
||||
{
|
||||
unsigned int nColor = 0; //black
|
||||
_CP_OPT(double) opacity;
|
||||
|
||||
OOXShapeReader::Parse(oParam, &m_ooxRunProps->m_oTextOutline->Fill, nColor, opacity);
|
||||
|
||||
RtfColor rtfColor;
|
||||
rtfColor.SetRGB(nColor);
|
||||
|
||||
}
|
||||
if ( m_ooxRunProps->m_oTextFill.is_init())
|
||||
{
|
||||
unsigned int nColor = 0; //black
|
||||
_CP_OPT(double) opacity;
|
||||
|
||||
OOXShapeReader::Parse(oParam, &m_ooxRunProps->m_oTextFill, nColor, opacity);
|
||||
|
||||
RtfColor rtfColor;
|
||||
rtfColor.SetRGB(nColor);
|
||||
}
|
||||
if( m_ooxRunProps->m_oColor.IsInit() )
|
||||
{
|
||||
OOXColorReader oColorReader;
|
||||
@ -1965,14 +1986,22 @@ bool OOXSectionPropertyReader::Parse( ReaderParameter oParam , RtfSectionPropert
|
||||
}
|
||||
if( m_ooxSectionProperty->m_oCols.IsInit() )
|
||||
{
|
||||
if(m_ooxSectionProperty->m_oCols->m_oNum.IsInit())
|
||||
oOutput.m_nColumnNumber = m_ooxSectionProperty->m_oCols->m_oNum->GetValue();
|
||||
else
|
||||
oOutput.m_nColumnNumber = 1;
|
||||
if (!m_ooxSectionProperty->m_oCols->m_arrColumns.empty())
|
||||
{
|
||||
oOutput.m_nColumnNumber = m_ooxSectionProperty->m_oCols->m_arrColumns.size();
|
||||
}
|
||||
|
||||
if(m_ooxSectionProperty->m_oCols->m_oNum.IsInit())
|
||||
{
|
||||
oOutput.m_nColumnNumber = m_ooxSectionProperty->m_oCols->m_oNum->GetValue();
|
||||
}
|
||||
|
||||
if(m_ooxSectionProperty->m_oCols->m_oSpace.IsInit())
|
||||
oOutput.m_nColumnSpace = m_ooxSectionProperty->m_oCols->m_oSpace->ToTwips(); //todooo twips????
|
||||
|
||||
if (m_ooxSectionProperty->m_oCols->m_oSep.IsInit())
|
||||
oOutput.m_bColumnLineBetween = m_ooxSectionProperty->m_oCols->m_oSep->ToBool();
|
||||
|
||||
for (size_t i = 0; i < m_ooxSectionProperty->m_oCols->m_arrColumns.size(); i++ )
|
||||
{
|
||||
RtfSectionProperty::ColumnProperty::CollumnVar oNewColumn;
|
||||
|
||||
@ -284,19 +284,19 @@ public:
|
||||
if (m_ooxAnchor->m_oWrapTight->m_oWrapPolygon.IsInit())
|
||||
{
|
||||
int nValueX, nValueY;
|
||||
|
||||
|
||||
if (m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_oStart.IsInit())
|
||||
{
|
||||
nValueX = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_oStart->m_oX.ToTwips();
|
||||
nValueY = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_oStart->m_oY.ToTwips();
|
||||
nValueX = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_oStart->m_oX.ToEmu();
|
||||
nValueY = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_oStart->m_oY.ToEmu();
|
||||
|
||||
pOutput->m_aWrapPoints.push_back( std::pair<int,int>(nValueX, nValueY) );
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_arrLineTo.size(); i++ )
|
||||
{
|
||||
nValueX = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_arrLineTo[i]->m_oX.ToTwips();
|
||||
nValueY = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_arrLineTo[i]->m_oY.ToTwips();
|
||||
nValueX = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_arrLineTo[i]->m_oX.ToEmu();
|
||||
nValueY = m_ooxAnchor->m_oWrapTight->m_oWrapPolygon->m_arrLineTo[i]->m_oY.ToEmu();
|
||||
|
||||
pOutput->m_aWrapPoints.push_back( std::pair<int,int>(nValueX, nValueY) );
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
pOutput->m_nTop = 0;
|
||||
pOutput->m_nPositionHRelative = 3;
|
||||
pOutput->m_nPositionVRelative = 3;
|
||||
|
||||
|
||||
int nDistLeft = m_ooxInline->m_oDistL.IsInit() ? (int)m_ooxInline->m_oDistL->ToTwips() : PROP_DEF;
|
||||
int nDistTop = m_ooxInline->m_oDistT.IsInit() ? (int)m_ooxInline->m_oDistT->ToTwips() : PROP_DEF;
|
||||
int nDistRight = m_ooxInline->m_oDistR.IsInit() ? (int)m_ooxInline->m_oDistR->ToTwips() : PROP_DEF;
|
||||
|
||||
@ -648,11 +648,13 @@ void OOXShapeReader::Parse(ReaderParameter oParam, PPTX::Logic::ColorBase *oox_c
|
||||
{
|
||||
if (!oox_color) return;
|
||||
|
||||
oox_color->SetParentFilePointer(oParam.oDocx->m_pTheme);
|
||||
|
||||
nColor = oox_color->GetARGB(0);
|
||||
BYTE alpha = nColor >> 24;
|
||||
if (alpha != 0xff)
|
||||
opacity = alpha;
|
||||
nColor = nColor & 0xff000000;
|
||||
nColor = nColor & 0x00ffffff;
|
||||
//switch( oox_color->m_eType )
|
||||
//{
|
||||
// case OOX::Drawing::colorSheme: Parse(oParam, &oox_color->m_oShemeClr, nColor, opacity); break;
|
||||
@ -698,7 +700,10 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L
|
||||
|
||||
if (change_sheme_color && oox_solid_fill->Color.getType() == OOX::et_a_schemeClr)
|
||||
{
|
||||
//oox_solid_fill->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
|
||||
PPTX::Logic::SchemeClr *pSchemeColor = new PPTX::Logic::SchemeClr();
|
||||
pSchemeColor->val.set(*change_sheme_color);
|
||||
|
||||
oox_solid_fill->Color.Color.reset(pSchemeColor);
|
||||
}
|
||||
|
||||
Parse(oParam, oox_solid_fill, nColor, opacity);
|
||||
@ -910,21 +915,29 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Logic::SolidFill> fill = oox_line_prop->Fill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
NSCommon::smart_ptr<PPTX::Logic::NoFill> no_fill = oox_line_prop->Fill.Fill.smart_dynamic_cast<PPTX::Logic::NoFill>();
|
||||
if (fill.IsInit())
|
||||
|
||||
if (no_fill.IsInit())
|
||||
{
|
||||
pOutput->m_bLine = false;
|
||||
}
|
||||
else if (fill.IsInit())
|
||||
{
|
||||
if (change_sheme_color && fill->Color.getType() == OOX::et_a_schemeClr)
|
||||
{
|
||||
//fill->Color.FromString(*change_sheme_color);
|
||||
}
|
||||
PPTX::Logic::SchemeClr *pSchemeColor = new PPTX::Logic::SchemeClr();
|
||||
pSchemeColor->val.set(*change_sheme_color);
|
||||
|
||||
fill->Color.Color.reset(pSchemeColor);
|
||||
}
|
||||
unsigned int nColor = 0; //black
|
||||
_CP_OPT(double) opacity;
|
||||
|
||||
Parse(oParam, fill.operator->(), nColor, opacity);
|
||||
pOutput->m_nLineColor = nColor;
|
||||
}
|
||||
else if (no_fill.IsInit())
|
||||
else
|
||||
{
|
||||
pOutput->m_bLine = false;
|
||||
|
||||
}
|
||||
}
|
||||
if (oox_line_prop->w.IsInit())
|
||||
@ -1061,15 +1074,26 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
PPTX::Logic::Shape * ooxShape = dynamic_cast<PPTX::Logic::Shape*> (m_ooxShape);
|
||||
|
||||
if (!ooxShape) return false;
|
||||
|
||||
PPTX::Logic::BodyPr *text_properties = NULL;
|
||||
|
||||
if (ooxShape->oTextBoxBodyPr.IsInit())
|
||||
if (ooxShape->oTextBoxShape.IsInit())
|
||||
{
|
||||
if (ooxShape->oTextBoxBodyPr->fromWordArt.get_value_or(false))
|
||||
text_properties = ooxShape->oTextBoxBodyPr.GetPointer();
|
||||
}
|
||||
|
||||
if (ooxShape->txBody.IsInit())
|
||||
{
|
||||
text_properties = ooxShape->txBody->bodyPr.GetPointer();
|
||||
}
|
||||
if (text_properties)
|
||||
{
|
||||
if (text_properties->fromWordArt.get_value_or(false))
|
||||
{
|
||||
pOutput->m_bGtext = 1;
|
||||
if (ooxShape->oTextBoxBodyPr->prstTxWarp.IsInit())
|
||||
if (text_properties->prstTxWarp.IsInit())
|
||||
{
|
||||
SimpleTypes::ETextShapeType type = (SimpleTypes::ETextShapeType)ooxShape->oTextBoxBodyPr->prstTxWarp->prst.GetBYTECode();
|
||||
SimpleTypes::ETextShapeType type = (SimpleTypes::ETextShapeType)text_properties->prstTxWarp->prst.GetBYTECode();
|
||||
|
||||
pOutput->m_nShapeType = OOX::PrstTx2VmlShapeType(type);
|
||||
}
|
||||
@ -1164,9 +1188,50 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
Parse(oParam, pOutput, ooxShape->spPr.ln.GetPointer());
|
||||
}
|
||||
//---------------------------------------------------------------------
|
||||
PPTX::Logic::TxBody * text_properties = NULL;
|
||||
OOXTextItemReader oTextItemReader;
|
||||
|
||||
RtfCharProperty old = oParam.oRtf->m_oDefaultCharProp;
|
||||
if ((oox_sp_style) && (oox_sp_style->fontRef.idx.IsInit()))
|
||||
{
|
||||
std::wstring font_name;
|
||||
if (oox_sp_style->fontRef.idx->GetBYTECode() == 0)
|
||||
{
|
||||
font_name = oParam.oDocx->m_pTheme->themeElements.fontScheme.majorFont.latin.typeface;
|
||||
}
|
||||
else if (oox_sp_style->fontRef.idx->GetBYTECode() == 1)
|
||||
{
|
||||
font_name = oParam.oDocx->m_pTheme->themeElements.fontScheme.minorFont.latin.typeface;
|
||||
}
|
||||
if (!font_name.empty())
|
||||
{
|
||||
RtfFont oCurFont;
|
||||
if( true == oParam.oRtf->m_oFontTable.GetFont( font_name, oCurFont ) )
|
||||
{
|
||||
oParam.oRtf->m_oDefaultCharProp.m_nFont = oCurFont.m_nID;
|
||||
}
|
||||
else
|
||||
{
|
||||
oCurFont.m_sName = font_name;
|
||||
oCurFont.m_nID = oParam.oRtf->m_oDefaultCharProp.m_nFont = oParam.oRtf->m_oFontTable.GetCount() + 1;
|
||||
oParam.oRtf->m_oFontTable.AddItem( oCurFont );
|
||||
}
|
||||
}
|
||||
if (oox_sp_style->fontRef.Color.is_init())
|
||||
{
|
||||
unsigned int nColor = 0; //black
|
||||
_CP_OPT(double) opacity;
|
||||
|
||||
OOXShapeReader::Parse(oParam, oox_sp_style->fontRef.Color.Color.operator ->(), nColor, opacity);
|
||||
|
||||
RtfColor rtfColor;
|
||||
rtfColor.SetRGB(nColor);
|
||||
|
||||
oParam.oRtf->m_oDefaultCharProp.m_nForeColor = oParam.oRtf->m_oColorTable.AddItem(rtfColor);
|
||||
}
|
||||
}
|
||||
|
||||
Parse(oParam, pOutput, text_properties);
|
||||
|
||||
if (ooxShape->txBody.IsInit())
|
||||
{
|
||||
for (size_t i=0; i < ooxShape->txBody->Paragrs.size(); i++)
|
||||
@ -1174,7 +1239,13 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
oTextItemReader.Parse(&ooxShape->txBody->Paragrs[i], oParam );
|
||||
}
|
||||
|
||||
text_properties = ooxShape->txBody.GetPointer();
|
||||
}
|
||||
else if (ooxShape->oTextBoxShape.IsInit())
|
||||
{
|
||||
for (size_t i=0; i < ooxShape->oTextBoxShape->m_arrItems.size(); i++)
|
||||
{
|
||||
oTextItemReader.Parse(ooxShape->oTextBoxShape->m_arrItems[i], oParam );
|
||||
}
|
||||
}
|
||||
|
||||
if (oTextItemReader.m_oTextItems)
|
||||
@ -1190,13 +1261,70 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
{
|
||||
pOutput->m_aTextItems = oTextItemReader.m_oTextItems;
|
||||
}
|
||||
}
|
||||
|
||||
if (text_properties)
|
||||
oParam.oRtf->m_oDefaultCharProp = old;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::BodyPr *text_props)
|
||||
{
|
||||
if (!text_props) return;
|
||||
|
||||
if (text_props->lIns.IsInit()) pOutput->m_nTexpLeft = *text_props->lIns;
|
||||
if (text_props->tIns.IsInit()) pOutput->m_nTexpTop = *text_props->tIns;
|
||||
if (text_props->rIns.IsInit()) pOutput->m_nTexpRight = *text_props->rIns;
|
||||
if (text_props->bIns.IsInit()) pOutput->m_nTexpBottom = *text_props->bIns;
|
||||
|
||||
if (text_props->anchor.IsInit())
|
||||
{
|
||||
switch(text_props->anchor->GetBYTECode())
|
||||
{
|
||||
case 0: pOutput->m_nAnchorText = 2; break;
|
||||
case 4: pOutput->m_nAnchorText = 0; break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
pOutput->m_nAnchorText = 4; break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (text_props->rtlCol.IsInit())
|
||||
pOutput->m_nTxdir = *text_props->rtlCol;
|
||||
|
||||
if (text_props->numCol.IsInit())
|
||||
pOutput->m_nCcol = *text_props->numCol;
|
||||
|
||||
switch(text_props->Fit.type)
|
||||
{
|
||||
case 2: pOutput->m_bFitShapeToText = 1; break;
|
||||
case 3: pOutput->m_bFitTextToShape = 1; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (text_props->vert.IsInit())
|
||||
{
|
||||
switch(text_props->vert->GetBYTECode())
|
||||
{
|
||||
case 0: pOutput->m_nTxflTextFlow = 1; break;
|
||||
case 2: pOutput->m_nTxflTextFlow = 2; break;
|
||||
case 3: pOutput->m_nTxflTextFlow = 1; break;
|
||||
case 4: pOutput->m_nTxflTextFlow = 2; break;
|
||||
case 5: pOutput->m_nTxflTextFlow = 5; break;
|
||||
case 6: pOutput->m_nTxflTextFlow = 5; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (text_props->rot.IsInit())
|
||||
{
|
||||
pOutput->m_fRotateText = 1;
|
||||
}
|
||||
//nullable_int rot;
|
||||
//nullable_limit<Limit::TextWrap> wrap;
|
||||
|
||||
}
|
||||
|
||||
bool OOXShapeReader::ParsePic( ReaderParameter oParam, RtfShapePtr& pOutput)
|
||||
@ -1571,7 +1699,7 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
|
||||
|
||||
if( m_ooxGroup->grpSpPr.xfrm.IsInit())
|
||||
{
|
||||
double rot = m_ooxGroup->grpSpPr.xfrm->rot.get() / 60000.;
|
||||
double rot = m_ooxGroup->grpSpPr.xfrm->rot.IsInit() ? m_ooxGroup->grpSpPr.xfrm->rot.get() / 60000. : 0.;
|
||||
if (rot > 0.01)
|
||||
pOutput->m_nRotation = (int)(rot * 65535);
|
||||
|
||||
@ -1896,3 +2024,31 @@ bool OOXShapeReader::WriteDataToPicture( std::wstring sPath, RtfPicture& pOutput
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OOXShapeReader::Parse(ReaderParameter oParam, PPTX::Logic::UniFill *uni_fill, unsigned int & nColor, _CP_OPT(double) &opacity)
|
||||
{
|
||||
if (!uni_fill) return;
|
||||
|
||||
if (uni_fill->m_type == PPTX::Logic::UniFill::noFill )
|
||||
{
|
||||
nColor = 0xffffff; //white
|
||||
}
|
||||
else if (uni_fill->m_type == PPTX::Logic::UniFill::solidFill )
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Logic::SolidFill> fill = uni_fill->Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
|
||||
Parse(oParam, fill->Color.Color.operator ->(), nColor, opacity);
|
||||
}
|
||||
else if (uni_fill->m_type == PPTX::Logic::UniFill::gradFill )
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Logic::GradFill> fill = uni_fill->Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
|
||||
unsigned int nColor = 0; //black
|
||||
_CP_OPT(double) opacity;
|
||||
|
||||
if (!fill->GsLst.empty())
|
||||
{
|
||||
Parse(oParam, fill->GsLst[0].color.Color.operator ->(), nColor, opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,14 +66,16 @@ public:
|
||||
void ParseAdjustment(RtfShape& oShape, std::wstring sAdjustment);
|
||||
|
||||
static bool Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::BlipFill *oox_bitmap_fill);
|
||||
static void Parse(ReaderParameter oParam, PPTX::Logic::UniFill *fill, unsigned int & nColor, _CP_OPT(double) &opacity);
|
||||
static void Parse(ReaderParameter oParam, PPTX::Logic::ColorBase *oox_color, unsigned int & nColor, _CP_OPT(double) &opacity);
|
||||
private:
|
||||
|
||||
bool ParseShape( ReaderParameter oParam , RtfShapePtr& oOutput);
|
||||
bool ParsePic( ReaderParameter oParam , RtfShapePtr& oOutput);
|
||||
|
||||
void Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::BodyPr *text_properties);
|
||||
void Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::Xfrm *xfrm);
|
||||
|
||||
void Parse(ReaderParameter oParam, PPTX::Logic::ColorBase *oox_color, unsigned int & nColor, _CP_OPT(double) &opacity);
|
||||
void Parse(ReaderParameter oParam, PPTX::Logic::SolidFill *oox_solid_fill, unsigned int & nColor, _CP_OPT(double) &opacity);
|
||||
|
||||
void Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::StyleRef *style_ref, int type);
|
||||
|
||||
@ -79,16 +79,9 @@ bool OOXtrPrReader::Parse( ReaderParameter oParam , RtfRowProperty& oOutputPrope
|
||||
if (m_ooxTableRowProps->m_oTblHeight->m_oHRule.IsInit() && m_ooxTableRowProps->m_oTblHeight->m_oHRule->GetValue() == SimpleTypes::heightruleExact)
|
||||
oOutputProperty.m_nHeight = -oOutputProperty.m_nHeight;
|
||||
}
|
||||
if( m_ooxTableRowProps->m_oWBefore.IsInit() && m_ooxTableRowProps->m_oWBefore->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nWidthStartInvCell = m_ooxTableRowProps->m_oWBefore->m_oW->GetValue();
|
||||
oOutputProperty.m_eMUStartInvCell = _MetricUnits::mu_Twips;
|
||||
}
|
||||
if( m_ooxTableRowProps->m_oWAfter.IsInit() && m_ooxTableRowProps->m_oWAfter->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nWidthEndInvCell = m_ooxTableRowProps->m_oWAfter->m_oW->GetValue();
|
||||
oOutputProperty.m_eMUEndInvCell = _MetricUnits::mu_Twips;
|
||||
}
|
||||
|
||||
OOXtcPrReader::Parse(m_ooxTableRowProps->m_oWBefore.GetPointer(), oOutputProperty.m_eWidthStartInvCellUnit, oOutputProperty.m_nWidthStartInvCell);
|
||||
OOXtcPrReader::Parse(m_ooxTableRowProps->m_oWAfter.GetPointer(), oOutputProperty.m_eWidthEndInvCellUnit, oOutputProperty.m_nWidthEndInvCell);
|
||||
|
||||
if( m_ooxTableRowProps->m_oGridBefore.IsInit() && m_ooxTableRowProps->m_oGridBefore->m_oVal.IsInit())
|
||||
oOutputProperty.m_nGridBefore = m_ooxTableRowProps->m_oGridBefore->m_oVal->GetValue();
|
||||
@ -172,10 +165,10 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
|
||||
|
||||
long nRowCount = m_ooxTable->m_nCountRow, nCurRow = 0;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxTable->m_arrItems.begin(); it != m_ooxTable->m_arrItems.end(); ++it)
|
||||
for (size_t i =0; i < m_ooxTable->m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( (*it) == NULL) continue;
|
||||
if ( (*it)->getType() != OOX::et_w_tr) continue;
|
||||
if ( m_ooxTable->m_arrItems[i] == NULL) continue;
|
||||
if ( m_ooxTable->m_arrItems[i]->getType() != OOX::et_w_tr) continue;
|
||||
|
||||
ReaderParameter newParam = oParam;
|
||||
newParam.poTableStyle = poTableStyle;
|
||||
@ -185,10 +178,11 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
|
||||
//т.к. в RTF нет свойств таблиц и все свойства записываются в свойства row
|
||||
(*((RtfTableProperty*)&oNewRow->m_oProperty)).Merge( oOutputTable.m_oProperty );
|
||||
|
||||
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(*it);
|
||||
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(m_ooxTable->m_arrItems[i]);
|
||||
|
||||
OOXTableRowReader oRowReader(ooxRow, m_ooxTable->m_oTableProperties);
|
||||
oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount );
|
||||
|
||||
oOutputTable.AddItem( oNewRow );
|
||||
}
|
||||
oOutputTable.CalculateCellx( *oParam.oRtf );
|
||||
|
||||
@ -54,7 +54,14 @@ public:
|
||||
if (m_ooxRowTable == NULL) return false;
|
||||
|
||||
CcnfStyle oConditionStyle;
|
||||
//с начала применяем свойства
|
||||
|
||||
if (nCurRow == 0 && oOutputRow.m_oProperty.m_bAutoFirstRow == 1)
|
||||
oConditionStyle.bFirstRow = true;
|
||||
|
||||
if (nCurRow == nRowCount - 1 && oOutputRow.m_oProperty.m_bAutoLastRow == 1)
|
||||
oConditionStyle.bLastRow = true;
|
||||
|
||||
//сначала применяем свойства
|
||||
if( m_ooxRowTable->m_pTableRowProperties )
|
||||
{
|
||||
OOXtrPrReader otrPrReader(m_ooxRowTable->m_pTableRowProperties);
|
||||
@ -63,10 +70,10 @@ public:
|
||||
|
||||
int nCellCount = m_ooxRowTable->m_nCountCell, nCurCell = 0;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = m_ooxRowTable->m_arrItems.begin(); it != m_ooxRowTable->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < m_ooxRowTable->m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( (*it) == NULL ) continue;
|
||||
if ( (*it)->getType() != OOX::et_w_tc)continue;//todooo bookmarks
|
||||
if ( m_ooxRowTable->m_arrItems[i] == NULL ) continue;
|
||||
if ( m_ooxRowTable->m_arrItems[i]->getType() != OOX::et_w_tc) continue;//todooo bookmarks
|
||||
|
||||
RtfTableCellPtr oNewCell( new RtfTableCell() );
|
||||
|
||||
@ -74,7 +81,7 @@ public:
|
||||
|
||||
if (nCurCell < m_ooxRowTable->m_arrItems.size())
|
||||
{
|
||||
ooxCell = dynamic_cast<OOX::Logic::CTc *>(*it);
|
||||
ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[i]);
|
||||
}
|
||||
|
||||
OOXTableCellReader oCellReader(ooxCell, m_ooxTableProps );
|
||||
|
||||
@ -277,15 +277,20 @@ private:
|
||||
if( nBoundLeft == nCurX )
|
||||
{
|
||||
oOutputProperty.m_oBorderLeft.Merge( oInputStyle->m_oTableProp.m_oBorderLeft );
|
||||
|
||||
if( nBoundRight == nCurX )
|
||||
oOutputProperty.m_oBorderRight.Merge( oInputStyle->m_oTableProp.m_oBorderRight );
|
||||
else if (oInputStyle->m_oTableProp.m_bAutoNoColBand != 1)
|
||||
else //if (oInputStyle->m_oTableProp.m_bAutoNoColBand != 1)
|
||||
oOutputProperty.m_oBorderRight.Merge( oInputStyle->m_oTableProp.m_oBorderVert );
|
||||
}
|
||||
else if( nBoundRight == nCurX )
|
||||
{
|
||||
oOutputProperty.m_oBorderLeft.Merge( oInputStyle->m_oTableProp.m_oBorderVert );
|
||||
oOutputProperty.m_oBorderRight.Merge( oInputStyle->m_oTableProp.m_oBorderRight );
|
||||
|
||||
if( nBoundLeft == nCurX )
|
||||
oOutputProperty.m_oBorderLeft.Merge( oInputStyle->m_oTableProp.m_oBorderLeft );
|
||||
else //if (oInputStyle->m_oTableProp.m_bAutoNoColBand != 1)
|
||||
oOutputProperty.m_oBorderLeft.Merge( oInputStyle->m_oTableProp.m_oBorderVert );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -298,13 +303,16 @@ private:
|
||||
oOutputProperty.m_oBorderTop.Merge( oInputStyle->m_oTableProp.m_oBorderTop );
|
||||
if( nBoundBottom == nCurY )
|
||||
oOutputProperty.m_oBorderBottom.Merge( oInputStyle->m_oTableProp.m_oBorderBottom );
|
||||
else if (oInputStyle->m_oTableProp.m_bAutoNoRowBand != 1)
|
||||
else// if (oInputStyle->m_oTableProp.m_bAutoNoRowBand != 1)
|
||||
oOutputProperty.m_oBorderBottom.Merge( oInputStyle->m_oTableProp.m_oBorderHor );
|
||||
}
|
||||
else if( nBoundBottom == nCurY )
|
||||
{
|
||||
oOutputProperty.m_oBorderTop.Merge( oInputStyle->m_oTableProp.m_oBorderHor );
|
||||
oOutputProperty.m_oBorderBottom.Merge( oInputStyle->m_oTableProp.m_oBorderBottom );
|
||||
if( nBoundTop == nCurX )
|
||||
oOutputProperty.m_oBorderTop.Merge( oInputStyle->m_oTableProp.m_oBorderTop );
|
||||
else //if (oInputStyle->m_oTableProp.m_bAutoNoRowBand != 1)
|
||||
oOutputProperty.m_oBorderTop.Merge( oInputStyle->m_oTableProp.m_oBorderHor );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
{
|
||||
m_ooxTabs = ooxTabs;
|
||||
}
|
||||
bool Parse( ReaderParameter oParam ,RtfTabs& oOutputProperty)
|
||||
bool Parse( ReaderParameter oParam, RtfTabs& oOutputProperty)
|
||||
{
|
||||
if (m_ooxTabs == NULL) return false;
|
||||
|
||||
@ -64,6 +64,8 @@ public:
|
||||
case SimpleTypes::tabtlcMiddleDot : oCurTab.m_eLeader = RtfTab::tl_mdot; break;
|
||||
case SimpleTypes::tabtlcNone : break;
|
||||
case SimpleTypes::tabtlcUnderscore : oCurTab.m_eLeader = RtfTab::tl_ul; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_ooxTabs->m_arrTabs[i]->m_oVal.IsInit())
|
||||
@ -79,6 +81,8 @@ public:
|
||||
case SimpleTypes::tabjcStart : oCurTab.m_eKind = RtfTab::tk_tql; break;
|
||||
case SimpleTypes::tabjcRight : oCurTab.m_eKind = RtfTab::tk_tqr; break;
|
||||
case SimpleTypes::tabjcLeft : oCurTab.m_eKind = RtfTab::tk_tql; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_ooxTabs->m_arrTabs[i]->m_oPos.IsInit())
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
{
|
||||
if (m_ooxTblLook == NULL) return false;
|
||||
|
||||
oOutput.bLastRow = m_ooxTblLook->IsFirstRow();
|
||||
oOutput.bFirstRow = m_ooxTblLook->IsFirstRow();
|
||||
oOutput.bLastRow = m_ooxTblLook->IsLastRow();
|
||||
oOutput.bFirstCol = m_ooxTblLook->IsFirstColumn();
|
||||
oOutput.bLastCol = m_ooxTblLook->IsLastColumn();
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "OOXtblpPrReader.h"
|
||||
#include "OOXReaderBasic.h"
|
||||
#include "OOXtblLookReader.h"
|
||||
#include "OOXtcPrReader.h"
|
||||
|
||||
#include "../RtfDocument.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h"
|
||||
@ -78,26 +79,9 @@ public:
|
||||
oOutputProperty.m_nStyle = oTableStyle->m_nID;
|
||||
}
|
||||
}
|
||||
if(m_ooxTableProps->m_oTblInd.IsInit() )
|
||||
{
|
||||
SimpleTypes::ETblWidth eType = m_ooxTableProps->m_oTblInd->m_oType.IsInit() ? m_ooxTableProps->m_oTblInd->m_oType->GetValue() : SimpleTypes::tblwidthNil;
|
||||
double dValue = m_ooxTableProps->m_oTblInd->m_oW.IsInit() ? m_ooxTableProps->m_oTblInd->m_oW->GetValue() : 0;
|
||||
|
||||
switch(eType)
|
||||
{
|
||||
case SimpleTypes::tblwidthDxa://сделаем не по документации, а как все остальные юниты !!!
|
||||
{
|
||||
oOutputProperty.nTableIndentUnits = 3;
|
||||
oOutputProperty.nTableIndent = (int)dValue;
|
||||
oOutputProperty.m_nLeft = (int)oOutputProperty.nTableIndent;
|
||||
}break;
|
||||
case SimpleTypes::tblwidthPct:
|
||||
{
|
||||
// oOutputProperty.nTableIndentUnits = 3;
|
||||
// oOutputProperty.nTableIndent = Strings::ToInteger( sValue );
|
||||
}break;
|
||||
}
|
||||
}
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblInd.GetPointer(), oOutputProperty.eTableIndentUnit, oOutputProperty.nTableIndent, false);
|
||||
oOutputProperty.m_nLeft = oOutputProperty.nTableIndent;
|
||||
|
||||
if( m_ooxTableProps->m_oTblLayout.IsInit() && m_ooxTableProps->m_oTblLayout->m_oType.IsInit())
|
||||
{
|
||||
if( m_ooxTableProps->m_oTblLayout->m_oType->GetValue() == SimpleTypes::tbllayouttypeAutofit) oOutputProperty.m_nAutoFit = 1;
|
||||
@ -164,66 +148,37 @@ public:
|
||||
}
|
||||
if( m_ooxTableProps->m_oTblCellMar.IsInit() )
|
||||
{
|
||||
_MetricUnits eMetric = mu_none;
|
||||
int nValue = PROP_DEF;
|
||||
//if( mu_Twips == eMetric && PROP_DEF != nValue )
|
||||
//todooo сделать вариант с процентми
|
||||
if( m_ooxTableProps->m_oTblCellMar->m_oBottom.IsInit() && m_ooxTableProps->m_oTblCellMar->m_oBottom->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nDefCellMarBottomUnits= 3;
|
||||
oOutputProperty.m_nDefCellMarBottom = (int)m_ooxTableProps->m_oTblCellMar->m_oBottom->m_oW->GetValue();
|
||||
}
|
||||
if(m_ooxTableProps->m_oTblCellMar->m_oStart.IsInit() && m_ooxTableProps->m_oTblCellMar->m_oStart->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nDefCellMarLeftUnits = 3;
|
||||
oOutputProperty.m_nDefCellMarLeft = (int)m_ooxTableProps->m_oTblCellMar->m_oStart->m_oW->GetValue();
|
||||
}
|
||||
if(m_ooxTableProps->m_oTblCellMar->m_oEnd.IsInit() && m_ooxTableProps->m_oTblCellMar->m_oEnd->m_oW.IsInit() )
|
||||
{
|
||||
oOutputProperty.m_nDefCellMarRightUnits = 3;
|
||||
oOutputProperty.m_nDefCellMarRight = (int)m_ooxTableProps->m_oTblCellMar->m_oEnd->m_oW->GetValue();
|
||||
}
|
||||
if(m_ooxTableProps->m_oTblCellMar->m_oTop.IsInit() && m_ooxTableProps->m_oTblCellMar->m_oTop->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nDefCellMarTopUnits = 3;
|
||||
oOutputProperty.m_nDefCellMarTop = (int)m_ooxTableProps->m_oTblCellMar->m_oTop->m_oW->GetValue();
|
||||
}
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblCellMar->m_oBottom.GetPointer(), oOutputProperty.m_eDefCellMarBottomUnit, oOutputProperty.m_nDefCellMarBottom, false);
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblCellMar->m_oStart.GetPointer(), oOutputProperty.m_eDefCellMarLeftUnit, oOutputProperty.m_nDefCellMarLeft, false);
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblCellMar->m_oEnd.GetPointer(), oOutputProperty.m_eDefCellMarRightUnit, oOutputProperty.m_nDefCellMarRight, false);
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblCellMar->m_oTop.GetPointer(), oOutputProperty.m_eDefCellMarTopUnit, oOutputProperty.m_nDefCellMarTop, false);
|
||||
|
||||
}
|
||||
if( m_ooxTableProps->m_oTblCellSpacing.IsInit() && m_ooxTableProps->m_oTblCellSpacing->m_oW.IsInit())
|
||||
|
||||
if( m_ooxTableProps->m_oTblCellSpacing.IsInit())
|
||||
{
|
||||
//todooo тут тоже не было изначально варианта с процентами
|
||||
//mu_Twips == eMetric && PROP_DEF != nValue )
|
||||
{
|
||||
double nValue = m_ooxTableProps->m_oTblCellSpacing->m_oW->GetValue();
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblCellSpacing.GetPointer(), oOutputProperty.m_eDefCellSpTopUnit, oOutputProperty.m_nDefCellSpTop, false);
|
||||
|
||||
oOutputProperty.m_eDefCellSpBottomUnit = oOutputProperty.m_eDefCellSpTopUnit;
|
||||
oOutputProperty.m_eDefCellSpLeftUnit = oOutputProperty.m_eDefCellSpTopUnit;
|
||||
oOutputProperty.m_eDefCellSpRightUnit = oOutputProperty.m_eDefCellSpTopUnit;
|
||||
|
||||
oOutputProperty.m_nDefCellSpTopUnits = 3;
|
||||
oOutputProperty.m_nDefCellSpBottomUnits = 3;
|
||||
oOutputProperty.m_nDefCellSpLeftUnits = 3;
|
||||
oOutputProperty.m_nDefCellSpRightUnits = 3;
|
||||
|
||||
oOutputProperty.m_nDefCellSpTop = (int)nValue;
|
||||
oOutputProperty.m_nDefCellSpBottom = (int)nValue;
|
||||
oOutputProperty.m_nDefCellSpLeft = (int)nValue;
|
||||
oOutputProperty.m_nDefCellSpRight = (int)nValue;
|
||||
}
|
||||
oOutputProperty.m_nDefCellSpBottom = oOutputProperty.m_nDefCellSpTop;
|
||||
oOutputProperty.m_nDefCellSpLeft = oOutputProperty.m_nDefCellSpTop;
|
||||
oOutputProperty.m_nDefCellSpRight = oOutputProperty.m_nDefCellSpTop;
|
||||
}
|
||||
if( m_ooxTableProps->m_oTblLook.IsInit())
|
||||
{
|
||||
OOXtblLookReader oLookReader(m_ooxTableProps->m_oTblLook.GetPointer());
|
||||
CtblLook oLook;
|
||||
oLookReader.Parse( oParam, oLook );
|
||||
if( true == oLook.bFirstRow )
|
||||
oOutputProperty.m_bAutoFirstRow = 1;
|
||||
if( true == oLook.bLastRow )
|
||||
oOutputProperty.m_bAutoLastRow = 1;
|
||||
if( true == oLook.bFirstCol )
|
||||
oOutputProperty.m_bAutoFirstCol = 1;
|
||||
if( true == oLook.bLastCol )
|
||||
oOutputProperty.m_bAutoLastCol = 1;
|
||||
if( true == oLook.bNoHBand )
|
||||
oOutputProperty.m_bAutoNoRowBand = 1;
|
||||
if( true == oLook.bNoVBand )
|
||||
oOutputProperty.m_bAutoNoColBand = 1;
|
||||
|
||||
if ( oLook.bFirstRow ) oOutputProperty.m_bAutoFirstRow = 1;
|
||||
if ( oLook.bLastRow ) oOutputProperty.m_bAutoLastRow = 1;
|
||||
if ( oLook.bFirstCol ) oOutputProperty.m_bAutoFirstCol = 1;
|
||||
if ( oLook.bLastCol ) oOutputProperty.m_bAutoLastCol = 1;
|
||||
if ( oLook.bNoHBand ) oOutputProperty.m_bAutoNoRowBand = 1;
|
||||
if ( oLook.bNoVBand ) oOutputProperty.m_bAutoNoColBand = 1;
|
||||
}
|
||||
if (m_ooxTableProps->m_oTblStyleRowBandSize.IsInit() && m_ooxTableProps->m_oTblStyleRowBandSize->m_oVal.IsInit())
|
||||
oOutputProperty.m_nRowBandSize = m_ooxTableProps->m_oTblStyleRowBandSize->m_oVal->GetValue();
|
||||
@ -231,25 +186,8 @@ public:
|
||||
if (m_ooxTableProps->m_oTblStyleColBandSize.IsInit() && m_ooxTableProps->m_oTblStyleColBandSize->m_oVal.IsInit())
|
||||
oOutputProperty.m_nColBandSize = m_ooxTableProps->m_oTblStyleColBandSize->m_oVal->GetValue();
|
||||
|
||||
if( m_ooxTableProps->m_oTblW.IsInit() && m_ooxTableProps->m_oTblW->m_oW.IsInit())
|
||||
{
|
||||
if( m_ooxTableProps->m_oTblW->m_oType.IsInit())
|
||||
{
|
||||
switch(m_ooxTableProps->m_oTblW->m_oType->GetValue())
|
||||
{
|
||||
case SimpleTypes::tblwidthDxa:
|
||||
{
|
||||
oOutputProperty.m_nWidth = (int)m_ooxTableProps->m_oTblW->m_oW->GetValue();
|
||||
oOutputProperty.m_eMUWidth = mu_Twips;
|
||||
}break;
|
||||
case SimpleTypes::tblwidthPct:
|
||||
{
|
||||
oOutputProperty.m_nWidth = (int)m_ooxTableProps->m_oTblW->m_oW->GetValue();
|
||||
oOutputProperty.m_eMUWidth = mu_Percent;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
OOXtcPrReader::Parse(m_ooxTableProps->m_oTblW.GetPointer(), oOutputProperty.m_eWidthUnit, oOutputProperty.m_nWidth, true );
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -72,6 +72,8 @@ public:
|
||||
{
|
||||
case SimpleTypes::mergeContinue : oOutputProperty.m_bMerge = 1; break;
|
||||
case SimpleTypes::mergeRestart : oOutputProperty.m_bMergeFirst = 1; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oVMerge.IsInit())
|
||||
@ -89,45 +91,13 @@ public:
|
||||
|
||||
if( m_ooxTableCellProps->m_oTcMar.IsInit() )
|
||||
{
|
||||
//todooo сделать реализацию с процентами
|
||||
if( m_ooxTableCellProps->m_oTcMar->m_oBottom.IsInit() && m_ooxTableCellProps->m_oTcMar->m_oBottom->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nPaddingBottom = (int)m_ooxTableCellProps->m_oTcMar->m_oBottom->m_oW->GetValue();
|
||||
oOutputProperty.m_nIsPaddingBottom = 3;
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oTcMar->m_oEnd.IsInit() && m_ooxTableCellProps->m_oTcMar->m_oEnd->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nPaddingRight = (int)m_ooxTableCellProps->m_oTcMar->m_oEnd->m_oW->GetValue();
|
||||
oOutputProperty.m_nIsPaddingRight = 3;
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oTcMar->m_oStart.IsInit() && m_ooxTableCellProps->m_oTcMar->m_oStart->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nPaddingLeft = (int)m_ooxTableCellProps->m_oTcMar->m_oStart->m_oW->GetValue();
|
||||
oOutputProperty.m_nIsPaddingLeft = 3;
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oTcMar->m_oTop.IsInit() && m_ooxTableCellProps->m_oTcMar->m_oTop->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nPaddingTop = (int)m_ooxTableCellProps->m_oTcMar->m_oTop->m_oW->GetValue();
|
||||
oOutputProperty.m_nIsPaddingTop = 3;
|
||||
}
|
||||
Parse (m_ooxTableCellProps->m_oTcMar->m_oStart.GetPointer(), oOutputProperty.m_ePaddingLeftUnit, oOutputProperty.m_nPaddingLeft, false);
|
||||
Parse (m_ooxTableCellProps->m_oTcMar->m_oTop.GetPointer(), oOutputProperty.m_ePaddingTopUnit, oOutputProperty.m_nPaddingTop, false);
|
||||
Parse (m_ooxTableCellProps->m_oTcMar->m_oEnd.GetPointer(), oOutputProperty.m_ePaddingRightUnit, oOutputProperty.m_nPaddingRight, false);
|
||||
Parse (m_ooxTableCellProps->m_oTcMar->m_oBottom.GetPointer(), oOutputProperty.m_ePaddingBottomUnit, oOutputProperty.m_nPaddingBottom, false);
|
||||
}
|
||||
Parse(m_ooxTableCellProps->m_oTcW.GetPointer(), oOutputProperty.m_eWidthUnit, oOutputProperty.m_nWidth, true);
|
||||
|
||||
if( m_ooxTableCellProps->m_oTcW.IsInit() && m_ooxTableCellProps->m_oTcW->m_oW.IsInit())
|
||||
{
|
||||
bool auto_ = false;
|
||||
if (m_ooxTableCellProps->m_oTcW->m_oType.IsInit() && m_ooxTableCellProps->m_oTcW->m_oType->GetValue() == SimpleTypes::tblwidthAuto)
|
||||
auto_ = true;
|
||||
|
||||
if (auto_)
|
||||
{
|
||||
oOutputProperty.m_eWidthUnits = mu_Auto;
|
||||
}
|
||||
else
|
||||
{
|
||||
oOutputProperty.m_nWidth = (int)m_ooxTableCellProps->m_oTcW->m_oW->GetValue();
|
||||
oOutputProperty.m_eWidthUnits = m_ooxTableCellProps->m_oTcW->m_oW->IsPercent() ? mu_Percent : mu_Twips;
|
||||
}
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oHideMark.IsInit())
|
||||
oOutputProperty.m_bHideMark = m_ooxTableCellProps->m_oHideMark->m_oVal.ToBool() ? 1 : 0;
|
||||
|
||||
@ -216,19 +186,22 @@ public:
|
||||
case SimpleTypes::verticaljcBottom : oOutputProperty.m_eAlign = RtfCellProperty::ca_Bottom; break;
|
||||
case SimpleTypes::verticaljcCenter : oOutputProperty.m_eAlign = RtfCellProperty::ca_Center; break;
|
||||
case SimpleTypes::verticaljcTop : oOutputProperty.m_eAlign = RtfCellProperty::ca_Top; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oTextDirection.IsInit() && m_ooxTableCellProps->m_oTextDirection->m_oVal.IsInit())
|
||||
{
|
||||
switch(m_ooxTableCellProps->m_oTextDirection->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb; break;
|
||||
case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; break;
|
||||
case SimpleTypes::textdirectionLrV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv; break;
|
||||
case SimpleTypes::textdirectionRl : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrl; break;
|
||||
case SimpleTypes::textdirectionRlV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrlv; break;
|
||||
case SimpleTypes::textdirectionTbV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; //??
|
||||
case SimpleTypes::textdirectionTb : //lrTb .. default
|
||||
default: break;
|
||||
case SimpleTypes::textdirectionTbV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv; break;
|
||||
case SimpleTypes::textdirectionTb : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_ooxTableCellProps->m_oGridSpan.IsInit() && m_ooxTableCellProps->m_oGridSpan->m_oVal.IsInit())
|
||||
@ -236,4 +209,36 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
static void Parse(ComplexTypes::Word::CTblWidth* margin, int& type, int& value, bool full = true )
|
||||
{
|
||||
if (!margin) return;
|
||||
if (false == margin->m_oType.IsInit()) return;
|
||||
if (false == margin->m_oW.IsInit()) return;
|
||||
|
||||
if (full == true)
|
||||
{
|
||||
switch (margin->m_oType->GetValue())
|
||||
{
|
||||
case SimpleTypes::tblwidthNil: type = 0; break;
|
||||
case SimpleTypes::tblwidthAuto: type = 1; break;
|
||||
case SimpleTypes::tblwidthPct: type = 2; break;
|
||||
case SimpleTypes::tblwidthDxa: type = 3; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (margin->m_oType->GetValue())
|
||||
{
|
||||
case SimpleTypes::tblwidthDxa: type = 3; break;
|
||||
case SimpleTypes::tblwidthAuto:
|
||||
case SimpleTypes::tblwidthNil: type = 1; break;
|
||||
}
|
||||
}
|
||||
if (margin->m_oType->GetValue() != SimpleTypes::tblwidthNil)
|
||||
{
|
||||
value = (int)margin->m_oW->GetValue();
|
||||
}
|
||||
|
||||
//todooo сделать реализацию с процентами
|
||||
}
|
||||
};
|
||||
@ -254,7 +254,7 @@ std::wstring RtfField::RenderToOOX(RenderParameter oRenderParameter)
|
||||
oNewParametr.nType = RENDER_TO_OOX_PARAM_RUN;
|
||||
sResult += m_pResult->m_pTextItems->m_aArray[0]->RenderToOOX(oNewParametr);
|
||||
|
||||
for (size_t i = 1; i < m_pResult->m_pTextItems->GetCount(); i++)
|
||||
for (int i = 1; i < m_pResult->m_pTextItems->GetCount(); i++)
|
||||
{
|
||||
RtfParagraph *paragraph = dynamic_cast<RtfParagraph *>(m_pResult->m_pTextItems->m_aArray[i].get());
|
||||
if (paragraph)
|
||||
|
||||
@ -69,7 +69,7 @@ std::wstring RtfListTable::RenderToOOX(RenderParameter oRenderParameter)
|
||||
{
|
||||
RenderParameter oNewParam = oRenderParameter;
|
||||
oNewParam.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE;
|
||||
for (size_t i = 0; i < m_aPictureList.GetCount(); i++ )
|
||||
for (int i = 0; i < m_aPictureList.GetCount(); i++ )
|
||||
{
|
||||
sResult += L"<w:numPicBullet w:numPicBulletId=\"" + std::to_wstring(i) + L"\">";
|
||||
sResult += m_aPictureList[i]->RenderToOOX(oNewParam);
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
}
|
||||
private:
|
||||
POLE::Storage* m_piStorage;
|
||||
std::wstring m_sOleFilename;
|
||||
std::wstring m_sOleFilename;
|
||||
|
||||
std::wstring RenderToOOXOnlyOle(RenderParameter oRenderParameter);
|
||||
};
|
||||
|
||||
@ -56,6 +56,8 @@ std::wstring RtfFont::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case ft_fhiminor: sResult += L"\\fhiminor"; break;
|
||||
case ft_fdbminor: sResult += L"\\fdbminor"; break;
|
||||
case ft_fbiminor: sResult += L"\\fbiminor"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sResult += L"\\f" + std::to_wstring(m_nID);
|
||||
|
||||
@ -69,6 +71,8 @@ std::wstring RtfFont::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case ff_fdecor: sResult += L"\\fdecor"; break;
|
||||
case ff_ftech: sResult += L"\\ftech"; break;
|
||||
case ff_fbidi: sResult += L"\\fbidi"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nCharset, sResult, L"fcharset" )
|
||||
RENDER_RTF_INT( m_nPitch, sResult, L"fprq" )
|
||||
@ -126,6 +130,8 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case ft_fhiminor: sTag = L"latin"; break;
|
||||
case ft_fdbminor: sTag = L"ea"; break;
|
||||
case ft_fbiminor: sTag = L"cs"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( !sTag.empty() )
|
||||
{
|
||||
@ -145,6 +151,8 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case ft_fhiminor: sTag = L"latin"; break;
|
||||
case ft_fdbmajor: sTag = L"ea"; break;
|
||||
case ft_fbimajor: sTag = L"cs"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( !sTag.empty() )
|
||||
{
|
||||
@ -185,6 +193,8 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case ff_fdecor: sFamily = L"decorative"; break;
|
||||
case ff_ftech: sFamily = L"auto"; break;
|
||||
case ff_fbidi: sFamily = L"auto"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( !sFamily.empty() )
|
||||
{
|
||||
@ -207,6 +217,8 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case 0: sPitch = L"default"; break;
|
||||
case 1: sPitch = L"fixed"; break;
|
||||
case 2: sPitch = L"variable"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sResult += L"<w:pitch w:val=\"";
|
||||
sResult += sPitch;
|
||||
@ -243,6 +255,8 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
|
||||
sHint = L" w:hint=\"cs\"/>";
|
||||
}break;
|
||||
//?? нужно ли описывать default??? todooo
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sResult += L"<w:rFonts w:ascii=\"";
|
||||
sResult += sFontName;
|
||||
@ -324,6 +338,8 @@ std::wstring RtfShadingChar::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sResult += L"\\chbgdkbdiag"; break;
|
||||
case st_chbgdkcross: sResult += L"\\chbgdkcross"; break;
|
||||
case st_chbgdkdcross: sResult += L"\\chbgdkdcross"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nForeColor, sResult, L"chcfpat" )
|
||||
RENDER_RTF_INT( m_nBackColor, sResult, L"chcbpat" )
|
||||
@ -348,6 +364,8 @@ std::wstring RtfShadingPar::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sResult += L"\\bgdkbdiag"; break;
|
||||
case st_chbgdkcross: sResult += L"\\bgdkcross"; break;
|
||||
case st_chbgdkdcross: sResult += L"\\bgdkdcross"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nForeColor, sResult, L"cfpat" )
|
||||
RENDER_RTF_INT( m_nBackColor, sResult, L"cbpat" )
|
||||
@ -373,6 +391,8 @@ std::wstring RtfShadingCell::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sResult += L"\\clbgdkbdiag"; break;
|
||||
case st_chbgdkcross: sResult += L"\\clbgdkcross"; break;
|
||||
case st_chbgdkdcross: sResult += L"\\clbgdkdcross"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nForeColor, sResult, L"clcfpat" )
|
||||
if( PROP_DEF != m_nBackColor )
|
||||
@ -401,6 +421,8 @@ std::wstring RtfShadingRow::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sResult += L"\\trbgdkbdiag"; break;
|
||||
case st_chbgdkcross: sResult += L"\\trbgdkcross"; break;
|
||||
case st_chbgdkdcross: sResult += L"\\trbgdkdcross"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nForeColor, sResult, L"trcfpat" )
|
||||
RENDER_RTF_INT( m_nBackColor, sResult, L"trcbpat" )
|
||||
@ -425,6 +447,8 @@ std::wstring RtfShadingTableStyle::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sResult += L"\\tsbgdkbdiag"; break;
|
||||
case st_chbgdkcross: sResult += L"\\tsbgdkcross"; break;
|
||||
case st_chbgdkdcross: sResult += L"\\tsbgdkdcross"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nForeColor, sResult, L"tscellcfpat" )
|
||||
RENDER_RTF_INT( m_nBackColor, sResult, L"tscellcbpat" )
|
||||
@ -499,6 +523,8 @@ std::wstring RtfShading::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case st_chbgdkbdiag: sShading += L" w:val=\"diagStripe\""; break;
|
||||
case st_chbgdkcross: sShading += L" w:val=\"horzCross\""; break;
|
||||
case st_chbgdkdcross: sShading += L" w:val=\"diagCross\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( false == sShading.empty() )
|
||||
@ -537,6 +563,8 @@ std::wstring RtfBorder::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case bt_brdrengrave: sResult = L"\\brdrengrave"; break;
|
||||
case bt_brdroutset: sResult = L"\\brdroutset"; break;
|
||||
case bt_brdrnone: sResult = L"\\brdrnone"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nWidth && m_nWidth > 0)
|
||||
sResult += L"\\brdrw" + std::to_wstring(m_nWidth );
|
||||
@ -593,6 +621,8 @@ std::wstring RtfBorder::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case bt_brdrdashdotstr: sResult += L" w:val=\"dashDotStroked\""; break;
|
||||
case bt_brdremboss: sResult += L" w:val=\"threeDEmboss\""; break;
|
||||
case bt_brdrengrave: sResult += L" w:val=\"threeDEngrave\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( false == sResult.empty() )
|
||||
{
|
||||
@ -670,6 +700,8 @@ std::wstring RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case uls_Double_wave: sResult += L"\\ululdbwave"; break;
|
||||
case uls_Word: sResult += L"\\ulw"; break;
|
||||
case uls_Wave: sResult += L"\\ulwave"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nUnderlineColor, sResult, L"ulc" )
|
||||
RENDER_RTF_INT( m_nUp, sResult, L"up" )
|
||||
@ -768,6 +800,8 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case 4: sResult += L"<w:effect w:val=\"antsBlack\"/>"; break;
|
||||
case 5: sResult += L"<w:effect w:val=\"antsRed\"/>"; break;
|
||||
case 6: sResult += L"<w:effect w:val=\"shimmer\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_OOX_BOOL ( m_bBold, sResult, L"w:b" )
|
||||
RENDER_OOX_BOOL ( m_bCaps, sResult, L"w:caps" )
|
||||
@ -898,6 +932,8 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case uls_Double_wave: sResult += L" w:val=\"wavyDouble\"/>"; break;
|
||||
case uls_Word: sResult += L" w:val=\"words\"/>"; break;
|
||||
case uls_Wave: sResult += L" w:val=\"wave\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1045,6 +1081,8 @@ std::wstring RtfListLevelProperty::RenderToOOX2(RenderParameter oRenderParameter
|
||||
case 0: sResult += L"<w:suff w:val=\"tab\"/>"; break;
|
||||
case 1: sResult += L"<w:suff w:val=\"space\"/>"; break;
|
||||
case 2: sResult += L"<w:suff w:val=\"nothing\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1178,6 +1216,8 @@ std::wstring RtfStyle::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
case stCharacter : sType = L"character"; break;
|
||||
case stSection : sType = L"numbering"; break;
|
||||
case stTable : sType = L"table"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//sResult += L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\">";
|
||||
sResult += L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + L"Style_" + std::to_wstring(m_nID) + L"\">";
|
||||
@ -1301,10 +1341,11 @@ std::wstring RtfParagraphStyle::RenderToOOX(RenderParameter oRenderParameter)
|
||||
// RENDER_RTF_INT( m_nPaddingLeft, sResult, L"tscellpaddl" )
|
||||
// RENDER_RTF_INT( m_nPaddingRight, sResult, L"tscellpaddr" )
|
||||
// RENDER_RTF_INT( m_nPaddingBottom, sResult, L"tscellpaddb" )
|
||||
// RENDER_RTF_INT( m_nIsPaddingTop, sResult, L"tscellpaddft" )
|
||||
// RENDER_RTF_INT( m_nIsPaddingLeft, sResult, L"tscellpaddfl" )
|
||||
// RENDER_RTF_INT( m_nIsPaddingRight, sResult, L"tscellpaddfr" )
|
||||
// RENDER_RTF_INT( m_nIsPaddingBottom, sResult, L"tscellpaddfb" )
|
||||
|
||||
// RENDER_RTF_INT( m_ePaddingTopUnit, sResult, L"tscellpaddft" )
|
||||
// RENDER_RTF_INT( m_ePaddingLeftUnit, sResult, L"tscellpaddfl" )
|
||||
// RENDER_RTF_INT( m_ePaddingRightUnit, sResult, L"tscellpaddfr" )
|
||||
// RENDER_RTF_INT( m_ePaddingBottomUnit, sResult, L"tscellpaddfb" )
|
||||
//
|
||||
// switch( m_eAlign )
|
||||
// {
|
||||
@ -1551,6 +1592,8 @@ std::wstring RtfTab::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case tl_mdot: sResult += L"\\tlmdot"; break;
|
||||
case tl_hyph: sResult += L"\\tlhyph"; break;
|
||||
case tl_ul: sResult += L"\\tlul"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sResult += L"\\tb" + std::to_wstring( m_nTab );
|
||||
}
|
||||
@ -1562,12 +1605,16 @@ std::wstring RtfTab::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case tl_mdot: sResult += L"\\tlmdot"; break;
|
||||
case tl_hyph: sResult += L"\\tlhyph"; break;
|
||||
case tl_ul: sResult += L"\\tlul"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_eKind )
|
||||
{
|
||||
case tk_tqr: sResult += L"\\tqr"; break;
|
||||
case tk_tqc: sResult += L"\\tqc"; break;
|
||||
case tk_tqdec: sResult += L"\\tqdec"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sResult += L"\\tx" + std::to_wstring( m_nTab );
|
||||
}
|
||||
@ -1585,6 +1632,8 @@ std::wstring RtfTab::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case tl_mdot: sTab += L" w:leader=\"middleDot\""; break;
|
||||
case tl_hyph: sTab += L" w:leader=\"hyphen\""; break;
|
||||
case tl_ul: sTab += L" w:leader=\"underscore\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_eKind )
|
||||
{
|
||||
@ -1593,6 +1642,8 @@ std::wstring RtfTab::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case tk_tqc: sTab += L" w:val=\"center\""; break;
|
||||
case tk_tqdec: sTab += L" w:val=\"decimal\""; break;
|
||||
case tk_tqbar: sTab += L" w:val=\"bar\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nTab )
|
||||
sTab += L" w:pos=\"" + std::to_wstring(m_nTab) + L"\"";
|
||||
@ -1611,6 +1662,8 @@ std::wstring RtfFrame::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case hr_phmrg: sResult += L"\\phmrg"; break;
|
||||
case hr_phpg: sResult += L"\\phpg"; break;
|
||||
case hr_phcol: sResult += L"\\phcol"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nHPos )
|
||||
{
|
||||
@ -1626,6 +1679,8 @@ std::wstring RtfFrame::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case hp_posxo: sResult += L"\\posxo"; break;
|
||||
case hp_posxl: sResult += L"\\posxl"; break;
|
||||
case hp_posxr: sResult += L"\\posxr"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( m_eVRef )
|
||||
@ -1633,6 +1688,8 @@ std::wstring RtfFrame::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case vr_pvmrg: sResult += L"\\pvmrg"; break;
|
||||
case vr_pvpg: sResult += L"\\pvpg"; break;
|
||||
case vr_pvpara: sResult += L"\\pvpara"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nVPos )
|
||||
{
|
||||
@ -1649,6 +1706,8 @@ std::wstring RtfFrame::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case vp_posyc: sResult += L"\\posyc"; break;
|
||||
case vp_posyin: sResult += L"\\posyin"; break;
|
||||
case vp_posyout: sResult += L"\\posyout"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_bLockAnchor, sResult, L"abslock" )
|
||||
|
||||
@ -1658,6 +1717,8 @@ std::wstring RtfFrame::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case tw_wraparound: sResult += L"\\wraparound"; break;
|
||||
case tw_wraptight: sResult += L"\\wraptight"; break;
|
||||
case tw_wrapthrough: sResult += L"\\wrapthrough"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_DropcapType, sResult, L"dropcapt" )
|
||||
RENDER_RTF_INT( m_DropcapLines, sResult, L"dropcapli" )
|
||||
@ -1696,6 +1757,8 @@ std::wstring RtfFrame::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case hr_phmrg: sFrame += L" w:hAnchor=\"margin\""; break;
|
||||
case hr_phpg: sFrame += L" w:hAnchor=\"page\""; break;
|
||||
case hr_phcol: sFrame += L" w:hAnchor=\"text\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_OOX_INT_ATTRIBUTE( m_nHPos, sFrame, L"w:x" )
|
||||
switch ( m_eHPos )
|
||||
@ -1705,12 +1768,16 @@ std::wstring RtfFrame::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case hp_posxo: sFrame += L" w:xAlign=\"outside\""; break;
|
||||
case hp_posxl: sFrame += L" w:xAlign=\"left\""; break;
|
||||
case hp_posxr: sFrame += L" w:xAlign=\"right\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch ( m_eVRef )
|
||||
{
|
||||
case vr_pvmrg: sFrame += L" w:vAnchor=\"margin\""; break;
|
||||
case vr_pvpg: sFrame += L" w:vAnchor=\"page\""; break;
|
||||
case vr_pvpara: sFrame += L" w:vAnchor=\"text\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_OOX_INT_ATTRIBUTE( m_nVPos, sFrame, L"w:y" )
|
||||
switch ( m_eVPos )
|
||||
@ -1721,6 +1788,8 @@ std::wstring RtfFrame::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case vp_posyc: sFrame += L" w:yAlign=\"center\""; break;
|
||||
case vp_posyin: sFrame += L" w:yAlign=\"inside\""; break;
|
||||
case vp_posyout: sFrame += L" w:yAlign=\"outside\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_OOX_BOOL_ATTRIBUTE( m_bLockAnchor, sFrame, L"w:anchorLock" )
|
||||
switch ( m_eWrap )
|
||||
@ -1729,6 +1798,8 @@ std::wstring RtfFrame::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case tw_wraparound: sFrame += L" w:wrap=\"around\""; break;
|
||||
case tw_wraptight: sFrame += L" w:wrap=\"tight\""; break;
|
||||
case tw_wrapthrough: sFrame += L" w:wrap=\"through\""; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( 1 == m_DropcapType ) sFrame += L" w:dropCap=\"drop\"";
|
||||
else if( 2 == m_DropcapType ) sFrame += L" w:dropCap=\"margin\"";
|
||||
@ -1775,6 +1846,8 @@ std::wstring RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case pa_qk0: sResult += L"\\qk0"; break;
|
||||
case pa_qk10: sResult += L"\\qk10"; break;
|
||||
case pa_qk20: sResult += L"\\qk20"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_eFontAlign )
|
||||
{
|
||||
@ -1784,6 +1857,8 @@ std::wstring RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case fa_faroman: sResult += L"\\faroman"; break;
|
||||
case fa_favar: sResult += L"\\favar"; break;
|
||||
case fa_fafixed: sResult += L"\\fafixed"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nIndFirstLine , sResult, L"fi" );
|
||||
RENDER_RTF_INT( m_nIndLeft , sResult, L"li" );
|
||||
@ -1816,6 +1891,8 @@ std::wstring RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case tbw_txbxtwfirstlast: sResult += L"\\txbxtwfirstlast"; break;
|
||||
case tbw_txbxtwfirst: sResult += L"\\txbxtwfirst"; break;
|
||||
case tbw_txbxtwlast: sResult += L"\\txbxtwlast"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nListId && PROP_DEF != m_nListLevel )
|
||||
{
|
||||
@ -1874,6 +1951,8 @@ std::wstring RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case tf_frmtxbtlr: sResult += L"\\frmtxbtlr"; break;
|
||||
case tf_frmtxlrtbv: sResult += L"\\frmtxlrtbv"; break;
|
||||
case tf_frmtxtbrlv: sResult += L"\\frmtxtbrlv"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( true == m_oTabs.IsValid() )
|
||||
sResult += m_oTabs.RenderToRtf( oRenderParameter );
|
||||
@ -1992,6 +2071,8 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case pa_qk0: sResult += L"<w:jc w:val=\"lowKashida\" />"; break;
|
||||
case pa_qk10: sResult += L"<w:jc w:val=\"mediumKashida\" />"; break;
|
||||
case pa_qk20: sResult += L"<w:jc w:val=\"highKashida\" />"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_eFontAlign )
|
||||
{
|
||||
@ -2001,6 +2082,8 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case fa_faroman: sResult += L"<w:textAlignment w:val=\"baseline\" />";break;
|
||||
case fa_favar: sResult += L"<w:textAlignment w:val=\"bottom\" />"; break;
|
||||
case fa_fafixed: sResult += L"<w:textAlignment w:val=\"bottom\" />"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
std::wstring sIndent;
|
||||
if( PROP_DEF != m_nIndFirstLine )
|
||||
@ -2072,6 +2155,8 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case tbw_txbxtwfirstlast: sResult += L"<w:textboxTightWrap w:val=\"firstAndLastLine\"/>"; break;
|
||||
case tbw_txbxtwfirst: sResult += L"<w:textboxTightWrap w:val=\"firstLineOnly\"/>"; break;
|
||||
case tbw_txbxtwlast: sResult += L"<w:textboxTightWrap w:val=\"lastLineOnly\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nListId && PROP_DEF != m_nListLevel )
|
||||
sResult += L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(m_nListLevel) + L"\" /><w:numId w:val=\"" + std::to_wstring(m_nListId) + L"\" /></w:numPr>";
|
||||
@ -2136,6 +2221,8 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case tf_frmtxbtlr: sResult += L"<w:textFlow w:val=\"btlr\" />"; break;
|
||||
case tf_frmtxlrtbv: sResult += L"<w:textFlow w:val=\"lrtbV\" />";break;
|
||||
case tf_frmtxtbrlv: sResult += L"<w:textFlow w:val=\"tbrlV\" />";break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( true == m_oTabs.IsValid() )
|
||||
{
|
||||
@ -2176,23 +2263,24 @@ std::wstring RtfCellProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
RENDER_RTF_BOOL( m_bFitText, sResult, L"clFitText" )
|
||||
RENDER_RTF_BOOL( m_bNoWrap, sResult, L"clNoWrap" )
|
||||
|
||||
RENDER_RTF_INT( m_nIsPaddingLeft, sResult, L"clpadfl" )
|
||||
RENDER_RTF_INT( m_nPaddingLeft, sResult, L"clpadl" )
|
||||
RENDER_RTF_INT( m_nIsPaddingRight, sResult, L"clpadfr" )
|
||||
//https://www.office-forums.com/threads/rtf-file-weirdness-clpadt-vs-clpadl.2163500/
|
||||
RENDER_RTF_INT( m_nPaddingLeft, sResult, L"clpadt" ) //перепутаны top & left
|
||||
RENDER_RTF_INT( m_ePaddingLeftUnit, sResult, L"clpadft" ) //перепутаны top & left
|
||||
RENDER_RTF_INT( m_nPaddingRight, sResult, L"clpadr" )
|
||||
RENDER_RTF_INT( m_nIsPaddingTop, sResult, L"clpadft" )
|
||||
RENDER_RTF_INT( m_nPaddingTop, sResult, L"clpadt" )
|
||||
RENDER_RTF_INT( m_nIsPaddingBottom, sResult, L"clpadfb" )
|
||||
RENDER_RTF_INT( m_ePaddingRightUnit, sResult, L"clpadfr" )
|
||||
RENDER_RTF_INT( m_nPaddingTop, sResult, L"clpadl" ) //перепутаны top & left
|
||||
RENDER_RTF_INT( m_ePaddingTopUnit, sResult, L"clpadfl" ) //перепутаны top & left
|
||||
RENDER_RTF_INT( m_nPaddingBottom, sResult, L"clpadb" )
|
||||
RENDER_RTF_INT( m_ePaddingBottomUnit, sResult, L"clpadfb" )
|
||||
|
||||
RENDER_RTF_INT( m_nIsSpacingLeft, sResult, L"clspfl" )
|
||||
RENDER_RTF_INT( m_eSpacingLeftUnit, sResult, L"clspfl" )
|
||||
RENDER_RTF_INT( m_nSpacingLeft, sResult, L"clspl" )
|
||||
RENDER_RTF_INT( m_nIsSpacingRight, sResult, L"clspl" )
|
||||
RENDER_RTF_INT( m_eSpacingRightUnit, sResult, L"clspl" )
|
||||
RENDER_RTF_INT( m_nSpacingRight, sResult, L"clspr" )
|
||||
|
||||
RENDER_RTF_INT( m_nIsSpacingTop, sResult, L"clspft" )
|
||||
RENDER_RTF_INT( m_eSpacingTopUnit, sResult, L"clspft" )
|
||||
RENDER_RTF_INT( m_nSpacingTop, sResult, L"clspt" )
|
||||
RENDER_RTF_INT( m_nIsSpacingBottom, sResult, L"clspfb" )
|
||||
RENDER_RTF_INT( m_eSpacingBottomUnit, sResult, L"clspfb" )
|
||||
RENDER_RTF_INT( m_nSpacingBottom, sResult, L"clspb" )
|
||||
|
||||
RENDER_RTF_BOOL( m_bHideMark, sResult, L"clhidemark" )
|
||||
@ -2235,6 +2323,8 @@ std::wstring RtfCellProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case ca_Top: sResult += L"\\clvertalt"; break;
|
||||
case ca_Center: sResult += L"\\clvertalc"; break;
|
||||
case ca_Bottom: sResult += L"\\clvertalb"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_oCellFlow )
|
||||
{
|
||||
@ -2243,14 +2333,18 @@ std::wstring RtfCellProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case cf_btlr: sResult += L"\\cltxbtlr"; break;
|
||||
case cf_lrtbv: sResult += L"\\cltxlrtbv"; break;
|
||||
case cf_tbrlv: sResult += L"\\cltxtbrlv"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nWidth, sResult, L"clwWidth" )
|
||||
switch( m_eWidthUnits )
|
||||
switch( m_eWidthUnit )
|
||||
{
|
||||
case mu_none: sResult += L"\\clftsWidth0"; break;
|
||||
case mu_Auto: sResult += L"\\clftsWidth1"; break;
|
||||
case mu_Percent: sResult += L"\\clftsWidth2"; break;
|
||||
case mu_Twips: sResult += L"\\clftsWidth3"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sResult += L"\\cellx" + std::to_wstring(m_nCellx);
|
||||
@ -2269,14 +2363,14 @@ std::wstring RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
RENDER_OOX_BOOL( m_bNoWrap, sResult, L"w:noWrap" )
|
||||
|
||||
std::wstring sMargin;
|
||||
if( 3 == m_nIsPaddingLeft && PROP_DEF != m_nPaddingLeft)
|
||||
sResult += L"<w:left w:w=\"" + std::to_wstring(m_nPaddingLeft) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_nIsPaddingRight && PROP_DEF != m_nPaddingRight)
|
||||
sResult += L"<w:right w:w=\"" + std::to_wstring(m_nPaddingRight) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_nIsPaddingTop && PROP_DEF != m_nPaddingTop)
|
||||
sResult += L"<w:top w:w=\"" + std::to_wstring(m_nPaddingTop) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_nIsPaddingBottom && PROP_DEF != m_nPaddingBottom)
|
||||
sResult += L"<w:bottom w:w=\"" + std::to_wstring(m_nPaddingBottom) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_ePaddingLeftUnit && PROP_DEF != m_nPaddingLeft)
|
||||
sMargin += L"<w:left w:w=\"" + std::to_wstring(m_nPaddingLeft) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_ePaddingRightUnit && PROP_DEF != m_nPaddingRight)
|
||||
sMargin += L"<w:right w:w=\"" + std::to_wstring(m_nPaddingRight) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_ePaddingTopUnit && PROP_DEF != m_nPaddingTop)
|
||||
sMargin += L"<w:top w:w=\"" + std::to_wstring(m_nPaddingTop) + L"\" w:type=\"dxa\"/>";
|
||||
if( 3 == m_ePaddingBottomUnit && PROP_DEF != m_nPaddingBottom)
|
||||
sMargin += L"<w:bottom w:w=\"" + std::to_wstring(m_nPaddingBottom) + L"\" w:type=\"dxa\"/>";
|
||||
|
||||
if( !sMargin.empty() )
|
||||
{
|
||||
@ -2312,9 +2406,9 @@ std::wstring RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
|
||||
if( PROP_DEF != m_nWidth )
|
||||
{
|
||||
if( mu_Percent == m_eWidthUnits )
|
||||
if( mu_Percent == m_eWidthUnit )
|
||||
sResult += L"<w:tcW w:type=\"pct\" w:w=\"" + std::to_wstring(m_nWidth) + L"%\"/>";
|
||||
else if( mu_Twips == m_eWidthUnits )
|
||||
else if( mu_Twips == m_eWidthUnit )
|
||||
sResult += L"<w:tcW w:type=\"dxa\" w:w=\"" + std::to_wstring(m_nWidth) + L"\"/>";
|
||||
}
|
||||
RENDER_OOX_BOOL( m_bHideMark, sResult, L"w:hideMark" )
|
||||
@ -2386,6 +2480,8 @@ std::wstring RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case ca_Top: sResult += L"<w:vAlign w:val=\"top\"/>"; break;
|
||||
case ca_Center: sResult += L"<w:vAlign w:val=\"center\"/>"; break;
|
||||
case ca_Bottom: sResult += L"<w:vAlign w:val=\"bottom\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( m_oCellFlow )
|
||||
{
|
||||
@ -2394,7 +2490,8 @@ std::wstring RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case cf_btlr: sResult += L"<w:textDirection w:val=\"btLr\"/>"; break;
|
||||
case cf_lrtbv: sResult += L"<w:textDirection w:val=\"lrTbV\"/>"; break;
|
||||
case cf_tbrlv: sResult += L"<w:textDirection w:val=\"tbRlV\"/>"; break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
RENDER_OOX_INT( m_nSpan, sResult, L"w:gridSpan" );
|
||||
@ -2434,7 +2531,7 @@ std::wstring RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
RENDER_RTF_INT( m_nAutoFit, sResult, L"trautofit" )
|
||||
RENDER_RTF_INT( m_nGraph, sResult, L"trgaph" )
|
||||
RENDER_RTF_INT( nTableIndent, sResult, L"tblind" )
|
||||
RENDER_RTF_INT( nTableIndentUnits, sResult, L"tblindtype" )
|
||||
RENDER_RTF_INT( eTableIndentUnit, sResult, L"tblindtype" )
|
||||
|
||||
RENDER_RTF_INT( m_nWrapLeft, sResult, L"tdfrmtxtLeft" )
|
||||
RENDER_RTF_INT( m_nWrapRight, sResult, L"tdfrmtxtRight" )
|
||||
@ -2492,49 +2589,51 @@ std::wstring RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
RENDER_RTF_INT( m_nDefCellMarRight, sResult, L"trpaddr" );
|
||||
RENDER_RTF_INT( m_nDefCellMarTop, sResult, L"trpaddt" );
|
||||
RENDER_RTF_INT( m_nDefCellMarBottom, sResult, L"trpaddb" );
|
||||
RENDER_RTF_INT( m_nDefCellMarLeftUnits, sResult, L"trpaddfl" );
|
||||
RENDER_RTF_INT( m_nDefCellMarRightUnits, sResult, L"trpaddfr" );
|
||||
RENDER_RTF_INT( m_nDefCellMarTopUnits, sResult, L"trpaddft" );
|
||||
RENDER_RTF_INT( m_nDefCellMarBottomUnits, sResult, L"trpaddfb" );
|
||||
RENDER_RTF_INT( m_eDefCellMarLeftUnit, sResult, L"trpaddfl" );
|
||||
RENDER_RTF_INT( m_eDefCellMarRightUnit, sResult, L"trpaddfr" );
|
||||
RENDER_RTF_INT( m_eDefCellMarTopUnit, sResult, L"trpaddft" );
|
||||
RENDER_RTF_INT( m_eDefCellMarBottomUnit, sResult, L"trpaddfb" );
|
||||
|
||||
RENDER_RTF_INT( m_nDefCellSpBottom, sResult, L"trspdb" );
|
||||
RENDER_RTF_INT( m_nDefCellSpLeft, sResult, L"trspdl" );
|
||||
RENDER_RTF_INT( m_nDefCellSpRight, sResult, L"trspdr" );
|
||||
RENDER_RTF_INT( m_nDefCellSpTop, sResult, L"trspdt" );
|
||||
RENDER_RTF_INT( m_nDefCellSpBottomUnits, sResult, L"trspdfb" );
|
||||
RENDER_RTF_INT( m_nDefCellSpLeftUnits, sResult, L"trspdfl" );
|
||||
RENDER_RTF_INT( m_nDefCellSpRightUnits, sResult, L"trspdfr" );
|
||||
RENDER_RTF_INT( m_nDefCellSpTopUnits, sResult, L"trspdft" );
|
||||
RENDER_RTF_INT( m_eDefCellSpBottomUnit, sResult, L"trspdfb" );
|
||||
RENDER_RTF_INT( m_eDefCellSpLeftUnit, sResult, L"trspdfl" );
|
||||
RENDER_RTF_INT( m_eDefCellSpRightUnit, sResult, L"trspdfr" );
|
||||
RENDER_RTF_INT( m_eDefCellSpTopUnit, sResult, L"trspdft" );
|
||||
|
||||
if( m_oBorderLeft.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrl";
|
||||
sResult += m_oBorderLeft.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderRight.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrr";
|
||||
sResult += m_oBorderRight.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderTop.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrt";
|
||||
sResult += m_oBorderTop.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderLeft.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrl";
|
||||
sResult += m_oBorderLeft.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderBottom.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrb";
|
||||
sResult += m_oBorderBottom.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderRight.IsValid() == true )
|
||||
{
|
||||
sResult += L"\\trbrdrr";
|
||||
sResult += m_oBorderRight.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderVert.IsValid() == true && m_bAutoNoColBand != 1)
|
||||
if( m_oBorderHor.IsValid() == true/* && m_bAutoNoRowBand != 1*/)
|
||||
{
|
||||
sResult += L"\\trbrdrh";
|
||||
sResult += m_oBorderHor.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderVert.IsValid() == true/* && m_bAutoNoColBand != 1*/)
|
||||
{
|
||||
sResult += L"\\trbrdrv";
|
||||
sResult += m_oBorderVert.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
if( m_oBorderHor.IsValid() == true && m_bAutoNoRowBand != 1)
|
||||
{
|
||||
sResult += L"\\trbrdrh";
|
||||
sResult += m_oBorderHor.RenderToRtf( oRenderParameter );
|
||||
}
|
||||
|
||||
if( m_oShading.IsValid() == true )
|
||||
sResult += m_oShading.RenderToRtf( oRenderParameter );
|
||||
|
||||
@ -2574,15 +2673,9 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
sResult += L"<w:tblLayout w:type=\"autofit\"/>";
|
||||
|
||||
//сделаем не по документации, а как все остальные юниты !!!
|
||||
if( PROP_DEF != nTableIndent && 1 != nTableIndentUnits )
|
||||
if( PROP_DEF != nTableIndent && 3 == eTableIndentUnit )
|
||||
{
|
||||
switch(nTableIndentUnits)
|
||||
{
|
||||
//case 0: sResult += L"<w:tblInd w:w=\"0\" w:type=\"dxa\"/>" );break;
|
||||
//case 2: sResult += L"<w:tblInd w:w=\"" + std::to_wstring(nTableIndent) + L"%%\" w:type=\"pct\"/>", );break;
|
||||
case 3: sResult += L"<w:tblInd w:w=\"" + std::to_wstring(nTableIndent) + L"\" w:type=\"dxa\"/>"; break;
|
||||
//default: sResult += L"<w:tblInd w:w=\"" + std::to_wstring(nTableIndent) + L"\" w:type=\"dxa\"/>", nTableIndent );break;
|
||||
}
|
||||
sResult += L"<w:tblInd w:w=\"" + std::to_wstring(nTableIndent) + L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
|
||||
if( 1 == m_bOverlap )
|
||||
@ -2593,6 +2686,8 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case rj_trql : sResult += L"<w:jc w:val=\"left\"/>"; break;
|
||||
case rj_trqr : sResult += L"<w:jc w:val=\"right\"/>"; break;
|
||||
case rj_trqc : sResult += L"<w:jc w:val=\"center\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
std::wstring sFloatingPosition;
|
||||
@ -2649,9 +2744,9 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
sResult += L"/>";
|
||||
}
|
||||
|
||||
if( PROP_DEF != m_nWidth && ( 2 == m_eMUWidth || 3 == m_eMUWidth ))
|
||||
if( PROP_DEF != m_nWidth && ( 2 == m_eWidthUnit || 3 == m_eWidthUnit ))
|
||||
{
|
||||
if( 2 == m_eMUWidth )
|
||||
if( 2 == m_eWidthUnit )
|
||||
sResult += L"<w:tblW w:w=\"" + std::to_wstring(m_nWidth) + L"\" w:type=\"pct\"/>";
|
||||
else
|
||||
sResult += L"<w:tblW w:w=\"" + std::to_wstring(m_nWidth) + L"\" w:type=\"dxa\"/>";
|
||||
@ -2660,19 +2755,19 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
sResult += L"<w:tblW w:w=\"0\" w:type=\"auto\"/>";
|
||||
|
||||
std::wstring sDefCellMargins;
|
||||
if( PROP_DEF != m_nDefCellMarBottom && 3 == m_nDefCellMarBottomUnits )
|
||||
if( PROP_DEF != m_nDefCellMarBottom && 3 == m_eDefCellMarBottomUnit )
|
||||
sDefCellMargins += L"<w:bottom w:w=\"" + std::to_wstring(m_nDefCellMarBottom) + L"\" w:type=\"dxa\"/>";
|
||||
if( PROP_DEF != m_nDefCellMarLeft && 3 == m_nDefCellMarLeftUnits )
|
||||
if( PROP_DEF != m_nDefCellMarLeft && 3 == m_eDefCellMarLeftUnit )
|
||||
sDefCellMargins += L"<w:left w:w=\"" + std::to_wstring(m_nDefCellMarLeft) + L"\" w:type=\"dxa\"/>";
|
||||
if( PROP_DEF != m_nDefCellMarRight && 3 == m_nDefCellMarRightUnits )
|
||||
if( PROP_DEF != m_nDefCellMarRight && 3 == m_eDefCellMarRightUnit )
|
||||
sDefCellMargins += L"<w:right w:w=\"" + std::to_wstring(m_nDefCellMarRight) + L"\" w:type=\"dxa\"/>";
|
||||
if( PROP_DEF != m_nDefCellMarTop && 3 == m_nDefCellMarTopUnits )
|
||||
if( PROP_DEF != m_nDefCellMarTop && 3 == m_eDefCellMarTopUnit )
|
||||
sDefCellMargins += L"<w:top w:w=\"" + std::to_wstring(m_nDefCellMarTop) + L"\" w:type=\"dxa\"/>";
|
||||
|
||||
if( !sDefCellMargins.empty() )
|
||||
sResult += L"<w:tblCellMar>" + sDefCellMargins + L"</w:tblCellMar>";
|
||||
|
||||
if( PROP_DEF != m_nDefCellSpBottom && 3 == m_nDefCellSpBottomUnits )
|
||||
if( PROP_DEF != m_nDefCellSpBottom && 3 == m_eDefCellSpBottomUnit )
|
||||
sResult += L"<w:tblCellSpacing w:w=\"" + std::to_wstring(m_nDefCellSpBottom) + L"\" w:type=\"dxa\"/>";
|
||||
|
||||
//if( PROP_DEF != m_nLeft )
|
||||
@ -2738,30 +2833,38 @@ std::wstring RtfRowProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
case rj_trql : sResult += L"\\trql"; break;
|
||||
case rj_trqr : sResult += L"\\trqr"; break;
|
||||
case rj_trqc : sResult += L"\\trqc"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nHeight, sResult, L"trrh" );
|
||||
|
||||
RENDER_RTF_INT( m_nWidth, sResult, L"trwWidth" );
|
||||
switch( m_eMUWidth )
|
||||
switch( m_eWidthUnit )
|
||||
{
|
||||
case mu_Auto: sResult += L"\\trftsWidth1"; break;
|
||||
case mu_Percent: sResult += L"\\trftsWidth2"; break;
|
||||
case mu_Twips: sResult += L"\\trftsWidth3"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nWidthStartInvCell, sResult, L"trwWidthB" );
|
||||
switch( m_eMUStartInvCell )
|
||||
RENDER_RTF_INT( m_nWidth, sResult, L"trwWidth" );
|
||||
switch( m_eWidthStartInvCellUnit )
|
||||
{
|
||||
case mu_Auto: sResult += L"\\trftsWidthB1"; break;
|
||||
case mu_Percent: sResult += L"\\trftsWidthB2"; break;
|
||||
case mu_Twips: sResult += L"\\trftsWidthB3"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nWidthEndInvCell, sResult, L"trwWidthA" );
|
||||
switch( m_eMUEndInvCell )
|
||||
RENDER_RTF_INT( m_nWidthStartInvCell, sResult, L"trwWidthB" );
|
||||
switch( m_eWidthEndInvCellUnit )
|
||||
{
|
||||
case mu_Auto: sResult += L"\\trftsWidthA1"; break;
|
||||
case mu_Percent: sResult += L"\\trftsWidthA2"; break;
|
||||
case mu_Twips: sResult += L"\\trftsWidthA3"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
RENDER_RTF_INT( m_nWidthEndInvCell, sResult, L"trwWidthA" );
|
||||
sResult += RtfTableProperty::RenderToRtf( oRenderParameter );
|
||||
|
||||
for (size_t i = 0; i < m_aArray.size(); i++ )
|
||||
@ -2791,6 +2894,8 @@ std::wstring RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
case rj_trql : sResult += L"<w:jc w:val=\"left\"/>"; break;
|
||||
case rj_trqr : sResult += L"<w:jc w:val=\"right\"/>"; break;
|
||||
case rj_trqc : sResult += L"<w:jc w:val=\"center\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( PROP_DEF != m_nHeight )
|
||||
{
|
||||
@ -2802,18 +2907,22 @@ std::wstring RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
|
||||
if( PROP_DEF != m_nWidthStartInvCell )
|
||||
{
|
||||
switch( m_eMUStartInvCell )
|
||||
switch( m_eWidthStartInvCellUnit )
|
||||
{
|
||||
case mu_Percent: sResult += L"<w:wBefore w:type=\"pct\" w:w=\"" + std::to_wstring(m_nWidthStartInvCell) + L"%\"/>"; break;
|
||||
case mu_Twips: sResult += L"<w:wBefore w:type=\"dxa\" w:w=\"" + std::to_wstring(m_nWidthStartInvCell) + L"\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( PROP_DEF != m_nWidthEndInvCell )
|
||||
{
|
||||
switch( m_eMUEndInvCell )
|
||||
switch( m_eWidthEndInvCellUnit )
|
||||
{
|
||||
case mu_Percent: sResult += L"<w:wAfter w:type=\"pct\" w:w=\"" + std::to_wstring(m_nWidthEndInvCell) + L"%\"/>"; break;
|
||||
case mu_Twips: sResult += L"<w:wAfter w:type=\"dxa\" w:w=\"" + std::to_wstring(m_nWidthEndInvCell) + L"\"/>"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
RENDER_OOX_INT( m_nGridBefore, sResult, L"w:gridBefore" )
|
||||
@ -2917,10 +3026,10 @@ std::wstring RtfInformation::RenderToRtf(RenderParameter oRenderParameter)
|
||||
{
|
||||
sResult += L"{\\comment "; sResult += RtfChar::renderRtfText( m_sComment, oRenderParameter.poDocument ); sResult += L"}";
|
||||
}
|
||||
|
||||
if( PROP_DEF != m_nVersion )
|
||||
sResult += L"{\\version" + std::to_wstring(m_nVersion) + L"}";
|
||||
|
||||
if( !m_sDocCom.empty() )
|
||||
{
|
||||
sResult += L"{\\doccomm "; sResult += RtfChar::renderRtfText( m_sDocCom, oRenderParameter.poDocument ); sResult += L"}";
|
||||
}
|
||||
if( !m_sDocCom.empty() )
|
||||
{
|
||||
sResult += L"{\\doccomm "; sResult += RtfChar::renderRtfText( m_sDocCom, oRenderParameter.poDocument ); sResult += L"}";
|
||||
@ -2978,6 +3087,21 @@ std::wstring RtfInformation::RenderToRtf(RenderParameter oRenderParameter)
|
||||
if( PROP_DEF != m_nInternalId )
|
||||
sResult += L"{\\id" + std::to_wstring(m_nInternalId) + L"}";
|
||||
|
||||
m_sApplication = L"ONLYOFFICE";
|
||||
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
m_sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
if( !m_sApplication.empty() )
|
||||
{
|
||||
sResult += L"{\\*\\userprops ";
|
||||
sResult += L"{\\propname Application}";
|
||||
sResult += L"\\proptype30";
|
||||
sResult += L"{\\staticval " + RtfChar::renderRtfText( m_sApplication, oRenderParameter.poDocument ) + L"}";
|
||||
sResult += L"}";
|
||||
}
|
||||
|
||||
if( !sResult.empty() )
|
||||
sResult = L"{\\info" + sResult + L"}";
|
||||
return sResult;
|
||||
|
||||
@ -1779,7 +1779,7 @@ public:
|
||||
int m_nGraph; //trgaphN Half the space between the cells of a table row in twips.
|
||||
|
||||
int nTableIndent; //tblindN
|
||||
int nTableIndentUnits; // tblindtypeN
|
||||
int eTableIndentUnit; // tblindtypeN
|
||||
|
||||
enum _RowJust
|
||||
{
|
||||
@ -1803,28 +1803,29 @@ public:
|
||||
int m_nVPos; //tposyN Position table N twips from the top edge of the vertical reference frame.
|
||||
|
||||
int m_nLeft;
|
||||
int m_nWidth; //trwWidthN Preferred row width. Overrides \trautofitN.
|
||||
_MetricUnits m_eMUWidth; //trftsWidthN Units for \trwWidthN:
|
||||
|
||||
int m_nWidth; //trwWidthN Width of invisible cell at the end of the row. Used only when rows have different widths.
|
||||
int m_eWidthUnit; //trftsWidthN Units for \trwWidthN:
|
||||
|
||||
int m_nDefCellMarBottom; //trpaddbN Default bottom cell margin or padding for the row.
|
||||
int m_nDefCellMarLeft; //trpaddlN Default left cell margin or padding for the row.
|
||||
int m_nDefCellMarRight; //trpaddrN Default right cell margin or padding for the row.
|
||||
int m_nDefCellMarTop; //trpaddtN Default top cell margin or padding for the row.
|
||||
|
||||
int m_nDefCellMarBottomUnits; //Units for \trpaddbN: 0 Null. Ignore \trpaddbN in favor of \trgaphN (Word 97 style padding). 3 Twips.
|
||||
int m_nDefCellMarLeftUnits;
|
||||
int m_nDefCellMarRightUnits;
|
||||
int m_nDefCellMarTopUnits;
|
||||
int m_eDefCellMarBottomUnit; //Units for \trpaddbN: 0 Null. Ignore \trpaddbN in favor of \trgaphN (Word 97 style padding). 3 Twips.
|
||||
int m_eDefCellMarLeftUnit;
|
||||
int m_eDefCellMarRightUnit;
|
||||
int m_eDefCellMarTopUnit;
|
||||
|
||||
int m_nDefCellSpBottom; //trspdbN Default bottom cell spacing for the row. The total vertical spacing between adjacent cells is equal to the sum of \trspdtN from the bottom cell and \trspdbN from the top cell, both of which will have the same value when written by Word.
|
||||
int m_nDefCellSpLeft; //trspdlN
|
||||
int m_nDefCellSpRight; //trspdrN
|
||||
int m_nDefCellSpTop; //trspdtN
|
||||
|
||||
int m_nDefCellSpBottomUnits; //trspdfbN Units for \trspdbN: 0 Null. Ignore \trspdbN. 3 Twips.
|
||||
int m_nDefCellSpLeftUnits;
|
||||
int m_nDefCellSpRightUnits;
|
||||
int m_nDefCellSpTopUnits;
|
||||
int m_eDefCellSpBottomUnit; //trspdfbN Units for \trspdbN: 0 Null. Ignore \trspdbN. 3 Twips.
|
||||
int m_eDefCellSpLeftUnit;
|
||||
int m_eDefCellSpRightUnit;
|
||||
int m_eDefCellSpTopUnit;
|
||||
|
||||
RtfBorder m_oBorderLeft;
|
||||
RtfBorder m_oBorderRight;
|
||||
@ -1837,12 +1838,12 @@ public:
|
||||
int m_nStyle;
|
||||
|
||||
//Autoformatting Flags
|
||||
int m_bAutoFirstRow; //tbllkhdrrows Flag sets table autoformat to format the first (header) row.
|
||||
int m_bAutoFirstRow; //tbllkhdrrows Flag sets table autoformat to format the first (header) row.
|
||||
int m_bAutoLastRow; //tbllklastrow Flag sets table autoformat to format the last row.
|
||||
int m_bAutoFirstCol; //tbllkhdrcols Flag sets table autoformat to format the first (header) column.
|
||||
int m_bAutoFirstCol; //tbllkhdrcols Flag sets table autoformat to format the first (header) column.
|
||||
int m_bAutoLastCol; //tbllklastcol Flag sets table autoformat to format the last column.
|
||||
int m_bAutoNoRowBand; //tbllknorowband Specifies row banding conditional formatting shall not be applied.
|
||||
int m_bAutoNoColBand; //tbllknocolband Specifies column banding conditional formatting shall not be applied.
|
||||
int m_bAutoNoRowBand; //tbllknorowband Specifies row banding conditional formatting shall not be applied.
|
||||
int m_bAutoNoColBand; //tbllknocolband Specifies column banding conditional formatting shall not be applied.
|
||||
|
||||
int m_nRowBandSize; //tscbandshN Count of rows in a row band
|
||||
int m_nColBandSize; //tscbandsvN Count of cells in a cell band
|
||||
@ -1868,7 +1869,7 @@ public:
|
||||
DEFAULT_PROPERTY( m_nGraph )
|
||||
|
||||
DEFAULT_PROPERTY( nTableIndent )
|
||||
DEFAULT_PROPERTY( nTableIndentUnits )
|
||||
DEFAULT_PROPERTY( eTableIndentUnit )
|
||||
|
||||
m_eJust = rj_none;
|
||||
|
||||
@ -1888,7 +1889,7 @@ public:
|
||||
DEFAULT_PROPERTY( m_nLeft )
|
||||
DEFAULT_PROPERTY( m_nWidth )
|
||||
|
||||
m_eMUWidth = mu_none;
|
||||
m_eWidthUnit = mu_none;
|
||||
|
||||
//m_nDefCellMarBottom = 0;
|
||||
//m_nDefCellMarRight = 108;
|
||||
@ -1899,24 +1900,24 @@ public:
|
||||
DEFAULT_PROPERTY( m_nDefCellMarLeft )
|
||||
DEFAULT_PROPERTY( m_nDefCellMarTop )
|
||||
|
||||
m_nDefCellMarBottomUnits = 3;
|
||||
m_nDefCellMarRightUnits = 3;
|
||||
m_nDefCellMarLeftUnits = 3;
|
||||
m_nDefCellMarTopUnits = 3;
|
||||
//DEFAULT_PROPERTY( m_nDefCellMarBottomUnits )
|
||||
//DEFAULT_PROPERTY( m_nDefCellMarRightUnits )
|
||||
//DEFAULT_PROPERTY( m_nDefCellMarLeftUnits )
|
||||
//DEFAULT_PROPERTY( m_nDefCellMarTopUnits )
|
||||
//m_eDefCellMarBottomUnit = 3;
|
||||
//m_eDefCellMarRightUnit = 3;
|
||||
//m_eDefCellMarLeftUnit = 3;
|
||||
//m_eDefCellMarTopUnit = 3;
|
||||
DEFAULT_PROPERTY( m_eDefCellMarBottomUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellMarRightUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellMarLeftUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellMarTopUnit )
|
||||
|
||||
DEFAULT_PROPERTY( m_nDefCellSpBottom )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpLeft )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpRight )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpTop )
|
||||
|
||||
DEFAULT_PROPERTY( m_nDefCellSpBottomUnits )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpLeftUnits )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpRightUnits )
|
||||
DEFAULT_PROPERTY( m_nDefCellSpTopUnits )
|
||||
DEFAULT_PROPERTY( m_eDefCellSpBottomUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellSpLeftUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellSpRightUnit )
|
||||
DEFAULT_PROPERTY( m_eDefCellSpTopUnit )
|
||||
|
||||
m_oBorderLeft.SetEmpty();
|
||||
m_oBorderRight.SetEmpty();
|
||||
@ -1949,7 +1950,7 @@ public:
|
||||
MERGE_PROPERTY( m_nAutoFit, oTablePr )
|
||||
MERGE_PROPERTY( m_nGraph, oTablePr )
|
||||
MERGE_PROPERTY( nTableIndent, oTablePr )
|
||||
MERGE_PROPERTY( nTableIndentUnits, oTablePr )
|
||||
MERGE_PROPERTY( eTableIndentUnit, oTablePr )
|
||||
|
||||
MERGE_PROPERTY_DEF( m_eJust, oTablePr, rj_none )
|
||||
|
||||
@ -1968,25 +1969,26 @@ public:
|
||||
|
||||
MERGE_PROPERTY( m_nLeft, oTablePr )
|
||||
MERGE_PROPERTY( m_nWidth, oTablePr )
|
||||
MERGE_PROPERTY_DEF( m_eMUWidth, oTablePr, mu_none )
|
||||
|
||||
MERGE_PROPERTY_DEF( m_eWidthUnit, oTablePr, mu_none )
|
||||
|
||||
MERGE_PROPERTY( m_nDefCellMarBottom, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarRight, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarLeft, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarTop, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarBottomUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarRightUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarLeftUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellMarTopUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellMarBottomUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellMarRightUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellMarLeftUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellMarTopUnit, oTablePr )
|
||||
|
||||
MERGE_PROPERTY( m_nDefCellSpBottom, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpLeft, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpRight, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpTop, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpBottomUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpLeftUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpRightUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_nDefCellSpTopUnits, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellSpBottomUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellSpLeftUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellSpRightUnit, oTablePr )
|
||||
MERGE_PROPERTY( m_eDefCellSpTopUnit, oTablePr )
|
||||
|
||||
m_oBorderLeft.Merge ( oTablePr.m_oBorderLeft );
|
||||
m_oBorderRight.Merge( oTablePr.m_oBorderRight );
|
||||
@ -2177,25 +2179,25 @@ public:
|
||||
int m_bNoWrap; //clNoWrap Do not wrap text for the cell. Only has an effect if the table cell does not have a preferred \clwWidthN, which overrides \trautofitN.
|
||||
|
||||
int m_nPaddingLeft; //clpadlN Left cell margin or padding. Overrides \trpaddlN.
|
||||
int m_nIsPaddingLeft; //clpadflN Units for \clpadlN:
|
||||
int m_ePaddingLeftUnit; //clpadflN Units for \clpadlN:
|
||||
int m_nPaddingRight;
|
||||
int m_nIsPaddingRight;
|
||||
int m_ePaddingRightUnit;
|
||||
int m_nPaddingTop;
|
||||
int m_nIsPaddingTop;
|
||||
int m_ePaddingTopUnit;
|
||||
int m_nPaddingBottom;
|
||||
int m_nIsPaddingBottom;
|
||||
int m_ePaddingBottomUnit;
|
||||
|
||||
int m_nSpacingLeft; //clsplN Left cell margin or padding. Overrides \trspdlN.
|
||||
int m_nIsSpacingLeft; //clspflN Units for \clsplN:
|
||||
int m_eSpacingLeftUnit; //clspflN Units for \clsplN:
|
||||
int m_nSpacingRight;
|
||||
int m_nIsSpacingRight;
|
||||
int m_eSpacingRightUnit;
|
||||
int m_nSpacingTop;
|
||||
int m_nIsSpacingTop;
|
||||
int m_eSpacingTopUnit;
|
||||
int m_nSpacingBottom;
|
||||
int m_nIsSpacingBottom;
|
||||
int m_eSpacingBottomUnit;
|
||||
|
||||
int m_nWidth; //clwWidthN Preferred cell width. Overrides \trautofitN.
|
||||
_MetricUnits m_eWidthUnits; //clftsWidthN Units for \clwWidthN:
|
||||
int m_eWidthUnit; //clftsWidthN Units for \clwWidthN:
|
||||
|
||||
int m_bHideMark; //clhidemark This control word specifies whether the end of cell glyph shall influence the height of the given table row in the table. If it is specified, then only printing characters in this cell shall be used to determine the row height.
|
||||
|
||||
@ -2266,24 +2268,24 @@ public:
|
||||
DEFAULT_PROPERTY( m_bNoWrap )
|
||||
|
||||
DEFAULT_PROPERTY( m_nPaddingLeft )
|
||||
DEFAULT_PROPERTY( m_nIsPaddingLeft )
|
||||
DEFAULT_PROPERTY( m_ePaddingLeftUnit )
|
||||
DEFAULT_PROPERTY( m_nPaddingRight )
|
||||
DEFAULT_PROPERTY( m_nIsPaddingRight )
|
||||
DEFAULT_PROPERTY( m_ePaddingRightUnit )
|
||||
DEFAULT_PROPERTY( m_nPaddingTop )
|
||||
DEFAULT_PROPERTY( m_nIsPaddingTop )
|
||||
DEFAULT_PROPERTY( m_ePaddingTopUnit )
|
||||
DEFAULT_PROPERTY( m_nPaddingBottom )
|
||||
DEFAULT_PROPERTY( m_nIsPaddingBottom )
|
||||
DEFAULT_PROPERTY( m_ePaddingBottomUnit )
|
||||
|
||||
DEFAULT_PROPERTY( m_nSpacingLeft )
|
||||
DEFAULT_PROPERTY( m_nIsSpacingLeft )
|
||||
DEFAULT_PROPERTY( m_eSpacingLeftUnit )
|
||||
DEFAULT_PROPERTY( m_nSpacingRight )
|
||||
DEFAULT_PROPERTY( m_nIsSpacingRight )
|
||||
DEFAULT_PROPERTY( m_eSpacingRightUnit )
|
||||
DEFAULT_PROPERTY( m_nSpacingTop )
|
||||
DEFAULT_PROPERTY( m_nIsSpacingTop )
|
||||
DEFAULT_PROPERTY( m_eSpacingTopUnit )
|
||||
DEFAULT_PROPERTY( m_nSpacingBottom )
|
||||
DEFAULT_PROPERTY( m_nIsSpacingBottom )
|
||||
DEFAULT_PROPERTY( m_eSpacingBottomUnit )
|
||||
|
||||
m_eWidthUnits = mu_none;
|
||||
m_eWidthUnit = mu_none;
|
||||
DEFAULT_PROPERTY( m_nWidth )
|
||||
DEFAULT_PROPERTY( m_bHideMark )
|
||||
|
||||
@ -2325,35 +2327,35 @@ public:
|
||||
|
||||
void Merge( RtfCellProperty& oCellPr )
|
||||
{
|
||||
MERGE_PROPERTY( m_bMergeFirst, oCellPr )
|
||||
MERGE_PROPERTY( m_bMerge, oCellPr )
|
||||
MERGE_PROPERTY( m_bMergeFirstVertical, oCellPr )
|
||||
MERGE_PROPERTY( m_bMergeVertical, oCellPr )
|
||||
MERGE_PROPERTY( m_bMergeFirst, oCellPr )
|
||||
MERGE_PROPERTY( m_bMerge, oCellPr )
|
||||
MERGE_PROPERTY( m_bMergeFirstVertical, oCellPr )
|
||||
MERGE_PROPERTY( m_bMergeVertical, oCellPr )
|
||||
|
||||
MERGE_PROPERTY( m_bFitText, oCellPr )
|
||||
MERGE_PROPERTY( m_bNoWrap, oCellPr )
|
||||
MERGE_PROPERTY( m_bNoWrap, oCellPr )
|
||||
|
||||
MERGE_PROPERTY( m_nPaddingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsPaddingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsPaddingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsPaddingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsPaddingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_ePaddingLeftUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_ePaddingRightUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_ePaddingTopUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nPaddingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_ePaddingBottomUnit, oCellPr )
|
||||
|
||||
MERGE_PROPERTY( m_nSpacingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsSpacingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsSpacingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsSpacingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_nIsSpacingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingLeft, oCellPr )
|
||||
MERGE_PROPERTY( m_eSpacingLeftUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingRight, oCellPr )
|
||||
MERGE_PROPERTY( m_eSpacingRightUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingTop, oCellPr )
|
||||
MERGE_PROPERTY( m_eSpacingTopUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nSpacingBottom, oCellPr )
|
||||
MERGE_PROPERTY( m_eSpacingBottomUnit, oCellPr )
|
||||
|
||||
MERGE_PROPERTY( m_eWidthUnits, oCellPr )
|
||||
MERGE_PROPERTY( m_nWidth, oCellPr )
|
||||
MERGE_PROPERTY( m_bHideMark, oCellPr )
|
||||
MERGE_PROPERTY( m_eWidthUnit, oCellPr )
|
||||
MERGE_PROPERTY( m_nWidth, oCellPr )
|
||||
MERGE_PROPERTY( m_bHideMark, oCellPr )
|
||||
|
||||
m_oBorderDiagonalLR.Merge( oCellPr.m_oBorderDiagonalLR );
|
||||
m_oBorderDiagonalRL.Merge( oCellPr.m_oBorderDiagonalRL );
|
||||
@ -2421,11 +2423,11 @@ public:
|
||||
|
||||
int m_nHeight; //trrhN Height of a table row in twips. When 0, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line.
|
||||
|
||||
int m_nWidthStartInvCell; //trwWidthBN Width of invisible cell at the beginning of the row. Used only in cases where rows have different widths.
|
||||
_MetricUnits m_eMUStartInvCell; //trftsWidthBN Units for \trwWidthBN:
|
||||
int m_nWidthStartInvCell; //trwWidthBN Width of invisible cell at the beginning of the row. Used only in cases where rows have different widths.
|
||||
int m_eWidthStartInvCellUnit; //trftsWidthBN Units for \trwWidthBN:
|
||||
|
||||
int m_nWidthEndInvCell; //trwWidthAN Width of invisible cell at the end of the row. Used only when rows have different widths.
|
||||
_MetricUnits m_eMUEndInvCell; //trftsWidthAN Units for \trwWidthAN:
|
||||
int m_nWidthEndInvCell; //trwWidthAN Width of invisible cell at the end of the row. Used only when rows have different widths.
|
||||
int m_eWidthEndInvCellUnit; //trftsWidthAN Units for \trwWidthAN:
|
||||
|
||||
int m_nGridBefore; //для oox
|
||||
int m_nGridAfter; //для oox
|
||||
@ -2481,9 +2483,11 @@ public:
|
||||
DEFAULT_PROPERTY( m_nHeight )
|
||||
|
||||
DEFAULT_PROPERTY( m_nWidthStartInvCell )
|
||||
m_eMUStartInvCell = mu_none;
|
||||
DEFAULT_PROPERTY( m_nWidthEndInvCell )
|
||||
m_eMUEndInvCell = mu_none;
|
||||
|
||||
m_eWidthStartInvCellUnit = mu_none;
|
||||
m_eWidthEndInvCellUnit = mu_none;
|
||||
|
||||
DEFAULT_PROPERTY( m_nGridBefore )
|
||||
DEFAULT_PROPERTY( m_nGridAfter )
|
||||
m_aArray.clear();
|
||||
@ -2524,10 +2528,10 @@ public:
|
||||
|
||||
MERGE_PROPERTY( m_nHeight, oRowPr )
|
||||
|
||||
MERGE_PROPERTY ( m_nWidthStartInvCell, oRowPr )
|
||||
MERGE_PROPERTY_DEF ( m_eMUStartInvCell, oRowPr, mu_none )
|
||||
MERGE_PROPERTY ( m_nWidthEndInvCell, oRowPr )
|
||||
MERGE_PROPERTY_DEF ( m_eMUEndInvCell, oRowPr, mu_none )
|
||||
MERGE_PROPERTY ( m_nWidthStartInvCell, oRowPr )
|
||||
MERGE_PROPERTY_DEF ( m_eWidthStartInvCellUnit, oRowPr, mu_none )
|
||||
MERGE_PROPERTY ( m_nWidthEndInvCell, oRowPr )
|
||||
MERGE_PROPERTY_DEF ( m_eWidthEndInvCellUnit, oRowPr, mu_none )
|
||||
|
||||
MERGE_PROPERTY_DEF ( m_nGridBefore, oRowPr, mu_none )
|
||||
MERGE_PROPERTY_DEF ( m_nGridAfter, oRowPr, mu_none )
|
||||
@ -2926,6 +2930,9 @@ public:
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sDocCom;
|
||||
std::wstring m_sLinkBase;
|
||||
|
||||
std::wstring m_sApplication;
|
||||
|
||||
RtfTime m_oCreateTime;
|
||||
RtfTime m_oRevTime;
|
||||
RtfTime m_oPrintTime;
|
||||
|
||||
@ -307,13 +307,12 @@ std::wstring RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
|
||||
RENDER_RTF_INT ( m_nColumnNumber, sResult, L"cols" )
|
||||
RENDER_RTF_INT ( m_nColumnSpace, sResult, L"colsx" )
|
||||
RENDER_RTF_BOOL ( m_bColumnLineBetween, sResult, L"linebetcol" )
|
||||
|
||||
int nCollFormCount = (int)m_oCollumnProperty.m_aCollumnProperty.size();
|
||||
if( nCollFormCount > 0 )
|
||||
{
|
||||
for( int i = 0; i < nCollFormCount; i++ )
|
||||
|
||||
if (m_nColumnNumber > 1)
|
||||
{
|
||||
for( size_t i = 0; i < m_oCollumnProperty.m_aCollumnProperty.size(); i++ )
|
||||
{
|
||||
sResult += L"\\colno" + std::to_wstring( i + 1 );
|
||||
sResult += L"\\colno" + std::to_wstring( i + 1 );
|
||||
RENDER_RTF_INT( m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnSpaceToRightOfCol, sResult, L"colsr" )
|
||||
RENDER_RTF_INT( m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnWidth, sResult, L"colw" )
|
||||
}
|
||||
@ -575,23 +574,36 @@ std::wstring RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
|
||||
}
|
||||
}
|
||||
sCollumnFormating += L"<w:cols w:num=\"" + std::to_wstring(m_nColumnNumber) + L"\"";
|
||||
|
||||
if( PROP_DEF != m_nColumnSpace )
|
||||
sCollumnFormating += L" w:space=\"" + std::to_wstring(m_nColumnSpace) + L"\"";
|
||||
if( true == bEqualWidth )
|
||||
sCollumnFormating += L" w:equalWidth=\"true\"/>";
|
||||
|
||||
if (m_nColumnNumber > 1)
|
||||
{
|
||||
if (PROP_DEF != m_bColumnLineBetween)
|
||||
sCollumnFormating += std::wstring(L" w:sep=\"") + (m_bColumnLineBetween ? L"1" : L"0") + L"\"";
|
||||
|
||||
if( true == bEqualWidth )
|
||||
sCollumnFormating += L" w:equalWidth=\"true\"/>";
|
||||
else
|
||||
{
|
||||
sCollumnFormating += L" w:equalWidth=\"false\">";
|
||||
|
||||
for (size_t i = 0; i < m_oCollumnProperty.m_aCollumnProperty.size(); i++ )
|
||||
{
|
||||
sCollumnFormating += L"<w:col";
|
||||
if( PROP_DEF != m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnWidth )
|
||||
sCollumnFormating += L" w:w=\"" + std::to_wstring(m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnWidth) + L"\"";
|
||||
if( PROP_DEF != m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnSpaceToRightOfCol )
|
||||
sCollumnFormating += L" w:space=\"" + std::to_wstring(m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnSpaceToRightOfCol ) + L"\"";
|
||||
sCollumnFormating += L"/>";
|
||||
}
|
||||
sCollumnFormating += L"</w:cols>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sCollumnFormating += L" w:equalWidth=\"false\">";
|
||||
for (size_t i = 0; i < m_oCollumnProperty.m_aCollumnProperty.size(); i++ )
|
||||
{
|
||||
sCollumnFormating += L"<w:col";
|
||||
if( PROP_DEF != m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnWidth )
|
||||
sCollumnFormating += L" w:w=\"" + std::to_wstring(m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnWidth) + L"\"";
|
||||
if( PROP_DEF != m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnSpaceToRightOfCol )
|
||||
sCollumnFormating += L" w:space=\"" + std::to_wstring(m_oCollumnProperty.m_aCollumnProperty[i].m_nColumnSpaceToRightOfCol ) + L"\"";
|
||||
sCollumnFormating += L"/>";
|
||||
}
|
||||
sCollumnFormating += L"</w:cols>";
|
||||
sCollumnFormating += L"/>";
|
||||
}
|
||||
if( false == sCollumnFormating.empty() )
|
||||
sResult += sCollumnFormating;
|
||||
|
||||
@ -315,15 +315,11 @@ public:
|
||||
class ColumnProperty
|
||||
{
|
||||
public:
|
||||
class CollumnVar
|
||||
struct CollumnVar
|
||||
{
|
||||
public: int m_nColumnSpaceToRightOfCol; // colsrN Space to right of column in twips; used to specify formatting for variable-width columns.
|
||||
int m_nColumnWidth; // colwN Width of column in twips; used to override the default constant width setting for variable-width columns.
|
||||
CollumnVar()
|
||||
{
|
||||
m_nColumnSpaceToRightOfCol = PROP_DEF;
|
||||
m_nColumnWidth = PROP_DEF;
|
||||
}
|
||||
int m_nColumnSpaceToRightOfCol = PROP_DEF; // colsrN Space to right of column in twips; used to specify formatting for variable-width columns.
|
||||
int m_nColumnWidth = PROP_DEF; // colwN Width of column in twips; used to override the default constant width setting for variable-width columns.
|
||||
|
||||
};
|
||||
std::vector< CollumnVar > m_aCollumnProperty;
|
||||
ColumnProperty()
|
||||
@ -570,8 +566,6 @@ public:
|
||||
DEFAULT_PROPERTY ( m_nColumnSpace )
|
||||
DEFAULT_PROPERTY ( m_bColumnLineBetween )
|
||||
|
||||
m_oCollumnProperty.m_aCollumnProperty.resize( m_nColumnNumber );
|
||||
|
||||
//Footnotes and Endnotes
|
||||
DEFAULT_PROPERTY_DEF( m_eFootnotesJust, fj_none )
|
||||
DEFAULT_PROPERTY ( m_nFootnotesStart )
|
||||
|
||||
@ -55,7 +55,8 @@ void RtfShape::SetDefault()
|
||||
DEFAULT_PROPERTY( m_bLockAnchor )
|
||||
DEFAULT_PROPERTY_DEF( m_eXAnchor, ax_column ) //по умолчанию - привязка к тексту
|
||||
DEFAULT_PROPERTY_DEF( m_eYAnchor, ay_Para )//по умолчанию - привязка к тексту
|
||||
|
||||
DEFAULT_PROPERTY( m_nLockPosition )
|
||||
DEFAULT_PROPERTY( m_nLockRotation )
|
||||
//Position absolute
|
||||
DEFAULT_PROPERTY( m_nPositionH )
|
||||
DEFAULT_PROPERTY( m_nPositionHRelative )
|
||||
@ -89,19 +90,27 @@ void RtfShape::SetDefault()
|
||||
|
||||
//Text box
|
||||
DEFAULT_PROPERTY( m_nAnchorText )
|
||||
DEFAULT_PROPERTY_DEF( m_nTexpLeft, 91440 )
|
||||
DEFAULT_PROPERTY_DEF( m_nTexpTop, 45720 )
|
||||
DEFAULT_PROPERTY_DEF( m_nTexpRight, 91440 )
|
||||
DEFAULT_PROPERTY_DEF( m_nTexpBottom, 45720 )
|
||||
|
||||
//DEFAULT_PROPERTY_DEF( m_nTexpLeft, 91440 )
|
||||
//DEFAULT_PROPERTY_DEF( m_nTexpTop, 45720 )
|
||||
//DEFAULT_PROPERTY_DEF( m_nTexpRight, 91440 )
|
||||
//DEFAULT_PROPERTY_DEF( m_nTexpBottom, 45720 )
|
||||
|
||||
DEFAULT_PROPERTY( m_nTexpLeft )
|
||||
DEFAULT_PROPERTY( m_nTexpTop )
|
||||
DEFAULT_PROPERTY( m_nTexpRight )
|
||||
DEFAULT_PROPERTY( m_nTexpBottom )
|
||||
|
||||
DEFAULT_PROPERTY( m_bFitShapeToText )
|
||||
DEFAULT_PROPERTY( m_bFitTextToShape )
|
||||
DEFAULT_PROPERTY( m_nCcol )
|
||||
DEFAULT_PROPERTY( m_nTxdir )
|
||||
DEFAULT_PROPERTY( m_nWrapText )
|
||||
DEFAULT_PROPERTY( m_nTxflTextFlow)
|
||||
DEFAULT_PROPERTY( m_fRotateText)
|
||||
DEFAULT_PROPERTY( m_nScaleText)
|
||||
DEFAULT_PROPERTY( m_fAutoTextMargin)
|
||||
DEFAULT_PROPERTY( m_CdirFont)
|
||||
//Geometry
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
DEFAULT_PROPERTY( m_nAdjustValue[i] )
|
||||
@ -178,9 +187,9 @@ void RtfShape::SetDefault()
|
||||
m_aTextItems = TextItemContainerPtr();
|
||||
m_oPicture = RtfPicturePtr();
|
||||
m_bBackground = false;
|
||||
m_bIsOle = false;
|
||||
m_bInGroup = false;
|
||||
m_bIsGroup = false;
|
||||
m_bIsOle = false;
|
||||
|
||||
m_oCharProperty.SetDefault();
|
||||
}
|
||||
@ -425,6 +434,8 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
|
||||
RENDER_RTF_SHAPE_PROP(L"posrelh", sResult, m_nPositionHRelative);
|
||||
RENDER_RTF_SHAPE_PROP(L"posv", sResult, m_nPositionV);
|
||||
RENDER_RTF_SHAPE_PROP(L"posrelv", sResult, m_nPositionVRelative);
|
||||
RENDER_RTF_SHAPE_PROP(L"fLockPosition", sResult, m_nLockPosition);
|
||||
RENDER_RTF_SHAPE_PROP(L"fLockRotation", sResult, m_nLockRotation);
|
||||
|
||||
RENDER_RTF_SHAPE_PROP(L"fLayoutInCell", sResult, m_bLayoutInCell);
|
||||
RENDER_RTF_SHAPE_PROP(L"fAllowOverlap", sResult, m_bAllowOverlap);
|
||||
@ -442,12 +453,12 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
|
||||
if (m_sName.empty() == false)
|
||||
{
|
||||
sResult += L"{\\sp{\\sn wzName}{\\sv ";
|
||||
sResult += m_sName + L"}}";
|
||||
sResult += RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, -1 ) + L"}}";
|
||||
}
|
||||
if (m_sDescription.empty() == false)
|
||||
{
|
||||
sResult += L"{\\sp{\\sn wzDescription}{\\sv ";
|
||||
sResult += m_sDescription + L"}}";
|
||||
sResult += RtfChar::renderRtfText(m_sDescription, oRenderParameter.poDocument, -1 ) + L"}}";
|
||||
}
|
||||
//Rehydration
|
||||
//RENDER_RTF_SHAPE_PROP(L"metroBlob", sResult, m_sMetroBlob);
|
||||
@ -482,6 +493,8 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
|
||||
RENDER_RTF_SHAPE_PROP(L"ccol", sResult, m_nCcol);
|
||||
RENDER_RTF_SHAPE_PROP(L"txdir", sResult, m_nTxdir);
|
||||
RENDER_RTF_SHAPE_PROP(L"WrapText", sResult, m_nWrapText);
|
||||
RENDER_RTF_SHAPE_PROP(L"txflTextFlow", sResult, m_nTxflTextFlow);
|
||||
RENDER_RTF_SHAPE_PROP(L"fRotateText", sResult, m_fRotateText);
|
||||
//Geometry
|
||||
RENDER_RTF_SHAPE_PROP(L"adjustValue", sResult, m_nAdjustValue[0] );
|
||||
RENDER_RTF_SHAPE_PROP(L"adjust2Value", sResult, m_nAdjustValue[1] );
|
||||
@ -538,7 +551,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
|
||||
//Fill
|
||||
if( 0 == m_bFilled )
|
||||
sResult += L"{\\sp{\\sn fFilled}{\\sv 0}}";
|
||||
RENDER_RTF_SHAPE_PROP(L"fillType", sResult, m_nFillType );
|
||||
RENDER_RTF_SHAPE_PROP(L"fillType", sResult, m_nFillType );
|
||||
RENDER_RTF_SHAPE_PROP(L"fillColor", sResult, m_nFillColor );
|
||||
RENDER_RTF_SHAPE_PROP(L"fillBackColor", sResult, m_nFillColor2 );
|
||||
|
||||
@ -675,69 +688,63 @@ std::wstring RtfShape::RenderToOOX(RenderParameter oRenderParameter)
|
||||
std::wstring sResult;
|
||||
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
|
||||
|
||||
TextItemContainerPtr aTempTextItems;
|
||||
|
||||
if( NSOfficeDrawing::sptPictureFrame == m_nShapeType && 0 != m_aTextItems )
|
||||
{//Значит это Ole обьект с anchor, для него все также только TextBox надо делать по-другому
|
||||
aTempTextItems = m_aTextItems;
|
||||
m_aTextItems = TextItemContainerPtr();
|
||||
m_bIsOle = true;
|
||||
{//test for ole
|
||||
TextItemContainerPtr aTempTextItems = m_aTextItems;
|
||||
|
||||
m_aTextItems = TextItemContainerPtr();
|
||||
|
||||
if( 0 != aTempTextItems )
|
||||
{//пишем только Ole обьект
|
||||
//ищем первый ole обьект
|
||||
RtfOlePtr poFirstOle;
|
||||
int nTempTextItemsCount = aTempTextItems->GetCount();
|
||||
for (size_t i = 0; i < nTempTextItemsCount; i++ )
|
||||
{
|
||||
ITextItemPtr piCurTextItem;
|
||||
aTempTextItems->GetItem( piCurTextItem, i );
|
||||
if( NULL != piCurTextItem && TYPE_RTF_PARAGRAPH == piCurTextItem->GetType() )
|
||||
{
|
||||
RtfParagraphPtr poCurParagraph = boost::static_pointer_cast< RtfParagraph, ITextItem >( piCurTextItem );
|
||||
if( NULL != poCurParagraph )
|
||||
{
|
||||
for (size_t j = 0; j < poCurParagraph->GetCount(); j++ )
|
||||
{
|
||||
IDocumentElementPtr piCurIDocumentElement;
|
||||
poCurParagraph->GetItem( piCurIDocumentElement, j );
|
||||
if( NULL != piCurIDocumentElement && TYPE_RTF_OLE == piCurIDocumentElement->GetType() )
|
||||
{
|
||||
//рендерим только Ole часть
|
||||
RenderParameter oNewParam = oRenderParameter;
|
||||
oNewParam.nType = RENDER_TO_OOX_PARAM_OLE_ONLY;
|
||||
oNewParam.nValue = m_nID;
|
||||
|
||||
RtfOlePtr poCurOle = boost::static_pointer_cast< RtfOle, IDocumentElement >( piCurIDocumentElement );
|
||||
if( NULL != poCurOle )
|
||||
{
|
||||
m_sOle += poCurOle->RenderToOOX( oNewParam );
|
||||
if (!m_sOle.empty())
|
||||
{
|
||||
m_bIsOle = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( true == m_bIsOle )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//возвращаем text box на место
|
||||
m_aTextItems = aTempTextItems;
|
||||
}
|
||||
}
|
||||
|
||||
sResult = RenderToOOXBegin(oRenderParameter);
|
||||
|
||||
if( !sResult.empty() )
|
||||
sResult += RenderToOOXEnd(oRenderParameter);
|
||||
|
||||
std::wstring sOle;
|
||||
if( 0 != aTempTextItems )
|
||||
{//пишем только Ole обьект
|
||||
//ищем первый ole обьект
|
||||
RtfOlePtr poFirstOle;
|
||||
int nTempTextItemsCount = aTempTextItems->GetCount();
|
||||
for (size_t i = 0; i < nTempTextItemsCount; i++ )
|
||||
{
|
||||
ITextItemPtr piCurTextItem;
|
||||
aTempTextItems->GetItem( piCurTextItem, i );
|
||||
if( NULL != piCurTextItem && TYPE_RTF_PARAGRAPH == piCurTextItem->GetType() )
|
||||
{
|
||||
RtfParagraphPtr poCurParagraph = boost::static_pointer_cast< RtfParagraph, ITextItem >( piCurTextItem );
|
||||
if( NULL != poCurParagraph )
|
||||
{
|
||||
bool bBreak = false;
|
||||
for (size_t j = 0; j < poCurParagraph->GetCount(); j++ )
|
||||
{
|
||||
IDocumentElementPtr piCurIDocumentElement;
|
||||
poCurParagraph->GetItem( piCurIDocumentElement, j );
|
||||
if( NULL != piCurIDocumentElement && TYPE_RTF_OLE == piCurIDocumentElement->GetType() )
|
||||
{
|
||||
//рендерим только Ole часть
|
||||
RenderParameter oNewParam = oRenderParameter;
|
||||
oNewParam.nType = RENDER_TO_OOX_PARAM_OLE_ONLY;
|
||||
oNewParam.nValue = m_nID;
|
||||
|
||||
RtfOlePtr poCurOle = boost::static_pointer_cast< RtfOle, IDocumentElement >( piCurIDocumentElement );
|
||||
if( NULL != poCurOle )
|
||||
{
|
||||
sOle += poCurOle->RenderToOOX( oNewParam );
|
||||
bBreak = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( true == bBreak )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//возвращаем text box на место
|
||||
m_aTextItems = aTempTextItems;
|
||||
}
|
||||
|
||||
if( !sOle.empty() && !sResult.empty())
|
||||
{
|
||||
XmlUtils::replace_all(sResult, L"</w:pict>", sOle + L"</w:pict>" );//todooo переписать
|
||||
}
|
||||
|
||||
return sResult;
|
||||
}
|
||||
@ -772,7 +779,14 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
;//child shape
|
||||
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
|
||||
{//pic bullets
|
||||
sResult += L"<w:pict>";
|
||||
if (m_bIsOle)
|
||||
{
|
||||
sResult += L"<w:object w:dxaOrig=\"0\" w:dyaOrig=\"0\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult += L"<w:pict>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{//работает по умолчанию
|
||||
@ -804,7 +818,14 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
sResult += sCharProp;
|
||||
sResult += L"</w:rPr>";
|
||||
}
|
||||
sResult += L"<w:pict>";
|
||||
if (m_bIsOle)
|
||||
{
|
||||
sResult += L"<w:object w:dxaOrig=\"0\" w:dyaOrig=\"0\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult += L"<w:pict>";
|
||||
}
|
||||
}
|
||||
|
||||
if (oRenderParameter.sValue.empty())
|
||||
@ -814,12 +835,13 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
|
||||
sResult += L"<" + oRenderParameter.sValue;
|
||||
|
||||
if (m_sName.empty())
|
||||
RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
|
||||
sResult += L" id=\"_x0000_s" + std::to_wstring(poDocument->GetShapeId( m_nID )) + L"\"";
|
||||
|
||||
if (!m_sName.empty())
|
||||
{
|
||||
RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
|
||||
m_sName += L"_x0000_s" + std::to_wstring(poDocument->GetShapeId( m_nID )) + L"";
|
||||
sResult += L" title=\"" + m_sName + L"\"";
|
||||
}
|
||||
sResult += L" id=\"" + m_sName + L"\"";
|
||||
|
||||
if( PROP_DEF != m_nShapeType && 0 != m_nShapeType)
|
||||
{
|
||||
@ -1072,7 +1094,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
sResult += L" style=\"" + sStyle + L"\"";
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
if( true == m_bIsOle ) sResult += L" o:ole=\"\"";
|
||||
if( false == m_sOle.empty() ) sResult += L" o:ole=\"\"";
|
||||
|
||||
if( PROP_DEF != m_nGroupLeft && PROP_DEF != m_nGroupTop )
|
||||
sResult += L" coordorigin=\"" + std::to_wstring(m_nGroupLeft) + L"," + std::to_wstring(m_nGroupTop) + L"\"";
|
||||
@ -1249,7 +1271,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
}
|
||||
}
|
||||
|
||||
if( 0 != m_aTextItems )
|
||||
if( 0 != m_aTextItems && !m_bIsOle)
|
||||
{
|
||||
RenderParameter oNewParam = oRenderParameter;
|
||||
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
|
||||
@ -1305,16 +1327,19 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
|
||||
|
||||
sResult += L"<v:imagedata r:id=\"" + sPicture + L"\"";
|
||||
|
||||
if( PROP_DEF != nCropLeft )
|
||||
sResult += L" cropleft=\"" + std::to_wstring(nCropLeft) + L"f\"";
|
||||
if( PROP_DEF != nCropTop )
|
||||
sResult += L" croptop=\"" + std::to_wstring(nCropTop) + L"f\"";
|
||||
if( PROP_DEF != nCropRight )
|
||||
sResult += L" cropright=\"" + std::to_wstring(nCropRight) + L"f\"";
|
||||
if( PROP_DEF != nCropBottom )
|
||||
sResult += L" cropbottom=\"" + std::to_wstring(nCropBottom) + L"f\"";
|
||||
if (!m_bIsOle)
|
||||
{
|
||||
if( PROP_DEF != nCropLeft )
|
||||
sResult += L" cropleft=\"" + std::to_wstring(nCropLeft) + L"f\"";
|
||||
if( PROP_DEF != nCropTop )
|
||||
sResult += L" croptop=\"" + std::to_wstring(nCropTop) + L"f\"";
|
||||
if( PROP_DEF != nCropRight )
|
||||
sResult += L" cropright=\"" + std::to_wstring(nCropRight) + L"f\"";
|
||||
if( PROP_DEF != nCropBottom )
|
||||
sResult += L" cropbottom=\"" + std::to_wstring(nCropBottom) + L"f\"";
|
||||
}
|
||||
|
||||
sResult += L" o:title=\"\"/>";
|
||||
sResult += L" o:title=\"" + m_sName + L"\"/>";
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
@ -1440,10 +1465,20 @@ std::wstring RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter)
|
||||
if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2 == oRenderParameter.nType )
|
||||
;
|
||||
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
|
||||
sResult += L"</w:pict>";
|
||||
{
|
||||
if (!m_sOle.empty()) sResult += m_sOle + L"</w:object>";
|
||||
else sResult += L"</w:pict>";
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult += L"</w:pict></w:r>";//работает по умолчанию
|
||||
if (!m_sOle.empty())
|
||||
{
|
||||
sResult += m_sOle + L"</w:object></w:r>";//работает по умолчанию
|
||||
}
|
||||
else
|
||||
{
|
||||
sResult += L"</w:pict></w:r>";//работает по умолчанию
|
||||
}
|
||||
|
||||
if (m_bDelete) sResult += L"</w:del>";
|
||||
if (m_bInsert) sResult += L"</w:ins>";
|
||||
|
||||
@ -44,9 +44,10 @@ private:
|
||||
public:
|
||||
bool m_bBackground;
|
||||
bool m_bIsGroup;
|
||||
bool m_bIsOle;
|
||||
bool m_bInGroup; //local anchor
|
||||
|
||||
std::wstring m_sOle;
|
||||
bool m_bIsOle;
|
||||
//-----------------------------
|
||||
enum _AnchorTypeShape { st_none, st_inline, st_anchor };
|
||||
enum _AnchorX
|
||||
@ -83,6 +84,8 @@ public:
|
||||
int m_nWrapSideType; //shpwrkN Wrap on side (for types 2 and 4 for \shpwrN ):
|
||||
int m_nZOrderRelative; //shpfblwtxtN Describes relative z-ordering:
|
||||
int m_bLockAnchor; //shplockanchor Lock anchor for a shape.
|
||||
int m_nLockPosition;
|
||||
int m_nLockRotation;
|
||||
|
||||
_AnchorX m_eXAnchor;
|
||||
_AnchorY m_eYAnchor;
|
||||
@ -132,6 +135,11 @@ public:
|
||||
int m_nCcol; //columns
|
||||
int m_nTxdir; //bidi
|
||||
int m_nWrapText;
|
||||
int m_nTxflTextFlow;
|
||||
int m_fAutoTextMargin;
|
||||
int m_fRotateText;
|
||||
int m_nScaleText;
|
||||
int m_CdirFont;
|
||||
//Geometry
|
||||
int m_nAdjustValue[10];
|
||||
//Custom
|
||||
|
||||
@ -104,9 +104,10 @@ public:
|
||||
|
||||
int nWidthBefore = 0;
|
||||
int nWidthAfter = 0;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUStartInvCell)
|
||||
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthStartInvCellUnit)
|
||||
nWidthBefore = oCurRow->m_oProperty.m_nWidthStartInvCell;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUEndInvCell)
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthEndInvCellUnit)
|
||||
nWidthAfter = oCurRow->m_oProperty.m_nWidthEndInvCell;
|
||||
|
||||
int nDelta = 0;// поправка на margin и indent и spacing
|
||||
@ -114,13 +115,13 @@ public:
|
||||
nDelta = -oCurRow->m_oProperty.m_nLeft;
|
||||
else
|
||||
{
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.nTableIndentUnits )
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.eTableIndentUnit )
|
||||
nDelta -= m_oProperty.nTableIndent;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_nDefCellMarLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_eDefCellMarLeftUnit )
|
||||
nDelta += m_oProperty.m_nDefCellMarLeft;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_nDefCellSpLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_eDefCellSpLeftUnit )
|
||||
nDelta += 2 * m_oProperty.m_nDefCellSpLeft;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUStartInvCell)
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthStartInvCellUnit)
|
||||
nDelta -= oCurRow->m_oProperty.m_nWidthStartInvCell;
|
||||
}
|
||||
|
||||
@ -155,9 +156,9 @@ public:
|
||||
|
||||
int nWidthBefore = 0;
|
||||
int nWidthAfter = 0;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUStartInvCell)
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthStartInvCellUnit)
|
||||
nWidthBefore = oCurRow->m_oProperty.m_nWidthStartInvCell;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUEndInvCell)
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthEndInvCellUnit)
|
||||
nWidthAfter = oCurRow->m_oProperty.m_nWidthEndInvCell;
|
||||
|
||||
int nDelta = 0;// поправка на margin и indent и spacing и border
|
||||
@ -165,13 +166,13 @@ public:
|
||||
nDelta = -oCurRow->m_oProperty.m_nLeft;
|
||||
else
|
||||
{
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.nTableIndentUnits )
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.eTableIndentUnit )
|
||||
nDelta -= m_oProperty.nTableIndent;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_nDefCellMarLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_eDefCellMarLeftUnit )
|
||||
nDelta += m_oProperty.m_nDefCellMarLeft;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_nDefCellSpLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_eDefCellSpLeftUnit )
|
||||
nDelta += 2 * m_oProperty.m_nDefCellSpLeft;
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUStartInvCell)
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthStartInvCell && mu_Twips == oCurRow->m_oProperty.m_eWidthStartInvCellUnit)
|
||||
nDelta -= oCurRow->m_oProperty.m_nWidthStartInvCell;
|
||||
}
|
||||
|
||||
@ -203,8 +204,8 @@ public:
|
||||
nWidth = aCellx[k];
|
||||
else
|
||||
nWidth = aCellx[k] - aCellx[nLastIndex - 1];
|
||||
oCurCell->m_oProperty.m_nWidth = nWidth;
|
||||
oCurCell->m_oProperty.m_eWidthUnits = mu_Twips;
|
||||
oCurCell->m_oProperty.m_nWidth = nWidth;
|
||||
oCurCell->m_oProperty.m_eWidthUnit = mu_Twips;
|
||||
nLastIndex = k + 1;
|
||||
break;
|
||||
}
|
||||
@ -247,23 +248,27 @@ public:
|
||||
int nGutter = oDocument.m_oProperty.m_nGutterWidth;
|
||||
if( 1 == oDocument.m_oProperty.m_bGutterAtTop )//не учитываем если это Top gutter
|
||||
nGutter = 0;
|
||||
m_oProperty.m_nWidth = oDocument.m_oProperty.m_nPaperWidth - oDocument.m_oProperty.m_nMarginLeft - oDocument.m_oProperty.m_nMarginRight - nGutter;
|
||||
m_oProperty.m_eMUWidth = mu_Twips;
|
||||
m_oProperty.m_nWidth = oDocument.m_oProperty.m_nPaperWidth - oDocument.m_oProperty.m_nMarginLeft - oDocument.m_oProperty.m_nMarginRight - nGutter;
|
||||
m_oProperty.m_eWidthUnit = mu_Twips;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < (int)m_aArray.size(); i++)
|
||||
{
|
||||
RtfTableRowPtr oCurRow = m_aArray[i];
|
||||
int nCellCount = oCurRow->GetCount();
|
||||
|
||||
if( oCurRow->m_oProperty.GetCount() < nCellCount )
|
||||
nCellCount = oCurRow->m_oProperty.GetCount();
|
||||
|
||||
if( nCellCount > 0 )
|
||||
{
|
||||
int nCellWidth = m_oProperty.m_nWidth / nCellCount;
|
||||
int nCurCellX = 0;
|
||||
|
||||
for (int j = 0; j < nCellCount; j++ )
|
||||
{
|
||||
nCurCellX += nCellWidth;
|
||||
|
||||
RtfTableCellPtr oCellPtr = (*oCurRow)[j];
|
||||
oCellPtr->m_oProperty.m_nCellx = nCurCellX;
|
||||
oCurRow->m_oProperty[j].m_nCellx = nCurCellX;
|
||||
@ -273,44 +278,45 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < (int)m_aArray.size(); i++)
|
||||
for (size_t i = 0; i < m_aArray.size(); i++)
|
||||
{
|
||||
RtfTableRowPtr oCurRow= m_aArray[ i ];
|
||||
|
||||
int nLeft = 0;
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.nTableIndentUnits )
|
||||
if( PROP_DEF != m_oProperty.nTableIndent && 3 == m_oProperty.eTableIndentUnit )
|
||||
nLeft += m_oProperty.nTableIndent;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_nDefCellMarLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellMarLeft && 3 == m_oProperty.m_eDefCellMarLeftUnit )
|
||||
nLeft -= m_oProperty.m_nDefCellMarLeft;
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_nDefCellSpLeftUnits )
|
||||
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_eDefCellSpLeftUnit )
|
||||
nLeft += 2 * m_oProperty.m_nDefCellSpLeft;
|
||||
int nDelta = nLeft;//в left учитывается GrindBefore
|
||||
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nGridBefore )
|
||||
{
|
||||
int nGridBefore = oCurRow->m_oProperty.m_nGridBefore;
|
||||
if( (int)m_aTableGrid.size() > nGridBefore - 1)
|
||||
{
|
||||
int nWidthBefore = 0;
|
||||
for (int k = 0; k < nGridBefore ; k++ )
|
||||
nWidthBefore += m_aTableGrid[k];
|
||||
oCurRow->m_oProperty.m_nWidthStartInvCell = nWidthBefore;
|
||||
oCurRow->m_oProperty.m_eMUStartInvCell = mu_Twips;
|
||||
nLeft += nWidthBefore;
|
||||
}
|
||||
}
|
||||
if( PROP_DEF != oCurRow->m_oProperty.m_nGridAfter )
|
||||
{
|
||||
int nGridAfter = oCurRow->m_oProperty.m_nGridAfter;
|
||||
if( (int)m_aTableGrid.size() > nGridAfter - 1)
|
||||
{
|
||||
int nWidthAfter = 0;
|
||||
for( int k = (int)m_aTableGrid.size() - 1; k >= (int)m_aTableGrid.size() - 1 - nGridAfter; k-- )
|
||||
nWidthAfter += m_aTableGrid[k];
|
||||
oCurRow->m_oProperty.m_nWidthEndInvCell = nWidthAfter;
|
||||
oCurRow->m_oProperty.m_eMUEndInvCell = mu_Twips;
|
||||
}
|
||||
}
|
||||
//if( PROP_DEF != oCurRow->m_oProperty.m_nGridBefore )
|
||||
//{
|
||||
// int nGridBefore = oCurRow->m_oProperty.m_nGridBefore;
|
||||
// if( (int)m_aTableGrid.size() > nGridBefore - 1)
|
||||
// {
|
||||
// int nWidthBefore = 0;
|
||||
// for (int k = 0; k < nGridBefore ; k++ )
|
||||
// nWidthBefore += m_aTableGrid[k];
|
||||
// oCurRow->m_oProperty.m_nWidthStartInvCell = nWidthBefore;
|
||||
// oCurRow->m_oProperty.m_eMUStartInvCell = mu_Twips;
|
||||
// nLeft += nWidthBefore;
|
||||
// }
|
||||
//}
|
||||
//if( PROP_DEF != oCurRow->m_oProperty.m_nGridAfter )
|
||||
//{
|
||||
// int nGridAfter = oCurRow->m_oProperty.m_nGridAfter;
|
||||
// if( (int)m_aTableGrid.size() > nGridAfter - 1)
|
||||
// {
|
||||
// int nWidthAfter = 0;
|
||||
//
|
||||
// for( int k = (int)m_aTableGrid.size() - 1; k >= (int)m_aTableGrid.size() - 1 - nGridAfter; k-- )
|
||||
// nWidthAfter += m_aTableGrid[k];
|
||||
// oCurRow->m_oProperty.m_nWidthEndInvCell = nWidthAfter;
|
||||
// oCurRow->m_oProperty.m_eMUEndInvCell = mu_Twips;
|
||||
// }
|
||||
//}
|
||||
|
||||
if( 0 != nLeft )
|
||||
oCurRow->m_oProperty.m_nLeft = nLeft;
|
||||
@ -322,10 +328,10 @@ public:
|
||||
RtfTableCellPtr oCurCell = oCurRow->operator [](j);
|
||||
|
||||
int nSpan = 1;
|
||||
|
||||
if( PROP_DEF != oCurCell->m_oProperty.m_nSpan )
|
||||
nSpan = oCurCell->m_oProperty.m_nSpan;
|
||||
else
|
||||
nSpan = 1;
|
||||
|
||||
if( j == 0 && PROP_DEF != oCurRow->m_oProperty.m_nGridBefore )
|
||||
nCurIndex += oCurRow->m_oProperty.m_nGridBefore;
|
||||
//if( j == oCurRow->m_oProperty.size() - 1 && PROP_DEF != oCurRow->m_oProperty.m_nGridAfter )
|
||||
|
||||
@ -78,11 +78,10 @@ namespace Txt2Docx
|
||||
|
||||
void Converter::write(/*const std::wstring& path*/XmlUtils::CStringWriter & stringWriter)
|
||||
{
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = converter_->m_outputFile.m_arrItems.begin();
|
||||
it != converter_->m_outputFile.m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < converter_->m_outputFile.m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( *it )
|
||||
stringWriter.WriteString((*it)->toXML());
|
||||
if ( converter_->m_outputFile.m_arrItems[i] )
|
||||
stringWriter.WriteString(converter_->m_outputFile.m_arrItems[i]->toXML());
|
||||
}
|
||||
//BOOL res = converter_->m_outputFile.Write(std_string2string(path.string()));
|
||||
return;
|
||||
@ -119,8 +118,10 @@ namespace Txt2Docx
|
||||
font.m_sHAnsi.Init(); *font.m_sHAnsi = L"Courier New";
|
||||
font.m_sCs.Init(); *font.m_sCs = L"Courier New";
|
||||
|
||||
for (std::vector<std::wstring>::iterator line = m_inputFile.m_listContent.begin(); line != m_inputFile.m_listContent.end(); line++)
|
||||
for (size_t i = 0; i < m_inputFile.m_listContent.size(); ++i)
|
||||
{
|
||||
std::wstring & line = m_inputFile.m_listContent[i];
|
||||
|
||||
OOX::Logic::CParagraph *paragraph = new OOX::Logic::CParagraph();
|
||||
OOX::Logic::CParagraphProperty *pPr = new OOX::Logic::CParagraphProperty();
|
||||
OOX::Logic::CRunProperty *rPr = new OOX::Logic::CRunProperty();
|
||||
@ -132,17 +133,17 @@ namespace Txt2Docx
|
||||
paragraph->m_arrItems.push_back(pPr);
|
||||
paragraph->m_oParagraphProperty = pPr; //копия для удобства
|
||||
|
||||
while(line->find(_T("\x08")) != line->npos)
|
||||
while(line.find(_T("\x08")) != line.npos)
|
||||
{
|
||||
line->erase(line->find(_T("\x08")), 1);//, "");
|
||||
line.erase(line.find(_T("\x08")), 1);//, "");
|
||||
}
|
||||
while(line->find(_T("\x09")) != line->npos)
|
||||
while(line.find(_T("\x09")) != line.npos)
|
||||
{
|
||||
int pos = line->find(_T("\x09"));
|
||||
int pos = line.find(_T("\x09"));
|
||||
|
||||
if (pos > 0)
|
||||
{
|
||||
std::wstring s = line->substr(0, pos - 1);
|
||||
std::wstring s = line.substr(0, pos - 1);
|
||||
if (!s.empty())
|
||||
{
|
||||
OOX::Logic::CRunProperty *rPr_ = new OOX::Logic::CRunProperty();
|
||||
@ -152,12 +153,12 @@ namespace Txt2Docx
|
||||
}
|
||||
}
|
||||
paragraph->AddTab();
|
||||
line->erase(0, pos + 1);
|
||||
line.erase(0, pos + 1);
|
||||
}
|
||||
|
||||
if (!line->empty())
|
||||
if (!line.empty())
|
||||
{
|
||||
std::wstring s_ = XmlUtils::EncodeXmlString(*line);
|
||||
std::wstring s_ = XmlUtils::EncodeXmlString(line);
|
||||
paragraph->AddText(s_, rPr);
|
||||
}
|
||||
pDocument->m_arrItems.push_back(paragraph);
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -71,6 +71,6 @@ cd ./icu/source/
|
||||
./runConfigureICU MacOSX
|
||||
make
|
||||
cd ../../
|
||||
cp "./icu/source/lib/libicudata.55.1.dylib" "build/llibicudata.55.1.dylib"
|
||||
cp "./icu/source/lib/libicudata.55.1.dylib" "build/libicudata.55.1.dylib"
|
||||
cp "./icu/source/lib/libicuuc.55.1.dylib" "build/libicuuc.55.1.dylib"
|
||||
fi
|
||||
|
||||
@ -50,9 +50,9 @@ fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
CFLAGS="-fPIC" CXXFLAGS="-fPIC -stdlib=libc++" LDFLAGS="-stdlib=libc++" make native
|
||||
CFLAGS="-fPIC" CXXFLAGS="-fPIC -stdlib=libc++" LDFLAGS="-stdlib=libc++" make native -j $(sysctl -n hw.ncpu)
|
||||
|
||||
ccp "./out/native/obj.target/tools/gyp/libv8_base.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_base.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_libbase.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_libplatform.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_nosnapshot.a" "./../$platform$arch/"
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
17C1FBA61ACC4250006B99B3 /* ParagraphProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A0661AC4262700F28F8B /* ParagraphProperty.cpp */; };
|
||||
17C1FBA71ACC4250006B99B3 /* NumFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A0001AC4262700F28F8B /* NumFormat.cpp */; };
|
||||
17C1FBA81ACC4250006B99B3 /* SystemUtility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A13D1AC4262800F28F8B /* SystemUtility.cpp */; };
|
||||
17C1FBAA1ACC4250006B99B3 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A00E1AC4262700F28F8B /* Utils.cpp */; };
|
||||
17C1FBAB1ACC4250006B99B3 /* FileFactory_Spreadsheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A1631AC4262800F28F8B /* FileFactory_Spreadsheet.cpp */; };
|
||||
17C1FBAC1ACC4250006B99B3 /* AlternateContent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A0561AC4262700F28F8B /* AlternateContent.cpp */; };
|
||||
17C1FBAD1ACC4250006B99B3 /* SmartTag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17E6A0721AC4262700F28F8B /* SmartTag.cpp */; };
|
||||
@ -215,6 +214,11 @@
|
||||
690FE0831E9BBA23004B26D0 /* DiagramDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */; };
|
||||
691C3E131F20C3D500F1775E /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 691C3E121F20C3D500F1775E /* File.cpp */; };
|
||||
69B3ADA920120093000EC6A7 /* VmlDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 69B3ADA820120093000EC6A7 /* VmlDrawing.h */; };
|
||||
69E6AC872031AB0C00795D9D /* Xlsx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69E6AC862031AB0C00795D9D /* Xlsx.cpp */; };
|
||||
69E6AC892031AC3500795D9D /* SheetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69E6AC882031AC3500795D9D /* SheetData.cpp */; };
|
||||
69E6AC8C2031ACA900795D9D /* VbaProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69E6AC8A2031ACA900795D9D /* VbaProject.cpp */; };
|
||||
69E6AC8D2031ACA900795D9D /* VbaProject.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E6AC8B2031ACA900795D9D /* VbaProject.h */; };
|
||||
69E6AC8F2031B72500795D9D /* Worksheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69E6AC8E2031B72500795D9D /* Worksheet.cpp */; };
|
||||
69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -252,7 +256,6 @@
|
||||
17E6A00B1AC4262700F28F8B /* SimpleTypes_Word.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleTypes_Word.h; sourceTree = "<group>"; };
|
||||
17E6A00C1AC4262700F28F8B /* Size.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Size.h; sourceTree = "<group>"; };
|
||||
17E6A00D1AC4262700F28F8B /* Unit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unit.h; sourceTree = "<group>"; };
|
||||
17E6A00E1AC4262700F28F8B /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = "<group>"; };
|
||||
17E6A00F1AC4262700F28F8B /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
|
||||
17E6A0101AC4262700F28F8B /* Wrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Wrap.cpp; sourceTree = "<group>"; };
|
||||
17E6A0111AC4262700F28F8B /* Wrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wrap.h; sourceTree = "<group>"; };
|
||||
@ -435,6 +438,11 @@
|
||||
690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramDrawing.h; sourceTree = "<group>"; };
|
||||
691C3E121F20C3D500F1775E /* File.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = File.cpp; sourceTree = "<group>"; };
|
||||
69B3ADA820120093000EC6A7 /* VmlDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VmlDrawing.h; sourceTree = "<group>"; };
|
||||
69E6AC862031AB0C00795D9D /* Xlsx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Xlsx.cpp; sourceTree = "<group>"; };
|
||||
69E6AC882031AC3500795D9D /* SheetData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SheetData.cpp; sourceTree = "<group>"; };
|
||||
69E6AC8A2031ACA900795D9D /* VbaProject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VbaProject.cpp; sourceTree = "<group>"; };
|
||||
69E6AC8B2031ACA900795D9D /* VbaProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VbaProject.h; sourceTree = "<group>"; };
|
||||
69E6AC8E2031B72500795D9D /* Worksheet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Worksheet.cpp; sourceTree = "<group>"; };
|
||||
69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -541,7 +549,6 @@
|
||||
17E6A00B1AC4262700F28F8B /* SimpleTypes_Word.h */,
|
||||
17E6A00C1AC4262700F28F8B /* Size.h */,
|
||||
17E6A00D1AC4262700F28F8B /* Unit.h */,
|
||||
17E6A00E1AC4262700F28F8B /* Utils.cpp */,
|
||||
17E6A00F1AC4262700F28F8B /* Utils.h */,
|
||||
17E6A0101AC4262700F28F8B /* Wrap.cpp */,
|
||||
17E6A0111AC4262700F28F8B /* Wrap.h */,
|
||||
@ -697,6 +704,8 @@
|
||||
17E6A0871AC4262700F28F8B /* Media.h */,
|
||||
17E6A0881AC4262700F28F8B /* OleObject.h */,
|
||||
17E6A0891AC4262700F28F8B /* Video.h */,
|
||||
69E6AC8A2031ACA900795D9D /* VbaProject.cpp */,
|
||||
69E6AC8B2031ACA900795D9D /* VbaProject.h */,
|
||||
);
|
||||
path = Media;
|
||||
sourceTree = "<group>";
|
||||
@ -772,6 +781,7 @@
|
||||
17E6A1871AC4262800F28F8B /* Worksheets */,
|
||||
17E6A18F1AC4262800F28F8B /* WritingElement.h */,
|
||||
17E6A1901AC4262800F28F8B /* Xlsx.h */,
|
||||
69E6AC862031AB0C00795D9D /* Xlsx.cpp */,
|
||||
);
|
||||
path = XlsxFormat;
|
||||
sourceTree = "<group>";
|
||||
@ -883,7 +893,9 @@
|
||||
17E6A18A1AC4262800F28F8B /* Hyperlinks.h */,
|
||||
17E6A18B1AC4262800F28F8B /* MergeCells.h */,
|
||||
17E6A18C1AC4262800F28F8B /* SheetData.h */,
|
||||
69E6AC882031AC3500795D9D /* SheetData.cpp */,
|
||||
17E6A18D1AC4262800F28F8B /* Worksheet.h */,
|
||||
69E6AC8E2031B72500795D9D /* Worksheet.cpp */,
|
||||
17E6A18E1AC4262800F28F8B /* WorksheetChildOther.h */,
|
||||
);
|
||||
path = Worksheets;
|
||||
@ -1052,6 +1064,7 @@
|
||||
17C1FC691ACC4250006B99B3 /* Footnote.h in Headers */,
|
||||
17C1FC6A1ACC4250006B99B3 /* ComplexTypes.h in Headers */,
|
||||
17C1FC6C1ACC4250006B99B3 /* RunContent.h in Headers */,
|
||||
69E6AC8D2031ACA900795D9D /* VbaProject.h in Headers */,
|
||||
17C1FC6D1ACC4250006B99B3 /* External.h in Headers */,
|
||||
17C1FC6E1ACC4250006B99B3 /* Fills.h in Headers */,
|
||||
17C1FC6F1ACC4250006B99B3 /* PhoneticPr.h in Headers */,
|
||||
@ -1156,6 +1169,7 @@
|
||||
17C1FB9E1ACC4250006B99B3 /* Align.cpp in Sources */,
|
||||
17C1FB9F1ACC4250006B99B3 /* Index.cpp in Sources */,
|
||||
17C1FBA01ACC4250006B99B3 /* TxtFile.cpp in Sources */,
|
||||
69E6AC8F2031B72500795D9D /* Worksheet.cpp in Sources */,
|
||||
17C1FBA11ACC4250006B99B3 /* SectionProperty.cpp in Sources */,
|
||||
17C1FBA31ACC4250006B99B3 /* Color.cpp in Sources */,
|
||||
17C1FBA41ACC4250006B99B3 /* Docx.cpp in Sources */,
|
||||
@ -1163,17 +1177,19 @@
|
||||
17C1FBA61ACC4250006B99B3 /* ParagraphProperty.cpp in Sources */,
|
||||
17C1FBA71ACC4250006B99B3 /* NumFormat.cpp in Sources */,
|
||||
17C1FBA81ACC4250006B99B3 /* SystemUtility.cpp in Sources */,
|
||||
17C1FBAA1ACC4250006B99B3 /* Utils.cpp in Sources */,
|
||||
17C1FBAB1ACC4250006B99B3 /* FileFactory_Spreadsheet.cpp in Sources */,
|
||||
17C1FBAC1ACC4250006B99B3 /* AlternateContent.cpp in Sources */,
|
||||
17C1FBAD1ACC4250006B99B3 /* SmartTag.cpp in Sources */,
|
||||
17C1FBAE1ACC4250006B99B3 /* oMath.cpp in Sources */,
|
||||
69E6AC892031AC3500795D9D /* SheetData.cpp in Sources */,
|
||||
17C1FBAF1ACC4250006B99B3 /* ChartSerialize.cpp in Sources */,
|
||||
17C1FBB11ACC4250006B99B3 /* Position.cpp in Sources */,
|
||||
69E6AC8C2031ACA900795D9D /* VbaProject.cpp in Sources */,
|
||||
691C3E131F20C3D500F1775E /* File.cpp in Sources */,
|
||||
17C1FBB21ACC4250006B99B3 /* Vml.cpp in Sources */,
|
||||
17C1FBB31ACC4250006B99B3 /* unicode_util.cpp in Sources */,
|
||||
17C1FBB41ACC4250006B99B3 /* FldSimple.cpp in Sources */,
|
||||
69E6AC872031AB0C00795D9D /* Xlsx.cpp in Sources */,
|
||||
17C1FBB91ACC4250006B99B3 /* Paragraph.cpp in Sources */,
|
||||
17C1FBBA1ACC4250006B99B3 /* SimpleTypes_Word.cpp in Sources */,
|
||||
17C1FBBB1ACC4250006B99B3 /* MathEquation.cpp in Sources */,
|
||||
|
||||
@ -47,6 +47,8 @@ namespace OOX
|
||||
std::wstring sName = oReader.GetName();
|
||||
if ( _T("mc:Choice") == sName )
|
||||
{
|
||||
ReadAttributes(oReader, m_oChoiceRequires);
|
||||
|
||||
CRun altRun(oReader);
|
||||
|
||||
for ( size_t i = 0; i < altRun.m_arrItems.size(); ++i)
|
||||
@ -62,6 +64,11 @@ namespace OOX
|
||||
}
|
||||
else if ( _T("mc:Fallback") == sName )
|
||||
{
|
||||
if (m_oChoiceRequires.is_init() && !m_arrChoiceItems.empty())
|
||||
{
|
||||
continue; // не зачем баласт читать - берем более современную или оригинальную версию.
|
||||
}
|
||||
|
||||
CRun altRun(oReader);
|
||||
|
||||
for ( size_t i = 0; i < altRun.m_arrItems.size(); ++i)
|
||||
|
||||
@ -83,9 +83,17 @@ namespace OOX
|
||||
{
|
||||
return OOX::et_mc_alternateContent;
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable_string & oRequires)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle( oReader, (L"Requires"), oRequires )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
|
||||
}
|
||||
nullable_string m_oChoiceRequires;
|
||||
|
||||
std::vector<WritingElement *> m_arrChoiceItems;
|
||||
std::vector<WritingElement *> m_arrFallbackItems;
|
||||
std::vector<WritingElement *> m_arrChoiceItems;
|
||||
std::vector<WritingElement *> m_arrFallbackItems;
|
||||
};
|
||||
} // namespace Words
|
||||
} // namespace OOX
|
||||
|
||||
@ -132,9 +132,9 @@ namespace OOX
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( L"w:txbxContent" == sName )
|
||||
if ( L"txbxContent" == sName) //namespaces w & wne
|
||||
m_oTxtbxContent = oReader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1752,9 +1752,7 @@ namespace OOX
|
||||
virtual ~CTcMar()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
if ( _T("w:tcMar") != oNode.GetName() )
|
||||
return;
|
||||
@ -1772,7 +1770,7 @@ namespace OOX
|
||||
if ( !m_oStart.IsInit() )
|
||||
WritingElement_ReadNode( oNode, oChild, _T("w:left"), m_oStart );
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
@ -1790,7 +1788,7 @@ namespace OOX
|
||||
else if ( !m_oStart.IsInit() && _T("w:left") == sName ) m_oStart = oReader;
|
||||
}
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
std::wstring sResult = _T("<w:tcMar>");
|
||||
|
||||
@ -1811,10 +1809,10 @@ namespace OOX
|
||||
static const CTcMar Merge(const CTcMar& oPrev, const CTcMar& oCurrent)
|
||||
{
|
||||
CTcMar oProperties;
|
||||
oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom );
|
||||
oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd );
|
||||
oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart );
|
||||
oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop );
|
||||
oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom );
|
||||
oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd );
|
||||
oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart );
|
||||
oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop );
|
||||
|
||||
return oProperties;
|
||||
}
|
||||
@ -1830,7 +1828,6 @@ namespace OOX
|
||||
|
||||
return oResult;
|
||||
}
|
||||
public:
|
||||
|
||||
nullable<ComplexTypes::Word::CTblWidth > m_oBottom;
|
||||
nullable<ComplexTypes::Word::CTblWidth > m_oEnd;
|
||||
|
||||
@ -2454,9 +2454,9 @@ namespace OOX
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("w:txbxContent") == sName )
|
||||
if ( L"txbxContent" == sName ) //namespaces w & wne
|
||||
m_oTxtbxContent = oReader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,9 +312,26 @@ namespace SimpleTypes
|
||||
}
|
||||
return this->m_eValue;
|
||||
}
|
||||
virtual std::wstring ToString () const
|
||||
virtual std::wstring ToString () const
|
||||
{
|
||||
return _T("0");
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case themecolorLight1: return L"lt1";
|
||||
case themecolorDark1: return L"dk1";
|
||||
case themecolorLight2: return L"lt2";
|
||||
case themecolorDark2: return L"dk2";
|
||||
case themecolorAccent1: return L"accent1";
|
||||
case themecolorAccent2: return L"accent2";
|
||||
case themecolorAccent3: return L"accent3";
|
||||
case themecolorAccent4: return L"accent4";
|
||||
case themecolorAccent5: return L"accent5";
|
||||
case themecolorAccent6: return L"accent6";
|
||||
case themecolorHyperlink: return L"hlink";
|
||||
case themecolorFollowedHyperlink: return L"folHlink";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
return _T("");
|
||||
}
|
||||
|
||||
SimpleType_FromString (EThemeColor)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user