Compare commits

..

114 Commits

Author SHA1 Message Date
182da130da RtfFormatWriter - fix table layouts 2018-02-14 20:01:13 +03:00
eb3ba8c42e RtfFormatWriter - fix table padding 2018-02-13 19:47:23 +03:00
dec099b19b [x2t] Fix bug #36922 2018-02-13 19:24:28 +03:00
21762360ac RtfFormatWriter - fix linux build 2018-02-13 12:13:42 +03:00
563fe88842 [x2t][UnicodeConverter] Change UTF-16,UTF-32 encoding name to UTF-16LE
As described in http://unicode.org/faq/utf_bom.html#gen6 UTF-16,UTF-32 requires BOM
2018-02-13 11:33:32 +03:00
0e085fbb13 RtfFormatWriter - fix text in ooxml shapes, expand properties ooxml shapes 2018-02-12 19:54:28 +03:00
ed409e745a fix bug #36905 2018-02-12 19:44:59 +03:00
4bc58482b3 [ios][x2t] fixed build project 2018-02-12 14:55:08 +03:00
89ee039a05 RtfFormatReader - fix convert shapes 2018-02-08 11:11:49 +03:00
5d5b1202c7 fix for ms office editor. bug 36869. 2018-02-07 17:57:11 +03:00
c7646fd813 Changed main default fonts 2018-02-07 17:09:40 +03:00
b1d406b448 fix xdr xfrm in graphiicFrame 2018-02-07 15:36:51 +03:00
ea37eab86e . 2018-02-07 13:15:58 +03:00
d045609523 DocFormatReader - fix shape 2018-02-06 20:13:06 +03:00
9336448ca9 fix bug 36861 2018-02-06 17:55:37 +03:00
5830e7824a fix bug #36740 - for csv preview remove error return 2018-02-06 17:35:11 +03:00
821feb51b5 . 2018-02-06 15:59:20 +03:00
547979cd9b bug: fix open CBulletColor with no UniColor 2018-02-06 14:22:27 +03:00
c4481eb125 DocFormatReader - adding decrypt for format 1995, adding xor method decrypting 2018-02-06 13:55:59 +03:00
ad0f2c89e0 fix bug #35277
XlsFormatReader - adding decrypt for format 1995, adding xor method decrypting
2018-02-05 17:38:14 +03:00
e15c75b6aa add sha-256 hash agrorithm 2018-02-05 13:52:29 +03:00
b2fb7f0fe7 . 2018-02-05 12:52:24 +03:00
410e5ebd75 . 2018-02-05 12:11:35 +03:00
9c57088ef1 RtfFormatWriter - add application property for info
OdfFormatWriter - ods - fix theme color in font
2018-02-03 18:55:49 +03:00
24230e12a3 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-02-02 18:26:11 +03:00
2acef0d4a2 . 2018-02-02 18:25:30 +03:00
aca5ffa36f add standard priority to "Wingdings" font-family 2018-02-02 16:58:10 +03:00
4fc3726f37 fix read strict ooxml textbox (namespace wne) 2018-02-02 15:08:11 +03:00
2682e1fbac Ooxml - fix vml image without image 2018-02-02 14:52:15 +03:00
f5c3ae779b . 2018-02-02 13:59:58 +03:00
068c60afa0 fix bug #36740 - extending error code
x2t version 2.4.515
2018-02-01 19:33:59 +03:00
5b8ca5b417 OdfFormatWriter - write columns table parts in formulas as ref 2018-02-01 18:55:57 +03:00
acfd12ea30 fix bug #36740 2018-02-01 16:42:34 +03:00
a04b83cada . 2018-02-01 12:28:46 +03:00
a7bf12c052 . 2018-01-31 18:17:45 +03:00
5c01b23dee . 2018-01-30 20:09:22 +03:00
db11b75a2e x2t version 2.4.514 2018-01-30 19:37:10 +03:00
2ba4c18cdf bug: initialize m_pWorkbookComments 2018-01-30 17:22:39 +03:00
b264f20f29 . 2018-01-30 15:21:05 +03:00
5e04ea62f7 fix operation priority 2018-01-30 14:44:52 +03:00
3d1db63c0e bug: bug on save onlyoffice extention for comments in xlsx 2018-01-29 19:51:06 +03:00
f124d18256 bug: save nil shading to docx 2018-01-29 18:14:23 +03:00
9bffb65dcb x2t 2.4.512 2018-01-29 15:46:08 +03:00
2fbcc3832f feat: add workbookComments, presentationComments 2018-01-26 20:37:27 +03:00
97b4311e95 . 2018-01-26 19:18:41 +03:00
228b3a52e9 . 2018-01-26 17:55:04 +03:00
2f2236646d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - data validation (type dropdown list)
  no squares
  fix previous commit
  font by symbol table
2018-01-26 17:08:57 +03:00
30603d0561 build fixed 2018-01-26 17:08:51 +03:00
933af771b7 OdfFormatReader - data validation (type dropdown list) 2018-01-26 14:45:24 +03:00
c04a537d69 no squares 2018-01-26 13:55:24 +03:00
e49d78db47 fix previous commit 2018-01-26 11:39:56 +03:00
99ec420ee5 font by symbol table 2018-01-26 11:36:19 +03:00
f764b034a1 . 2018-01-25 18:33:12 +03:00
73fe023460 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-25 18:26:55 +03:00
242af3c80e . 2018-01-25 18:26:14 +03:00
7756e4b8bd . 2018-01-25 18:17:46 +03:00
56a1d1f627 x2t -fix appVersion 2018-01-25 18:16:15 +03:00
11bd4ff61d . 2018-01-25 17:20:56 +03:00
93a06d7f86 . 2018-01-25 17:18:40 +03:00
76d2d429b7 x2t version 2.4.511 2018-01-25 17:07:43 +03:00
c6de37dbad . 2018-01-25 17:02:31 +03:00
d022e669f0 . 2018-01-25 15:57:17 +03:00
184e79bae1 . 2018-01-25 15:52:14 +03:00
e6581671c8 . 2018-01-25 15:27:06 +03:00
e0a1c688bf . 2018-01-24 19:28:04 +03:00
9e0b301179 write verion x2t to converted files 2018-01-24 18:25:23 +03:00
8680fb2e0e . 2018-01-24 15:45:10 +03:00
c7c605a970 fix bug #31327
convert script text in toggle property in simple text
2018-01-23 19:34:07 +03:00
23d648d92d fix bug #36409 2018-01-23 16:53:40 +03:00
b098c98dbb x2t version 2.4.510 2018-01-23 16:23:09 +03:00
b88726beaf fix bug #36514 2018-01-23 14:09:55 +03:00
b2d3e5e194 . 2018-01-22 19:21:57 +03:00
a8315efae0 . 2018-01-22 18:26:40 +03:00
3781cf6774 . 2018-01-22 17:45:21 +03:00
7e36d47991 fix bug #8010
OdfFormatReader - dropdown & user fields
2018-01-22 15:09:23 +03:00
419a01bd09 fix bug #36725 2018-01-22 11:21:28 +03:00
804a01cab3 x2t version 2.4.509 2018-01-20 15:22:31 +03:00
931d6aa17c . 2018-01-20 14:24:40 +03:00
2861539949 . 2018-01-19 19:33:12 +03:00
281dad68fb . 2018-01-19 14:42:32 +03:00
04ba432cde x2t version 2.4.508 2018-01-19 14:14:33 +03:00
61c943a3b2 up 2018-01-19 13:46:06 +03:00
9fdc7641b3 . 2018-01-18 15:24:33 +03:00
1029ee9101 OoxToBinary - modify preparing to binary write 2018-01-18 15:13:21 +03:00
9ef5bec2a5 [ios] fixed build 2018-01-17 12:43:03 +03:00
93132eb8a0 x2t version 2.4.506 2018-01-17 11:18:24 +03:00
9828c25e51 . 2018-01-16 19:45:34 +03:00
db1204288b OdfFormatWriter - keeping current font size 2018-01-15 18:16:41 +03:00
26c3d37be5 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-15 17:57:45 +03:00
077ea08368 OdfFormatWriter - text position (%) 2018-01-15 17:57:32 +03:00
98eab74e97 . 2018-01-15 17:51:30 +03:00
2a7e88ca76 v5.0.7 2018-01-15 15:19:37 +03:00
369596b860 OdfFormatWriter - fix dropCap, sections 2018-01-13 14:59:56 +03:00
15af8f561a OdfFormatWriter - fix picture size from placeholder 2018-01-12 17:02:33 +03:00
58f8d13d71 . 2018-01-12 13:57:26 +03:00
d6413057e2 x2t version 2.4.505
OOXML - add external audio, video; add sound effects for shapes; fix chart theme override, clrmap; convert canvas drawingML
RtfWriter - add image scaling from DrawingML
fix convert from google csv
2018-01-12 12:54:22 +03:00
008382213b Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
Conflicts:
	Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
2018-01-12 12:13:38 +03:00
dd5b4a719b x2t version 2.4.504 2018-01-12 12:03:44 +03:00
3d198bc211 for xlsx comments: Tahoma 9, User name in comment body 2018-01-11 20:43:10 +03:00
05ff75eeb2 fix bug #36652 2018-01-11 17:41:37 +03:00
597414ea6b DocFormatFile - fix users file (1995) without codepage 2017-12-26 13:08:02 +03:00
7f06ce7064 . 2017-12-26 11:21:39 +03:00
adf39680b6 OdfFormatWriter - extendede condition conditional formatting (x14) 2017-12-25 20:06:22 +03:00
ce77d478e3 x2t version 2.4.498 2017-12-25 15:42:59 +03:00
e1e14ae243 . 2017-12-25 13:52:57 +03:00
4f6e364225 . 2017-12-25 13:48:50 +03:00
26c02c5766 . 2017-12-23 19:33:05 +03:00
0d8c668f95 OdfFormat, fix bug 36596 (only for onlyoffice editors) 2017-12-23 17:34:20 +03:00
310cff0dfe change non-defined temp directory to unique 2017-12-23 14:48:44 +03:00
7f6611ab21 .. 2017-12-23 14:35:52 +03:00
bb37e348f5 . 2017-12-23 13:26:11 +03:00
6b5e03df5e . 2017-12-23 12:29:40 +03:00
d0e0109560 . 2017-12-22 15:10:45 +03:00
5039cec847 diagramm save error 2017-12-19 15:09:10 +03:00
514 changed files with 14348 additions and 10388 deletions

View File

@ -69,8 +69,13 @@ namespace OpenXmlContentTypes
static const wchar_t* Tiff = L"image/tiff";
static const wchar_t* Wmf = L"image/x-wmf";
static const wchar_t* Bmp = L"image/bmp";
static const wchar_t* Pcz = L"image/x-pcz";
}
namespace DocPrContentTypes
{
static const wchar_t* App = L"application/vnd.openxmlformats-officedocument.extended-properties+xml";
static const wchar_t* Core = L"application/vnd.openxmlformats-package.core-properties+xml";
}
namespace WordprocessingMLContentTypes
{
// WordprocessingML content types
@ -136,7 +141,7 @@ namespace OpenXmlNamespaces
namespace OpenXmlRelationshipTypes
{
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";

View File

@ -47,30 +47,17 @@ namespace DocFileFormat
virtual ~ConversionContext()
{
}
// Adds a new RSID to the set
inline void AddRsid(const std::wstring& rsid)
{
if (AllRsids.find(rsid) == AllRsids.end())
AllRsids.insert(rsid);
}
inline WordDocument* GetDocument()
{
return _doc;
}
inline WordprocessingDocument* GetXmlDocument()
{
return _docx;
}
public:
WordprocessingDocument* _docx;
WordDocument* _doc;
/// A set thta contains all revision ids.
std::set<std::wstring> AllRsids;
};
}

View File

@ -63,8 +63,16 @@ namespace DocFileFormat
{
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
{
if (!doc || !docx) return S_FALSE;
ConversionContext context( doc, docx );
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
//Write styles.xml
if (doc->Styles)
{
@ -107,14 +115,6 @@ namespace DocFileFormat
return S_FALSE;
}
}
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
if ( progress != NULL )
{
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );

View File

@ -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;
//}
}
}
}

View File

@ -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;
};
}

View File

@ -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);
}

View File

@ -48,7 +48,8 @@ namespace DocFileFormat
class FontFamilyName: public ByteStructure
{
friend class CharacterPropertiesMapping;
friend class WordDocument;
friend class CharacterPropertiesMapping;
friend class DocumentMapping;
friend class FontTableMapping;
friend class StyleSheetMapping;

View File

@ -34,32 +34,30 @@
namespace DocFileFormat
{
FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
FontTableMapping::FontTableMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
{
_ctx = ctx;
}
/*========================================================================================================*/
FontTableMapping::~FontTableMapping()
{
RELEASEOBJECT (m_pXmlWriter);
}
/*========================================================================================================*/
void FontTableMapping::Apply( IVisitable* visited )
{
StringTable<FontFamilyName>* table = static_cast<StringTable<FontFamilyName>*>( visited );
this->_ctx->_docx->RegisterFontTable();
_ctx->_docx->RegisterFontTable();
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
int sz_fonts = table->Data.size();
int sz_fonts = table->Data.size();
int users_fonts = 0;
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
@ -140,6 +138,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( L"w:fonts");
this->_ctx->_docx->FontTableXML = std::wstring( m_pXmlWriter->GetXmlString() );
_ctx->_docx->FontTableXML = m_pXmlWriter->GetXmlString() ;
}
}

View File

@ -38,8 +38,8 @@ namespace DocFileFormat
{
if (m_context)
{
m_document = m_context->GetDocument();
m_xmldocument = m_context->GetXmlDocument();
m_document = m_context->_doc;
m_xmldocument = m_context->_docx;
}
}

View File

@ -110,6 +110,11 @@ namespace DocFileFormat
unused2 = Reader->ReadByte();
unused3 = Reader->ReadByte();
if (btMacOS != btWin32)
{
btWin32 = btMacOS = (Global::BlipType)this->Instance;
}
if (BodySize > 0x24)
{
Blip = RecordFactory::ReadRecord(Reader, 0);

View File

@ -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;

View File

@ -192,14 +192,14 @@ public:
{
if (!bIsCompressed)
{
m_pMetaFile = pCompress;
m_lMetaFileSize = lUncompressSize;
m_pMetaFile = new BYTE[lCompressSize];
m_lMetaFileSize = lCompressSize;
memcpy(m_pMetaFile, pCompress, lCompressSize);
}
else
{
ULONG lSize = lUncompressSize;
m_pMetaFile = new BYTE[lUncompressSize];
//bool bRes = NSZLib::Decompress(pCompress, (ULONG)lCompressSize, m_pMetaFile, lSize);
HRESULT res = S_OK;
COfficeUtils* pOfficeUtils = new COfficeUtils(NULL);
@ -340,6 +340,8 @@ typedef enum _BlipCompression
if (typeCode == 0xf01b)
{
oMetaFile.m_sExtension = L".wmf";
WmfPlaceableFileHeader oWmfHeader = {};
oMetaHeader.ToWMFHeader(&oWmfHeader);
@ -349,24 +351,12 @@ typedef enum _BlipCompression
oMetaFile.SetHeader(pMetaHeader, lLenHeader);
}
if (typeCode == 0xf01c)
{
oMetaFile.m_sExtension = L".pcz";
//decompress???
}
oMetaFile.SetData(m_pvBits, oMetaHeader.cbSave, oMetaHeader.cbSize, 0 == oMetaHeader.compression);
//if (pos < sz)
//{
// NSFile::CFileBinary oFile;
// if (oFile.CreateFile(L"d:\\blop.dat"))
// {
// BYTE * d = Reader->ReadBytes( sz - pos, true );
// if (d)
// {
// oFile.WriteFile (d, sz - pos);
// delete []d;
// oFile.CloseFile();
// }
// }
//}
}
virtual ~MetafilePictBlip()

View File

@ -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)

View File

@ -71,7 +71,6 @@ namespace DocFileFormat
fUsefLockAgainstUngrouping = FormatUtils::BitmaskToBool(op,0x2000000);
}
public:
bool fLockAgainstGrouping;
bool fLockAdjustHandles;

View File

@ -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]));

View File

@ -1,71 +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
#ifndef OOX_EXTERNALAUDIO_INCLUDE_H_
#define OOX_EXTERNALAUDIO_INCLUDE_H_
#include "External.h"
namespace OOX
{
class ExternalAudio : public External
{
public:
ExternalAudio()
{
}
ExternalAudio(const CPath& uri)
{
read(uri);
}
~ExternalAudio()
{
}
public:
virtual const FileType type() const
{
return FileTypes::ExternalAudio;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
#endif // OOX_EXTERNALAUDIO_INCLUDE_H_
/*
* (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;
};
}

View File

@ -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" );
}

View File

@ -64,6 +64,8 @@ namespace DocFileFormat
DocumentContentTypesFile._defaultTypes.insert( make_pair( L"xml", std::wstring( OpenXmlContentTypes::Xml ) ) );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId1"), OpenXmlRelationshipTypes::OfficeDocument, L"word/document.xml") );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId2"), OpenXmlRelationshipTypes::CoreProperties, L"docProps/core.xml") );
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId3"), OpenXmlRelationshipTypes::ExtendedProperties, L"docProps/app.xml") );
}
@ -163,15 +165,21 @@ namespace DocFileFormat
{
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
std::list<std::wstring> entries = storageInp->entries(path);
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++)
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)
{
@ -195,14 +203,18 @@ namespace DocFileFormat
delete storageOut;
return S_OK;
}
int OpenXmlPackage::RegisterDocument()
void OpenXmlPackage::RegisterDocPr()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
AddPart( L"docProps", L"app.xml", DocPrContentTypes::App, L"");
AddPart( L"docProps", L"core.xml", DocPrContentTypes::Core, L"");
}
int OpenXmlPackage::RegisterDocumentMacros()
void OpenXmlPackage::RegisterDocument()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
}
void OpenXmlPackage::RegisterDocumentMacros()
{
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
}
int OpenXmlPackage::RegisterVbaProject()
{

View File

@ -165,8 +165,9 @@ namespace DocFileFormat
HRESULT SaveOLEObject ( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
int RegisterDocument();
int RegisterDocumentMacros();
void RegisterDocPr();
void RegisterDocument();
void RegisterDocumentMacros();
int RegisterFontTable();
int RegisterNumbering();
int RegisterSettings();

View File

@ -41,6 +41,7 @@ namespace DocFileFormat
{
template<class T> class StringTable: public IVisitable
{
friend class WordDocument;
friend class CharacterPropertiesMapping;
friend class FontTableMapping;
friend class StyleSheetMapping;

View File

@ -90,7 +90,7 @@ namespace DocFileFormat
std::list<std::wstring> entries, entries_sort;
entries = m_pStorage->entries_with_prefix( path );
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
{
std::wstring name = *it;
std::wstring fullname = path + name;
@ -104,8 +104,8 @@ namespace DocFileFormat
entries_sort.push_front(name);
}
}
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); ++it )
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
{
std::wstring name = *it;
std::wstring fullname = path + name;

View File

@ -156,16 +156,16 @@ namespace DocFileFormat
file.CloseFile();
OOX::CPath path(sTempXmlFile);
OOX::CDocument docEmbedded(path, path);
OOX::CDocument docEmbedded(NULL, path, path);
bool res = false;
for (std::list<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); it++)
for (std::vector<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); ++it)
{
if ((*it)->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(*it);
for (std::list<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
for (std::vector<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
(paragraph) && (jt != paragraph->m_arrItems.end()); jt++)
{
if ((*jt)->getType() == OOX::et_m_oMath)
@ -178,7 +178,7 @@ namespace DocFileFormat
{
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(*jt);
for (std::list<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
for (std::vector<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
(mathPara) && (kt != mathPara->m_arrItems.end()); kt++)
{
if ((*kt)->getType() == OOX::et_m_oMath)
@ -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))
@ -500,6 +502,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(oBlipEntry->Blip);
if (metaBlip)
@ -567,6 +570,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(L".wmf");
case Global::msoblipPICT:
return std::wstring(L".pcz");
default:
return std::wstring(L".png");
}
@ -601,6 +607,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(OpenXmlContentTypes::Wmf);
case Global::msoblipPICT:
return std::wstring(OpenXmlContentTypes::Pcz);
case Global::msoblipDIB:
return std::wstring(OpenXmlContentTypes::Bmp);

View File

@ -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
@ -1287,6 +1318,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
//it's a meta image
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(RecordFactory::ReadRecord(&reader, 0));
@ -1373,6 +1405,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring( L".wmf" );
case Global::msoblipPICT:
return std::wstring( L".pcz" );
default:
return std::wstring( L".png" );
}

View File

@ -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" );
}

View File

@ -40,8 +40,45 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
#include <unordered_map>
namespace DocFileFormat
{
static const int aCodePages[][2] = {
//charset codepage
0, 1252, //ANSI
1, 0,//Default
2, 42,//Symbol
77, 10000,//Mac Roman
78, 10001,//Mac Shift Jis
79, 10003,//Mac Hangul
80, 10008,//Mac GB2312
81, 10002,//Mac Big5
83, 10005,//Mac Hebrew
84, 10004,//Mac Arabic
85, 10006,//Mac Greek
86, 10081,//Mac Turkish
87, 10021,//Mac Thai
88, 10029,//Mac East Europe
89, 10007,//Mac Russian
128, 932,//Shift JIS
129, 949,//Hangul
130, 1361,//Johab
134, 936,//GB2312
136, 950,//Big5
238, 1250,//Greek
161, 1253,//Greek
162, 1254,//Turkish
163, 1258,//Vietnamese
177, 1255,//Hebrew
178, 1256, //Arabic
186, 1257,//Baltic
204, 1251,//Russian
222, 874,//Thai
238, 1250,//Eastern European
254, 437,//PC 437
255, 850//OEM
};
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) :
m_PieceTable(NULL), WordDocumentStream(NULL), TableStream(NULL), DataStream(NULL), FIB(NULL),
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
@ -55,12 +92,15 @@ namespace DocFileFormat
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
{
m_pCallFunc = pCallFunc;
m_sTempFolder = sTempFolder;
m_pCallFunc = pCallFunc;
m_sTempFolder = sTempFolder;
m_pStorage = NULL;
officeArtContent = NULL;
bOlderVersion = false;
m_pStorage = NULL;
officeArtContent = NULL;
bOlderVersion = false;
bDocumentCodePage = false;
nDocumentCodePage = ENCODING_WINDOWS_1250;
}
WordDocument::~WordDocument()
@ -134,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);
@ -152,7 +205,7 @@ namespace DocFileFormat
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
}
else
else if (encryptionHeader->bAES)
{
CRYPT::ECMADecryptor Decryptor;
@ -168,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;
@ -178,8 +230,6 @@ namespace DocFileFormat
m_pStorage->GetStream (L"SummaryInformation", &Summary);
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
document_code_page = ENCODING_WINDOWS_1250;
if ((Summary) && (Summary->size() > 0))
{
@ -188,7 +238,10 @@ namespace DocFileFormat
int document_code_page1 = summary_info.GetCodePage(); //from software last open
if (document_code_page1 > 0)
document_code_page = document_code_page1;
{
nDocumentCodePage = document_code_page1;
bDocumentCodePage = true;
}
}
if ((DocSummary) && (DocSummary->size() > 0))
{
@ -197,12 +250,18 @@ namespace DocFileFormat
int document_code_page2 = doc_summary_info.GetCodePage();
if (document_code_page2 > 0)
document_code_page = document_code_page2;
{
nDocumentCodePage = document_code_page2;
bDocumentCodePage = true;
}
}
if (!bOlderVersion)
document_code_page = ENCODING_UTF16;
{
nDocumentCodePage = ENCODING_UTF16;
bDocumentCodePage = true;
}
FIB->m_CodePage = document_code_page;
FIB->m_CodePage = nDocumentCodePage;
//-------------------------------------------------------------------------------------------------
try
{
@ -353,6 +412,31 @@ namespace DocFileFormat
return AVS_ERROR_FILEFORMAT;
}
}
if (!bDocumentCodePage && FontTable)
{
std::unordered_map<int, int> fonts_charsets;
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin();!bDocumentCodePage && iter != FontTable->Data.end(); iter++ )
{
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
if (!font) continue;
if (fonts_charsets.find(font->chs) == fonts_charsets.end())
{
fonts_charsets.insert(std::make_pair(font->chs, font->ff));
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
{
if (aCodePages[i][0] == font->chs && font->chs != 0)
{
nDocumentCodePage = aCodePages[i][1];
bDocumentCodePage = true;
break;
}
}
}
}
}
if (FIB->m_FibWord97.lcbClx > 0)
{
@ -371,7 +455,7 @@ namespace DocFileFormat
WordDocumentStream->read (bytes, cb);
Text = new std::vector<wchar_t>();
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, document_code_page);
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, nDocumentCodePage);
RELEASEARRAYOBJECTS(bytes);
}
@ -487,7 +571,7 @@ namespace DocFileFormat
//std::list<std::string> listStream = storageIn->entries();
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); ++it)
//{
// if (storageIn->isDirectory(*it))
// {
@ -531,7 +615,7 @@ namespace DocFileFormat
std::list<std::wstring> entries, entries_files, entries_dir;
entries = storageIn->entries_with_prefix( path );
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
{
std::wstring name = *it;
std::wstring fullname = path + name;
@ -557,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];
@ -578,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];
}
@ -590,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);

View File

@ -69,7 +69,6 @@ namespace DocFileFormat
{
class WordDocument: public IVisitable
{
/*Mapping classes with direct access to the Word Document.*/
friend class FootnotesMapping;
friend class EndnotesMapping;
friend class CommentsMapping;
@ -98,7 +97,8 @@ namespace DocFileFormat
long LoadDocument (const std::wstring & fileName, const std::wstring & password);
bool bOlderVersion;
int document_code_page;
int nDocumentCodePage;
bool bDocumentCodePage;
inline StructuredStorageReader* GetStorage() const
{
@ -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 ()

View File

@ -35,6 +35,10 @@
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
namespace ImageHelper
{
struct __BITMAPINFOHEADER
@ -211,6 +215,37 @@ namespace DocFileFormat
{
RegisterDocument();
}
OOX::CContentTypes oContentTypes;
OOX::CPath pathDocProps = m_strOutputPath + FILE_SEPARATOR_STR + _T("docProps");
NSDirectory::CreateDirectory(pathDocProps.GetPath());
OOX::CPath DocProps = std::wstring(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore(NULL);
if (pCore)
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
delete pCore;
}
RegisterDocPr();
WritePackage();

View File

@ -21,8 +21,6 @@ include($$PWD/../../../Common/3dParty/boost/boost.pri)
DEFINES += UNICODE \
_UNICODE \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
_USE_LIBXML2_READER_ \
LIBXML_READER_ENABLED \
DONT_WRITE_EMBEDDED_FONTS \
@ -237,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 \

View File

@ -52,6 +52,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4005;4311;4312"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@ -894,6 +895,10 @@
RelativePath="..\..\DocDocxConverter\OfficeDrawing\SplitMenuColorContainer.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\threeDBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\UnknownRecord.h"
>

View File

@ -67,7 +67,7 @@
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMT.lib"
IgnoreDefaultLibraryNames=""
IgnoreEmbeddedIDL="true"
GenerateDebugInformation="true"
SubSystem="1"

View File

@ -318,20 +318,29 @@ public:
docRGB Color;
CThemeColor ThemeColor;
bool bValue;
bool bColor;
bool bThemeColor;
Shd()
{
Value = shd_Nil;
bValue = false;
bColor = false;
bThemeColor = false;
}
std::wstring ToString()
{
std::wstring sShd;
if(bColor || (bThemeColor && ThemeColor.IsNoEmpty()))
if(bValue || bColor || (bThemeColor && ThemeColor.IsNoEmpty()))
{
sShd += L"<w:shd w:val=\"clear\" w:color=\"auto\"";
sShd += L"<w:shd";
if(bValue)
{
if(shd_Nil == Value)
sShd += L" w:val=\"nil\"";
else
sShd += L" w:val=\"clear\"";
}
sShd += L" w:color=\"auto\"";
if(bColor)
sShd += L" w:fill=\"" + Color.ToString() + L"\"";
if(bThemeColor && ThemeColor.IsNoEmpty())
@ -372,7 +381,7 @@ public:
class rPr
{
private:
std::map<std::wstring, int>& m_mapFonts;
boost::unordered_map<std::wstring, int>& m_mapFonts;
public:
bool Bold;
bool Italic;
@ -445,7 +454,7 @@ public:
bool bDoNotWriteNullProp;
public:
rPr(std::map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
rPr(boost::unordered_map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
{
Reset();
@ -1787,8 +1796,8 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
};
class CComments
{
std::map<int, CComment*> m_mapComments;
std::map<std::wstring, CComment*> m_mapAuthors;
boost::unordered_map<int, CComment*> m_mapComments;
boost::unordered_map<std::wstring, CComment*> m_mapAuthors;
public:
IdCounter m_oFormatIdCounter;
IdCounter m_oParaIdCounter;
@ -1798,7 +1807,7 @@ public:
}
~CComments()
{
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
delete it->second;
}
@ -1822,7 +1831,7 @@ public:
CComment* get(int nInd)
{
CComment* pRes = NULL;
std::map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
boost::unordered_map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
if(m_mapComments.end() != pair)
pRes = pair->second;
return pRes;
@ -1834,7 +1843,7 @@ public:
std::wstring writeContent()
{
std::wstring sRes;
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += (it->second->writeTemplates(CComment::writeContent));
}
@ -1843,7 +1852,7 @@ public:
std::wstring writeContentExt()
{
std::wstring sRes;
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += (it->second->writeTemplates(CComment::writeContentExt));
}
@ -1852,7 +1861,7 @@ public:
std::wstring writePeople()
{
std::wstring sRes;
for (std::map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
for (boost::unordered_map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
{
sRes += (it->second->writePeople(it->second));
}

View File

@ -36,7 +36,7 @@ namespace BinDocxRW {
int Binary_VbaProjectTableReader::Read()
{
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
m_oFileWriter.m_pVbaProject = new OOX::VbaProject(NULL);
m_oFileWriter.m_pVbaProject->fromPPTY(&m_oBufferedStream);
return c_oSerConstants::ReadOk;

View File

@ -37,7 +37,17 @@
#include "../BinWriter/BinReaderWriterDefines.h"
#include "../../XlsxSerializerCom/Writer/BinaryReader.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
#include "../DocWrapper/XlsxSerializer.h"
#include "../../DesktopEditor/common/ASCVariant.h"
@ -256,7 +266,10 @@ private:
Shd* pShd = static_cast<Shd*>(poResult);
switch(type)
{
case c_oSerShdType::Value: pShd->Value = m_oBufferedStream.GetUChar();break;
case c_oSerShdType::Value:
pShd->bValue = true;
pShd->Value = m_oBufferedStream.GetUChar();
break;
case c_oSerShdType::Color:
pShd->bColor = true;
pShd->Color = ReadColor();
@ -441,11 +454,8 @@ public:
{
Shd oShd;
oBinary_CommonReader2.ReadShdOut(length, &oShd);
if(shd_Nil != oShd.Value)
{
orPr->bShd = true;
orPr->Shd = oShd.ToString();
}
orPr->bShd = true;
orPr->Shd = oShd.ToString();
break;
}
case c_oSerProp_rPrType::RStyle:
@ -791,15 +801,7 @@ public:
{
Shd oShd;
oBinary_CommonReader2.ReadShdOut(length, &oShd);
if(shd_Nil != oShd.Value)
{
pCStringWriter->WriteString(oShd.ToString());
}
else
{
std::wstring sShd(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>");
pCStringWriter->WriteString(sShd);
}
pCStringWriter->WriteString(oShd.ToString());
break;
}
case c_oSerProp_pPrType::WidowControl:
@ -1772,11 +1774,8 @@ public:
{
Shd oShd;
oBinary_CommonReader2.ReadShdOut(length, &oShd);
if(shd_Nil != oShd.Value)
{
pWiterTblPr->Shd = oShd.ToString();
m_sCurTableShd = pWiterTblPr->Shd;
}
pWiterTblPr->Shd = oShd.ToString();
m_sCurTableShd = pWiterTblPr->Shd;
}
else if( c_oSerProp_tblPrType::tblpPr == type )
{
@ -2234,10 +2233,7 @@ public:
bCellShd = true;
Shd oShd;
oBinary_CommonReader2.ReadShdOut(length, &oShd);
if(shd_Nil != oShd.Value)
{
pCStringWriter->WriteString(oShd.ToString());
}
pCStringWriter->WriteString(oShd.ToString());
}
else if( c_oSerProp_cellPrType::TableCellBorders == type )
{
@ -2981,7 +2977,7 @@ public:
int Read()
{
return ReadTable(&Binary_OtherTableReader::ReadOtherContent, this);
};
}
int ReadOtherContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -2991,7 +2987,7 @@ public:
}
else if(c_oSerOtherTableTypes::DocxTheme == type)
{
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme();
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme(NULL);
pTheme->fromPPTY(&m_oBufferedStream);
NSBinPptxRW::CXmlWriter xmlWriter;
pTheme->toXmlWriter(&xmlWriter);
@ -3000,7 +2996,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadImageMapContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -3043,7 +3039,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
};
class Binary_CommentsTableReader : public Binary_CommonReader<Binary_CommentsTableReader>
{
@ -7258,7 +7254,7 @@ public:
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());
BinXlsxRW::BinaryChartReader oBinaryChartReader(m_oBufferedStream, oSaveParams, m_oFileWriter.m_pDrawingConverter);
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace(NULL);
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
//save xlsx
@ -7439,6 +7435,8 @@ public:
{
PPTX::Logic::CNvPr pNonVisualDrawingProps(L"wp");
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
pNonVisualDrawingProps.id = pDrawingProperty->m_nDocPr;
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML2(L"wp:docPr");
}
else

View File

@ -35,6 +35,7 @@
#include "../../XlsxSerializerCom/Common/Common.h"
#include "../../DesktopEditor/fontengine/FontManager.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
#include <boost/unordered_map.hpp>
namespace Writers
{
@ -48,7 +49,7 @@ namespace Writers
CApplicationFonts m_oApplicationFonts;
CFontManager* m_pFontManager;
public:
std::map<std::wstring, int> m_mapFonts;
boost::unordered_map<std::wstring, int> m_mapFonts;
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir):m_sDir(sDir)
{
@ -81,7 +82,7 @@ namespace Writers
bool bCalibri = false;
bool bTimes = false;
bool bCambria = false;
for (std::map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
for (boost::unordered_map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
{
const std::wstring& sFontName = it->first;
if(_T("Calibri") == sFontName)

View File

@ -416,7 +416,7 @@ namespace MathEquation
virtual void BeginEquation()
{
int nCurPos = WriteItemStart(BinDocxRW::c_oSerParType::OMath);
int nCurPos = WriteItemStart(BinDocxRW::c_oSer_OMathContentType::OMath);
m_aEquationStack.push(nCurPos);
}
virtual void EndEquation()
@ -618,7 +618,7 @@ namespace MathEquation
nRows = m_aRowsCounter.top();
m_aRowsCounter.pop();
}
int nPos = m_oStream.GetPosition();
int nPos = 0;
if (!m_aRowsPosCounter.empty())
{
nPos = m_aRowsPosCounter.top();

View File

@ -87,10 +87,14 @@ namespace BinDocxRW
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, pHdrFtr->m_arrShapeTypes);
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
m_pOfficeDrawingConverter->ClearShapeTypes();
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
m_pOfficeDrawingConverter->SetRels(oldRels);
}
}

View File

@ -37,12 +37,30 @@
#include "../../Common/Base64.h"
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
#include "../../XlsxSerializerCom/Reader/BinaryWriter.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
#include "BinEquationWriter.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
namespace BinDocxRW
{
class ParamsWriter
@ -2998,25 +3016,13 @@ namespace BinDocxRW
bool m_bWriteSectPr;//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
//---------------------------------
BinaryDocumentTableWriter(ParamsWriter& oParamsWriter, ParamsDocumentWriter& oParamsDocumentWriter, std::map<int, bool>* mapIgnoreComments, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter),m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter), m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
{
pBackground = NULL;
pSectPr = NULL;
poDocument = NULL;
m_bWriteSectPr = false;
}
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
{
smart_ptr<OOX::IFileContainer> oldRels = pOfficeDrawingConverter->GetRels();
pOfficeDrawingConverter->SetRels(rels);
for(size_t i = 0, length = aShapeTypes.size(); i < length; ++i)
{
std::wstring& sShapeType = aShapeTypes[i];
pOfficeDrawingConverter->AddShapeType(sShapeType);
}
pOfficeDrawingConverter->SetRels(oldRels);
}
void WriteVbaProject(OOX::VbaProject& oVbaProject)
{
m_oBcw.m_oStream.StartRecord(0);
@ -3024,18 +3030,18 @@ namespace BinDocxRW
m_oBcw.m_oStream.EndRecord();
}
void Write(std::list<OOX::WritingElement*> & aElems)
void Write(std::vector<OOX::WritingElement*> & aElems)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteDocumentContent(aElems);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void WriteDocumentContent(const std::list<OOX::WritingElement*> & aElems)
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems)
{
int nCurPos = 0;
for ( std::list<OOX::WritingElement*>::const_iterator it = aElems.begin(); it != aElems.end(); it++)
for ( size_t i = 0; i < aElems.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = aElems[i];
switch(item->getType())
{
@ -3113,23 +3119,6 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
}
//Write JsaProject
if (NULL != poDocument)
{
smart_ptr<OOX::File> pFile = poDocument->Get(OOX::FileTypes::JsaProject);
if (pFile.IsInit() && OOX::FileTypes::JsaProject == pFile->type())
{
OOX::JsaProject& jsaProject = pFile.as<OOX::JsaProject>();
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(jsaProject.filename().GetPath(), &pData, nBytesCount))
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
m_oBcw.WriteItemEnd(nCurPos);
}
}
}
}
void WriteBackground (OOX::Logic::CBackground* pBackground)
{
@ -3184,12 +3173,13 @@ namespace BinDocxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
void WriteParagraphContent(const std::list<OOX::WritingElement*> & content, bool bHyperlink = false)
void WriteParagraphContent(const std::vector<OOX::WritingElement*> & content, bool bHyperlink = false)
{
int nCurPos = 0;
for(std::list<OOX::WritingElement*>::const_iterator it = content.begin(); it != content.end(); it++)
{
OOX::WritingElement* item = *it;
for ( size_t i = 0; i < content.size(); ++i)
{
OOX::WritingElement* item = content[i];
switch (item->getType())
{
case OOX::et_w_fldSimple:
@ -3836,8 +3826,8 @@ namespace BinDocxRW
bool bWasText = false;
int nRecordType = 0;
std::list<OOX::WritingElement*>::iterator nIndexStart = pRun->m_arrItems.begin();
std::list<OOX::WritingElement*>::iterator nIndexEnd = pRun->m_arrItems.end();
std::vector<OOX::WritingElement*>::iterator nIndexStart = pRun->m_arrItems.begin();
std::vector<OOX::WritingElement*>::iterator nIndexEnd = pRun->m_arrItems.end();
if (bMathRun)
nRecordType = c_oSer_OMathContentType::Run;
@ -3845,9 +3835,9 @@ namespace BinDocxRW
nRecordType = c_oSerParType::Run;
//Разбиваем массив по знаку et_w_sym
for (std::list<OOX::WritingElement*>::iterator it = pRun->m_arrItems.begin(); it != nIndexEnd; it++)
for (std::vector<OOX::WritingElement*>::iterator it = nIndexStart; it != nIndexEnd; ++it)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = (*it);
if(OOX::et_w_sym == item->getType())
{
@ -3859,7 +3849,7 @@ namespace BinDocxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
nCurPos = m_oBcw.WriteItemStart(nRecordType);
std::list<OOX::WritingElement*>::iterator it_next = it; it_next++;
std::vector<OOX::WritingElement*>::iterator it_next = it; it_next++;
WritePreparedRun( pRun, bHyperlink, it, it_next);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
nIndexStart = it; nIndexStart++;
@ -3874,11 +3864,11 @@ namespace BinDocxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteMathArgNodes(const std::list<OOX::WritingElement*>& m_arrItems)
void WriteMathArgNodes(const std::vector<OOX::WritingElement*>& arrItems)
{
for(std::list<OOX::WritingElement*>::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for (size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
@ -4046,7 +4036,7 @@ namespace BinDocxRW
LONG lCol = 0;
//TODO убрать, тк при отсутствии m:mcs, к-во столбцов должно разруливаться динамически в скрипте
for (std::list<OOX::WritingElement*>::iterator jt = pMatrix->m_arrItems.begin(); jt != pMatrix->m_arrItems.end(); jt++)
for (std::vector<OOX::WritingElement*>::iterator jt = pMatrix->m_arrItems.begin(); jt != pMatrix->m_arrItems.end(); jt++)
{
OOX::WritingElement* item = *jt;
if (item->getType() == OOX::et_m_mr)
@ -4496,11 +4486,11 @@ namespace BinDocxRW
}
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathDelimiter(const std::list<OOX::WritingElement*> & arrItems, LONG &lColumn)
void WriteMathDelimiter(const std::vector<OOX::WritingElement*> & arrItems, LONG &lColumn)
{
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
@ -4616,11 +4606,12 @@ namespace BinDocxRW
}
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathEqArr(const std::list<OOX::WritingElement*> & arrItems, LONG& lRow)
void WriteMathEqArr(const std::vector<OOX::WritingElement*> & arrItems, LONG& lRow)
{
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
switch(eType)
@ -4844,12 +4835,13 @@ namespace BinDocxRW
}
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathMatrix(const std::list<OOX::WritingElement*> & arrItems, LONG &lRow, LONG &lCol)
void WriteMathMatrix(const std::vector<OOX::WritingElement*> & arrItems, LONG &lRow, LONG &lCol)
{
bool bColumn = false;
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
switch(eType)
@ -4946,9 +4938,9 @@ namespace BinDocxRW
{
int nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathBottomNodesType::Mcs);
for(std::list<OOX::WritingElement*>::const_iterator it = pMcs.m_arrItems.begin(); it != pMcs.m_arrItems.end(); it++)
for(size_t i = 0; i < pMcs.m_arrItems.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = pMcs.m_arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos1 = 0;
@ -5007,11 +4999,12 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathMr(const std::list<OOX::WritingElement*> & arrItems)
void WriteMathMr(const std::vector<OOX::WritingElement*> & arrItems)
{
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
if (eType == OOX::et_m_e)
@ -5089,11 +5082,12 @@ namespace BinDocxRW
WriteMathArgNodes(pOMath.m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteMathOMathPara(const std::list<OOX::WritingElement*> & arrItems)
void WriteMathOMathPara(const std::vector<OOX::WritingElement*> & arrItems)
{
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
OOX::EElementType eType = item->getType();
int nCurPos = 0;
if (eType == OOX::et_m_oMath)
@ -5505,7 +5499,7 @@ namespace BinDocxRW
}
m_oBcw.WriteItemEnd(nCurPos);
}
void WritePreparedRun(OOX::Logic::CRun *pRun, bool bHyperlink, std::list<OOX::WritingElement*>::iterator &start, std::list<OOX::WritingElement*>::iterator &end)
void WritePreparedRun(OOX::Logic::CRun *pRun, bool bHyperlink, std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end)
{
if (!pRun) return;
@ -5543,12 +5537,12 @@ namespace BinDocxRW
//Content пишется начиная от индекса nIndexStart и заканчивая предшествующим элементом для nIndexStop
nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::Content);
WriteRunContent(pRun->m_arrItems, start, end, bHyperlink);
WriteRunContent( start, end, bHyperlink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
void WriteRunContent(std::list<OOX::WritingElement*>& m_arrItems, std::list<OOX::WritingElement*>::iterator &start, std::list<OOX::WritingElement*>::iterator &end, bool bHyperlink = false)
void WriteRunContent(std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end, bool bHyperlink = false)
{
for ( std::list<OOX::WritingElement*>::iterator it = start; it != end; it++ )
for ( std::vector<OOX::WritingElement*>::iterator it = start; it != end; ++it )
{
OOX::WritingElement* item = *it;
switch (item->getType())
@ -6533,13 +6527,15 @@ namespace BinDocxRW
RELEASEOBJECT(pTblPr);
}
bool ValidateRow(const std::list<OOX::WritingElement *> & arrItems)
bool ValidateRow(const std::vector<OOX::WritingElement *> & arrItems)
{
//Проверяем чтобы не все ячейки в ряду были вертикально замержены
bool bRes = true;
for(std::list<OOX::WritingElement*>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = arrItems[i];
if(OOX::et_w_tc == item->getType())
{
OOX::Logic::CTc* tc = static_cast<OOX::Logic::CTc*>(item);
@ -6581,11 +6577,12 @@ namespace BinDocxRW
}
return false;
}
void GetTableSize(std::list<OOX::WritingElement *> & rows, int& nRows, int& nCols, OOX::Logic::CTableProperty** ppTblPr)
void GetTableSize(std::vector<OOX::WritingElement *> & rows, int& nRows, int& nCols, OOX::Logic::CTableProperty** ppTblPr)
{
for(std::list<OOX::WritingElement*>::iterator it = rows.begin(); it != rows.end(); it++)
for(size_t i = 0; i < rows.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = rows[i];
if(OOX::et_w_tblPr == item->getType())
{
*ppTblPr = new OOX::Logic::CTableProperty();
@ -6605,8 +6602,7 @@ namespace BinDocxRW
}
else
{
//
rows.erase(it);
rows.erase(rows.begin() + i);
}
}
else if(OOX::et_w_sdt == item->getType())
@ -6632,18 +6628,20 @@ namespace BinDocxRW
}
}
}
int GetColsCount(const std::list<OOX::WritingElement *>& arrItems)
int GetColsCount(const std::vector<OOX::WritingElement *>& arrItems)
{
int nColCount = 0;
for(std::list<OOX::WritingElement *>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
for(size_t i = 0; i < arrItems.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = arrItems[i];
if(OOX::et_w_tc == item->getType())
{
nColCount++;
OOX::Logic::CTc* tc = static_cast<OOX::Logic::CTc*>(item);
for(std::list<OOX::WritingElement *>::iterator jt = tc->m_arrItems.begin(); jt != tc->m_arrItems.end(); jt++)
for(std::vector<OOX::WritingElement *>::iterator jt = tc->m_arrItems.begin(); jt != tc->m_arrItems.end(); jt++)
{
OOX::WritingElement* item2 = *jt;
@ -6723,14 +6721,15 @@ namespace BinDocxRW
}
}
void WriteTableContent(std::list<OOX::WritingElement *>& content, OOX::Logic::CTableProperty* pTblPr, int nRows, int nCols)
void WriteTableContent(std::vector<OOX::WritingElement *>& content, OOX::Logic::CTableProperty* pTblPr, int nRows, int nCols)
{
int nCurPos = 0;
int nCurRowIndex = 0;
for(std::list<OOX::WritingElement*>::iterator it = content.begin(); it != content.end(); it++)
for(size_t i = 0; i < content.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = content[i];
if(OOX::et_w_tr == item->getType())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Row);
@ -6793,14 +6792,14 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteRowContent(const std::list<OOX::WritingElement *> & content, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
void WriteRowContent(const std::vector<OOX::WritingElement *> & content, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
{
int nCurPos = 0;
int nCurColIndex = 0;
for(std::list<OOX::WritingElement*>::const_iterator it = content.begin(); it != content.end(); it++)
{
OOX::WritingElement* item = *it;
for(size_t i = 0; i < content.size(); ++i)
{
OOX::WritingElement* item = content[i];
if(OOX::et_w_tc == item->getType())
{
@ -7200,7 +7199,7 @@ namespace BinDocxRW
if(mapAuthorToUserId.end() != pPair)
pNewCommentWriteTemp->sUserId = pPair->second;
}
for(std::list<OOX::WritingElement*>::iterator jt = pComment->m_arrItems.begin(); jt != pComment->m_arrItems.end(); jt++)
for(std::vector<OOX::WritingElement*>::iterator jt = pComment->m_arrItems.begin(); jt != pComment->m_arrItems.end(); jt++)
{
OOX::WritingElement* pWe = *jt;
@ -7384,9 +7383,10 @@ namespace BinDocxRW
};
void WriteMathPr(const OOX::Logic::CMathPr &pMathPr)
{
for(std::list<OOX::WritingElement*>::const_iterator it = pMathPr.m_arrItems.begin(); it != pMathPr.m_arrItems.end(); it++)
for(size_t i = 0; i < pMathPr.m_arrItems.size(); ++i)
{
OOX::WritingElement* item = *it;
OOX::WritingElement* item = pMathPr.m_arrItems[i];
OOX::EElementType eType = item->getType();
switch(eType)
{
@ -7712,7 +7712,7 @@ namespace BinDocxRW
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter, oFootnotes.m_arrShapeTypes);
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void WriteEndnotes(OOX::CEndnotes& oEndnotes)
@ -7721,20 +7721,27 @@ namespace BinDocxRW
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter, oEndnotes.m_arrShapeTypes);
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void WriteNotes(const std::vector<OOX::CFtnEdn*>& arrNotes, ParamsDocumentWriter& oParamsDocumentWriter, std::vector<std::wstring>& arrShapeTypes)
void WriteNotes(const std::vector<OOX::CFtnEdn*>& arrNotes, ParamsDocumentWriter& oParamsDocumentWriter)
{
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
m_pOfficeDrawingConverter->ClearShapeTypes();
int nCurPos = 0;
for(size_t i = 0 ; i < arrNotes.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::Note);
WriteNote(*arrNotes[i], oParamsDocumentWriter, arrShapeTypes);
WriteNote(*arrNotes[i], oBinaryDocumentTableWriter);
m_oBcw.WriteItemEnd(nCurPos);
}
m_pOfficeDrawingConverter->SetRels(oldRels);
}
void WriteNote(const OOX::CFtnEdn& oFtnEdn, ParamsDocumentWriter& oParamsDocumentWriter, std::vector<std::wstring>& arrShapeTypes)
void WriteNote(const OOX::CFtnEdn& oFtnEdn, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
{
int nCurPos = 0;
if(oFtnEdn.m_oType.IsInit())
@ -7749,10 +7756,6 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteLONG(oFtnEdn.m_oId->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, arrShapeTypes);
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::NoteContent);
oBinaryDocumentTableWriter.WriteDocumentContent(oFtnEdn.m_arrItems);
@ -7835,101 +7838,93 @@ namespace BinDocxRW
OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir));
m_oParamsWriter.m_poTheme = oDocx.GetTheme();
m_oParamsWriter.m_oSettings = oDocx.GetSettings();
m_oParamsWriter.m_poTheme = oDocx.m_pTheme;
m_oParamsWriter.m_oSettings = oDocx.m_pSettings;
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.GetTheme());
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.m_pTheme);
oBufferedStream.m_pTheme->AddRef();
OOX::CFontTable* pFontTable = oDocx.GetFontTable();
if(NULL != pFontTable)
m_oParamsWriter.m_pFontProcessor->setFontTable(pFontTable);
if(NULL != oDocx.m_pFontTable)
m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
//ищем первый SectPr и расставляем pageBreak
OOX::CDocument* poDocument = oDocx.GetDocument();
if (poDocument == NULL) return;
OOX::Logic::CSectionProperty* pFirstSectPr = poDocument->m_oSectPr.GetPointer();
if (oDocx.m_pDocument == NULL) return;
OOX::Logic::CSectionProperty* pFirstSectPr = oDocx.m_pDocument->m_oSectPr.GetPointer();
this->WriteMainTableStart();
int nCurPos = 0;
//Write Settings
OOX::CSettings* pSettings = oDocx.GetSettings();
if(NULL != pSettings)
if(NULL != oDocx.m_pSettings)
{
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
oBinarySettingsTableWriter.Write(*pSettings);
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings);
this->WriteTableEnd(nCurPos);
}
//Write Comments
OOX::CComments* pComments = oDocx.GetComments();
OOX::CCommentsExt* pCommentsExt = oDocx.GetCommentsExt();
OOX::CPeople* pPeople = oDocx.GetPeople();
if(NULL != pComments)
if(NULL != oDocx.m_pComments)
{
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments);
oBinaryCommentsTableWriter.Write(*pComments, pCommentsExt, pPeople, m_oParamsWriter.m_mapIgnoreComments);
oBinaryCommentsTableWriter.Write(*oDocx.m_pComments, oDocx.m_pCommentsExt, oDocx.m_pPeople, m_oParamsWriter.m_mapIgnoreComments);
this->WriteTableEnd(nCurPos);
}
//Write StyleTable
OOX::CStyles* pStyles = oDocx.GetStyles();
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
if(NULL != pStyles)
if(NULL != oDocx.m_pStyles)
{
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
oBinaryStyleTableWriter.Write(*pStyles);
oBinaryStyleTableWriter.Write(*oDocx.m_pStyles);
this->WriteTableEnd(nCurPos);
}
//Write Numbering
OOX::CNumbering* pNumbering = oDocx.GetNumbering();
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
if(NULL != pNumbering)
if(NULL != oDocx.m_pNumbering)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
oBinaryNumberingTableWriter.Write(*pNumbering);
oBinaryNumberingTableWriter.Write(*oDocx.m_pNumbering);
this->WriteTableEnd(nCurPos);
}
BinDocxRW::BinaryNotesTableWriter oBinaryNotesWriter(m_oParamsWriter);
//Write Footnotes
OOX::CFootnotes* pFootnotes = oDocx.GetFootnotes();
if(NULL != pFootnotes)
if(NULL != oDocx.m_pFootnotes)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Footnotes);
oBinaryNotesWriter.WriteFootnotes(*pFootnotes);
oBinaryNotesWriter.WriteFootnotes(*oDocx.m_pFootnotes);
this->WriteTableEnd(nCurPos);
}
//Write Endnotes
OOX::CEndnotes* pEndnotes = oDocx.GetEndnotes();
if(NULL != pEndnotes)
if(NULL != oDocx.m_pEndnotes)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Endnotes);
oBinaryNotesWriter.WriteEndnotes(*pEndnotes);
oBinaryNotesWriter.WriteEndnotes(*oDocx.m_pEndnotes);
this->WriteTableEnd(nCurPos);
}
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument, &m_oParamsWriter.m_mapIgnoreComments);
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, oDocx.m_pDocument, &m_oParamsWriter.m_mapIgnoreComments);
//Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
ParamsDocumentWriter oParamsDocumentWriter(oDocx.m_pDocument);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
m_oParamsWriter.m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
m_oParamsWriter.m_pOfficeDrawingConverter->ClearShapeTypes();
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.poDocument = poDocument;
oBinaryDocumentTableWriter.pBackground = oDocx.m_pDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.poDocument = oDocx.m_pDocument;
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if(NULL != oDocx.m_pVbaProject)
{
@ -7937,9 +7932,22 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
//Write JsaProject
if (NULL != oDocx.m_pJsaProject)
{
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(oDocx.m_pJsaProject->filename().GetPath(), &pData, nBytesCount))
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
m_oBcw.WriteItemEnd(nCurPos);
}
}
// Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
oBinaryDocumentTableWriter.Write(oDocx.m_pDocument->m_arrItems);
this->WriteTableEnd(nCurPos);
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::HdrFtr);
@ -7960,9 +7968,11 @@ namespace BinDocxRW
if(NULL != pParagraph)
{
OOX::Logic::CParagraphProperty* pPr = NULL;
for(std::list<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin(); it != pParagraph->m_arrItems.end(); it++)
for(size_t i = 0; i < pParagraph->m_arrItems.size(); ++i)
{
OOX::WritingElement* we = *it;
OOX::WritingElement* we = pParagraph->m_arrItems[i];
if(OOX::et_w_pPr == we->getType())
{
pPr = static_cast<OOX::Logic::CParagraphProperty*>(we);

View File

@ -32,7 +32,12 @@
#include "ChartWriter.h"
#include <algorithm>
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/Styles.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
#define NUMID_START 160
const wchar_t* gc_Cat = L"cat";
@ -127,10 +132,11 @@ namespace BinXlsxRW{
}
ChartWriter::~ChartWriter()
{
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); it++)
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
{
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
{
delete itRow->second;
}
@ -140,28 +146,34 @@ namespace BinXlsxRW{
void ChartWriter::toXlsx(OOX::Spreadsheet::CXlsx& oXlsx)
{
std::vector<std::wstring> aSharedStrings;
//Sheet
OOX::Spreadsheet::CWorkbook* pWorkbook = oXlsx.CreateWorkbook();
pWorkbook->m_oSheets.Init();
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets = oXlsx.GetWorksheets();
oXlsx.CreateWorkbook();
oXlsx.m_pWorkbook->m_oSheets.Init();
int nSheetId = 1;
OOX::Spreadsheet::CWorksheet* pFirstWorksheet = NULL;
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); it++)
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
{
const std::wstring& sSheetName = it->first;
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(mapWorksheets, sSheetName);
//find or generate black worksheet
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(oXlsx.m_arWorksheets, oXlsx.m_mapWorksheets, sSheetName);
//fill data to worksheet
toXlsxSheetdata(pWorksheet, *it->second, aSharedStrings);
OOX::Spreadsheet::CSheet* pSheet = new OOX::Spreadsheet::CSheet();
pSheet->m_oName.Init();
pSheet->m_oName->append(sSheetName);
pSheet->m_oSheetId.Init();
pSheet->m_oSheetId->SetValue(nSheetId++);
smart_ptr<OOX::File> oWorksheetFile = smart_ptr<OOX::File>(pWorksheet);
const OOX::RId oRId = pWorkbook->Add(oWorksheetFile);
const OOX::RId oRId = oXlsx.m_pWorkbook->Add(oWorksheetFile);
pSheet->m_oRid.Init();
pSheet->m_oRid->SetValue(oRId.get());
pWorkbook->m_oSheets->m_arrItems.push_back(pSheet);
mapWorksheets[pSheet->m_oName.get()] = pWorksheet;
oXlsx.m_pWorkbook->m_oSheets->m_arrItems.push_back(pSheet);
if(NULL == pFirstWorksheet)
{
@ -170,7 +182,7 @@ namespace BinXlsxRW{
}
//SharedStrings
OOX::Spreadsheet::CSharedStrings* pSharedStrings = oXlsx.CreateSharedStrings();
oXlsx.CreateSharedStrings();
for(size_t i = 0; i < aSharedStrings.size(); ++i)
{
OOX::Spreadsheet::CText* pText = new OOX::Spreadsheet::CText();
@ -182,33 +194,35 @@ namespace BinXlsxRW{
}
OOX::Spreadsheet::CSi* pSi = new OOX::Spreadsheet::CSi();
pSi->m_arrItems.push_back(pText);
pSharedStrings->AddSi(pSi);
oXlsx.m_pSharedStrings->AddSi(pSi);
}
pSharedStrings->m_oCount.Init();
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_nCount);
pSharedStrings->m_oUniqueCount.Init();
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_nCount);
oXlsx.m_pSharedStrings->m_oCount.Init();
oXlsx.m_pSharedStrings->m_oCount->SetValue(oXlsx.m_pSharedStrings->m_nCount);
oXlsx.m_pSharedStrings->m_oUniqueCount.Init();
oXlsx.m_pSharedStrings->m_oUniqueCount->SetValue(oXlsx.m_pSharedStrings->m_nCount);
//Styles
OOX::Spreadsheet::CStyles* pStyles = oXlsx.CreateStyles();
pStyles->m_oCellXfs.Init();
oXlsx.CreateStyles();
oXlsx.m_pStyles->m_oCellXfs.Init();
for(size_t i = 0; i < m_aXfs.size(); ++i)
{
pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
oXlsx.m_pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
}
pStyles->m_oNumFmts.Init();
for (std::map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); it++)
oXlsx.m_pStyles->m_oNumFmts.Init();
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
{
OOX::Spreadsheet::CNumFmt* pNumFmt = new OOX::Spreadsheet::CNumFmt();
pNumFmt->m_oFormatCode.Init();
pNumFmt->m_oFormatCode->append(it->first);
pNumFmt->m_oNumFmtId.Init();
pNumFmt->m_oNumFmtId->SetValue(NUMID_START + it->second);
pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
oXlsx.m_pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
}
pStyles->m_oNumFmts->m_oCount.Init();
pStyles->m_oNumFmts->m_oCount->SetValue(pStyles->m_oNumFmts->m_arrItems.size());
pStyles->m_oCellXfs->m_oCount.Init();
pStyles->m_oCellXfs->m_oCount->SetValue(pStyles->m_oCellXfs->m_arrItems.size());
oXlsx.m_pStyles->m_oNumFmts->m_oCount.Init();
oXlsx.m_pStyles->m_oNumFmts->m_oCount->SetValue(oXlsx.m_pStyles->m_oNumFmts->m_arrItems.size());
oXlsx.m_pStyles->m_oCellXfs->m_oCount.Init();
oXlsx.m_pStyles->m_oCellXfs->m_oCount->SetValue(oXlsx.m_pStyles->m_oCellXfs->m_arrItems.size());
OOX::Spreadsheet::CDxf* pDxf = new OOX::Spreadsheet::CDxf();
pDxf->m_oBorder.Init();
pDxf->m_oBorder->m_oStart.Init();
@ -235,15 +249,16 @@ namespace BinXlsxRW{
pDxf->m_oBorder->m_oBottom->m_oColor.Init();
pDxf->m_oBorder->m_oBottom->m_oColor->m_oIndexed.Init();
pDxf->m_oBorder->m_oBottom->m_oColor->m_oIndexed->SetValue(12);
pStyles->m_oDxfs.Init();
pStyles->m_oDxfs->m_arrItems.push_back(pDxf);
pStyles->m_oDxfs->m_oCount.Init();
pStyles->m_oDxfs->m_oCount->SetValue(pStyles->m_oDxfs->m_arrItems.size());
oXlsx.m_pStyles->m_oDxfs.Init();
oXlsx.m_pStyles->m_oDxfs->m_arrItems.push_back(pDxf);
oXlsx.m_pStyles->m_oDxfs->m_oCount.Init();
oXlsx.m_pStyles->m_oDxfs->m_oCount->SetValue(oXlsx.m_pStyles->m_oDxfs->m_arrItems.size());
//Table
//todo table в случае нескольких sheet или если серии разнесены по sheet
if(m_aTableNames.size() > 0)
{
OOX::Spreadsheet::CTableFile* pTable = new OOX::Spreadsheet::CTableFile();
OOX::Spreadsheet::CTableFile* pTable = new OOX::Spreadsheet::CTableFile(NULL);
pTable->m_oTable.Init();
pTable->m_oTable->m_oDisplayName.Init();
pTable->m_oTable->m_oDisplayName->append(L"Table1");
@ -286,9 +301,11 @@ namespace BinXlsxRW{
{
OOX::Spreadsheet::CTablePart* pTablePart = new OOX::Spreadsheet::CTablePart();
NSCommon::smart_ptr<OOX::File> pTableFile(pTable);
const OOX::RId oRId = pFirstWorksheet->Add(pTableFile);
pTablePart->m_oRId.Init();
pTablePart->m_oRId->SetValue(oRId.get());
pFirstWorksheet->m_oTableParts.Init();
pFirstWorksheet->m_oTableParts->m_arrItems.push_back(pTablePart);
pFirstWorksheet->m_oTableParts->m_oCount.Init();
@ -458,18 +475,22 @@ namespace BinXlsxRW{
//проверяем можем ли создать таблицу
if(m_mapSheets.size() > 0 && m_nRow1 > 0 && m_nRow2 > 0 && m_nCol1 > 0 && m_nCol2 > 0 && m_nRow1 < m_nRow2)
{
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
if(itRows != rows->end())
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
if(itRows != rows->end())
{
std::map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
std::map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
std::vector<int> aIndexesCell;
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); it++)
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); ++it)
{
aIndexesCell.push_back(it->first);
}
std::sort(aIndexesCell.begin(), aIndexesCell.end());
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
std::sort(aIndexesCell.begin(), aIndexesCell.end());
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
{
for(size_t j = 0; j < aIndexesCell.size(); ++j)
{
@ -482,13 +503,14 @@ namespace BinXlsxRW{
}
}
}
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(std::vector<OOX::Spreadsheet::CWorksheet*>& arWorksheets, std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
{
OOX::Spreadsheet::CWorksheet* pWorksheet = NULL;
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
if (it == mapWorksheets.end())
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator pFind = mapWorksheets.find(sName);
if (pFind == mapWorksheets.end())
{
pWorksheet = new OOX::Spreadsheet::CWorksheet();
pWorksheet = new OOX::Spreadsheet::CWorksheet(NULL);
pWorksheet->m_oSheetFormatPr.Init();
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight.Init();
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight->SetValue(15);
@ -508,39 +530,48 @@ namespace BinXlsxRW{
pWorksheet->m_oPageMargins->m_oFooter->FromInches(0.3);
mapWorksheets[sName] = pWorksheet;
arWorksheets.push_back(pWorksheet);
}
else
{
pWorksheet = it->second;
pWorksheet = pFind->second;
}
return pWorksheet;
}
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
{
pWorksheet->m_oSheetData.Init();
std::vector<int> aIndexesRow;
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); it++)
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); ++it)
{
aIndexesRow.push_back(it->first);
}
std::sort(aIndexesRow.begin(), aIndexesRow.end());
for(size_t i = 0; i < aIndexesRow.size(); ++i)
std::sort(aIndexesRow.begin(), aIndexesRow.end());
for(size_t i = 0; i < aIndexesRow.size(); ++i)
{
int nIndexRow = aIndexesRow[i];
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
pRow->m_oR.Init();
pRow->m_oR->SetValue(nIndexRow);
const std::map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
const std::map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
std::vector<int> aIndexesCell;
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); it++)
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); ++it)
{
aIndexesCell.push_back(it->first);
}
std::sort(aIndexesCell.begin(), aIndexesCell.end());
for(size_t j = 0; j < aIndexesCell.size(); ++j)
for(size_t j = 0; j < aIndexesCell.size(); ++j)
{
int nIndexCell = aIndexesCell[j];
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
//SharedStrings
if(pCell->m_oValue.IsInit())
{
@ -588,22 +619,24 @@ namespace BinXlsxRW{
}
void ChartWriter::parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format = NULL)
{
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
if(itSheets == m_mapSheets.end())
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
if(itSheets == m_mapSheets.end())
{
rows = new std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>();
rows = new std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>();
m_mapSheets.insert(std::make_pair(sheet, rows));
}
else
{
rows = itSheets->second;
}
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
std::map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
if(itRows == rows->end())
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
std::map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
if(itRows == rows->end())
{
cells = new std::map<int, OOX::Spreadsheet::CCell*>();
cells = new std::map<int, OOX::Spreadsheet::CCell*>();
rows->insert(std::make_pair(nRow, cells));
}
else
@ -622,10 +655,12 @@ namespace BinXlsxRW{
//пока добавляем как есть, shared string после записи таблицы
pNewCell->m_oValue.Init();
pNewCell->m_oValue->m_sText = val;
if(NULL != format)
if(NULL != format)
{
int nXfsIndex = m_aXfs.size();
std::map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
boost::unordered_map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
if(itFormat == m_mapFormats.end())
{
m_mapFormats[*format] = nXfsIndex;

View File

@ -33,8 +33,9 @@
#define CHART_WRITER
#include <string>
#include <map>
#include <vector>
#include <map>
#include <boost/unordered_map.hpp>
namespace OOX
{
@ -59,22 +60,26 @@ namespace BinXlsxRW {
class ChartWriter
{
public:
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
std::map<std::wstring, int> m_mapFormats;
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
std::vector<std::wstring> m_aTableNames;
int m_nRow1;
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
boost::unordered_map<std::wstring, int> m_mapFormats;
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
std::vector<std::wstring> m_aTableNames;
int m_nRow1;
int m_nCol1;
int m_nRow2;
int m_nCol2;
public:
ChartWriter();
ChartWriter();
~ChartWriter();
void toXlsx(OOX::Spreadsheet::CXlsx& oXlsx);
void parseChart(const OOX::Spreadsheet::CT_Chart* pChart);
private:
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
private:
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::vector<OOX::Spreadsheet::CWorksheet*>& arWorksheets, std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
void parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
OOX::Spreadsheet::CCell* parseCreateCell(const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
void parseStrRef(const OOX::Spreadsheet::CT_StrRef* pStrRef, bool bUpdateRange, const wchar_t* cRangeName);

View File

@ -39,6 +39,9 @@
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
int BinDocxRW::g_nCurFormatVersion = 0;
BinDocxRW::CDocxSerializer::CDocxSerializer()
@ -47,7 +50,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
m_pCurFileWriter = NULL;
m_bIsNoBase64Save = false;
m_bIsNoBase64 = false;
m_bIsNoBase64 = false;
m_bSaveChartAsImg = false;
}
BinDocxRW::CDocxSerializer::~CDocxSerializer()
@ -292,11 +295,13 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
OOX::CPath DocProps = std::wstring(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp();
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("5.0"));
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
@ -306,7 +311,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore();
OOX::CCore* pCore = new OOX::CCore(NULL);
if (pCore)
{
pCore->SetCreator(_T(""));

View File

@ -33,6 +33,12 @@
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h"
#include "../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
#include "../../Common/ASCUtils.h"
namespace DocWrapper {

View File

@ -42,6 +42,7 @@
#include "ChartWriter.h"
#include "../BinReader/DefaultThemeWriter.h"
//#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
namespace BinXlsxRW{
int g_nCurFormatVersion = 0;
@ -84,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);
@ -96,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);
@ -136,10 +136,10 @@ namespace BinXlsxRW{
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
int result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
RELEASEOBJECT(pFontPicker);
return true;
return result;
}
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
{
@ -168,7 +168,7 @@ namespace BinXlsxRW{
//todo theme path
BinXlsxRW::SaveParams oSaveParams(sThemePath, m_pExternalDrawingConverter->GetContentTypes());
OOX::Spreadsheet::CChartSpace oChartSpace;
OOX::Spreadsheet::CChartSpace oChartSpace(NULL);
BinXlsxRW::BinaryChartReader oBinaryChartReader(*pReader, oSaveParams, m_pExternalDrawingConverter);
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace.m_oChartSpace);

View File

@ -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);

View File

@ -16,8 +16,6 @@ include($$PWD/../../Common/3dParty/boost/boost.pri)
DEFINES += UNICODE \
_UNICODE \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
USE_AVSOFFICESTUDIO_XMLUTILS \
SOLUTION_ASCOFFICEDOCXFILE2 \
#DISABLE_FILE_DOWNLOADER \

View File

@ -68,6 +68,7 @@
ShowProgress="0"
Version=""
LinkIncremental="2"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"

View File

@ -407,11 +407,11 @@ namespace formulasconvert {
std::wstring is_forbidden(const std::wstring & formula)
{
std::wstring result = formula;
std::map<std::wstring, std::wstring> forbidden_formulas;
std::map<std::wstring, std::wstring> forbidden_formulas;
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); it++)
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
{
if (boost::algorithm::contains(formula, it->first))
{

View File

@ -335,8 +335,8 @@ namespace internal
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
{
return (
((it != end) && (internal::mask8(*it++)) == bom[0]) &&
((it != end) && (internal::mask8(*it++)) == bom[1]) &&
((it != end) && (internal::mask8(*++it)) == bom[0]) &&
((it != end) && (internal::mask8(*++it)) == bom[1]) &&
((it != end) && (internal::mask8(*it)) == bom[2])
);
}
@ -346,8 +346,8 @@ namespace internal
inline bool is_bom (octet_iterator it)
{
return (
(internal::mask8(*it++)) == bom[0] &&
(internal::mask8(*it++)) == bom[1] &&
(internal::mask8(*++it)) == bom[0] &&
(internal::mask8(*++it)) == bom[1] &&
(internal::mask8(*it)) == bom[2]
);
}

View File

@ -66,7 +66,7 @@ namespace utf8
case 1:
break;
case 2:
it++;
++it;
cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
break;
case 3:

View File

@ -22,8 +22,6 @@ include($$PWD/../../Common/3dParty/boost/boost.pri)
DEFINES += UNICODE \
_UNICODE \
_USE_LIBXML2_READER_ \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
LIBXML_READER_ENABLED \
DONT_WRITE_EMBEDDED_FONTS
@ -288,6 +286,7 @@ SOURCES += \
../src/docx/xlsx_table_state.cpp \
../src/docx/xlsx_textcontext.cpp \
../src/docx/xlsx_pivots_context.cpp \
../src/docx/xlsx_data_validation.cpp \
../src/docx/xlsx_utils.cpp \
../src/docx/xlsx_xf.cpp
}
@ -551,6 +550,7 @@ HEADERS += \
../src/docx/xlsx_table_position.h \
../src/docx/xlsx_table_state.h \
../src/docx/xlsx_textcontext.h \
../src/docx/xlsx_data_validation.h \
../src/docx/xlsx_utils.h \
../src/docx/xlsx_xf.h \
../include/logging.h \

View File

@ -101,3 +101,4 @@
#include "../src/docx/xlsx_utils.cpp"
#include "../src/docx/xlsx_xf.cpp"
#include "../src/docx/xlsx_pivots_context.cpp"
#include "../src/docx/xlsx_data_validation.cpp""

View File

@ -732,16 +732,38 @@ void docx_conversion_context::start_process_style_content()
styles_context_.start();
}
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)//from page layout
{
int count_columns = 1;
bool sep_columns = false;
oox::section_context::_section & section = get_section_context().get();
if (!columns)
{
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
{
if (const odf_reader::style_content * content = secStyle->content())
{
if (odf_reader::style_section_properties * sectPr = content->get_style_section_properties())
{
columns = dynamic_cast<odf_reader::style_columns *>( sectPr->style_columns_.get());
section.margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
section.margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
}
}
if (section.is_dump_)
{
get_section_context().remove_section();
}
}
}
std::vector<std::pair<double, double>> width_space;
if (columns)
{
if ((columns->fo_column_count_) && (*columns->fo_column_count_ > 1))
if (columns->fo_column_count_)
{
count_columns = *columns->fo_column_count_;
}
@ -750,44 +772,64 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
{
if (const odf_reader::style_content * content = secStyle->content())
{
if (odf_reader::style_section_properties * sectPr = content->get_style_section_properties())
{
if (odf_reader::style_columns * columns = dynamic_cast<odf_reader::style_columns *>( sectPr->style_columns_.get() ))
{
if (columns->fo_column_count_)
{
count_columns = *columns->fo_column_count_;
}
if (odf_reader::style_column_sep * columns_sep = dynamic_cast<odf_reader::style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
section.margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
section.margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
if (!columns->style_columns_.empty())
{
double page_width = 0;
const odf_reader::page_layout_instance * pp = root()->odf_context().pageLayoutContainer().page_layout_first();
if ((pp) && (pp->properties()))
{
odf_reader::style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
if (attr_page.fo_page_width_)
{
page_width = attr_page.fo_page_width_->get_value_unit(odf_types::length::pt);
}
if (attr_page.common_horizontal_margin_attlist_.fo_margin_left_)
{
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt);
}
if (attr_page.common_horizontal_margin_attlist_.fo_margin_right_)
{
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_right_->get_length().get_value_unit(odf_types::length::pt);
}
}
for (size_t i = 0; page_width > 0, i < columns->style_columns_.size(); i++)
{
odf_reader::style_column * col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i].get());
if (!col) continue;
double width = page_width * (col->style_rel_width_ ? col->style_rel_width_->get_value() / 65535. : 0);
double space = col->fo_end_indent_ ? col->fo_end_indent_->get_value_unit(odf_types::length::pt) : 0;
if (i < columns->style_columns_.size() - 1)
{
col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i + 1].get());
space += col->fo_start_indent_ ? col->fo_start_indent_->get_value_unit(odf_types::length::pt) : 0;
}
width_space.push_back(std::make_pair(width, space));
}
}
if (section.is_dump_)
{
get_section_context().remove_section();
}
}
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:cols")
{
CP_XML_ATTR(L"w:equalWidth", L"true");
CP_XML_ATTR(L"w:equalWidth", width_space.empty());
CP_XML_ATTR(L"w:num", count_columns);
CP_XML_ATTR(L"w:sep", sep_columns);
CP_XML_ATTR(L"w:space",0);
CP_XML_ATTR(L"w:space", 708);
for (size_t i = 0; i < width_space.size(); i++)
{
CP_XML_NODE(L"w:col")
{
CP_XML_ATTR(L"w:w", (int)(width_space[i].first * 20));
CP_XML_ATTR(L"w:space", (int)(width_space[i].second * 20));
}
}
}
}
}
@ -846,18 +888,18 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
CP_XML_WRITER(strm)
{
//Tutor_Charlotte_Tutor_the_Entire_World_.odt
if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_ || in_header_)
&& !get_table_context().in_table() && !in_drawing)
{//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
CP_XML_NODE(L"w:pPr")
{
CP_XML_STREAM() << get_section_context().dump_;
get_section_context().dump_.clear();
}
finish_paragraph();
start_paragraph();
}
////Tutor_Charlotte_Tutor_the_Entire_World_.odt
//if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_ || in_header_)
// && !get_table_context().in_table() && !in_drawing)
//{//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
// CP_XML_NODE(L"w:pPr")
// {
// CP_XML_STREAM() << get_section_context().dump_;
// get_section_context().dump_.clear();
// }
// finish_paragraph();
// start_paragraph();
//}
if (!paragraph_style.str().empty() || !ParentId.empty())
{
@ -1128,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;
}
@ -1320,7 +1362,7 @@ void docx_conversion_context::start_changes()
text_tracked_context_.dumpTcPr_.clear();
text_tracked_context_.dumpTblPr_.clear();
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
{
text_tracked_context::_state &state = it->second;
@ -1413,7 +1455,7 @@ void docx_conversion_context::end_changes()
{
if (process_comment_) return;
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
{
text_tracked_context::_state &state = it->second;

View File

@ -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_;// цепочки переименований нумераций
};

View File

@ -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_;
};

View File

@ -103,7 +103,7 @@ public:
reset_fill(l.fill_);
//floor_.content_= l;
}
void set_legend(odf_reader::chart::simple & l)
void set_legend(odf_reader::chart::legend & l)
{
reset_fill(l.fill_);
legend_.content_= l;

View File

@ -52,10 +52,9 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:legend")
{
CP_XML_NODE(L"c:legendPos")
{
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
CP_XML_ATTR(L"val", content_.position);
}
layout_.oox_serialize(CP_XML_STREAM());

View File

@ -48,7 +48,7 @@ public:
void oox_serialize(std::wostream & _Wostream);
odf_reader::chart::simple content_;
odf_reader::chart::legend content_;
private:
cpdoccore::oox::oox_layout layout_; //layout (Layout) §21.2.2.88

View File

@ -71,7 +71,7 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
{
oox_serialize_default_text(CP_XML_STREAM(), textPr_);
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); it++)
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
{
CP_XML_NODE(L"c:dLbl")
{

View File

@ -40,6 +40,7 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
namespace cpdoccore {
namespace oox {
@ -284,8 +285,8 @@ void core_file::write(const std::wstring & RootPath)
L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" "
L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >";
//resStream << L"<dc:creator>ONLYOFFICE Online Editor</dc:creator>";
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE Online Editor</cp:lastModifiedBy>";
//resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
resStream << L"<cp:revision>1</cp:revision>";
resStream << L"</cp:coreProperties>";
@ -300,8 +301,12 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>OnlyOffice</Application>";
resStream << L"</Properties>";
resStream << L"<Application>ONLYOFFICE";
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
resStream << L"/" << std::wstring(s.begin(), s.end()) ;
#endif
resStream << L"</Application></Properties>";
simple_element elm(L"app.xml", resStream.str());
elm.write(RootPath);

View File

@ -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);

View File

@ -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);

View File

@ -116,7 +116,7 @@ public:
int priority = 1;
CP_XML_WRITER(_Wostream)
{
for (int i = 0 ; i < conditionalFormattings_.size(); i++)
for (size_t i = 0 ; i < conditionalFormattings_.size(); i++)
{
conditionalFormatting & c = conditionalFormattings_[i];
@ -126,7 +126,7 @@ public:
{
CP_XML_ATTR(L"sqref", c.ref);
for (int j = 0 ; j < c.rules.size(); j++)
for (size_t j = 0 ; j < c.rules.size(); j++)
{
if (c.rules[j].type < 1 || c.rules[j].type > 5) continue;
@ -171,7 +171,7 @@ public:
if (c.rules[j].minLength) CP_XML_ATTR(L"minLength", *c.rules[j].minLength);
if (c.rules[j].maxLength) CP_XML_ATTR(L"maxLength", *c.rules[j].maxLength);
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
{
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
}
@ -189,11 +189,11 @@ public:
CP_XML_ATTR(L"type", L"colorScale");
CP_XML_NODE(L"colorScale")
{
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
{
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
}
for (int k = 0; k < c.rules[j].color.size(); k++)
for (size_t k = 0; k < c.rules[j].color.size(); k++)
{
CP_XML_NODE(L"color")
{
@ -209,7 +209,7 @@ public:
{
if (c.rules[j].showValue) CP_XML_ATTR(L"showValue", *c.rules[j].showValue);
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
{
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
}

View File

@ -0,0 +1,212 @@
/*
* (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 "xlsx_data_validation.h"
#include "xlsx_utils.h"
#include <vector>
#include <map>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/CPSharedPtr.h>
#include "../formulasconvert/formulasconvert.h"
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore {
namespace oox {
class xlsx_dataValidation
{
public:
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
std::wstring ref;
std::wstring activate_ref;
std::wstring type;
std::wstring formula1;
std::wstring formula2;
std::wstring operator_;
bool showErrorMessage;
bool showInputMessage;
bool showDropDown;
bool allowBlank;
};
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
class xlsx_dataValidations_context::Impl
{
public:
void serialize(std::wostream & _Wostream)
{
if (mapActivateDataValidations.empty()) return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"dataValidations")
{
CP_XML_ATTR(L"count", mapActivateDataValidations.size());
for (std::map<std::wstring, xlsx_dataValidation_ptr>::iterator it = mapActivateDataValidations.begin();
it != mapActivateDataValidations.end(); ++it)
{
CP_XML_NODE(L"dataValidation")
{
CP_XML_ATTR(L"sqref", it->second->activate_ref);
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
CP_XML_ATTR(L"operator", it->second->operator_);
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
CP_XML_ATTR(L"type", it->second->type);
if (!it->second->formula1.empty())
{
CP_XML_NODE(L"formula1")
{
CP_XML_STREAM() << it->second->formula1;
}
}
if (!it->second->formula2.empty())
{
CP_XML_NODE(L"formula2")
{
CP_XML_STREAM() << it->second->formula2;
}
}
}
}
}
}
mapActivateDataValidations.clear();
}
std::map<std::wstring, xlsx_dataValidation_ptr> mapDataValidations; //for all tables
std::map<std::wstring, xlsx_dataValidation_ptr> mapActivateDataValidations; //in current table
};
xlsx_dataValidations_context::xlsx_dataValidations_context() :
impl_(new xlsx_dataValidations_context::Impl())
{}
xlsx_dataValidations_context::~xlsx_dataValidations_context()
{
}
void xlsx_dataValidations_context::serialize(std::wostream & _Wostream)
{
return impl_->serialize(_Wostream);
}
void xlsx_dataValidations_context::activate(const std::wstring & name, const std::wstring & ref)
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFindActivate = impl_->mapActivateDataValidations.find(name);
if (pFindActivate != impl_->mapActivateDataValidations.end())
{
pFindActivate->second->activate_ref += L" " + ref;
}
else
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind != impl_->mapDataValidations.end())
{
pFind->second->activate_ref = ref;
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
}
}
}
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind == impl_->mapDataValidations.end()) return;
pFind->second->showInputMessage = val;
}
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind == impl_->mapDataValidations.end()) return;
pFind->second->showErrorMessage = val;
}
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
{
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());
formulasconvert::odf2oox_converter converter;
_new->ref = converter.convert_named_ref(ref, false, L";");
impl_->mapDataValidations.insert(std::make_pair(name, _new));
}
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind == impl_->mapDataValidations.end()) return;
formulasconvert::odf2oox_converter converter;
int pos = -1;
std::wstring val;
if ( 0 <= (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
{
pFind->second->type = L"list";
val = f.substr(24 + pos, f.size() - 25 - pos);
if ( val.substr(0, 1) == L"\"")
{
XmlUtils::replace_all(val, L"\"", L"");
pFind->second->formula1 = converter.convert(val);
if ( std::wstring::npos != val.find(L";") )//convert formula replacing ; on ,
{
pFind->second->formula1 = L"\"" + pFind->second->formula1 + L"\"";
}
}
else
{
pFind->second->formula1 = converter.convert(val);
}
}
}
}
}

View File

@ -1,71 +1,61 @@
/*
* (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
#ifndef OOX_EXTERNALVIDEO_INCLUDE_H_
#define OOX_EXTERNALVIDEO_INCLUDE_H_
#include "External.h"
namespace OOX
{
class ExternalVideo : public External
{
public:
ExternalVideo()
{
}
ExternalVideo(const CPath& uri)
{
read(uri);
}
~ExternalVideo()
{
}
public:
virtual const FileType type() const
{
return FileTypes::ExternalVideo;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
#endif // OOX_EXTERNALVIDEO_INCLUDE_H_
/*
* (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 <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <string>
namespace cpdoccore {
namespace oox {
class xlsx_dataValidations_context
{
public:
xlsx_dataValidations_context();
~xlsx_dataValidations_context();
void add(const std::wstring & name, const std::wstring & ref);
void add_formula(const std::wstring & name, const std::wstring & f);
void add_help_msg(const std::wstring & name, bool val);
void add_error_msg(const std::wstring & name, bool val);
void activate(const std::wstring & name, const std::wstring & ref);
void serialize(std::wostream & _Wostream);
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
};
}
}

View File

@ -54,6 +54,8 @@ public:
std::wstringstream sort_;
std::wstringstream autofilter_;
std::wstringstream conditionalFormatting_;
std::wstringstream picture_background_;
std::wstringstream dataValidations_;
std::wstringstream ole_objects_;
std::wstringstream page_props_;
@ -138,7 +140,14 @@ std::wostream & xlsx_xml_worksheet::page_properties()
{
return impl_->page_props_;
}
std::wostream & xlsx_xml_worksheet::picture_background()
{
return impl_->picture_background_;
}
std::wostream & xlsx_xml_worksheet::dataValidations()
{
return impl_->dataValidations_;
}
//---------------------------------------------------------------------------------------
rels & xlsx_xml_worksheet::sheet_rels()
{
@ -178,6 +187,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->conditionalFormatting_.str();
CP_XML_STREAM() << impl_->dataValidations_.str();
if (!impl_->hyperlinks_.str().empty())
{
CP_XML_NODE(L"hyperlinks")
@ -207,6 +217,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"headerFooter){}

View File

@ -61,6 +61,8 @@ public:
std::wostream & comments();
std::wostream & autofilter();
std::wostream & conditionalFormatting();
std::wostream & picture_background();
std::wostream & dataValidations();
std::wostream & sort();
std::wostream & ole_objects();
std::wostream & page_properties();

View File

@ -194,7 +194,7 @@ private:
std::map<size_t, size_t> count;
size_t max_size = 0;
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); it++)
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); ++it)
{
std::map<size_t, size_t>::iterator pFind = count.find(it->second);
if (pFind != count.end())
@ -215,7 +215,7 @@ private:
size_t found = 0;
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); it++)
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); ++it)
{
if (it->second == max_size)
{
@ -229,16 +229,16 @@ private:
{
if (it->second != found)
{
std::map<size_t, size_t>::iterator del = it; it++;
std::map<size_t, size_t>::iterator del = it; ++it;
map.erase(del);
}
else it++;
else ++it;
}
return true;
}
void clear_header_map2(std::map<size_t, size_t> & map, std::map<size_t, size_t> & map_by)
{//отсев тех кто во втором
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); it++)
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); ++it)
{
std::map<size_t, size_t>::iterator pFind = map.find(it->second);
if (pFind != map.end())

View File

@ -120,7 +120,7 @@ public:
xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
xlsx_comments_context & get_comments_context() { return xlsx_comments_context_; }
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() { return xlsx_conditionalFormatting_context_;}
void table_column_last_width(double w) { table_column_last_width_ = w; }
double table_column_last_width() const { return table_column_last_width_; };

View File

@ -253,7 +253,7 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
}
@ -271,7 +271,7 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
if (xlsx_data_ranges_[it->second]->filter)
{
@ -324,6 +324,10 @@ void xlsx_table_context::serialize_background(std::wostream & _Wostream)
{
return state()->serialize_background(_Wostream);
}
void xlsx_table_context::serialize_data_validation(std::wostream & _Wostream)
{
return xlsx_conversion_context_->get_dataValidations_context().serialize(_Wostream);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return state()->serialize_hyperlinks(_Wostream);

View File

@ -91,6 +91,7 @@ public:
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
void serialize_background (std::wostream & _Wostream);
void serialize_data_validation (std::wostream & _Wostream);
xlsx_table_metrics & get_table_metrics();

View File

@ -49,13 +49,6 @@
namespace cpdoccore {
namespace oox {
void removeCharsFromString( std::wstring &str, std::wstring charsToRemove )
{
for ( unsigned int i = 0; i < charsToRemove.length(); ++i )
{
str.erase( std::remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
}
}
class xlsx_text_context::Impl: boost::noncopyable
{

View File

@ -437,6 +437,7 @@ void xlsx_conversion_context::end_table()
get_table_context().serialize_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort());
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
get_table_context().serialize_data_validation (current_sheet().dataValidations());
get_drawing_context().set_odf_packet_path (root()->get_folder());
get_drawing_context().process_objects (get_table_metrics());

View File

@ -49,6 +49,7 @@
#include "xlsx_defined_names.h"
#include "xlsx_table_metrics.h"
#include "xlsx_pivots_context.h"
#include "xlsx_data_validation.h"
#include "oox_chart_context.h"
#include "mediaitems.h"
@ -179,6 +180,7 @@ public:
xlsx_drawing_context_handle & get_drawing_context_handle();
xlsx_comments_context & get_comments_context();
xlsx_comments_context_handle & get_comments_context_handle();
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
mediaitems & get_mediaitems() { return mediaitems_; }
@ -212,6 +214,7 @@ private:
xlsx_pivots_context xlsx_pivots_context_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
xlsx_comments_context_handle xlsx_comments_context_handle_;
xlsx_dataValidations_context xlsx_dataValidations_context_;
};
}

View File

@ -233,8 +233,9 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false);
Context.set_run_state (false);
Context.get_math_context().base_font_size_ = baseFontHeight_;
Context.start_math_formula();
Context.get_math_context().base_font_size_ = baseFontHeight_;
office_math_->oox_convert(Context.get_math_context());
Context.end_math_formula();
@ -762,6 +763,28 @@ void process_build_object::visit(const chart_footer& val)
void process_build_object::visit(const chart_legend& val)
{
object_odf_context_.legend_.bEnabled = true;
object_odf_context_.legend_.position = L"r";
if (val.attlist_.chart_legend_position_)
{
std::wstring pos = val.attlist_.chart_legend_position_.get();
if ( pos == L"bottom") object_odf_context_.legend_.position = L"b";
if ( pos == L"start") object_odf_context_.legend_.position = L"l";
if ( pos == L"top") object_odf_context_.legend_.position = L"t";
if ( pos == L"top-end") object_odf_context_.legend_.position = L"tr";
if ( pos == L"top-start") object_odf_context_.legend_.position = L"tl";
if ( pos == L"bottom-start") object_odf_context_.legend_.position = L"bl";
if ( pos == L"bottom-end") object_odf_context_.legend_.position = L"br";
}
if (val.attlist_.chart_legend_align_)
{
std::wstring align = val.attlist_.chart_legend_align_.get();
//if ( pos == L"start") object_odf_context_.legend_.align = L"b";
//if ( pos == L"center") object_odf_context_.legend_.align = L"l";
//if ( pos == L"end") object_odf_context_.legend_.align = L"t";
}
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);

View File

@ -188,7 +188,7 @@ public:
office_element_ptr_array title_odf_context_;
chart::title sub_title_;
chart::simple legend_;
chart::legend legend_;
chart::plot_area plot_area_;
chart::simple wall_;

View File

@ -76,6 +76,7 @@ namespace chart {
struct simple
{
simple() : bEnabled(false) {}
bool bEnabled;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
@ -92,6 +93,11 @@ namespace chart {
treadline(){bEquation = false; bREquation = false;}
};
struct legend : public simple
{
std::wstring position;
std::wstring align;
};
struct plot_area : public simple
{
std::wstring cell_range_address_;

View File

@ -58,6 +58,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va
break;
case calcext_type::Minimum:
_Wostream << L"minimum";
break;
case calcext_type::Percentile:
_Wostream << L"percentile";
break;
default:
break;
@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str)
return calcext_type( Minimum );
else if (tmp == L"formula")
return calcext_type( Formula );
else if (tmp == L"percentile")
return calcext_type( Percentile );
else
{
return calcext_type( Number );

View File

@ -49,7 +49,8 @@ public:
Minimum,
AutoMaximum,
AutoMinimum,
Formula
Formula,
Percentile
};
calcext_type() {}

View File

@ -41,9 +41,10 @@ std::wostream & operator << (std::wostream & _Wostream, const chart_data_label_n
{
switch(_Val.get_type())
{
case chart_data_label_number::none: _Wostream << L"none"; break;
case chart_data_label_number::value: _Wostream << L"value"; break;
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
case chart_data_label_number::none: _Wostream << L"none"; break;
case chart_data_label_number::value: _Wostream << L"value"; break;
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
case chart_data_label_number::value_and_percentage: _Wostream << L"value-and-percentage"; break;
}
return _Wostream;
}
@ -59,9 +60,10 @@ chart_data_label_number chart_data_label_number::parse(const std::wstring & Str)
return chart_data_label_number( value );
else if (tmp == L"percentage")
return chart_data_label_number( percentage );
else
else if (tmp == L"value-and-percentage")
return chart_data_label_number( value_and_percentage );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_data_label_number( none );
}
}

View File

@ -45,7 +45,8 @@ public:
{
none,
value,
percentage
percentage,
value_and_percentage
};
chart_data_label_number() {}

View File

@ -61,6 +61,7 @@ private:
document_context::document_context() : impl_( new document_context::Impl() )
{
level = 0;
}
document_context::~document_context()

View File

@ -45,10 +45,11 @@ class document_context
public:
document_context();
virtual ~document_context();
public:
void set_last_paragraph(text::paragraph * Paragraph);
text::paragraph * get_last_paragraph();
int level;
private:
class Impl;

View File

@ -144,7 +144,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);
// svg:definition-src
@ -164,10 +163,8 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_definition_src);
// style:font-face
class style_font_face : public office_element_impl<style_font_face>
{
@ -233,7 +230,6 @@ public:
friend class odf_document;
};
CP_REGISTER_OFFICE_ELEMENT2(style_font_face);
// office-font-face-decls
@ -257,7 +253,6 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(office_font_face_decls);
}

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"

View File

@ -38,7 +38,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPColorUtils.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
namespace odf_reader {

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
@ -152,6 +151,8 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
{
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
Context.next_dump_page_properties(true);
lastPageLayout->docx_serialize(Context.output_stream(), Context);
//Context.remove_page_properties();
}

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
@ -81,7 +80,16 @@ void chart_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
void chart_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
if CP_CHECK_NAME(L"text", L"tracked-changes")
{
//CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
//CP_CREATE_ELEMENT(content_validations_);
}
else
CP_CREATE_ELEMENT(content_);
}
void chart_title_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{

View File

@ -60,7 +60,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
office_element_ptr_array content_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
};
@ -72,7 +75,6 @@ class common_chart_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_style_name_;
};
@ -106,6 +108,10 @@ private:
public:
chart_chart_attlist attlist_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
};
@ -117,7 +123,6 @@ class chart_title_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) table_cell_range_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
@ -194,13 +199,13 @@ class chart_legend_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_legend_position_;
_CP_OPT(std::wstring) chart_legend_align_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
_CP_OPT(std::wstring) style_legend_expansion_;
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
common_chart_attlist common_attlist_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
};

View File

@ -69,8 +69,14 @@ enum ElementType
typeTextTime,
typeTextModificationTime,
typeTextFileName,
typeTextSequence,
typeTextSheetName,
typeTextTemplateName,
typeTextDropDown,
typeTextLabel,
typeTextSequenceDecls,
typeTextSequenceDecl,
typeTextSequence,
typePresentationFooter,
typePresentationDateTime,
@ -78,6 +84,8 @@ enum ElementType
typeDcCreator,
typeDcDate,
typeDrawA,
typeTextH,
typeTextP,
@ -90,28 +98,42 @@ enum ElementType
typeTextSectionSource,
typeTextIndexTitle,
typeTextIndexBody,
typeTextNumberedParagraph,
typeDrawA,
typeTextNumberedParagraph,
typeTextExpression,
typeTextTableOfContent,
typeTextIllustrationIndex,
typeTextTableIndex,
typeTextObjectIndex,
typeTextUserIndex,
typeTextAlphabeticalIndex,
typeTextBibliography,
typeTextBibliographyMark,
typeTextTableOfContentSource,
typeTextIllustrationIndex,
typeTextIllustrationIndexSource,
typeTextTableIndex,
typeTextTableIndexSource,
typeTextObjectIndex,
typeTextObjectIndexSource,
typeTextUserIndex,
typeTextUserIndexSource,
typeTextAlphabeticalIndex,
typeTextAlphabeticalIndexSource,
typeTextBibliographySource,
typeTextBibliography,
typeTextBibliographyMark,
typeTextBibliographySource,
typeTextVariableInput,
typeTextVariableGet,
typeTextVariableSet,
typeTextVariableDecl,
typeTextVariableDecls,
typeTextUserFieldDecls,
typeTextUserFieldDecl,
typeTextUserFieldGet,
typeTextUserFieldSet,
typeTextUserFieldInput,
typeTextTrackedChanges,
typeTextChangedRegion,
@ -125,6 +147,11 @@ enum ElementType
typeTextFormatChange,
typeTextInsertion,
typeTextMeta,
typeTextMetaField,
typeTextTextInput,
typeShape,
typeChangeMarks,
@ -206,6 +233,14 @@ enum ElementType
typeTableDatabaseRange,
typeTableSort,
typeTableSortBy,
typeTableCalculationSettings,
typeTableNullDate,
typeTableShapes,
typeTableContentValidation,
typeTableContentValidations,
typeTableHelpMassage,
typeTableErrorMassage,
typeTableErrorMacro,
typeTableFilter,
typeTableFilterAnd,
@ -384,9 +419,6 @@ enum ElementType
typeScriptEventListener,
typeTableCalculationSettings,
typeTableNullDate,
typeNumberNumberStyle,
typeNumberDataStyle,
typeNumberText,
@ -409,7 +441,6 @@ enum ElementType
typeNumberMinutes,
typeNumberSeconds,
typeNumberAmPm,
typeTableShapes,
typeChartChart,
typeChartTitle,

View File

@ -54,11 +54,25 @@ const wchar_t * office_presentation::name = L"presentation";
void office_presentation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"page")
{
CP_CREATE_ELEMENT(pages_);
}
else if CP_CHECK_NAME(L"table", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else if CP_CHECK_NAME(L"presentation", L"footer-decl")
{
CP_CREATE_ELEMENT(footer_decls_);
}
else if CP_CHECK_NAME(L"presentation", L"date-time-decl")
{
CP_CREATE_ELEMENT(date_time_decls_);
}
}

View File

@ -62,10 +62,13 @@ private:
public:
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
office_element_ptr_array pages_;
office_element_ptr_array pages_;
};

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -63,6 +63,10 @@ void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstrin
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else
CP_CREATE_ELEMENT(content_);
}
@ -88,6 +92,9 @@ void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
if (database_ranges_)
database_ranges_->xlsx_convert(Context);
if (content_validations_)
content_validations_->xlsx_convert(Context);
if (data_pilot_tables_)
data_pilot_tables_->xlsx_convert(Context);

View File

@ -62,12 +62,12 @@ public:
office_element_ptr database_ranges_;
office_element_ptr data_pilot_tables_;
office_element_ptr tracked_changes_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
// table:calculation-settings
// table:consolidation
// table:content-validations
// table:dde-links
// table:label-ranges

View File

@ -101,6 +101,10 @@ void office_text::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(content_validations_);
}
else if (is_text_content(Ns, Name))
{
CP_CREATE_ELEMENT(content_);

View File

@ -67,7 +67,9 @@ private:
// TODO: table-decls
office_element_ptr tracked_changes_;
office_element_ptr_array content_;
office_element_ptr content_validations_;
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions

View File

@ -39,7 +39,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/common/readstring.h>
#include <cpdoccore/odf/odf_document.h>
@ -742,7 +741,7 @@ std::wostream & title::text_to_stream(std::wostream & _Wostream) const
void title::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void title::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -806,7 +805,7 @@ std::wostream & subject::text_to_stream(std::wostream & _Wostream) const
void subject::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void subject::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -823,8 +822,8 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
Context.add_new_run();
std::wstring textNode = L"w:t";
@ -838,7 +837,7 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
strm << L"</" << textNode << L">";
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
void subject::xlsx_convert(oox::xlsx_conversion_context & Context)
@ -869,7 +868,7 @@ std::wostream & chapter::text_to_stream(std::wostream & _Wostream) const
void chapter::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void chapter::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1379,9 +1378,77 @@ void sequence::pptx_convert(oox::pptx_conversion_context & Context)
text_[i]->pptx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------------------------
// text:drop-down
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_drop_down::ns = L"text";
const wchar_t * text_drop_down::name = L"drop-down";
// text:sequesheet-namence
//////////////////////////////////////////////////////////////////////////////////////////////////
void text_drop_down::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_drop_down::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"label")
{
CP_CREATE_ELEMENT(content_);
}
else
{
}
}
void text_drop_down::add_text(const std::wstring & Text)
{
text_ = Text;
}
std::wostream & text_drop_down::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_drop_down::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << text_name_.get_value_or(L"") << L"\"/><w:enabled/>";
strm << L"<w:ddList><w:result w:val=\"0\"/>";
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
strm << L"</w:ddList></w:ffData>";
strm << L"</w:fldChar></w:r>";
strm << L"<w:r><w:instrText>FORMDROPDOWN</w:instrText></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
strm << L"<w:r><w:t>" << text_ << L"</w:t></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:label
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_label::ns = L"text";
const wchar_t * text_label::name = L"label";
void text_label::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:value", text_value_);
}
void text_label::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
strm << L"<w:listEntry w:val=\"" << text_value_.get_value_or(L"") << L"\"/>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * sheet_name::ns = L"text";
const wchar_t * sheet_name::name = L"sheet-name";

View File

@ -122,7 +122,6 @@ private:
_CP_OPT(unsigned int) text_c_;
_CP_OPT(std::wstring) content_;
};
CP_REGISTER_OFFICE_ELEMENT2(s);
// text:tab
@ -431,7 +430,6 @@ CP_REGISTER_OFFICE_ELEMENT2(a);
// text:note
//////////////////////////////////////////////////////////////////////////////////////////////////
class note : public paragraph_content_element<note>
{
public:
@ -452,18 +450,16 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(note);
// text:ruby
//////////////////////////////////////////////////////////////////////////////////////////////////
class ruby : public paragraph_content_element<ruby>
{
public:
@ -485,7 +481,6 @@ private:
office_element_ptr text_ruby_text_;
};
CP_REGISTER_OFFICE_ELEMENT2(ruby);
class common_field_fixed_attlist
@ -521,8 +516,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
office_element_ptr_array content_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -549,7 +544,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -577,7 +572,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -687,7 +682,7 @@ public:
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_;
office_element_ptr_array text_;
private:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -715,8 +710,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
//-------------------------------------------------------------------------------------------------------------------
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_time : public paragraph_content_element<text_time>
{
public:
@ -745,8 +741,9 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(text_time);
//-------------------------------------------------------------------------------------------------------------------
// text:modification-date
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_modification_time : public text_time
{
public:
@ -762,8 +759,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_time);
//-------------------------------------------------------------------------------------------------------------------
// text:file-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_file_name : public paragraph_content_element<text_file_name>
{
public:
@ -787,11 +785,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_file_name);
//-------------------------------------------------------------------------------------------------------------------
// text:sequence
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sequence : public paragraph_content_element<sequence>
{
public:
@ -815,11 +813,58 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sequence);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_drop_down : public paragraph_content_element<text_drop_down>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextDropDown;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
_CP_OPT(std::wstring) text_name_;
office_element_ptr_array content_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_drop_down);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_label : public paragraph_content_element<text_label>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextLabel;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
_CP_OPT(std::wstring) text_value_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_label);
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sheet_name : public paragraph_content_element<sheet_name>
{
public:
@ -837,11 +882,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sheet_name);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:footer
//-------------------------------------------------------------------------------------------------------------------
class presentation_footer : public paragraph_content_element<presentation_footer>
{
public:
@ -861,8 +906,9 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_footer);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:date-time
//-------------------------------------------------------------------------------------------------------------------
class presentation_date_time: public paragraph_content_element<presentation_date_time>
{
public:

View File

@ -33,7 +33,6 @@
#include "ruby.h"
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/xmlchar.h>

Some files were not shown because too many files have changed in this diff Show More