mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
495 Commits
v5.4.1.5
...
v5.5.99.20
| Author | SHA1 | Date | |
|---|---|---|---|
| 52b9a4b683 | |||
| 6d949ed6bf | |||
| 61973714b9 | |||
| 4b2656b07c | |||
| 9c5e79619a | |||
| 302f3aa7b6 | |||
| daf05b4410 | |||
| a103fc00b5 | |||
| f9de7868c5 | |||
| e72a4f2c76 | |||
| 374d005e14 | |||
| 106880b7f4 | |||
| de9d2b303d | |||
| 4082244e80 | |||
| ec8a674be4 | |||
| f917165411 | |||
| f4b46d144d | |||
| add0ab9dd3 | |||
| afedec1dd2 | |||
| 75386cab65 | |||
| 7df59d9491 | |||
| dcda192c0a | |||
| 961bde6723 | |||
| 2261de2884 | |||
| 7bc4ab9655 | |||
| 5e6d2f12d5 | |||
| fb7d20c7e0 | |||
| 60ba4407b9 | |||
| ba518d7c85 | |||
| a045f57430 | |||
| b10274c65d | |||
| 567ecfb5e2 | |||
| cd62b1d5c0 | |||
| 7a32e5f163 | |||
| a79fa0a2c5 | |||
| 2c64e08e3c | |||
| c1e4a2ce33 | |||
| c277590e3b | |||
| 42c89ac604 | |||
| bfc691741a | |||
| 517e71a6fb | |||
| ab68837a90 | |||
| ba122b98f0 | |||
| 8900c58bd3 | |||
| 6573ce860e | |||
| 681935eb68 | |||
| afd58646be | |||
| 4503678e2c | |||
| 1bc81c9be9 | |||
| 1cffeea6ab | |||
| d4b91d828a | |||
| 5e36f80c93 | |||
| 49a1a2d6a1 | |||
| 6389bd4d3d | |||
| 92c2aa3d06 | |||
| a25ecc22fb | |||
| 8417eedf84 | |||
| 89e88c03c4 | |||
| 785f5ae1db | |||
| aaf3fb5652 | |||
| 6bdcfe53de | |||
| ee091e7ca9 | |||
| 4eb58cd967 | |||
| d0df8d17a1 | |||
| 8751075b26 | |||
| d1b70c416a | |||
| f9c71dff07 | |||
| 8b49cc5463 | |||
| fbd4ad1565 | |||
| 45b3b568b6 | |||
| a654eb9396 | |||
| 7ab24309ee | |||
| 10b087b946 | |||
| baa9a19b70 | |||
| 5a416e201a | |||
| 3d814e7b40 | |||
| 5eb1fac52c | |||
| 987396b426 | |||
| 9caaab8942 | |||
| 52e558103b | |||
| 7c723b6c2a | |||
| 0e782ab80f | |||
| 2e2218d495 | |||
| 5f44b7fea0 | |||
| 824c59cbd8 | |||
| 06b4a03ebc | |||
| 1cb65a3f4f | |||
| 7259801cd5 | |||
| 1256f87df0 | |||
| 4512d9e22c | |||
| 49d51257ba | |||
| 7d5f2a4d41 | |||
| 46df190a44 | |||
| 13d7538d4e | |||
| f912aa1fb5 | |||
| bb65549dc1 | |||
| a99eaf1ec4 | |||
| a25e9e98c8 | |||
| 6015132652 | |||
| ac0c16e475 | |||
| 5294089fd0 | |||
| 3ec24e5e39 | |||
| dc44dc5e84 | |||
| cf76de8811 | |||
| 86421d8235 | |||
| 5e77e96e5f | |||
| 2f4296001a | |||
| 1ba171c2fe | |||
| 75e64e8c1d | |||
| 916c61483d | |||
| 0bf013e118 | |||
| 973b89609d | |||
| 93d96145b9 | |||
| cb48a131ce | |||
| a0c0171d12 | |||
| 736476f9cc | |||
| d5c5c4b8cf | |||
| 8e0e8e96af | |||
| 23b4fb4722 | |||
| 93f6d44759 | |||
| 23546dc602 | |||
| 89976b31dd | |||
| 60904a6df0 | |||
| 07295de852 | |||
| 72315d1229 | |||
| fef5735437 | |||
| 61f4ef0f3c | |||
| e3c66e7f54 | |||
| 91918313b4 | |||
| abb5fd1ec1 | |||
| fd6beb0044 | |||
| 3e8816786a | |||
| 1b6eff5cb7 | |||
| f018582446 | |||
| 4fc6511b37 | |||
| 52ff8af2be | |||
| d29475b6fb | |||
| 32e7193212 | |||
| 23fc146eca | |||
| c4ac29a97d | |||
| 9c24d4a4bb | |||
| bd579b8004 | |||
| 7fd9e52bc3 | |||
| dd13f9f24c | |||
| a2d9c972c1 | |||
| 0fe3c3ece5 | |||
| 963d2f9589 | |||
| d5574186b1 | |||
| 5d148a6d0d | |||
| d7af2cb41d | |||
| ed5bfb7b27 | |||
| b81e988da5 | |||
| a7c868d3d1 | |||
| d34d80788b | |||
| a381305a9f | |||
| bb022c49bd | |||
| 31e8a1cbdd | |||
| a19074993d | |||
| 2621ff9b5c | |||
| 0a1c718cc0 | |||
| 751e39960c | |||
| bc0bb1a721 | |||
| fb5da5e4ff | |||
| addd684e4a | |||
| 293f3c6cef | |||
| 61a157a3c4 | |||
| a7ba4c471e | |||
| d9d161655c | |||
| 8c18843b58 | |||
| 04d796d760 | |||
| 12c427b11e | |||
| 9415983797 | |||
| e82ea1bc5c | |||
| b100cb3927 | |||
| 2b3a0cd5b3 | |||
| 49f4bdb933 | |||
| 911fe73f58 | |||
| a577378a1e | |||
| 997bf0b887 | |||
| 428a2652de | |||
| 0580375bf4 | |||
| 51c1b7d21a | |||
| c8fbd13a31 | |||
| 4b0ce196e8 | |||
| ddacd8f2b0 | |||
| 49597e16ab | |||
| 7a713f925f | |||
| d64bfc230a | |||
| 938d593fc4 | |||
| b96189c213 | |||
| 987e6b6e76 | |||
| a39652e1eb | |||
| f62781de18 | |||
| aefef93e21 | |||
| 4d4142f3ae | |||
| 22f9c5188d | |||
| 1781318bad | |||
| b936394a68 | |||
| 38926d086c | |||
| f49d3756ea | |||
| dcb0621e5f | |||
| 5a5a444f42 | |||
| 9b608b2f76 | |||
| 2c04e9fb57 | |||
| 4142577664 | |||
| 30e92bab83 | |||
| 6957af8450 | |||
| 9ba350035f | |||
| f356755725 | |||
| d865ec0b59 | |||
| 2cdbcf4017 | |||
| 319a66181a | |||
| e6007815a2 | |||
| e4090bb123 | |||
| b9d6e370ca | |||
| 0b5e521f0d | |||
| 593e18225e | |||
| c064daed08 | |||
| 838d506af6 | |||
| 56482f0524 | |||
| dbf78d4c9f | |||
| e1ec5066f5 | |||
| 70cefc0467 | |||
| 3b4d6147b3 | |||
| 8114811bce | |||
| 006d79851a | |||
| 656b443af7 | |||
| fa472b3d9f | |||
| b901073171 | |||
| 03404d74a4 | |||
| 2154cb1dba | |||
| f3fb3f7ca7 | |||
| 3d154f9915 | |||
| 20090072ae | |||
| 7a0c3c9bfa | |||
| 0cfb79f2aa | |||
| 405e5a4aaa | |||
| 45cfdde703 | |||
| 5fe7642ad7 | |||
| bd85ec1b10 | |||
| 18d61f9f14 | |||
| cee502b855 | |||
| 524eac388e | |||
| 9197a889a2 | |||
| 0daaf560ae | |||
| e7c87085a7 | |||
| 1b445aa3bb | |||
| 9a5cb77ca0 | |||
| 39ddc7582f | |||
| 6225da01dc | |||
| 0e17401c16 | |||
| 00b16d548c | |||
| 9f5b114106 | |||
| b277385d4f | |||
| e91718f11b | |||
| aacc6faf88 | |||
| 442413f4a8 | |||
| 4f69be6dc5 | |||
| 6522ded7d9 | |||
| 68f2c3f6eb | |||
| 6a8d109a47 | |||
| 0ffe61b2fc | |||
| f38e31a081 | |||
| 9a925ffa1b | |||
| f47b968000 | |||
| 1dfef1f347 | |||
| f774f78a8d | |||
| 699e533fff | |||
| 88fcbcee28 | |||
| f754f81e6b | |||
| 19ae5946b9 | |||
| 3b8959b8a3 | |||
| 0b651a95bc | |||
| 43ce595c92 | |||
| 9ba07b30f0 | |||
| 4c956f9a91 | |||
| ca5307dd5d | |||
| ca348a9ea9 | |||
| e94dfb53b0 | |||
| b4d1b414ee | |||
| 19ec211697 | |||
| 384d51318c | |||
| 5a00bfb7b8 | |||
| 453b3dc2b6 | |||
| 6d70e67649 | |||
| 1e8b88b032 | |||
| 2f078de341 | |||
| ec7d1efc93 | |||
| ea99cf21b4 | |||
| 0b8b524ebc | |||
| 1097518927 | |||
| 26a9eda4ea | |||
| 3012252048 | |||
| f3fd70a895 | |||
| 998742d331 | |||
| 0e9f4386cc | |||
| 0b518d2272 | |||
| 44b4a808c4 | |||
| 3e6c04fdf2 | |||
| f2c4f429b7 | |||
| 2565ccacd7 | |||
| f914bc03ea | |||
| 06b73865b8 | |||
| 3e651985c1 | |||
| 9ead37d43f | |||
| 26b1b5acf0 | |||
| 194cd7b9dd | |||
| 1724504378 | |||
| 9b75205de1 | |||
| 4b78d15845 | |||
| 93108c244a | |||
| fd1bc80682 | |||
| 723c0f9f34 | |||
| 86fd036bad | |||
| 932ec85676 | |||
| 84919a9a02 | |||
| bd702e9c61 | |||
| 5d7348ac8a | |||
| a547fa8ad1 | |||
| 30424c3c1f | |||
| 4e3dda042d | |||
| 40009363ee | |||
| 70ccf677c3 | |||
| 50032f2fbf | |||
| 04c0030a85 | |||
| 95a8c7870b | |||
| b58194b5b4 | |||
| be35df9b5c | |||
| b638f6336a | |||
| 79cfaed6a8 | |||
| f677bf91e9 | |||
| 3f5bc0f444 | |||
| c2cd9b7b87 | |||
| 68ad5e9515 | |||
| d808689cb3 | |||
| f736a6e5fa | |||
| 460b087b1f | |||
| 447b590365 | |||
| af50daa022 | |||
| 89df29b945 | |||
| b5b35f1d3d | |||
| b48406c941 | |||
| 47826b7e23 | |||
| b9865d09c7 | |||
| d4577a487e | |||
| 36332af06e | |||
| 8c93208255 | |||
| 7d45cfaf45 | |||
| 858def093f | |||
| be04366d4c | |||
| 8ab28c7ad3 | |||
| 8d6249f9a5 | |||
| 1bc6615534 | |||
| 6d46824387 | |||
| 84a9194649 | |||
| f8c7bda679 | |||
| ea6f776dcb | |||
| 9254479612 | |||
| 4f01ab3f7a | |||
| e2d2e2a7f2 | |||
| 32909effd9 | |||
| 354a02b94c | |||
| 195520d21c | |||
| 3d2069592c | |||
| 368ccff384 | |||
| 6774ab10f5 | |||
| d3110f5c43 | |||
| 015146a927 | |||
| ecbfefeb5c | |||
| 57d0475281 | |||
| 88aa8a4c54 | |||
| 56348548be | |||
| b21ff58336 | |||
| baaa6ed85b | |||
| 8f3ae7e04b | |||
| 542d000435 | |||
| 9edd45f1bb | |||
| d9eb4f2cdc | |||
| 590da3344b | |||
| 81a50062b1 | |||
| c204d77b0d | |||
| c6750bb7bc | |||
| 53d4825b13 | |||
| 0be8ff94a1 | |||
| 7d7d60bf08 | |||
| c5c1911791 | |||
| 0fb95e259c | |||
| 5db9ebe93a | |||
| 39ed75c19c | |||
| 5b9688e087 | |||
| bd92dcf80b | |||
| f77dfa7825 | |||
| c26dc8cd78 | |||
| c7308f4211 | |||
| cbb2628856 | |||
| ae90c75b78 | |||
| 5be7ca2bc5 | |||
| 79bccd5002 | |||
| 254db1fc2c | |||
| d6735d1fb5 | |||
| 9b3944a017 | |||
| 6ebeaae305 | |||
| 8cdaf43001 | |||
| ee0329cc1d | |||
| 52bf8581e7 | |||
| afc60a62a7 | |||
| cb25a15a36 | |||
| cd0e152dbe | |||
| 8d014ee27a | |||
| 67a09bf28e | |||
| 9b1e705347 | |||
| 4f09747caf | |||
| 3af89f83eb | |||
| d4f2f69ed0 | |||
| 21984680ce | |||
| 6e2e23f5d0 | |||
| 06b5f0e8b8 | |||
| 484f6d2889 | |||
| 1eaa656001 | |||
| 5075d49b40 | |||
| d5529f4077 | |||
| b4240ca49b | |||
| b04c6b2f87 | |||
| 9d3b9ef021 | |||
| 01577278f0 | |||
| f97050a685 | |||
| 2715c774ed | |||
| aa545edf3d | |||
| 7626d6d75f | |||
| c8def9eb7b | |||
| cba74d6e8d | |||
| 62c9490282 | |||
| 048318e341 | |||
| 0f25a738d5 | |||
| 0d327e7743 | |||
| 49ee434202 | |||
| 8b3f1b9d86 | |||
| a76e93cea6 | |||
| c26252d25f | |||
| 2e23b79ab8 | |||
| 7faa83eb8a | |||
| 6d6d097069 | |||
| e9c1deaca6 | |||
| 0b34858d49 | |||
| b900613df1 | |||
| 095c53a61a | |||
| 640b914ff8 | |||
| e48be100ed | |||
| 429b4f1245 | |||
| cc7dee211a | |||
| 3238d504eb | |||
| aeda8ec571 | |||
| ec440d0bd3 | |||
| 2d094ae872 | |||
| 839c180d8c | |||
| 3f55d6d4ff | |||
| d67a4b9f6e | |||
| eb9242cba0 | |||
| 11eb11e502 | |||
| cf4451e60f | |||
| 1e2b9dbc34 | |||
| 7d7b4b816f | |||
| 5405763b05 | |||
| 0b468d5dd5 | |||
| 50477b5091 | |||
| f53103efe0 | |||
| f57e9718b9 | |||
| a747f96a9d | |||
| c5db9cf61f | |||
| c0cf748677 | |||
| 148d6b01ef | |||
| 54dbe697f1 | |||
| 66d534a415 | |||
| c215344550 | |||
| 9fb9fd3511 | |||
| 246474a2f7 | |||
| af0f878de2 | |||
| fc8d16196d | |||
| 41fc3eb8c1 | |||
| 53878c9d88 | |||
| 677982b4ce | |||
| e7290f5ad9 | |||
| 816c43bffe | |||
| 8dd58a2050 | |||
| e96221c83b | |||
| 2a4ee72059 | |||
| 9a3e9a9851 | |||
| 41920875ff | |||
| 0ae9b97774 | |||
| c644c419ec | |||
| 3874b56289 | |||
| 29df40407e | |||
| e3ff8912f0 | |||
| ae6d231acc | |||
| 98114aa7a5 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -3,13 +3,17 @@ dictionaries/
|
||||
LicenceManager/
|
||||
Common/boost_1_58_0
|
||||
Common/3dParty/boost/boost_1_58_0
|
||||
Common/3dParty/boost/boost.data
|
||||
Common/3dParty/boost/ios
|
||||
Common/3dParty/boost/osx
|
||||
Common/3dParty/icu/icu
|
||||
Common/3dParty/icu/win_64
|
||||
Common/3dParty/icu/win_32
|
||||
Common/3dParty/icu/linux_64
|
||||
Common/3dParty/icu/linux_32
|
||||
Common/3dParty/icu/mac_64
|
||||
Common/3dParty/icu/ios
|
||||
Common/3dParty/icu/mac-build
|
||||
Common/3dParty/cef/win_64
|
||||
Common/3dParty/cef/win_32
|
||||
Common/3dParty/cef/linux_64
|
||||
@ -44,6 +48,7 @@ Common/3dParty/openssl/openssl
|
||||
Thumbs.db
|
||||
*.xcuserstate
|
||||
*.xcuserdatad
|
||||
**/Makefile.*
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.idl
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.tlb
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.h
|
||||
@ -51,7 +56,6 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_i.c
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
|
||||
ASCOfficeXlsFile2/win32/dlldata.c
|
||||
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
X2tConverter/**/Makefile.*
|
||||
X2tConverter/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/Makefile
|
||||
X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
*.7z
|
||||
|
||||
14
.travis.yml
14
.travis.yml
@ -1,14 +0,0 @@
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- p7zip-full
|
||||
script:
|
||||
- exit 0
|
||||
# Build fails anyway. See explanation in
|
||||
# https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
|
||||
- cd Common/3dParty && ./make.sh
|
||||
- cd ../../
|
||||
- make
|
||||
@ -641,7 +641,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
std::string sCodePage;
|
||||
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
|
||||
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
|
||||
@ -653,7 +653,7 @@ namespace DocFileFormat
|
||||
sCodePage = "CP1250"/* + std::to_string(code_page)*/;
|
||||
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, size, sCodePage.c_str());
|
||||
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, (unsigned int)size, sCodePage.c_str());
|
||||
|
||||
for (size_t i = 0; i < unicode_string.size(); i++)
|
||||
{
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
@ -112,7 +113,10 @@ namespace XMLTools
|
||||
class XMLElement
|
||||
========================================================================================================*/
|
||||
|
||||
class XMLElement
|
||||
class XMLElement;
|
||||
typedef class boost::shared_ptr<XMLElement> XMLElementPtr;
|
||||
|
||||
class XMLElement
|
||||
{
|
||||
typedef std::pair< std::wstring, std::wstring> AttributeValuePair;
|
||||
|
||||
@ -180,7 +184,20 @@ namespace XMLTools
|
||||
}
|
||||
m_Elements.push_back( element );
|
||||
}
|
||||
void AppendChild( XMLElementPtr element, bool uniq = false)
|
||||
{
|
||||
if (!element) return;
|
||||
|
||||
if (m_ChildMap.find(element->GetName()) != m_ChildMap.end())
|
||||
{
|
||||
if (uniq) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ChildMap.insert(m_ChildMap.end(), std::pair<std::wstring, int>(element->GetName(), 0));
|
||||
}
|
||||
m_Elements.push_back( *element.get() );
|
||||
}
|
||||
void RemoveChild( const XMLElement& element )
|
||||
{
|
||||
m_Elements.remove( element );
|
||||
@ -368,7 +385,6 @@ namespace XMLTools
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CStringXmlWriter
|
||||
{
|
||||
std::wstring m_str;
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
Converter::Converter()
|
||||
Converter::Converter() : m_nUserLCID(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ namespace DocFileFormat
|
||||
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
{
|
||||
WordDocument doc(progress, m_sTempFolder);
|
||||
WordDocument doc(progress, m_sTempFolder, m_nUserLCID);
|
||||
WordprocessingDocument docx(strDstDirectory, &doc);
|
||||
|
||||
_UINT32 result = doc.LoadDocument(strSrcFile, password);
|
||||
|
||||
@ -48,6 +48,7 @@ namespace DocFileFormat
|
||||
~Converter();
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
int m_nUserLCID;
|
||||
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
|
||||
|
||||
@ -1344,7 +1344,7 @@ namespace DocFileFormat
|
||||
{
|
||||
ParagraphPropertyExceptions* backup = _lastValidPapx;
|
||||
|
||||
std::map<short, short> boundaries;
|
||||
std::map<short, short> mapBoundaries;
|
||||
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
@ -1406,19 +1406,26 @@ namespace DocFileFormat
|
||||
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
|
||||
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
|
||||
|
||||
AddBoundary(boundary1, boundary2, boundaries);
|
||||
//if (boundary1 < 0) boundary1 = 0;
|
||||
//if (boundary2 < 0) boundary2 = 0;
|
||||
|
||||
mapBoundaries.insert(std::make_pair(boundary1, 0));
|
||||
mapBoundaries.insert(std::make_pair(boundary2, 0));
|
||||
//AddBoundary(boundary1, boundary2, mapBoundaries);
|
||||
}
|
||||
if (max_boundary < boundary2)
|
||||
max_boundary = boundary2;
|
||||
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
mapBoundaries.insert(std::make_pair(boundary2, 0));
|
||||
mapBoundaries.insert(std::make_pair(max_boundary, 0));
|
||||
//AddBoundary(boundary2, max_boundary, mapBoundaries);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nestingLevel != iTap_current && fEndNestingLevel && !boundaries.empty())
|
||||
if (nestingLevel != iTap_current && fEndNestingLevel && !mapBoundaries.empty())
|
||||
break;
|
||||
//get the next papx
|
||||
papx = findValidPapx( fcRowEnd );
|
||||
@ -1431,11 +1438,16 @@ namespace DocFileFormat
|
||||
|
||||
}
|
||||
|
||||
if ( !boundaries.empty() )
|
||||
if ( !mapBoundaries.empty() )
|
||||
{
|
||||
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
|
||||
std::map<short, short>::iterator it = mapBoundaries.begin();
|
||||
std::map<short, short>::iterator it_next = it; it_next++;
|
||||
|
||||
for ( ; it_next != mapBoundaries.end(); ++it_next, ++it)
|
||||
{
|
||||
grid.push_back( it->second );
|
||||
int sz = it_next->first - it->first;
|
||||
if (sz > 2)
|
||||
grid.push_back( it_next->first - it->first );
|
||||
}
|
||||
}
|
||||
_lastValidPapx = backup;
|
||||
|
||||
@ -122,7 +122,8 @@ namespace DocFileFormat
|
||||
fNumber1 == val.fNumber1 &&
|
||||
fNumberAcross == val.fNumberAcross &&
|
||||
fRestartHdn == val.fRestartHdn &&
|
||||
fSpareX == val.fSpareX;
|
||||
fSpareX == val.fSpareX &&
|
||||
xst == val.xst;
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -158,7 +159,8 @@ namespace DocFileFormat
|
||||
fNumber1 == val->fNumber1 &&
|
||||
fNumberAcross == val->fNumberAcross &&
|
||||
fRestartHdn == val->fRestartHdn &&
|
||||
fSpareX == val->fSpareX;
|
||||
fSpareX == val->fSpareX &&
|
||||
xst == val->xst;
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
@ -129,6 +129,7 @@ namespace DocFileFormat
|
||||
std::wstring xst; //32 chars ansi
|
||||
|
||||
public:
|
||||
std::wstring rPr;
|
||||
|
||||
bool operator == (const NumberingDescriptor & val) const;
|
||||
bool operator == (const NumberingDescriptorPtr & val) const;
|
||||
|
||||
@ -72,16 +72,17 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
size_t ListTable::appendNumbering( NumberingDescriptorPtr &desc )
|
||||
size_t ListTable::appendNumbering( NumberingDescriptorPtr &desc, const std::wstring & rPr )
|
||||
{
|
||||
for (size_t i = 0; i < listNumbering.size(); ++i)
|
||||
{
|
||||
if (listNumbering[i]->operator==(desc))
|
||||
if (listNumbering[i]->operator == (desc))
|
||||
{
|
||||
return listNumbering[i]->id;
|
||||
}
|
||||
}
|
||||
desc->id = listData.size() + listNumbering.size()/* + 1*/;
|
||||
desc->rPr = rPr;
|
||||
desc->id = listData.size() + listNumbering.size() + 1; // 23.doc
|
||||
listNumbering.push_back(desc);
|
||||
return desc->id;
|
||||
}
|
||||
|
||||
@ -47,6 +47,6 @@ namespace DocFileFormat
|
||||
virtual ~ListTable();
|
||||
ListTable( FileInformationBlock* fib, POLE::Stream* tableStream );
|
||||
|
||||
size_t appendNumbering( NumberingDescriptorPtr &desc );
|
||||
size_t appendNumbering( NumberingDescriptorPtr &desc, const std::wstring & rPr );
|
||||
};
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace DocFileFormat
|
||||
m_document->DocProperties->bDisplayBackgroundShape = true;
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeBackgound();
|
||||
|
||||
ODRAW::OfficeArtFOPTEPtr boolFill = pShape->ExtractOption(fillStyleBooleanProperties);
|
||||
ODRAW::OfficeArtFOPTEPtr boolFill = pShape->ExtractOption(ODRAW::fillStyleBooleanProperties);
|
||||
|
||||
ODRAW::FillStyleBooleanProperties* booleans = dynamic_cast<ODRAW::FillStyleBooleanProperties*>(boolFill.get());
|
||||
|
||||
|
||||
@ -540,17 +540,24 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:pPr");
|
||||
|
||||
// rPr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:rPr", FALSE );
|
||||
|
||||
if (!fontFamily.empty())
|
||||
if (false == lvl->rPr.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:rFonts", TRUE );
|
||||
// w:hint="default"
|
||||
m_pXmlWriter->WriteAttribute(L"w:hAnsi",fontFamily);
|
||||
m_pXmlWriter->WriteAttribute(L"w:ascii",fontFamily);
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
m_pXmlWriter->WriteString( lvl->rPr );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:rPr", FALSE );
|
||||
|
||||
if (!fontFamily.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:rFonts", TRUE );
|
||||
// w:hint="default"
|
||||
m_pXmlWriter->WriteAttribute(L"w:hAnsi", fontFamily);
|
||||
m_pXmlWriter->WriteAttribute(L"w:ascii", fontFamily);
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:rPr");
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:rPr");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:lvl");
|
||||
}
|
||||
@ -702,7 +709,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (isPictureBullet)
|
||||
if (isPictureBullet && false == m_document->PictureBulletsCPsMap.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:lvlPicBulletId",TRUE);
|
||||
m_pXmlWriter->WriteAttribute(L"w:val",FormatUtils::IntToWideString(index));
|
||||
|
||||
@ -80,7 +80,7 @@ namespace DocFileFormat
|
||||
ShapeOptions* sh_options = dynamic_cast<ShapeOptions*>( this->Children[j] );
|
||||
if (sh_options)
|
||||
{
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(ODRAW::pib))
|
||||
{
|
||||
m_nShapeType = msosptPictureFrame;
|
||||
}
|
||||
@ -101,7 +101,7 @@ namespace DocFileFormat
|
||||
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
ODRAW::OfficeArtFOPTEPtr ExtractOption(const PropertyId & prop) const
|
||||
ODRAW::OfficeArtFOPTEPtr ExtractOption(const ODRAW::ePropertyId & prop) const
|
||||
{
|
||||
ODRAW::OfficeArtFOPTEPtr ret;
|
||||
|
||||
@ -111,7 +111,7 @@ namespace DocFileFormat
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
std::map<PropertyId, ODRAW::OfficeArtFOPTEPtr>::iterator pFind = opt->OptionsByID.find(prop);
|
||||
std::map<ODRAW::ePropertyId, ODRAW::OfficeArtFOPTEPtr>::iterator pFind = opt->OptionsByID.find(prop);
|
||||
if (pFind != opt->OptionsByID.end())
|
||||
{
|
||||
ret = pFind->second;
|
||||
|
||||
@ -36,432 +36,6 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
typedef enum _PropertyId
|
||||
{
|
||||
//Transform
|
||||
PropertyId_left=0,
|
||||
PropertyId_top=1,
|
||||
PropertyId_right=2,
|
||||
PropertyId_bottom=3,
|
||||
PropertyId_rotation=4,
|
||||
PropertyId_gvPage=5,
|
||||
PropertyId_fChangePage=61,
|
||||
PropertyId_fFlipV=62,
|
||||
PropertyId_fFlipH=63,
|
||||
|
||||
//Protection
|
||||
//fLockAgainstUngrouping=118,
|
||||
//fLockRotation=119,
|
||||
//fLockAspectRatio=120,
|
||||
//fLockPosition=121,
|
||||
//fLockAgainstSelect=122,
|
||||
//fLockCropping=123,
|
||||
//fLockVertices=124,
|
||||
//fLockText=125,
|
||||
//fLockAdjustHandles=126,
|
||||
protectionBooleans=127,
|
||||
|
||||
//Text
|
||||
lTxid=128,
|
||||
dxTextLeft=129,
|
||||
dyTextTop=130,
|
||||
dxTextRight=131,
|
||||
dyTextBottom=132,
|
||||
WrapText=133,
|
||||
scaleText=134,
|
||||
anchorText=135,
|
||||
txflTextFlow=136,
|
||||
cdirFont=137,
|
||||
hspNext=138,
|
||||
txdir=139,
|
||||
ccol=140,
|
||||
dzColMargin=141,
|
||||
|
||||
textBooleanProperties=191,
|
||||
|
||||
//GeoText
|
||||
gtextUNICODE=192,
|
||||
gtextRTF=193,
|
||||
gtextAlign=194,
|
||||
gtextSize=195,
|
||||
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,
|
||||
geometryTextBooleanProperties=255,
|
||||
|
||||
//BLIP
|
||||
cropFromTop=256,
|
||||
cropFromBottom=257,
|
||||
cropFromLeft=258,
|
||||
cropFromRight=259,
|
||||
Pib=260,
|
||||
pibName=261,
|
||||
pibFlags=262,
|
||||
pictureTransparent=263,
|
||||
pictureContrast=264,
|
||||
pictureBrightness=265,
|
||||
pictureGamma=266,
|
||||
pictureId=267,
|
||||
pictureDblCrMod=268,
|
||||
pictureFillCrMod=269,
|
||||
pictureLineCrMod=270,
|
||||
pibPrint=271,
|
||||
pibPrintName=272,
|
||||
pibPrintFlags=273,
|
||||
movie=274,
|
||||
pictureRecolor=282,
|
||||
picturePreserveGrays=313,
|
||||
|
||||
blipBooleanProperties=319,
|
||||
|
||||
//Geometry
|
||||
geoLeft=320,
|
||||
geoTop=321,
|
||||
geoRight=322,
|
||||
geoBottom=323,
|
||||
shapePath=324,
|
||||
pVertices=325,
|
||||
pSegmentInfo=326,
|
||||
adjustValue=327,
|
||||
adjust2Value=328,
|
||||
adjust3Value=329,
|
||||
adjust4Value=330,
|
||||
adjust5Value=331,
|
||||
adjust6Value=332,
|
||||
adjust7Value=333,
|
||||
adjust8Value=334,
|
||||
adjust9Value=335,
|
||||
adjust10Value=336,
|
||||
pConnectionSites=337,
|
||||
pConnectionSitesDir=338,
|
||||
xLimo=339,
|
||||
yLimo=340,
|
||||
pAdjustHandles=341,
|
||||
pGuides=342,
|
||||
pInscribe=343,
|
||||
cxk=344,
|
||||
pFragments=345,
|
||||
|
||||
geometryBooleans=383,
|
||||
|
||||
//Fill Style
|
||||
fillType=384,
|
||||
fillColor=385,
|
||||
fillOpacity=386,
|
||||
fillBackColor=387,
|
||||
fillBackOpacity=388,
|
||||
fillCrMod=389,
|
||||
fillBlip=390,
|
||||
fillBlipName=391,
|
||||
fillBlipFlags=392,
|
||||
fillWidth=393,
|
||||
fillHeight=394,
|
||||
fillAngle=395,
|
||||
fillFocus=396,
|
||||
fillToLeft=397,
|
||||
fillToTop=398,
|
||||
fillToRight=399,
|
||||
fillToBottom=400,
|
||||
fillRectLeft=401,
|
||||
fillRectTop=402,
|
||||
fillRectRight=403,
|
||||
fillRectBottom=404,
|
||||
fillDztype=405,
|
||||
fillShadePreset=406,
|
||||
fillShadeColors=407,
|
||||
fillOriginX=408,
|
||||
fillOriginY=409,
|
||||
fillShapeOriginX=410,
|
||||
fillShapeOriginY=411,
|
||||
fillShadeType=412,
|
||||
|
||||
fillColorExt=414,
|
||||
fillColorExtMod=416,
|
||||
fillBackColorExt=418,
|
||||
fillBackColorExtMod=420,
|
||||
|
||||
fillStyleBooleanProperties=447,
|
||||
|
||||
//Line Style
|
||||
lineColor=448,
|
||||
lineOpacity=449,
|
||||
lineBackColor=450,
|
||||
lineCrMod=451,
|
||||
lineType=452,
|
||||
lineFillBlip=453,
|
||||
lineFillBlipName=454,
|
||||
lineFillBlipFlags=455,
|
||||
lineFillWidth=456,
|
||||
lineFillHeight=457,
|
||||
lineFillDztype=458,
|
||||
lineWidth=459,
|
||||
lineMiterLimit=460,
|
||||
lineStyle=461,
|
||||
lineDashing=462,
|
||||
lineDashStyle=463,
|
||||
lineStartArrowhead=464,
|
||||
lineEndArrowhead=465,
|
||||
lineStartArrowWidth=466,
|
||||
lineStartArrowLength=467,
|
||||
lineEndArrowWidth=468,
|
||||
lineEndArrowLength=469,
|
||||
lineJoinStyle=470,
|
||||
lineEndCapStyle=471,
|
||||
|
||||
lineStyleBooleans=511,
|
||||
|
||||
//Shadow Style
|
||||
shadowType=512,
|
||||
shadowColor=513,
|
||||
shadowHighlight=514,
|
||||
shadowCrMod=515,
|
||||
shadowOpacity=516,
|
||||
shadowOffsetX=517,
|
||||
shadowOffsetY=518,
|
||||
shadowSecondOffsetX=519,
|
||||
shadowSecondOffsetY=520,
|
||||
shadowScaleXToX=521,
|
||||
shadowScaleYToX=522,
|
||||
shadowScaleXToY=523,
|
||||
shadowScaleYToY=524,
|
||||
shadowPerspectiveX=525,
|
||||
shadowPerspectiveY=526,
|
||||
shadowWeight=527,
|
||||
shadowOriginX=528,
|
||||
shadowOriginY=529,
|
||||
|
||||
shadowStyleBooleanProperties=575,
|
||||
|
||||
//Perspective Style
|
||||
perspectiveType=576,
|
||||
perspectiveOffsetX=577,
|
||||
perspectiveOffsetY=578,
|
||||
perspectiveScaleXToX=579,
|
||||
perspectiveScaleYToX=580,
|
||||
perspectiveScaleXToY=581,
|
||||
perspectiveScaleYToY=582,
|
||||
perspectivePerspectiveX=583,
|
||||
perspectivePerspectiveY=584,
|
||||
perspectiveWeight=585,
|
||||
perspectiveOriginX=586,
|
||||
perspectiveOriginY=587,
|
||||
|
||||
perspectiveStyleBooleanProperties=639,
|
||||
|
||||
//3D Object
|
||||
c3DSpecularAmt=640,
|
||||
c3DDiffuseAmt=641,
|
||||
c3DShininess=642,
|
||||
c3DEdgeThickness=643,
|
||||
C3DExtrudeForward=644,
|
||||
c3DExtrudeBackward=645,
|
||||
c3DExtrudePlane=646,
|
||||
c3DExtrusionColor=647,
|
||||
c3DCrMod=648,
|
||||
|
||||
threeDObjectBooleanProperties=703,
|
||||
|
||||
//3D Style
|
||||
c3DYRotationAngle=704,
|
||||
c3DXRotationAngle=705,
|
||||
c3DRotationAxisX=706,
|
||||
c3DRotationAxisY=707,
|
||||
c3DRotationAxisZ=708,
|
||||
c3DRotationAngle=709,
|
||||
c3DRotationCenterX=710,
|
||||
c3DRotationCenterY=711,
|
||||
c3DRotationCenterZ=712,
|
||||
c3DRenderMode=713,
|
||||
c3DTolerance=714,
|
||||
c3DXViewpoint=715,
|
||||
c3DYViewpoint=716,
|
||||
c3DZViewpoint=717,
|
||||
c3DOriginX=718,
|
||||
c3DOriginY=719,
|
||||
c3DSkewAngle=720,
|
||||
c3DSkewAmount=721,
|
||||
c3DAmbientIntensity=722,
|
||||
c3DKeyX=723,
|
||||
c3DKeyY=724,
|
||||
c3DKeyZ=725,
|
||||
c3DKeyIntensity=726,
|
||||
c3DFillX=727,
|
||||
c3DFillY=728,
|
||||
c3DFillZ=729,
|
||||
c3DFillIntensity=730,
|
||||
|
||||
threeDStyleBooleanProperties=767,
|
||||
|
||||
//Shape
|
||||
hspMaster=769,
|
||||
cxstyle=771,
|
||||
bWMode=772,
|
||||
bWModePureBW=773,
|
||||
bWModeBW=774,
|
||||
idDiscussAnchor=775,
|
||||
dgmLayout=777,
|
||||
dgmNodeKind=778,
|
||||
dgmLayoutMRU=779,
|
||||
wzEquationXML=780,
|
||||
|
||||
shapeBooleans=831,
|
||||
|
||||
//Callout
|
||||
spcot=832,
|
||||
dxyCalloutGap=833,
|
||||
spcoa=834,
|
||||
spcod=835,
|
||||
dxyCalloutDropSpecified=836,
|
||||
dxyCalloutLengthSpecified=837,
|
||||
fCallout=889,
|
||||
fCalloutAccentBar=890,
|
||||
fCalloutTextBorder=891,
|
||||
fCalloutMinusX=892,
|
||||
fCalloutMinusY=893,
|
||||
fCalloutDropAuto=894,
|
||||
fCalloutLengthSpecified=895,
|
||||
|
||||
//Groupe Shape
|
||||
wzName=896,
|
||||
wzDescription=897,
|
||||
pihlShape=898,
|
||||
pWrapPolygonVertices=899,
|
||||
dxWrapDistLeft=900,
|
||||
dyWrapDistTop=901,
|
||||
dxWrapDistRight=902,
|
||||
dyWrapDistBottom=903,
|
||||
lidRegroup=904,
|
||||
groupLeft=905,
|
||||
groupTop=906,
|
||||
groupRight=907,
|
||||
groupBottom=908,
|
||||
wzTooltip=909,
|
||||
wzScript=910,
|
||||
posh=911,
|
||||
posrelh=912,
|
||||
posv=913,
|
||||
posrelv=914,
|
||||
pctHR=915,
|
||||
alignHR=916,
|
||||
dxHeightHR=917,
|
||||
dxWidthHR=918,
|
||||
wzScriptExtAttr=919,
|
||||
scriptLang=920,
|
||||
wzScriptIdAttr=921,
|
||||
wzScriptLangAttr=922,
|
||||
borderTopColor=923,
|
||||
borderLeftColor=924,
|
||||
borderBottomColor=925,
|
||||
borderRightColor=926,
|
||||
tableProperties=927,
|
||||
tableRowProperties=928,
|
||||
scriptHtmlLocation=929,
|
||||
wzApplet=930,
|
||||
wzFrameTrgtUnused=932,
|
||||
wzWebBot=933,
|
||||
wzAppletArg=934,
|
||||
wzAccessBlob=936,
|
||||
metroBlob=937,
|
||||
dhgt=938,
|
||||
|
||||
groupShapeBooleans = 959,
|
||||
|
||||
relRotation = 964,
|
||||
|
||||
//Unknown HTML
|
||||
wzLineId=1026,
|
||||
wzFillId=1027,
|
||||
wzPictureId=1028,
|
||||
wzPathId=1029,
|
||||
wzShadowId=1030,
|
||||
wzPerspectiveId=1031,
|
||||
wzGtextId=1032,
|
||||
wzFormulaeId=1033,
|
||||
wzHandlesId=1034,
|
||||
wzCalloutId=1035,
|
||||
wzLockId=1036,
|
||||
wzTextId=1037,
|
||||
wzThreeDId=1038,
|
||||
FakeShapeType=1039,
|
||||
fFakeMaster=1086,
|
||||
|
||||
//Diagramm
|
||||
dgmt=1280,
|
||||
dgmStyle=1281,
|
||||
pRelationTbl=1284,
|
||||
dgmScaleX=1285,
|
||||
dgmScaleY=1286,
|
||||
dgmDefaultFontSize=1287,
|
||||
dgmConstrainBounds=1288,
|
||||
dgmBaseTextScale=1289,
|
||||
fBorderlessCanvas=1338,
|
||||
fNonStickyInkCanvas=1339,
|
||||
fDoFormat=1340,
|
||||
fReverse=1341,
|
||||
fDoLayout=1342,
|
||||
diagramBooleans=1343,
|
||||
|
||||
//Web Component
|
||||
webComponentWzHtml=1664,
|
||||
webComponentWzName=1665,
|
||||
webComponentWzUrl=1666,
|
||||
webComponentWzProperties=1667,
|
||||
fIsWebComponent=1727,
|
||||
|
||||
//Clip
|
||||
pVerticesClip=1728,
|
||||
pSegmentInfoClip=1729,
|
||||
shapePathClip=1730,
|
||||
fClipToWrap=1790,
|
||||
fClippedOK=1791,
|
||||
|
||||
//Ink
|
||||
pInkData=1792,
|
||||
fInkAnnotation=1852,
|
||||
fHitTestInk=1853,
|
||||
fRenderShape=1854,
|
||||
fRenderInk=1855,
|
||||
|
||||
//Signature
|
||||
wzSigSetupId=1921,
|
||||
wzSigSetupProvId=192,
|
||||
wzSigSetupSuggSigner=1923,
|
||||
wzSigSetupSuggSigner2=1924,
|
||||
wzSigSetupSuggSignerEmail=1925,
|
||||
wzSigSetupSignInst=1926,
|
||||
wzSigSetupAddlXml=1927,
|
||||
wzSigSetupProvUrl=1928,
|
||||
fSigSetupShowSignDate=1980,
|
||||
fSigSetupAllowComments=1981,
|
||||
fSigSetupSignInstSet=1982,
|
||||
fIsSignatureLine=1983,
|
||||
|
||||
//Groupe Shape 2
|
||||
pctHoriz=1984,
|
||||
pctVert=1985,
|
||||
pctHorizPos=1986,
|
||||
pctVertPos=1987,
|
||||
sizerelh=1988,
|
||||
sizerelv=1989,
|
||||
colStart=1990,
|
||||
colSpan=1991
|
||||
} PropertyId;
|
||||
|
||||
//!!!TODO: Реальные значения не соответствуют значениям из спецификации!!!
|
||||
typedef enum _PositionHorizontal
|
||||
{
|
||||
@ -534,8 +108,8 @@ namespace DocFileFormat
|
||||
static const unsigned short TYPE_CODE_0xF121 = 0xF121;
|
||||
static const unsigned short TYPE_CODE_0xF122 = 0xF122;
|
||||
|
||||
std::vector<ODRAW::OfficeArtFOPTEPtr> Options;
|
||||
std::map<PropertyId, ODRAW::OfficeArtFOPTEPtr> OptionsByID;
|
||||
std::vector<ODRAW::OfficeArtFOPTEPtr> Options;
|
||||
std::map<ODRAW::ePropertyId, ODRAW::OfficeArtFOPTEPtr> OptionsByID;
|
||||
|
||||
ShapeOptions() : Record()
|
||||
{
|
||||
@ -566,7 +140,7 @@ namespace DocFileFormat
|
||||
{
|
||||
Options[i]->ReadComplexData(Reader);
|
||||
}
|
||||
OptionsByID.insert(std::make_pair((PropertyId)Options[i]->opid, Options[i]));
|
||||
OptionsByID.insert(std::make_pair((ODRAW::ePropertyId)Options[i]->opid, Options[i]));
|
||||
}
|
||||
|
||||
Reader->Seek(( pos + size ), 0/*STREAM_SEEK_SET*/);
|
||||
|
||||
@ -104,32 +104,33 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//append formatting of paragraph end mark
|
||||
|
||||
XMLTools::XMLElementPtr rPr = XMLTools::XMLElementPtr(XMLTools::XMLElementPtr(new XMLTools::XMLElement( L"w:rPr" )));
|
||||
|
||||
if ( _paraEndChpx != NULL )
|
||||
{
|
||||
XMLTools::XMLElement* rPr = new XMLTools::XMLElement( L"w:rPr" );
|
||||
|
||||
//append properties
|
||||
RevisionData* rev = new RevisionData( _paraEndChpx );
|
||||
CharacterPropertiesMapping* ccMapping = new CharacterPropertiesMapping( rPr, m_document, rev, papx, false );
|
||||
CharacterPropertiesMapping* ccMapping = new CharacterPropertiesMapping( rPr.get(), m_document, rev, papx, false );
|
||||
|
||||
_paraEndChpx->Convert( ccMapping );
|
||||
|
||||
//append delete infos
|
||||
if ( rev->Type == Deleted )
|
||||
{
|
||||
XMLTools::XMLElement del( L"w:del" );
|
||||
XMLTools::XMLElement del( L"w:del" );
|
||||
rPr->AppendChild( del );
|
||||
}
|
||||
|
||||
if( rPr->GetChildCount() >0 )
|
||||
if( rPr->GetChildCount() > 0 )
|
||||
{
|
||||
_pPr->AppendChild( *rPr );
|
||||
_pPr->AppendChild( rPr );
|
||||
}
|
||||
|
||||
RELEASEOBJECT( ccMapping );
|
||||
RELEASEOBJECT( rev );
|
||||
RELEASEOBJECT( rPr );
|
||||
}
|
||||
|
||||
bool bNumPr = false;
|
||||
|
||||
std::list<SinglePropertyModifier>::iterator end = papx->grpprl->end();
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != end; ++iter)
|
||||
{
|
||||
@ -426,7 +427,10 @@ namespace DocFileFormat
|
||||
|
||||
if (m_document->listTable)
|
||||
{
|
||||
unsigned short numId = m_document->listTable->appendNumbering( desc );
|
||||
std::wstring sRPr;
|
||||
if (rPr->GetChildCount() > 0) sRPr = rPr->GetXMLString();
|
||||
|
||||
unsigned short numId = m_document->listTable->appendNumbering( desc, sRPr );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
}break;
|
||||
@ -439,8 +443,10 @@ namespace DocFileFormat
|
||||
case sprmOldPNLvlAnm:
|
||||
{
|
||||
short level = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize) - 1;
|
||||
if (level > 0 && level < 10)
|
||||
appendValueElement( _pPr, L"outlineLvl", level, false );
|
||||
|
||||
level = 0;
|
||||
appendValueElement( &numPr, L"ilvl", level, true );
|
||||
bNumPr = true;
|
||||
}break;
|
||||
|
||||
case sprmOldPFNoLineNumb:
|
||||
@ -456,25 +462,11 @@ namespace DocFileFormat
|
||||
case sprmPIlfo:
|
||||
{
|
||||
//Если numbering.xml пустой, то не пищем свойство
|
||||
//Todo разобраться с закоментированным кодом
|
||||
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
|
||||
{
|
||||
unsigned short numId = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
|
||||
//check if there is a ilvl reference, if not, check the count of LVLs.
|
||||
//if only one LVL exists in the referenced list, create a hard reference to that LVL
|
||||
//if (containsLvlReference(papx.grpprl) == false)
|
||||
//{
|
||||
// ListFormatOverride lfo = m_context.Doc.ListFormatOverrideTable[val];
|
||||
// int index = NumberingMapping.FindIndexbyId(m_context.Doc.ListTable, lfo.lsid);
|
||||
// ListData lst = m_context.Doc.ListTable[index];
|
||||
// if (lst.rglvl.Length == 1)
|
||||
// {
|
||||
// appendValueElement(numPr, "ilvl", "0", true);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -645,15 +637,18 @@ namespace DocFileFormat
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
//append frame properties
|
||||
|
||||
if ( numPr.GetChildCount() > 0 && ((bNumPr && m_document->nWordVersion > 0) || m_document->nWordVersion == 0))//append numPr
|
||||
{//23.doc
|
||||
_pPr->AppendChild( numPr );
|
||||
}
|
||||
|
||||
if ( _framePr->GetAttributeCount() > 0 )
|
||||
{
|
||||
_pPr->AppendChild( *_framePr );
|
||||
}
|
||||
|
||||
_isSectionPageBreak = 0;
|
||||
//append section properties
|
||||
if ( _sepx != NULL )
|
||||
{
|
||||
XMLTools::XMLElement sectPr( L"w:sectPr" );
|
||||
@ -672,34 +667,27 @@ namespace DocFileFormat
|
||||
_pPr->AppendChild( sectPr );
|
||||
}
|
||||
|
||||
//append indent
|
||||
if ( ind.GetAttributeCount() > 0 )
|
||||
{
|
||||
_pPr->AppendChild( ind );
|
||||
}
|
||||
|
||||
if ( spacing.GetAttributeCount() > 0 )//append spacing
|
||||
if ( spacing.GetAttributeCount() > 0 )
|
||||
{
|
||||
_pPr->AppendChild( spacing );
|
||||
}
|
||||
|
||||
if ( jc ) //append justification
|
||||
if ( jc )
|
||||
{
|
||||
_pPr->AppendChild( *jc );
|
||||
RELEASEOBJECT( jc );
|
||||
}
|
||||
|
||||
if ( numPr.GetChildCount() > 0 )//append numPr
|
||||
{
|
||||
_pPr->AppendChild( numPr );
|
||||
}
|
||||
|
||||
if ( pBdr.GetChildCount() > 0 ) //append borders
|
||||
|
||||
if ( pBdr.GetChildCount() > 0 )
|
||||
{
|
||||
_pPr->AppendChild( pBdr );
|
||||
}
|
||||
|
||||
//write Properties
|
||||
if ( ( _pPr->GetChildCount() > 0 ) || ( _pPr->GetAttributeCount() > 0 ) )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _pPr->GetXMLString() );
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
@ -99,14 +99,21 @@ namespace ImageHelper
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
if (header->biClrUsed > 0)
|
||||
{
|
||||
oFrame.put_Palette((unsigned char*)data + offset, header->biClrUsed);
|
||||
|
||||
offset += header->biClrUsed * 4;
|
||||
}
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
if (-stride >= header->biWidth/* && header->biBitCount >= 24*/)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
oFrame.put_Stride(stride);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
@ -117,24 +124,28 @@ namespace ImageHelper
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
file_name += L".png";
|
||||
if (!oFrame.SaveFile(file_name, 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
{
|
||||
result = Global::msoblipDIB;
|
||||
}
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
file_name += L".wmf";
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
if (file.CreateFileW(file_name))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
if (biSizeImage > 0 && result == Global::msoblipDIB)
|
||||
{
|
||||
file_name += L".bmp";
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
if (file.CreateFileW(file_name))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
|
||||
@ -162,6 +162,6 @@ namespace ImageHelper
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name);
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, std::wstring& file_name);
|
||||
}
|
||||
|
||||
|
||||
@ -96,9 +96,12 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
//std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
|
||||
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
|
||||
//for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
|
||||
std::list<SinglePropertyModifier>::const_iterator end = tapx->grpprl->end();
|
||||
|
||||
for (std::list<SinglePropertyModifier>::const_iterator iter = tapx->grpprl->begin(); iter != end; ++iter)
|
||||
{
|
||||
switch (iter->OpCode)
|
||||
{
|
||||
|
||||
@ -225,8 +225,11 @@ namespace DocFileFormat
|
||||
documentMapping->m_document->nWordVersion);
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
|
||||
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
|
||||
tapx.Convert( &trpMapping );
|
||||
if (chpxs)
|
||||
{
|
||||
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
|
||||
tapx.Convert( &trpMapping );
|
||||
}
|
||||
|
||||
documentMapping->_lastValidPapx = papxBackup;
|
||||
documentMapping->_lastValidSepx = sepxBackup;
|
||||
|
||||
@ -336,7 +336,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case metroBlob:
|
||||
case ODRAW::metroBlob:
|
||||
{//встроенная неведомая хуйня
|
||||
ODRAW::MetroBlob* blob = dynamic_cast<ODRAW::MetroBlob*>(iter.get());
|
||||
if (blob)
|
||||
@ -350,28 +350,28 @@ namespace DocFileFormat
|
||||
}
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
case ODRAW::borderBottomColor:
|
||||
if (!pict->brcBottom)
|
||||
{
|
||||
RGBColor bottomColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderLeftColor:
|
||||
case ODRAW::borderLeftColor:
|
||||
if (!pict->brcLeft)
|
||||
{
|
||||
RGBColor leftColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderRightColor:
|
||||
case ODRAW::borderRightColor:
|
||||
if (!pict->brcRight)
|
||||
{
|
||||
RGBColor rightColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderTopColor:
|
||||
case ODRAW::borderTopColor:
|
||||
if (!pict->brcTop)
|
||||
{
|
||||
RGBColor topColor( (int)iter->op, RedFirst );
|
||||
@ -379,28 +379,28 @@ namespace DocFileFormat
|
||||
}
|
||||
break;
|
||||
//CROPPING
|
||||
case cropFromBottom:
|
||||
case ODRAW::cropFromBottom:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropBottom = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropbottom", FormatUtils::IntToWideString( cropBottom ) + L"f" );
|
||||
}
|
||||
break;
|
||||
case cropFromLeft:
|
||||
case ODRAW::cropFromLeft:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropLeft = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropleft", FormatUtils::IntToWideString( cropLeft ) + L"f" );
|
||||
}
|
||||
break;
|
||||
case cropFromRight:
|
||||
case ODRAW::cropFromRight:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropRight = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropright", FormatUtils::IntToWideString( cropRight ) + L"f" );
|
||||
}
|
||||
break;
|
||||
case cropFromTop:
|
||||
case ODRAW::cropFromTop:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropTop = (int)iter->op;
|
||||
@ -408,7 +408,7 @@ namespace DocFileFormat
|
||||
}
|
||||
break;
|
||||
//------------------------------------------------------------
|
||||
case PropertyId_rotation:
|
||||
case ODRAW::ePropertyId_rotation:
|
||||
{
|
||||
double dAngle = (double)((int)iter->op) / 65535.0;
|
||||
|
||||
@ -420,23 +420,23 @@ namespace DocFileFormat
|
||||
|
||||
appendStyleProperty(strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
}break;
|
||||
case posh:
|
||||
case ODRAW::posh:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
}break;
|
||||
case posrelh:
|
||||
case ODRAW::posrelh:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case posv:
|
||||
case ODRAW::posv:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
|
||||
}break;
|
||||
case posrelv:
|
||||
case ODRAW::posrelv:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
case groupShapeBooleans:
|
||||
case ODRAW::groupShapeBooleanProperties:
|
||||
{
|
||||
ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
|
||||
|
||||
@ -559,8 +559,8 @@ namespace DocFileFormat
|
||||
pict->embeddedData = newData;
|
||||
}
|
||||
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
pict->embeddedData, pict->embeddedDataSize, Global::msoblipDIB));
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(btWin32),
|
||||
pict->embeddedData, pict->embeddedDataSize, btWin32));
|
||||
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
@ -589,22 +589,20 @@ namespace DocFileFormat
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + FILE_SEPARATOR_STR + L"tmp_image";
|
||||
oBlipEntry->btWin32 = ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name);
|
||||
|
||||
if (oBlipEntry->btWin32 == Global::msoblipPNG)
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
boost::shared_array<unsigned char>(pData), nData, oBlipEntry->btWin32));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
}
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
|
||||
@ -141,7 +141,9 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:group", true );
|
||||
m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index)));
|
||||
|
||||
bool twistDimensions = false;
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index, twistDimensions)));
|
||||
m_pXmlWriter->WriteAttribute( L"coordorigin", ( FormatUtils::IntToWideString(gsr->rcgBounds.topLeftAngle.x) + L"," + FormatUtils::IntToWideString( gsr->rcgBounds.topLeftAngle.y)));
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)));
|
||||
|
||||
@ -150,7 +152,7 @@ namespace DocFileFormat
|
||||
{
|
||||
switch (options[i]->opid)
|
||||
{
|
||||
case pWrapPolygonVertices:
|
||||
case ODRAW::pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = GetWrapCoords(options[i]);
|
||||
if (!wrapCoords.empty())
|
||||
@ -237,18 +239,19 @@ namespace DocFileFormat
|
||||
|
||||
if ( !pShape->fBackground )
|
||||
{
|
||||
bool twistDimensions = false;
|
||||
if (pShape->GetShapeType())
|
||||
{
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex)));
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex, twistDimensions)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
//append "from" and "to" attributes
|
||||
m_pXmlWriter->WriteAttribute(L"from", GetLineFrom(pAnchor));
|
||||
m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor));
|
||||
m_pXmlWriter->WriteAttribute(L"from", GetLineFrom(pAnchor, twistDimensions));
|
||||
m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor, twistDimensions));
|
||||
}
|
||||
|
||||
if (m_isBullete)
|
||||
@ -304,7 +307,7 @@ namespace DocFileFormat
|
||||
switch (iter->opid)
|
||||
{
|
||||
//BOOLEANS
|
||||
case geometryBooleans:
|
||||
case ODRAW::geometryBooleanProperties:
|
||||
{
|
||||
ODRAW::GeometryBooleanProperties *booleans = dynamic_cast<ODRAW::GeometryBooleanProperties*>(iter.get());
|
||||
if (booleans->fUsefLineOK && !booleans->fLineOK)
|
||||
@ -325,7 +328,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
case fillStyleBooleanProperties:
|
||||
case ODRAW::fillStyleBooleanProperties:
|
||||
{
|
||||
ODRAW::FillStyleBooleanProperties *booleans = dynamic_cast<ODRAW::FillStyleBooleanProperties *>(iter.get());
|
||||
if (booleans->fUsefFilled && !booleans->fFilled)
|
||||
@ -338,7 +341,7 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_fill, L"rotate", L"t");
|
||||
}
|
||||
}break;
|
||||
case lineStyleBooleans:
|
||||
case ODRAW::lineStyleBooleanProperties:
|
||||
{
|
||||
ODRAW::LineStyleBooleanProperties *booleans = dynamic_cast<ODRAW::LineStyleBooleanProperties *>(iter.get());
|
||||
if (booleans->fUsefLine && !booleans->fLine)
|
||||
@ -347,16 +350,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
case protectionBooleans:
|
||||
case ODRAW::protectionBooleanProperties:
|
||||
{
|
||||
//ProtectionBooleanProperties booleans(iter->op);
|
||||
}
|
||||
break;
|
||||
case diagramBooleans:
|
||||
case ODRAW::diagramBooleanProperties:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case groupShapeBooleans:
|
||||
case ODRAW::groupShapeBooleanProperties:
|
||||
{
|
||||
ODRAW::GroupShapeBooleanProperties *booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties *>(iter.get());
|
||||
if (booleans->fUsefLayoutInCell)
|
||||
@ -366,78 +369,78 @@ namespace DocFileFormat
|
||||
}
|
||||
break;
|
||||
// GEOMETRY
|
||||
case shapePath :
|
||||
case ODRAW::shapePath :
|
||||
{
|
||||
bHavePath = true;
|
||||
nShapePath = iter->op;
|
||||
}break;
|
||||
case pVertices:
|
||||
case ODRAW::pVertices:
|
||||
{
|
||||
opVerticles = iter;
|
||||
}break;
|
||||
case pSegmentInfo:
|
||||
case ODRAW::pSegmentInfo:
|
||||
{
|
||||
opSegmentInfo = iter;
|
||||
}break;
|
||||
case pGuides:
|
||||
case ODRAW::pGuides:
|
||||
{
|
||||
GetGuides(iter);
|
||||
}break;
|
||||
case pConnectionSites:
|
||||
case ODRAW::pConnectionSites:
|
||||
{
|
||||
opConnectLocs = iter;
|
||||
}break;
|
||||
case pConnectionSitesDir:
|
||||
case ODRAW::pConnectionSitesDir:
|
||||
{
|
||||
opConnectAngles = iter;
|
||||
}break;
|
||||
case pInscribe:
|
||||
case ODRAW::pInscribe:
|
||||
{
|
||||
opInscribe = iter;
|
||||
}break;
|
||||
case adjustValue:
|
||||
case ODRAW::adjustValue:
|
||||
{
|
||||
m_nAdjValues[0] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues,1);
|
||||
}
|
||||
break;
|
||||
case adjust2Value:
|
||||
case ODRAW::adjust2Value:
|
||||
{
|
||||
m_nAdjValues[1] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 2);
|
||||
}
|
||||
break;
|
||||
case adjust3Value:
|
||||
case ODRAW::adjust3Value:
|
||||
{
|
||||
m_nAdjValues[2] = (int)iter->op;
|
||||
nAdjValues =(std::max)(nAdjValues, 3);
|
||||
}break;
|
||||
case adjust4Value:
|
||||
case ODRAW::adjust4Value:
|
||||
{
|
||||
m_nAdjValues[3] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 4);
|
||||
}break;
|
||||
case adjust5Value:
|
||||
case ODRAW::adjust5Value:
|
||||
{
|
||||
m_nAdjValues[4] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 5);
|
||||
}break;
|
||||
case adjust6Value:
|
||||
case ODRAW::adjust6Value:
|
||||
{
|
||||
m_nAdjValues[5] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 6);
|
||||
}break;
|
||||
case adjust7Value:
|
||||
case ODRAW::adjust7Value:
|
||||
{
|
||||
m_nAdjValues[6] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 7);
|
||||
}break;
|
||||
case adjust8Value:
|
||||
case ODRAW::adjust8Value:
|
||||
{
|
||||
m_nAdjValues[7] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 8);
|
||||
}break;
|
||||
case pWrapPolygonVertices:
|
||||
case ODRAW::pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = GetWrapCoords(iter);
|
||||
|
||||
@ -446,22 +449,22 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"wrapcoords", wrapCoords);
|
||||
}
|
||||
}break;
|
||||
case geoRight:
|
||||
case ODRAW::geoRight:
|
||||
{
|
||||
xCoord = iter->op;
|
||||
}break;
|
||||
case geoBottom:
|
||||
case ODRAW::geoBottom:
|
||||
{
|
||||
yCoord = iter->op;
|
||||
}break;
|
||||
// LINE
|
||||
case lineColor:
|
||||
case ODRAW::lineColor:
|
||||
{
|
||||
RGBColor lineColor((int)iter->op, RedFirst);
|
||||
if ( !pShape->fBackground )
|
||||
m_pXmlWriter->WriteAttribute( L"strokecolor", (std::wstring(L"#") + lineColor.SixDigitHexCode));
|
||||
}break;
|
||||
case lineWidth:
|
||||
case ODRAW::lineWidth:
|
||||
{
|
||||
if (iter->op > 0)
|
||||
{
|
||||
@ -469,39 +472,39 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"strokeweight", FormatUtils::DoubleToWideString(eLineWidth.ToPoints()) + L"pt");
|
||||
}
|
||||
}break;
|
||||
case lineDashing:
|
||||
case ODRAW::lineDashing:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"dashstyle", FormatUtils::MapValueToWideString( iter->op, &Global::DashStyleMap[0][0], 11, 16 ) );
|
||||
}break;
|
||||
case lineStyle:
|
||||
case ODRAW::lineStyle:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"linestyle", getLineStyle( iter->op ));
|
||||
}break;
|
||||
case lineEndArrowhead:
|
||||
case ODRAW::lineEndArrowhead:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"endarrow", getArrowStyle( iter->op ));
|
||||
}break;
|
||||
case lineEndArrowLength:
|
||||
case ODRAW::lineEndArrowLength:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"endarrowlength", getArrowLength( iter->op ));
|
||||
}break;
|
||||
case lineEndArrowWidth:
|
||||
case ODRAW::lineEndArrowWidth:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"endarrowwidth", getArrowWidth( iter->op ));
|
||||
}break;
|
||||
case lineStartArrowhead:
|
||||
case ODRAW::lineStartArrowhead:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"startarrow", getArrowStyle( iter->op ));
|
||||
}break;
|
||||
case lineStartArrowLength:
|
||||
case ODRAW::lineStartArrowLength:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"startarrowlength", getArrowLength( iter->op ));
|
||||
}break;
|
||||
case lineStartArrowWidth:
|
||||
case ODRAW::lineStartArrowWidth:
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"startarrowwidth", getArrowWidth( iter->op ));
|
||||
}break;
|
||||
case cxstyle:
|
||||
case ODRAW::cxstyle:
|
||||
{
|
||||
if (pShape->GetShapeType() == NULL)
|
||||
{
|
||||
@ -517,39 +520,39 @@ namespace DocFileFormat
|
||||
}
|
||||
}break;
|
||||
// FILL
|
||||
case fillColor:
|
||||
case ODRAW::fillColor:
|
||||
{
|
||||
RGBColor fillColor((int)iter->op, RedFirst);
|
||||
m_pXmlWriter->WriteAttribute(L"fillcolor", ( std::wstring( L"#" ) + fillColor.SixDigitHexCode ));
|
||||
}break;
|
||||
case fillBackColor:
|
||||
case ODRAW::fillBackColor:
|
||||
{
|
||||
RGBColor fillBackColor( (int)iter->op, RedFirst );
|
||||
appendValueAttribute(&m_fill, L"color2", ( std::wstring( L"#" ) + fillBackColor.SixDigitHexCode ));
|
||||
}break;
|
||||
case fillAngle:
|
||||
case ODRAW::fillAngle:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) appendValueAttribute(&m_fill, L"angle", FormatUtils::DoubleToWideString( point->dVal ));
|
||||
}break;
|
||||
case fillShadeType:
|
||||
case ODRAW::fillShadeType:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"method", getFillMethod( iter->op ));
|
||||
}break;
|
||||
case fillShadeColors:
|
||||
case ODRAW::fillShadeColors:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter ));
|
||||
}break;
|
||||
case fillFocus:
|
||||
case ODRAW::fillFocus:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"focus", ( FormatUtils::IntToWideString( iter->op ) + L"%" ));
|
||||
appendValueAttribute(&m_fill, L"focussize", L"");
|
||||
}break;
|
||||
case fillType:
|
||||
case ODRAW::fillType:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"type", getFillType( iter->op ));
|
||||
}break;
|
||||
case fillBlip:
|
||||
case ODRAW::fillBlip:
|
||||
{
|
||||
BlipStoreEntry* pFillBlip = NULL;
|
||||
|
||||
@ -570,76 +573,76 @@ namespace DocFileFormat
|
||||
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case fillBlipName:
|
||||
case ODRAW::fillBlipName:
|
||||
{
|
||||
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
|
||||
if ((str) && (!str->string_.empty()))
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"o:title", FormatUtils::XmlEncode(str->string_));
|
||||
appendValueAttribute(&m_fill, L"o:title", str->string_);
|
||||
}
|
||||
}break;
|
||||
case fillOpacity:
|
||||
case ODRAW::fillOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"opacity", ( FormatUtils::IntToWideString( iter->op ) + L"f" ));
|
||||
}
|
||||
break;
|
||||
case fillBackOpacity:
|
||||
case ODRAW::fillBackOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"o:opacity2", (FormatUtils::IntToWideString(iter->op) + L"f"));
|
||||
}break;
|
||||
// SHADOW
|
||||
case shadowType:
|
||||
case ODRAW::shadowType:
|
||||
{
|
||||
appendValueAttribute(&m_shadow, L"type", getShadowType(iter->op));
|
||||
}break;
|
||||
|
||||
case shadowColor:
|
||||
case ODRAW::shadowColor:
|
||||
{
|
||||
RGBColor shadowColor((int)iter->op, RedFirst);
|
||||
appendValueAttribute(&m_shadow, L"color", ( std::wstring( L"#" ) + shadowColor.SixDigitHexCode ));
|
||||
}break;
|
||||
case shadowOffsetX:
|
||||
case ODRAW::shadowOffsetX:
|
||||
{
|
||||
ShadowOffsetX = EmuValue( (int)iter->op );
|
||||
}break;
|
||||
case shadowSecondOffsetX:
|
||||
case ODRAW::shadowSecondOffsetX:
|
||||
{
|
||||
SecondShadowOffsetX = EmuValue( (int)iter->op );
|
||||
}break;
|
||||
case shadowOffsetY:
|
||||
case ODRAW::shadowOffsetY:
|
||||
{
|
||||
ShadowOffsetY = EmuValue( (int)iter->op );
|
||||
}break;
|
||||
case shadowSecondOffsetY:
|
||||
case ODRAW::shadowSecondOffsetY:
|
||||
{
|
||||
SecondShadowOffsetY = EmuValue( (int)iter->op );
|
||||
}break;
|
||||
case shadowOriginX:
|
||||
case ODRAW::shadowOriginX:
|
||||
{
|
||||
ShadowOriginX = ( iter->op / pow( (double)2, (double)16 ) );
|
||||
}break;
|
||||
case shadowOriginY:
|
||||
case ODRAW::shadowOriginY:
|
||||
{
|
||||
ShadowOriginY = (iter->op / pow( (double)2, (double)16));
|
||||
}break;
|
||||
case shadowOpacity:
|
||||
case ODRAW::shadowOpacity:
|
||||
{
|
||||
double shadowOpa = (iter->op / pow( (double)2, (double)16));
|
||||
|
||||
appendValueAttribute(&m_shadow, L"opacity", FormatUtils::DoubleToFormattedWideString( shadowOpa, L"%.2f" ));
|
||||
}break;
|
||||
case shadowStyleBooleanProperties:
|
||||
case ODRAW::shadowStyleBooleanProperties:
|
||||
{
|
||||
//ODRAW::ShadowStyleBooleanProperties
|
||||
|
||||
}break;
|
||||
// OLE
|
||||
case pictureId:
|
||||
case ODRAW::pictureId:
|
||||
{
|
||||
indexOLE = iter->op;
|
||||
}break;
|
||||
// PICTURE
|
||||
case Pib:
|
||||
case ODRAW::pib:
|
||||
{
|
||||
int index = (int)( iter->op - 1 );
|
||||
|
||||
@ -653,101 +656,101 @@ namespace DocFileFormat
|
||||
}
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case pibName:
|
||||
case ODRAW::pibName:
|
||||
{
|
||||
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
|
||||
if ((str) && (!str->string_.empty()))
|
||||
{
|
||||
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(str->string_));
|
||||
appendValueAttribute(&m_imagedata, L"o:title", str->string_);
|
||||
}
|
||||
}break;
|
||||
// 3D STYLE
|
||||
case threeDStyleBooleanProperties:
|
||||
case ODRAW::threeDStyleBooleanProperties:
|
||||
{
|
||||
ODRAW::ThreeDStyleBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDStyleBooleanProperties*>(iter.get());
|
||||
}break;
|
||||
case threeDObjectBooleanProperties:
|
||||
case ODRAW::threeDObjectBooleanProperties:
|
||||
{
|
||||
ODRAW::ThreeDObjectBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDObjectBooleanProperties*>(iter.get());
|
||||
|
||||
if ((booleans) && (booleans->fUsef3D && !booleans->f3D))
|
||||
b3D = false;
|
||||
}break;
|
||||
case c3DRenderMode:
|
||||
case ODRAW::c3DRenderMode:
|
||||
{
|
||||
}break;
|
||||
case c3DExtrudeBackward:
|
||||
case ODRAW::c3DExtrudeBackward:
|
||||
{
|
||||
EmuValue backwardValue( (int)iter->op );
|
||||
std::wstring depth = FormatUtils::DoubleToWideString( backwardValue.ToPoints() ) + L"pt";
|
||||
appendValueAttribute(&m_3dstyle, L"backdepth", depth);
|
||||
}break;
|
||||
case c3DAmbientIntensity:
|
||||
case ODRAW::c3DAmbientIntensity:
|
||||
{
|
||||
std::wstring intens = FormatUtils::IntToWideString((int)iter->op) + L"f";
|
||||
appendValueAttribute(&m_3dstyle, L"brightness", intens);
|
||||
}break;
|
||||
case c3DSpecularAmt:
|
||||
case ODRAW::c3DSpecularAmt:
|
||||
{
|
||||
std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f";
|
||||
appendValueAttribute(&m_3dstyle, L"specularity", amt);
|
||||
}break;
|
||||
case c3DDiffuseAmt:
|
||||
case ODRAW::c3DDiffuseAmt:
|
||||
{
|
||||
std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f";
|
||||
appendValueAttribute(&m_3dstyle, L"diffusity", amt);
|
||||
}break;
|
||||
case c3DKeyIntensity:
|
||||
case ODRAW::c3DKeyIntensity:
|
||||
{
|
||||
std::wstring amt = FormatUtils::IntToWideString((int)iter->op);
|
||||
appendValueAttribute(&m_3dstyle, L"lightlevel", amt);
|
||||
}break;
|
||||
case c3DExtrusionColor:
|
||||
case ODRAW::c3DExtrusionColor:
|
||||
{
|
||||
std::wstring color = FormatUtils::IntToFormattedWideString(iter->op, L"#%06x");
|
||||
appendValueAttribute(&m_3dstyle, L"color", color);
|
||||
}break;
|
||||
case c3DSkewAngle:
|
||||
case ODRAW::c3DSkewAngle:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString( point->dVal ));
|
||||
}break;
|
||||
case c3DXViewpoint:
|
||||
case ODRAW::c3DXViewpoint:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) ViewPointX = EmuValue( (int)point->dVal );
|
||||
}break;
|
||||
case c3DYViewpoint:
|
||||
case ODRAW::c3DYViewpoint:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) ViewPointY = EmuValue( (int)point->dVal );
|
||||
}break;
|
||||
case c3DZViewpoint:
|
||||
case ODRAW::c3DZViewpoint:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) ViewPointZ = EmuValue( (int)point->dVal );
|
||||
}break;
|
||||
case c3DOriginX:
|
||||
case ODRAW::c3DOriginX:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) viewPointOriginX = point->dVal;
|
||||
}break;
|
||||
case c3DOriginY:
|
||||
case ODRAW::c3DOriginY:
|
||||
{
|
||||
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
|
||||
if (point) viewPointOriginY = point->dVal;
|
||||
}break;
|
||||
// TEXTBOX
|
||||
case lTxid:
|
||||
case ODRAW::lTxid:
|
||||
{
|
||||
hasTextbox = true;
|
||||
nLTxID = (((iter->op) >> 16) & 0xFFFF);
|
||||
}break;
|
||||
case dxTextLeft: {ndxTextLeft = (int)iter->op; break;}
|
||||
case dyTextTop: {ndyTextTop = (int)iter->op; break;}
|
||||
case dxTextRight: {ndxTextRight = (int)iter->op; break;}
|
||||
case dyTextBottom: {ndyTextBottom = (int)iter->op; break;}
|
||||
case txflTextFlow:
|
||||
case ODRAW::dxTextLeft: {ndxTextLeft = (int)iter->op; break;}
|
||||
case ODRAW::dyTextTop: {ndyTextTop = (int)iter->op; break;}
|
||||
case ODRAW::dxTextRight: {ndxTextRight = (int)iter->op; break;}
|
||||
case ODRAW::dyTextBottom: {ndyTextBottom = (int)iter->op; break;}
|
||||
case ODRAW::txflTextFlow:
|
||||
{
|
||||
switch(iter->op)
|
||||
{
|
||||
@ -755,6 +758,7 @@ namespace DocFileFormat
|
||||
case 4://обычный
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 5://верт (склони голову направо)
|
||||
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
|
||||
break;
|
||||
@ -765,49 +769,33 @@ namespace DocFileFormat
|
||||
}
|
||||
}break;
|
||||
// Word Art
|
||||
case gtextUNICODE:
|
||||
case ODRAW::gtextUNICODE:
|
||||
{
|
||||
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
|
||||
if ((str) && (!str->string_.empty()))
|
||||
{
|
||||
std::wstring text = FormatUtils::XmlEncode(str->string_);
|
||||
if (std::wstring::npos != text.find(L"\n"))
|
||||
{
|
||||
m_textpath.AppendText(text);
|
||||
}
|
||||
text = ReplaceString(text, L"\n", L"
");
|
||||
appendValueAttribute(&m_textpath, L"string", text);
|
||||
appendValueAttribute(&m_textpath, L"string", str->string_);
|
||||
}
|
||||
}break;
|
||||
case gtextFont:
|
||||
case ODRAW::gtextFont:
|
||||
{
|
||||
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
|
||||
if ((str) && (!str->string_.empty()))
|
||||
if (str)
|
||||
{
|
||||
std::wstring font = str->string_;
|
||||
size_t i = font.size();
|
||||
while (i > 0)
|
||||
{
|
||||
if (font[i-1] != 0) break;
|
||||
i--;
|
||||
}
|
||||
if (i < font.size()) font.erase(font.begin() + i, font.end());
|
||||
|
||||
font = std::wstring(L"\"") + font + std::wstring(L"\"");
|
||||
appendStyleProperty(m_textPathStyle, L"font-family", font);
|
||||
appendStyleProperty(m_textPathStyle, L"font-family", str->string_);
|
||||
}
|
||||
}break;
|
||||
case gtextSize:
|
||||
case ODRAW::gtextSize:
|
||||
{
|
||||
std::wstring fontSize = FormatUtils::IntToWideString(iter->op/65535);
|
||||
appendStyleProperty(m_textPathStyle, L"font-size", fontSize + L"pt");
|
||||
}break;
|
||||
case gtextSpacing:
|
||||
case ODRAW::gtextSpacing:
|
||||
{
|
||||
std::wstring spacing = FormatUtils::IntToWideString(iter->op);
|
||||
appendStyleProperty(m_textPathStyle, L"v-text-spacing", spacing + L"f");
|
||||
}break;
|
||||
case geometryTextBooleanProperties:
|
||||
case ODRAW::geometryTextBooleanProperties:
|
||||
{
|
||||
ODRAW::GeometryTextBooleanProperties *props = dynamic_cast<ODRAW::GeometryTextBooleanProperties*>(iter.get());
|
||||
if (props->fUsegFBestFit && props->fBestFit)
|
||||
@ -1128,7 +1116,14 @@ namespace DocFileFormat
|
||||
|
||||
m_context->_doc->Convert(&textboxMapping);
|
||||
|
||||
m_pXmlWriter->WriteString(textboxMapping.getOLEObject());
|
||||
std::wstring sOleXml = textboxMapping.getOLEObject();
|
||||
|
||||
if (false == sOleXml.empty())
|
||||
m_pXmlWriter->WriteString(sOleXml);
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(txtBoxWrapper.GetXmlString());
|
||||
}
|
||||
}
|
||||
|
||||
//ShapeType
|
||||
@ -1215,7 +1210,7 @@ namespace DocFileFormat
|
||||
return strXmlAttr;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::GetLineFrom(const ChildAnchor* pAnchor) const
|
||||
std::wstring VMLShapeMapping::GetLineFrom(const ChildAnchor* pAnchor, bool twistDimensions) const
|
||||
{
|
||||
//Если линия находится в группе, то координаты должны быть в Twips
|
||||
//Если линия находится в группе, то координаты должны быть в других единицах измерения (например в twips)
|
||||
@ -1224,15 +1219,33 @@ namespace DocFileFormat
|
||||
|
||||
if (NULL != pAnchor)
|
||||
{
|
||||
strXmlFrom += FormatUtils::IntToWideString(pAnchor->rcgBounds.topLeftAngle.x);
|
||||
int left = pAnchor->rcgBounds.topLeftAngle.x;
|
||||
int top = pAnchor->rcgBounds.topLeftAngle.y;
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
int right = pAnchor->rcgBounds.topLeftAngle.x + pAnchor->rcgBounds.size.cx;
|
||||
int bottom = pAnchor->rcgBounds.topLeftAngle.y + pAnchor->rcgBounds.size.cy;
|
||||
|
||||
left = (right + pAnchor->rcgBounds.topLeftAngle.x) * 0.5 - (bottom - pAnchor->rcgBounds.topLeftAngle.y) * 0.5;
|
||||
top = (bottom + pAnchor->rcgBounds.topLeftAngle.y) * 0.5 - (right - pAnchor->rcgBounds.topLeftAngle.x) * 0.5;
|
||||
}
|
||||
|
||||
strXmlFrom += FormatUtils::IntToWideString(left);
|
||||
strXmlFrom += L",";
|
||||
strXmlFrom += FormatUtils::IntToWideString(pAnchor->rcgBounds.topLeftAngle.y);
|
||||
strXmlFrom += FormatUtils::IntToWideString(top);
|
||||
}
|
||||
else if (m_pSpa)
|
||||
{
|
||||
TwipsValue oLeft(m_pSpa->xaLeft);
|
||||
TwipsValue oTop(m_pSpa->yaTop);
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
oLeft = TwipsValue((m_pSpa->xaRight + m_pSpa->xaLeft) * 0.5 - (m_pSpa->yaBottom - m_pSpa->yaTop) * 0.5);
|
||||
oTop = TwipsValue((m_pSpa->yaBottom + m_pSpa->yaTop) * 0.5 - (m_pSpa->xaRight - m_pSpa->xaLeft) * 0.5);
|
||||
}
|
||||
|
||||
strXmlFrom += FormatUtils::DoubleToWideString(oLeft.ToPoints());
|
||||
strXmlFrom += L"pt,";
|
||||
strXmlFrom += FormatUtils::DoubleToWideString(oTop.ToPoints());
|
||||
@ -1242,7 +1255,7 @@ namespace DocFileFormat
|
||||
return strXmlFrom;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::GetLineTo(const ChildAnchor* pAnchor) const
|
||||
std::wstring VMLShapeMapping::GetLineTo(const ChildAnchor* pAnchor, bool twistDimensions) const
|
||||
{
|
||||
//Если линия находится в группе, то координаты должны быть в других единицах измерения (например в twips)
|
||||
|
||||
@ -1250,15 +1263,32 @@ namespace DocFileFormat
|
||||
|
||||
if (NULL != pAnchor)
|
||||
{
|
||||
strXmlTo += FormatUtils::IntToWideString(pAnchor->rcgBounds.topLeftAngle.x + pAnchor->rcgBounds.size.cx);
|
||||
int right = pAnchor->rcgBounds.topLeftAngle.x + pAnchor->rcgBounds.size.cx;
|
||||
int bottom = pAnchor->rcgBounds.topLeftAngle.y + pAnchor->rcgBounds.size.cy;
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
int left = (right + pAnchor->rcgBounds.topLeftAngle.x) * 0.5 - (bottom - pAnchor->rcgBounds.topLeftAngle.y) * 0.5;
|
||||
int top = (bottom + pAnchor->rcgBounds.topLeftAngle.y) * 0.5 - (right - pAnchor->rcgBounds.topLeftAngle.x) * 0.5;
|
||||
|
||||
right = left + pAnchor->rcgBounds.size.cy;
|
||||
bottom = top + pAnchor->rcgBounds.size.cx;
|
||||
}
|
||||
strXmlTo += FormatUtils::IntToWideString(right);
|
||||
strXmlTo += L",";
|
||||
strXmlTo += FormatUtils::IntToWideString(pAnchor->rcgBounds.topLeftAngle.y + pAnchor->rcgBounds.size.cy);
|
||||
strXmlTo += FormatUtils::IntToWideString(bottom);
|
||||
}
|
||||
else if (m_pSpa)
|
||||
{
|
||||
TwipsValue oRight (m_pSpa->xaRight);
|
||||
TwipsValue oBottom (m_pSpa->yaBottom);
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
oRight = TwipsValue((m_pSpa->yaBottom - m_pSpa->yaTop) + (m_pSpa->xaRight + m_pSpa->xaLeft) * 0.5 - (m_pSpa->yaBottom - m_pSpa->yaTop) * 0.5);
|
||||
oBottom = TwipsValue((m_pSpa->xaRight - m_pSpa->xaLeft) + (m_pSpa->yaBottom + m_pSpa->yaTop) * 0.5 - (m_pSpa->xaRight - m_pSpa->xaLeft) * 0.5);
|
||||
}
|
||||
|
||||
strXmlTo += FormatUtils::DoubleToWideString(oRight.ToPoints());
|
||||
strXmlTo += L"pt,";
|
||||
strXmlTo += FormatUtils::DoubleToWideString(oBottom.ToPoints());
|
||||
@ -1322,12 +1352,11 @@ namespace DocFileFormat
|
||||
{
|
||||
boost::shared_array<unsigned char> arDecompressed(decompressed);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), arDecompressed, decompressedSize));
|
||||
result = true;
|
||||
}
|
||||
|
||||
RELEASEOBJECT(metaBlip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
@ -1341,38 +1370,35 @@ namespace DocFileFormat
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
|
||||
if (Global::msoblipPNG == ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name))
|
||||
oBlip->btWin32 = ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name);
|
||||
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
oBlip->btWin32 = Global::msoblipPNG;
|
||||
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32),
|
||||
boost::shared_array<unsigned char>(pData), nData, oBlip->btWin32));
|
||||
result = true;
|
||||
break;
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
}
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32),
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlip->btWin32));
|
||||
RELEASEOBJECT (bitBlip);
|
||||
}
|
||||
}break;
|
||||
result = true;
|
||||
}break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
result = false;
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
m_nImageId = m_context->_docx->RegisterImage (m_pCaller, oBlip->btWin32);
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
m_nImageId = m_context->_docx->RegisterImage (m_pCaller, oBlip->btWin32);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1613,26 +1639,26 @@ namespace DocFileFormat
|
||||
switch (iter->opid)
|
||||
{
|
||||
// POSITIONING
|
||||
case posh:
|
||||
case ODRAW::posh:
|
||||
{
|
||||
nPosH = iter->op;
|
||||
}break;
|
||||
case posrelh:
|
||||
case ODRAW::posrelh:
|
||||
{
|
||||
nRelH = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case posv:
|
||||
case ODRAW::posv:
|
||||
{
|
||||
nPosV = iter->op;
|
||||
}break;
|
||||
case posrelv:
|
||||
case ODRAW::posrelv:
|
||||
{
|
||||
nRelV = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
// BOOLEANS
|
||||
case groupShapeBooleans:
|
||||
case ODRAW::groupShapeBooleanProperties:
|
||||
{
|
||||
ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
|
||||
|
||||
@ -1660,7 +1686,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}break;
|
||||
// GEOMETRY
|
||||
case PropertyId_rotation:
|
||||
case ODRAW::ePropertyId_rotation:
|
||||
{
|
||||
double dAngle = (double)((int)iter->op) / 65535.0;
|
||||
|
||||
@ -1670,24 +1696,24 @@ namespace DocFileFormat
|
||||
appendStyleProperty(oStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
}break;
|
||||
// TEXTBOX
|
||||
case anchorText:
|
||||
case ODRAW::anchorText:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"v-text-anchor", getTextboxAnchor(iter->op));
|
||||
}break;
|
||||
// WRAP DISTANCE
|
||||
case dxWrapDistLeft:
|
||||
case ODRAW::dxWrapDistLeft:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-left", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
case dxWrapDistRight:
|
||||
case ODRAW::dxWrapDistRight:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-right", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
case dyWrapDistBottom:
|
||||
case ODRAW::dyWrapDistBottom:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-bottom", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
case dyWrapDistTop:
|
||||
case ODRAW::dyWrapDistTop:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-top", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
@ -1746,17 +1772,17 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex) const
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex, bool &twistDimensions) const
|
||||
{
|
||||
std::wstring style;
|
||||
|
||||
bool twistDimensions = false;
|
||||
twistDimensions = false;
|
||||
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
const ODRAW::OfficeArtFOPTEPtr & iter = options[i];
|
||||
|
||||
if (geometryTextBooleanProperties == iter->opid)
|
||||
if (ODRAW::geometryTextBooleanProperties == iter->opid)
|
||||
{
|
||||
ODRAW::GeometryTextBooleanProperties* booleans = dynamic_cast<ODRAW::GeometryTextBooleanProperties*>(iter.get());
|
||||
|
||||
@ -1766,13 +1792,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
else if (PropertyId_rotation == iter->opid)
|
||||
else if (ODRAW::ePropertyId_rotation == iter->opid)
|
||||
{
|
||||
double dAngle = (double)((int)iter->op) / 65535.0;
|
||||
|
||||
if (dAngle < -360.0)
|
||||
dAngle += 360.0;
|
||||
|
||||
if (dAngle > 360.0)
|
||||
dAngle -= 360.0;
|
||||
|
||||
if ((dAngle >= 45.0 && dAngle <= 135.0) || (dAngle >= 225.0 && dAngle <= 315.0) || (dAngle <= -45.0 && dAngle >= -135.0) || (dAngle <= -225.0 && dAngle >= -315.0))
|
||||
twistDimensions = true;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring getTextboxAnchor( unsigned int anchor ) const;
|
||||
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex, bool &twistDimensions) const;
|
||||
void AppendOptionsToStyle ( std::wstring& style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
|
||||
int UpdateFromGuides(const int val) const;
|
||||
@ -112,8 +112,8 @@ namespace DocFileFormat
|
||||
void WriteEndShapeNode (const Shape* pShape);
|
||||
std::wstring GetShapeID (const Shape* pShape) const;
|
||||
|
||||
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
|
||||
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
|
||||
std::wstring GetLineFrom (const ChildAnchor* pAnchor, bool twistDimensions) const;
|
||||
std::wstring GetLineTo (const ChildAnchor* pAnchor, bool twistDimensions) const;
|
||||
|
||||
std::wstring GetWrapCoords ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
|
||||
std::vector<std::wstring> GetTextRectangles ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "WordDocument.h"
|
||||
|
||||
#include "../../Common/OfficeFileErrorDescription.h"
|
||||
#include "../../Common/MS-LCID.h"
|
||||
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h"
|
||||
@ -79,7 +80,7 @@ namespace DocFileFormat
|
||||
254, 437,//PC 437
|
||||
255, 850//OEM
|
||||
};
|
||||
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) :
|
||||
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder, const int userLCID) :
|
||||
m_PieceTable(NULL), WordDocumentStream(NULL), TableStream(NULL), DataStream(NULL), FIB(NULL),
|
||||
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
@ -94,6 +95,7 @@ namespace DocFileFormat
|
||||
{
|
||||
m_pCallFunc = pCallFunc;
|
||||
m_sTempFolder = sTempFolder;
|
||||
m_nUserLCID = userLCID;
|
||||
|
||||
m_pStorage = NULL;
|
||||
officeArtContent = NULL;
|
||||
@ -276,6 +278,17 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
FIB->m_CodePage = nDocumentCodePage;
|
||||
|
||||
if (!bDocumentCodePage && m_nUserLCID > 0)
|
||||
{
|
||||
int user_codepage = msLCID2DefCodePage(m_nUserLCID);
|
||||
|
||||
if (user_codepage > 0)
|
||||
{
|
||||
bDocumentCodePage = true;
|
||||
nDocumentCodePage = user_codepage;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder );
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder, const int userLCID);
|
||||
virtual ~WordDocument();
|
||||
|
||||
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
@ -153,6 +153,7 @@ namespace DocFileFormat
|
||||
std::wstring m_sPassword;
|
||||
std::wstring m_sTempFolder;
|
||||
std::wstring m_sTempDecryptFileName;
|
||||
int m_nUserLCID;
|
||||
|
||||
const ProgressCallback* m_pCallFunc;
|
||||
|
||||
|
||||
@ -39,7 +39,9 @@ _UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::w
|
||||
_UINT32 hr = 0;
|
||||
|
||||
DocFileFormat::Converter docToDocx;
|
||||
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
docToDocx.m_nUserLCID = m_nUserLCID;
|
||||
|
||||
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack, bMacros);
|
||||
|
||||
|
||||
@ -43,15 +43,11 @@ struct ProgressCallback;
|
||||
class COfficeDocFile
|
||||
{
|
||||
public:
|
||||
COfficeDocFile()
|
||||
{
|
||||
}
|
||||
COfficeDocFile() : m_nUserLCID(-1) {}
|
||||
virtual ~COfficeDocFile() {}
|
||||
|
||||
virtual ~COfficeDocFile()
|
||||
{
|
||||
}
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
std::wstring m_sTempFolder;
|
||||
int m_nUserLCID;
|
||||
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
|
||||
@ -77,6 +77,7 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
COfficeDocFile docFile;
|
||||
|
||||
docFile.m_sTempFolder = outputDir;
|
||||
docFile.m_nUserLCID = 1049;
|
||||
|
||||
bool bMacros = true;
|
||||
HRESULT hRes = docFile.LoadFromFile( srcFileName, dstTempPath, L"password", bMacros, NULL);
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/freetype-2.5.2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS;DONT_USED_EXTRA_LIBRARY"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
||||
@ -29,10 +29,9 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef COMMENTS_WRITER
|
||||
#define COMMENTS_WRITER
|
||||
#pragma once
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "HeaderFooterWriter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
|
||||
|
||||
namespace Writers
|
||||
@ -49,8 +48,9 @@ namespace Writers
|
||||
class CommentsWriter
|
||||
{
|
||||
std::wstring m_sDir;
|
||||
std::wstring m_sFileName;
|
||||
public:
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sCommentExt;
|
||||
std::wstring m_sCommentsIds;
|
||||
std::wstring m_sPeople;
|
||||
@ -73,6 +73,10 @@ namespace Writers
|
||||
m_sDocumentCommentsIds = sDocumentCommentsIds;
|
||||
m_sDocumentPeople = sDocumentPeople;
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return OOX::FileTypes::Comments.DefaultFileName().GetPath();
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
std::wstring sDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR;
|
||||
@ -156,5 +160,4 @@ namespace Writers
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef COMMENTS_WRITER
|
||||
}
|
||||
@ -29,8 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_FOOTER_WRITER
|
||||
#define HEADER_FOOTER_WRITER
|
||||
#pragma once
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
|
||||
@ -60,8 +59,8 @@ namespace Writers
|
||||
std::wstring rId;
|
||||
SimpleTypes::EHdrFtr eType;
|
||||
};
|
||||
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
static std::wstring g_string_xml_start = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
static std::wstring g_string_xmlns = L"xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
@ -78,35 +77,19 @@ xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_hdr_End = _T("</w:hdr>");
|
||||
mc:Ignorable=\"w14 w15 wp14\">";
|
||||
|
||||
static std::wstring g_string_hdr_Start = g_string_xml_start + L"<w:hdr " + g_string_xmlns;
|
||||
static std::wstring g_string_hdr_End = L"</w:hdr>";
|
||||
|
||||
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
|
||||
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
|
||||
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
|
||||
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
|
||||
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
|
||||
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_ftr_End = _T("</w:ftr>");
|
||||
static std::wstring g_string_ftr_Start = g_string_xml_start + L"<w:ftr " + g_string_xmlns;
|
||||
static std::wstring g_string_ftr_End = L"</w:ftr>";
|
||||
|
||||
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
|
||||
static std::wstring g_string_footnotes_Start = g_string_xml_start + L"<w:footnotes " + g_string_xmlns;
|
||||
static std::wstring g_string_footnotes_End = L"</w:footnotes>";
|
||||
|
||||
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
|
||||
static std::wstring g_string_endnotes_Start = g_string_xml_start + L"<w:endnotes " + g_string_xmlns;
|
||||
static std::wstring g_string_endnotes_End = L"</w:endnotes>";
|
||||
|
||||
class HeaderFooterWriter
|
||||
{
|
||||
@ -133,17 +116,17 @@ mc:Ignorable=\"w14 w15 wp14\">");
|
||||
for(size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pHeader = m_aHeaders[i];
|
||||
WriteItem(_T("header"), pHeader->m_sFilename, pHeader->Header, true);
|
||||
WriteItem(L"header", pHeader->m_sFilename, pHeader->Header, true);
|
||||
}
|
||||
for(size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pFooter = m_aFooters[i];
|
||||
WriteItem(_T("footer"), pFooter->m_sFilename, pFooter->Header, false);
|
||||
WriteItem(L"footer", pFooter->m_sFilename, pFooter->Header, false);
|
||||
}
|
||||
}
|
||||
void WriteItem( std::wstring sHeader, std::wstring& sFilename, ContentWriter& m_oWriter, bool bHeader)
|
||||
{
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
@ -186,7 +169,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return _T("footnotes.xml");
|
||||
return L"footnotes.xml";
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
@ -208,7 +191,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
|
||||
|
||||
std::wstring sFilename = getFilename();
|
||||
|
||||
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
|
||||
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath);
|
||||
@ -219,7 +202,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return _T("endnotes.xml");
|
||||
return L"endnotes.xml";
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
@ -227,4 +210,3 @@ mc:Ignorable=\"w14 w15 wp14\">");
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef HEADER_FOOTER_WRITER
|
||||
|
||||
@ -31,10 +31,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef READER_CLASSES
|
||||
#define READER_CLASSES
|
||||
#include "HeaderFooterWriter.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@ -99,6 +99,7 @@ public:
|
||||
bSectionType = false;
|
||||
bPageNumStart = false;
|
||||
bRtlGutter = false;
|
||||
bGutter = false;
|
||||
}
|
||||
std::wstring Write()
|
||||
{
|
||||
@ -439,13 +440,12 @@ public:
|
||||
class Tab
|
||||
{
|
||||
public:
|
||||
BYTE Val;
|
||||
SimpleTypes::CTabJc<> Val;
|
||||
long Pos;
|
||||
BYTE Leader;
|
||||
bool bLeader;
|
||||
Tab()
|
||||
{
|
||||
Val = shd_Nil;
|
||||
Pos = 0;
|
||||
bLeader = false;
|
||||
}
|
||||
@ -688,8 +688,8 @@ public:
|
||||
{
|
||||
if(DStrikeout)
|
||||
pCStringWriter->WriteString(L"<w:dstrike/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:dstrike w:val=\"false\"/>");
|
||||
//else if(false == bDoNotWriteNullProp)
|
||||
// pCStringWriter->WriteString(L"<w:dstrike w:val=\"false\"/>");
|
||||
}
|
||||
if(bVanish)
|
||||
{
|
||||
@ -732,7 +732,9 @@ public:
|
||||
}
|
||||
if(bFontSizeCs)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
if(false == bFontSize)
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
}
|
||||
if(bHighLight)
|
||||
{
|
||||
@ -1406,7 +1408,9 @@ class docLvl
|
||||
public:
|
||||
long ILvl;
|
||||
long Format;
|
||||
std::wstring sFormat;
|
||||
BYTE Jc;
|
||||
std::wstring sJc;
|
||||
std::vector<docLvlText*> Text;
|
||||
long Restart;
|
||||
long Start;
|
||||
@ -1491,7 +1495,11 @@ public:
|
||||
{
|
||||
oWriter.WriteString(L"<w:start w:val=\"" + std::to_wstring(Start) + L"\"/>");
|
||||
}
|
||||
if(bFormat)
|
||||
if(!sFormat.empty())
|
||||
{
|
||||
oWriter.WriteString(sFormat);
|
||||
}
|
||||
else if(bFormat)
|
||||
{
|
||||
std::wstring sFormat;
|
||||
switch(Format)
|
||||
@ -1599,19 +1607,23 @@ public:
|
||||
}
|
||||
oWriter.WriteString(L"/>");
|
||||
}
|
||||
if(bJc)
|
||||
if(!sJc.empty())
|
||||
{
|
||||
std::wstring sJc;
|
||||
oWriter.WriteString(sJc);
|
||||
}
|
||||
else if(bJc)
|
||||
{
|
||||
std::wstring sJcType;
|
||||
switch(Jc)
|
||||
{
|
||||
case align_Right:sJc = _T("right");break;
|
||||
case align_Left:sJc = _T("left");break;
|
||||
case align_Center:sJc = _T("center");break;
|
||||
case align_Justify:sJc = _T("distribute");break;
|
||||
case align_Right:sJcType = _T("right");break;
|
||||
case align_Left:sJcType = _T("left");break;
|
||||
case align_Center:sJcType = _T("center");break;
|
||||
case align_Justify:sJcType = _T("distribute");break;
|
||||
}
|
||||
if(!sJc.empty())
|
||||
if(!sJcType.empty())
|
||||
{
|
||||
oWriter.WriteString(L"<w:lvlJc w:val=\"" + sJc + L"\"/>");
|
||||
oWriter.WriteString(L"<w:lvlJc w:val=\"" + sJcType + L"\"/>");
|
||||
}
|
||||
}
|
||||
if(bParaPr)
|
||||
@ -1759,9 +1771,9 @@ public:
|
||||
if(bGridAfter && nGridAfter > 0)
|
||||
{
|
||||
writer.WriteString(L"<w:grid" + sName + L" w:val=\"" + std::to_wstring(nGridAfter) + L"\"/>");
|
||||
if(oAfterWidth.bW)
|
||||
oAfterWidth.Write(writer, _T("w:w") + sName);
|
||||
}
|
||||
if(oAfterWidth.bW)
|
||||
oAfterWidth.Write(writer, _T("w:w") + sName);
|
||||
}
|
||||
};
|
||||
class WriteHyperlink
|
||||
@ -1893,12 +1905,19 @@ public:
|
||||
m_nId += nCount;
|
||||
return nRes;
|
||||
}
|
||||
int getCurrentId()
|
||||
{
|
||||
return m_nId;
|
||||
}
|
||||
};
|
||||
class CComment{
|
||||
class CComment
|
||||
{
|
||||
private:
|
||||
IdCounter& m_oParaIdCounter;
|
||||
IdCounter& m_oFormatIdCounter;
|
||||
public:
|
||||
void *pBinary_DocumentTableReader;
|
||||
|
||||
int IdOpen;
|
||||
int IdFormat;
|
||||
std::wstring UserName;
|
||||
@ -1910,8 +1929,10 @@ public:
|
||||
bool Solved;
|
||||
unsigned int DurableId;
|
||||
std::wstring Text;
|
||||
std::wstring m_sParaId;
|
||||
std::wstring m_sParaIdParent;
|
||||
std::wstring sContent;
|
||||
|
||||
std::wstring sParaId;
|
||||
std::wstring sParaIdParent;
|
||||
std::vector<CComment*> replies;
|
||||
|
||||
bool bIdOpen;
|
||||
@ -1982,8 +2003,8 @@ public:
|
||||
|
||||
int nId = pComment->m_oParaIdCounter.getNextId();
|
||||
|
||||
pComment->m_sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
sRes += L"<w:p w14:paraId=\"" + pComment->m_sParaId + L"\" w14:textId=\"" + pComment->m_sParaId + L"\">";
|
||||
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
sRes += L"<w:p w14:paraId=\"" + pComment->sParaId + L"\" w14:textId=\"" + pComment->sParaId + L"\">";
|
||||
sRes += L"<w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">";
|
||||
sRes += sPart;
|
||||
sRes += L"</w:t></w:r></w:p>";
|
||||
@ -2025,49 +2046,58 @@ public:
|
||||
sRes += L"\"";
|
||||
}
|
||||
sRes += L">";
|
||||
std::wstring sText = pComment->Text;
|
||||
|
||||
XmlUtils::replace_all(sText, L"\r", L"");
|
||||
|
||||
int nPrevIndex = 0;
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
if (false == pComment->sContent.empty())
|
||||
{
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
{
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
|
||||
nPrevIndex = i + 1;
|
||||
}
|
||||
sRes += pComment->sContent;
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
|
||||
sRes += L"</w:comment>";
|
||||
else
|
||||
{
|
||||
//old comments
|
||||
std::wstring sText = pComment->Text;
|
||||
|
||||
XmlUtils::replace_all(sText, L"\r", L"");
|
||||
|
||||
int nPrevIndex = 0;
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
{
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
{
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
|
||||
nPrevIndex = i + 1;
|
||||
}
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
|
||||
}
|
||||
sRes += L"</w:comment>";
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeContentExt(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
if(!pComment->m_sParaId.empty())
|
||||
if(false == pComment->sParaId.empty())
|
||||
{
|
||||
std::wstring sDone(L"0");
|
||||
if(pComment->bSolved && pComment->Solved)
|
||||
sDone = _T("1");
|
||||
if(!pComment->m_sParaIdParent.empty())
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" \
|
||||
w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
if(!pComment->sParaIdParent.empty())
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" \
|
||||
w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
else
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
//расставляем paraIdParent
|
||||
for(size_t i = 0; i < pComment->replies.size(); i++)
|
||||
pComment->replies[i]->m_sParaIdParent = pComment->m_sParaId;
|
||||
pComment->replies[i]->sParaIdParent = pComment->sParaId;
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeContentsIds(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
if(!pComment->m_sParaId.empty() && pComment->bDurableId)
|
||||
if(!pComment->sParaId.empty() && pComment->bDurableId)
|
||||
{
|
||||
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->m_sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
|
||||
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
@ -2099,8 +2129,8 @@ class CComments
|
||||
public:
|
||||
IdCounter m_oFormatIdCounter;
|
||||
IdCounter m_oParaIdCounter;
|
||||
public:
|
||||
CComments():m_oParaIdCounter(1)
|
||||
|
||||
CComments() : m_oParaIdCounter(1)
|
||||
{
|
||||
}
|
||||
~CComments()
|
||||
@ -3117,4 +3147,3 @@ public:
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef READER_CLASSES
|
||||
|
||||
@ -904,15 +904,7 @@ int Binary_pPrReader::ReadContent( BYTE type, long length, void* poResult)
|
||||
for(size_t i = 0; i < nLen; ++i)
|
||||
{
|
||||
Tab& oTab = oTabs.m_aTabs[i];
|
||||
std::wstring sVal;
|
||||
switch(oTab.Val)
|
||||
{
|
||||
case g_tabtype_right: sVal = L"right"; break;
|
||||
case g_tabtype_center: sVal = L"center"; break;
|
||||
case g_tabtype_clear: sVal = L"clear"; break;
|
||||
default: sVal = L"left"; break;
|
||||
}
|
||||
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(oTab.Pos) + L"\"");
|
||||
pCStringWriter->WriteString(L"<w:tab w:val=\"" + oTab.Val.ToString() + L"\" w:pos=\"" + std::to_wstring(oTab.Pos) + L"\"");
|
||||
if (oTab.bLeader)
|
||||
{
|
||||
std::wstring sLeader;
|
||||
@ -1138,7 +1130,17 @@ int Binary_pPrReader::ReadTabItem(BYTE type, long length, void* poResult)
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
Tab* poTabItem = static_cast<Tab*>(poResult);
|
||||
if(c_oSerProp_pPrType::Tab_Item_Val == type)
|
||||
poTabItem->Val = m_oBufferedStream.GetUChar();
|
||||
poTabItem->Val.SetValue((SimpleTypes::ETabJc)m_oBufferedStream.GetUChar());
|
||||
else if(c_oSerProp_pPrType::Tab_Item_Val_deprecated == type)
|
||||
{
|
||||
switch(m_oBufferedStream.GetUChar())
|
||||
{
|
||||
case 1: poTabItem->Val.SetValue(SimpleTypes::tabjcRight);break;
|
||||
case 2: poTabItem->Val.SetValue(SimpleTypes::tabjcCenter);break;
|
||||
case 3: poTabItem->Val.SetValue(SimpleTypes::tabjcClear);break;
|
||||
default:poTabItem->Val.SetValue(SimpleTypes::tabjcLeft);break;
|
||||
}
|
||||
}
|
||||
else if(c_oSerProp_pPrType::Tab_Item_Pos == type)
|
||||
poTabItem->Pos = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
else if(c_oSerProp_pPrType::Tab_Item_PosTwips == type)
|
||||
@ -1935,7 +1937,6 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult)
|
||||
Shd oShd;
|
||||
READ2_DEF(length, res, oBinary_CommonReader2.ReadShd, &oShd);
|
||||
pWiterTblPr->Shd = oShd.ToString();
|
||||
m_sCurTableShd = pWiterTblPr->Shd;
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::tblpPr == type )
|
||||
{
|
||||
@ -2402,7 +2403,6 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult)
|
||||
}
|
||||
else if( c_oSerProp_cellPrType::Shd == type )
|
||||
{
|
||||
bCellShd = true;
|
||||
Shd oShd;
|
||||
READ2_DEF(length, res, oBinary_CommonReader2.ReadShd, &oShd);
|
||||
pCStringWriter->WriteString(oShd.ToString());
|
||||
@ -2824,11 +2824,24 @@ int Binary_NumberingTableReader::ReadLevel(BYTE type, long length, void* poResul
|
||||
odocLvl->bFormat = true;
|
||||
odocLvl->Format = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerNumTypes::lvl_Jc == type )
|
||||
else if ( c_oSerNumTypes::lvl_NumFmt == type )
|
||||
{
|
||||
ComplexTypes::Word::CNumFmt oNumFmt;
|
||||
READ1_DEF(length, res, oBinary_pPrReader.ReadNumFmt, &oNumFmt);
|
||||
odocLvl->sFormat = L"<w:numFmt " + oNumFmt.ToString() + L"/>";
|
||||
}
|
||||
else if ( c_oSerNumTypes::lvl_Jc_deprecated == type )
|
||||
{
|
||||
odocLvl->bJc = true;
|
||||
odocLvl->Jc = m_oBufferedStream.GetUChar();
|
||||
}
|
||||
else if ( c_oSerNumTypes::lvl_Jc == type )
|
||||
{
|
||||
ComplexTypes::Word::CJc oJc;
|
||||
oJc.m_oVal.Init();
|
||||
oJc.m_oVal->SetValue((SimpleTypes::EJc)m_oBufferedStream.GetUChar());
|
||||
odocLvl->sJc = L"<w:lvlJc " + oJc.ToString() + L"/>";
|
||||
}
|
||||
else if ( c_oSerNumTypes::lvl_LvlText == type )
|
||||
{
|
||||
odocLvl->bText = true;
|
||||
@ -3340,22 +3353,40 @@ int Binary_OtherTableReader::ReadImageMapContent(BYTE type, long length, void* p
|
||||
}
|
||||
|
||||
|
||||
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):Binary_CommonReader(poBufferedStream)
|
||||
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
|
||||
{
|
||||
}
|
||||
int Binary_CommentsTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
|
||||
Writers::ContentWriter oContentWriter;
|
||||
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, oContentWriter, &m_oComments);
|
||||
|
||||
oBinary_DocumentTableReader.m_bUsedParaIdCounter = true;
|
||||
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
READ_TABLE_DEF(res, this->ReadComments, NULL);
|
||||
READ_TABLE_DEF(res, this->ReadComments, &oBinary_DocumentTableReader);
|
||||
|
||||
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
|
||||
FILE_SEPARATOR_STR + L"_rels"+
|
||||
FILE_SEPARATOR_STR + m_oFileWriter.m_oCommentsWriter.getFilename() + L".rels";
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if ( c_oSer_CommentsType::Comment == type )
|
||||
{
|
||||
CComment* pComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
|
||||
pComment->pBinary_DocumentTableReader = poResult;
|
||||
|
||||
READ1_DEF(length, res, this->ReadCommentContent, pComment);
|
||||
|
||||
if(pComment->bIdOpen && NULL == m_oComments.get(pComment->IdOpen))
|
||||
m_oComments.add(pComment);
|
||||
else
|
||||
@ -3364,11 +3395,12 @@ int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poRes
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
CComment* pComment = static_cast<CComment*>(poResult);
|
||||
|
||||
if ( c_oSer_CommentsType::Id == type )
|
||||
{
|
||||
pComment->bIdOpen = true;
|
||||
@ -3418,28 +3450,55 @@ int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void*
|
||||
pComment->bDurableId = true;
|
||||
pComment->DurableId = m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSer_CommentsType::CommentContent == type )
|
||||
{
|
||||
READ1_DEF(length, res, this->ReadCommentContentExt, pComment->pBinary_DocumentTableReader);
|
||||
|
||||
Binary_DocumentTableReader* doc_reader = (Binary_DocumentTableReader*)pComment->pBinary_DocumentTableReader;
|
||||
|
||||
pComment->sContent = doc_reader->m_oDocumentWriter.m_oContent.GetData();
|
||||
doc_reader->m_oDocumentWriter.m_oContent.Clear();
|
||||
|
||||
int nId = doc_reader->m_pComments->m_oParaIdCounter.getCurrentId();
|
||||
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
}
|
||||
else if ( c_oSer_CommentsType::Replies == type )
|
||||
{
|
||||
READ1_DEF(length, res, this->ReadReplies, &pComment->replies);
|
||||
READ1_DEF(length, res, this->ReadReplies, pComment);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
int Binary_CommentsTableReader::ReadCommentContentExt(BYTE type, long length, void* poResult)
|
||||
{
|
||||
Binary_DocumentTableReader* pBinary_DocumentTableReader = static_cast<Binary_DocumentTableReader*>(poResult);
|
||||
|
||||
if (!pBinary_DocumentTableReader) return c_oSerConstants::ReadOk;
|
||||
|
||||
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
|
||||
}
|
||||
int Binary_CommentsTableReader::ReadReplies(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
std::vector<CComment*>* paComments = static_cast<std::vector<CComment*>*>(poResult);
|
||||
|
||||
CComment* pCommentParent = static_cast<CComment*>(poResult);
|
||||
|
||||
if ( c_oSer_CommentsType::Comment == type )
|
||||
{
|
||||
CComment* pNewComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
|
||||
pNewComment->pBinary_DocumentTableReader = pCommentParent->pBinary_DocumentTableReader;
|
||||
|
||||
READ1_DEF(length, res, this->ReadCommentContent, pNewComment);
|
||||
paComments->push_back(pNewComment);
|
||||
|
||||
pNewComment->sParaIdParent = pCommentParent->sParaId;
|
||||
pCommentParent->replies.push_back(pNewComment);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Binary_SettingsTableReader::Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom& oSettingsCustom):
|
||||
@ -3944,9 +4003,9 @@ int Binary_SettingsTableReader::ReadMathDispDef(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:dispDef");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(sVal);
|
||||
}
|
||||
else
|
||||
@ -4120,9 +4179,9 @@ int Binary_SettingsTableReader::ReadMathSmallFrac(BYTE type, long length, void*
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:smallFrac m:val=");
|
||||
if (bVal)
|
||||
sVal += _T("\"true\" />");
|
||||
sVal += _T("\"on\" />");
|
||||
else
|
||||
sVal += _T("\"false\" />");
|
||||
sVal += _T("\"off\" />");
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(sVal);
|
||||
}
|
||||
else
|
||||
@ -4154,9 +4213,9 @@ int Binary_SettingsTableReader::ReadMathWrapRight(BYTE type, long length, void*
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:wrapRight m:val=");
|
||||
if (bVal)
|
||||
sVal += _T("\"true\" />");
|
||||
sVal += _T("\"on\" />");
|
||||
else
|
||||
sVal += _T("\"false\" />");
|
||||
sVal += _T("\"off\" />");
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(sVal);
|
||||
}
|
||||
else
|
||||
@ -4191,6 +4250,7 @@ Binary_DocumentTableReader::Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileR
|
||||
, m_oMath_rPr(m_oFontTableWriter.m_mapFonts)
|
||||
, m_pComments(pComments)
|
||||
{
|
||||
m_bUsedParaIdCounter = false;
|
||||
m_byteLastElemType = c_oSerParType::Content;
|
||||
m_pCurWriter = NULL;
|
||||
}
|
||||
@ -4224,20 +4284,26 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void
|
||||
m_byteLastElemType = c_oSerParType::Par;
|
||||
m_oCur_pPr.ClearNoAttack();
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
|
||||
if (m_bUsedParaIdCounter && m_pComments)
|
||||
{
|
||||
int nId = m_pComments->m_oParaIdCounter.getNextId();
|
||||
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
|
||||
}
|
||||
READ1_DEF(length, res, this->ReadParagraph, NULL);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
|
||||
}
|
||||
else if(c_oSerParType::Table == type)
|
||||
{
|
||||
m_byteLastElemType = c_oSerParType::Table;
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:tbl>")));
|
||||
READ1_DEF(length, res, this->ReadDocTable, &m_oDocumentWriter.m_oContent);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:tbl>")));
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
@ -4457,13 +4523,13 @@ int Binary_DocumentTableReader::ReadParagraphContent(BYTE type, long length, voi
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
READ1_DEF(length, res, this->ReadBookmarkStart, &oBookmarkStart);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkStart.toXML());
|
||||
GetRunStringWriter().WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::BookmarkEnd == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
READ1_DEF(length, res, this->ReadBookmarkEnd, &oBookmarkEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
|
||||
GetRunStringWriter().WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -5209,9 +5275,9 @@ int Binary_DocumentTableReader::ReadMathAln(BYTE type, long length, void* poResu
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:aln");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5226,9 +5292,9 @@ int Binary_DocumentTableReader::ReadMathAlnScr(BYTE type, long length, void* poR
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:alnScr");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5642,12 +5708,13 @@ int Binary_DocumentTableReader::ReadMathDegHide(BYTE type, long length, void* po
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if ( c_oSer_OMathBottomNodesValType::Val == type )
|
||||
{
|
||||
//word writes "1"(excel, powerpoint write "on"). "on" is correct for word, libre, onedrive, gdrive
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:degHide");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5662,9 +5729,9 @@ int Binary_DocumentTableReader::ReadMathDiff(BYTE type, long length, void* poRes
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:diff");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5912,9 +5979,9 @@ int Binary_DocumentTableReader::ReadMathGrow(BYTE type, long length, void* poRes
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:grow");
|
||||
if (!bVal)
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
@ -5930,9 +5997,9 @@ int Binary_DocumentTableReader::ReadMathHideBot(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:hideBot");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5947,9 +6014,9 @@ int Binary_DocumentTableReader::ReadMathHideLeft(BYTE type, long length, void* p
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:hideLeft");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5964,9 +6031,9 @@ int Binary_DocumentTableReader::ReadMathHideRight(BYTE type, long length, void*
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:hideRight");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -5981,9 +6048,9 @@ int Binary_DocumentTableReader::ReadMathHideTop(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:hideTop");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6115,9 +6182,9 @@ int Binary_DocumentTableReader::ReadMathLit(BYTE type, long length, void* poResu
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:lit");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6151,9 +6218,9 @@ int Binary_DocumentTableReader::ReadMathMaxDist(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:maxDist");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6363,9 +6430,9 @@ int Binary_DocumentTableReader::ReadMathNoBreak(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:noBreak");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6380,9 +6447,9 @@ int Binary_DocumentTableReader::ReadMathNor(BYTE type, long length, void* poResu
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:nor");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6397,9 +6464,9 @@ int Binary_DocumentTableReader::ReadMathObjDist(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:objDist");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6457,9 +6524,9 @@ int Binary_DocumentTableReader::ReadMathOpEmu(BYTE type, long length, void* poRe
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:opEmu");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6526,9 +6593,9 @@ int Binary_DocumentTableReader::ReadMathPlcHide(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:plcHide");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -6811,9 +6878,9 @@ int Binary_DocumentTableReader::ReadMathShow(BYTE type, long length, void* poRes
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:show");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7015,9 +7082,9 @@ int Binary_DocumentTableReader::ReadMathStrikeBLTR(BYTE type, long length, void*
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:strikeBLTR");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7032,9 +7099,9 @@ int Binary_DocumentTableReader::ReadMathStrikeH(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:strikeH");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7049,9 +7116,9 @@ int Binary_DocumentTableReader::ReadMathStrikeTLBR(BYTE type, long length, void*
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:strikeTLBR");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7066,9 +7133,9 @@ int Binary_DocumentTableReader::ReadMathStrikeV(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:strikeV");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7104,9 +7171,9 @@ int Binary_DocumentTableReader::ReadMathSubHide(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:subHide");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7121,9 +7188,9 @@ int Binary_DocumentTableReader::ReadMathSupHide(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:supHide");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7138,9 +7205,9 @@ int Binary_DocumentTableReader::ReadMathTransp(BYTE type, long length, void* poR
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:transp");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7195,9 +7262,9 @@ int Binary_DocumentTableReader::ReadMathZeroAsc(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:zeroAsc");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7212,9 +7279,9 @@ int Binary_DocumentTableReader::ReadMathZeroDesc(BYTE type, long length, void* p
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:zaroDesc");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7229,9 +7296,9 @@ int Binary_DocumentTableReader::ReadMathZeroWid(BYTE type, long length, void* po
|
||||
bool bVal = m_oBufferedStream.GetBool();
|
||||
std::wstring sVal = _T("<m:zeroWid");
|
||||
if (bVal)
|
||||
sVal += _T(" m:val=\"true\" />");
|
||||
sVal += _T(" m:val=\"on\" />");
|
||||
else
|
||||
sVal += _T(" m:val=\"false\" />");
|
||||
sVal += _T(" m:val=\"off\" />");
|
||||
GetRunStringWriter().WriteString(sVal);
|
||||
}
|
||||
else
|
||||
@ -7356,23 +7423,29 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR
|
||||
}
|
||||
else if(c_oSerRunType::table == type)
|
||||
{
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
//todo
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:tbl>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:tbl>"));
|
||||
READ1_DEF(length, res, this->ReadDocTable, &m_oDocumentWriter.m_oContent);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:tbl>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:tbl>"));
|
||||
|
||||
if (m_bUsedParaIdCounter && m_pComments)
|
||||
{
|
||||
int nId = m_pComments->m_oParaIdCounter.getNextId();
|
||||
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
|
||||
}
|
||||
if(m_oCur_pPr.GetCurSize() > 0)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:pPr>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:pPr>"));
|
||||
m_oDocumentWriter.m_oContent.Write(m_oCur_pPr);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:pPr>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:pPr>"));
|
||||
}
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
}
|
||||
else if(c_oSerRunType::fldstart_deprecated == type)
|
||||
{
|
||||
@ -7753,13 +7826,7 @@ int Binary_DocumentTableReader::ReadCell(BYTE type, long length, void* poResult)
|
||||
if( c_oSerDocTableType::Cell_Pr == type )
|
||||
{
|
||||
pCStringWriter->WriteString(std::wstring(_T("<w:tcPr>")));
|
||||
oBinary_tblPrReader.bCellShd = false;
|
||||
READ2_DEF(length, res, oBinary_tblPrReader.Read_CellPr, pCStringWriter);
|
||||
if(false == oBinary_tblPrReader.bCellShd && !oBinary_tblPrReader.m_sCurTableShd.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(oBinary_tblPrReader.m_sCurTableShd);
|
||||
}
|
||||
oBinary_tblPrReader.bCellShd = false;
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:tcPr>")));
|
||||
}
|
||||
else if( c_oSerDocTableType::Cell_Content == type )
|
||||
@ -7769,7 +7836,7 @@ int Binary_DocumentTableReader::ReadCell(BYTE type, long length, void* poResult)
|
||||
//Потому что если перед </tc> не идет <p>, то документ считается невалидным
|
||||
if(c_oSerParType::Par != oBinary_DocumentTableReader.m_byteLastElemType)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p />")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p/>")));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -8717,6 +8784,52 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
|
||||
pSdtPr->m_oText->m_oMultiLine.Init();
|
||||
pSdtPr->m_oText->m_oMultiLine->FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::Checkbox == type)
|
||||
{
|
||||
pSdtPr->m_oCheckbox.Init();
|
||||
READ1_DEF(length, res, this->ReadSdtCheckBox, pSdtPr->m_oCheckbox.GetPointer());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int Binary_DocumentTableReader::ReadSdtCheckBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtCheckBox* pSdtCheckBox = static_cast<OOX::Logic::CSdtCheckBox*>(poResult);
|
||||
if (c_oSerSdt::CheckboxChecked == type)
|
||||
{
|
||||
pSdtCheckBox->m_oChecked.Init();
|
||||
pSdtCheckBox->m_oChecked->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::CheckboxCheckedFont == type)
|
||||
{
|
||||
if(!pSdtCheckBox->m_oCheckedState.IsInit())
|
||||
pSdtCheckBox->m_oCheckedState.Init();
|
||||
pSdtCheckBox->m_oCheckedState->m_oFont.Init();
|
||||
pSdtCheckBox->m_oCheckedState->m_oFont->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::CheckboxCheckedVal == type)
|
||||
{
|
||||
if(!pSdtCheckBox->m_oCheckedState.IsInit())
|
||||
pSdtCheckBox->m_oCheckedState.Init();
|
||||
pSdtCheckBox->m_oCheckedState->m_oVal.Init();
|
||||
pSdtCheckBox->m_oCheckedState->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerSdt::CheckboxUncheckedFont == type)
|
||||
{
|
||||
if(!pSdtCheckBox->m_oUncheckedState.IsInit())
|
||||
pSdtCheckBox->m_oUncheckedState.Init();
|
||||
pSdtCheckBox->m_oUncheckedState->m_oFont.Init();
|
||||
pSdtCheckBox->m_oUncheckedState->m_oFont->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::CheckboxUncheckedVal == type)
|
||||
{
|
||||
if(!pSdtCheckBox->m_oUncheckedState.IsInit())
|
||||
pSdtCheckBox->m_oUncheckedState.Init();
|
||||
pSdtCheckBox->m_oUncheckedState->m_oVal.Init();
|
||||
pSdtCheckBox->m_oUncheckedState->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -8745,13 +8858,11 @@ int Binary_DocumentTableReader::ReadSdtListItem(BYTE type, long length, void* po
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = static_cast<ComplexTypes::Word::CSdtListItem*>(poResult);
|
||||
if (c_oSerSdt::DisplayText == type)
|
||||
{
|
||||
pSdtListItem->m_sDisplayText.Init();
|
||||
pSdtListItem->m_sDisplayText->append(m_oBufferedStream.GetString3(length));
|
||||
pSdtListItem->m_sDisplayText = m_oBufferedStream.GetString3(length);
|
||||
}
|
||||
else if (c_oSerSdt::Value == type)
|
||||
{
|
||||
pSdtListItem->m_sValue.Init();
|
||||
pSdtListItem->m_sValue->append(m_oBufferedStream.GetString3(length));
|
||||
pSdtListItem->m_sValue = m_oBufferedStream.GetString3(length);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -8849,8 +8960,7 @@ int Binary_DocumentTableReader::ReadDropDownList(BYTE type, long length, void* p
|
||||
OOX::Logic::CSdtDropDownList* pDropDownList = static_cast<OOX::Logic::CSdtDropDownList*>(poResult);
|
||||
if (c_oSerSdt::LastValue == type)
|
||||
{
|
||||
pDropDownList->m_sLastValue.Init();
|
||||
pDropDownList->m_sLastValue->append(m_oBufferedStream.GetString3(length));
|
||||
pDropDownList->m_sLastValue = m_oBufferedStream.GetString3(length);
|
||||
}
|
||||
else if (c_oSerSdt::SdtListItem == type)
|
||||
{
|
||||
@ -8864,14 +8974,15 @@ int Binary_DocumentTableReader::ReadDropDownList(BYTE type, long length, void* p
|
||||
}
|
||||
|
||||
|
||||
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote):
|
||||
Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_pComments(pComments),m_bIsFootnote(bIsFootnote)
|
||||
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter), m_pComments(pComments), m_bIsFootnote(bIsFootnote)
|
||||
{
|
||||
}
|
||||
int Binary_NotesTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
std::wstring sFilename;
|
||||
|
||||
std::wstring sFilename;
|
||||
Writers::ContentWriter* pContentWriter = NULL;
|
||||
if(m_bIsFootnote)
|
||||
{
|
||||
|
||||
@ -152,9 +152,7 @@ protected:
|
||||
Binary_pPrReader oBinary_pPrReader;
|
||||
Binary_CommonReader2 oBinary_CommonReader2;
|
||||
public:
|
||||
std::wstring m_sCurTableShd;
|
||||
std::vector<double> m_aCurTblGrid;
|
||||
bool bCellShd;
|
||||
public:
|
||||
Binary_tblPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read_tblPr(BYTE type, long length, void* poResult);
|
||||
@ -228,12 +226,14 @@ public:
|
||||
class Binary_CommentsTableReader : public Binary_CommonReader
|
||||
{
|
||||
public:
|
||||
CComments m_oComments;
|
||||
public:
|
||||
CComments m_oComments;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
|
||||
Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read();
|
||||
int ReadComments(BYTE type, long length, void* poResult);
|
||||
int ReadCommentContent(BYTE type, long length, void* poResult);
|
||||
int ReadCommentContentExt(BYTE type, long length, void* poResult);
|
||||
int ReadReplies(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_SettingsTableReader : public Binary_CommonReader
|
||||
@ -281,18 +281,21 @@ private:
|
||||
Binary_pPrReader oBinary_pPrReader;
|
||||
Binary_rPrReader oBinary_rPrReader;
|
||||
Binary_tblPrReader oBinary_tblPrReader;
|
||||
NSStringUtils::CStringBuilder* m_pCurWriter;
|
||||
NSStringUtils::CStringBuilder* m_pCurWriter;
|
||||
rPr m_oCur_rPr;
|
||||
rPr m_oMath_rPr;
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
BYTE m_byteLastElemType;
|
||||
CComments* m_pComments;
|
||||
public:
|
||||
CComments* m_pComments;
|
||||
Writers::ContentWriter& m_oDocumentWriter;
|
||||
Writers::MediaWriter& m_oMediaWriter;
|
||||
|
||||
bool m_bUsedParaIdCounter;
|
||||
|
||||
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments);
|
||||
~Binary_DocumentTableReader();
|
||||
|
||||
int Read();
|
||||
NSStringUtils::CStringBuilder& GetRunStringWriter();
|
||||
int ReadDocumentContentOut(long length);
|
||||
@ -456,6 +459,7 @@ public:
|
||||
int Read_SecPr(BYTE type, long length, void* poResult);
|
||||
int ReadSdt(BYTE type, long length, void* poResult);
|
||||
int ReadSdtPr(BYTE type, long length, void* poResult);
|
||||
int ReadSdtCheckBox(BYTE type, long length, void* poResult);
|
||||
int ReadSdtComboBox(BYTE type, long length, void* poResult);
|
||||
int ReadSdtListItem(BYTE type, long length, void* poResult);
|
||||
int ReadSdtPrDataBinding(BYTE type, long length, void* poResult);
|
||||
|
||||
@ -36,9 +36,6 @@ namespace BinDocxRW
|
||||
{
|
||||
const double eps = 0.001;
|
||||
|
||||
const int shd_Clear = 0;
|
||||
const int shd_Nil = 1;
|
||||
|
||||
const int g_tabtype_left = 0;
|
||||
const int g_tabtype_right = 1;
|
||||
const int g_tabtype_center = 2;
|
||||
@ -173,7 +170,7 @@ extern int g_nCurFormatVersion;
|
||||
AbstractNum_Lvls = 4,
|
||||
Lvl = 5,
|
||||
lvl_Format = 6,//deprecated (instead use lvl_NumFmt)
|
||||
lvl_Jc = 7,
|
||||
lvl_Jc_deprecated = 7,//deprecated
|
||||
lvl_LvlText = 8,
|
||||
lvl_LvlTextItem = 9,
|
||||
lvl_LvlTextItemText = 10,
|
||||
@ -202,7 +199,8 @@ extern int g_nCurFormatVersion;
|
||||
LvlLegacy = 33,
|
||||
Legacy = 34,
|
||||
LegacyIndent = 35,
|
||||
LegacySpace = 36
|
||||
LegacySpace = 36,
|
||||
lvl_Jc = 37
|
||||
};}
|
||||
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
|
||||
{
|
||||
@ -345,7 +343,7 @@ extern int g_nCurFormatVersion;
|
||||
Tab = 17,
|
||||
Tab_Item = 18,
|
||||
Tab_Item_Pos = 19,
|
||||
Tab_Item_Val = 20,
|
||||
Tab_Item_Val_deprecated = 20,
|
||||
ParaStyle = 21,
|
||||
numPr = 22,
|
||||
numPr_lvl = 23,
|
||||
@ -367,7 +365,8 @@ extern int g_nCurFormatVersion;
|
||||
Spacing_LineTwips = 39,
|
||||
Spacing_BeforeTwips = 40,
|
||||
Spacing_AfterTwips = 41,
|
||||
Tab_Item_PosTwips = 42
|
||||
Tab_Item_PosTwips = 42,
|
||||
Tab_Item_Val = 43
|
||||
};}
|
||||
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
|
||||
{
|
||||
@ -806,7 +805,8 @@ extern int g_nCurFormatVersion;
|
||||
Replies = 9,
|
||||
OOData = 10,
|
||||
DurableId = 11,
|
||||
ProviderId = 12
|
||||
ProviderId = 12,
|
||||
CommentContent = 13
|
||||
};}
|
||||
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -1169,7 +1169,13 @@ extern int g_nCurFormatVersion;
|
||||
Temporary = 34,
|
||||
MultiLine = 35,
|
||||
Appearance = 36,
|
||||
Color = 37
|
||||
Color = 37,
|
||||
Checkbox = 38,
|
||||
CheckboxChecked = 39,
|
||||
CheckboxCheckedFont = 40,
|
||||
CheckboxCheckedVal = 41,
|
||||
CheckboxUncheckedFont = 42,
|
||||
CheckboxUncheckedVal = 43
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
|
||||
@ -43,8 +43,9 @@
|
||||
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
#ifndef _IOS
|
||||
#include "../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
|
||||
#include "../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
|
||||
#endif
|
||||
#include "../../HtmlFile/HtmlFile.h"
|
||||
#include "../../ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h"
|
||||
|
||||
|
||||
@ -1105,21 +1106,7 @@ void Binary_pPrWriter::WriteTabItem(const ComplexTypes::Word::CTabStop& TabItem,
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(TabItem.m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::tabjcEnd:
|
||||
case SimpleTypes::tabjcRight:
|
||||
m_oBcw.m_oStream.WriteBYTE(g_tabtype_right);
|
||||
bRight = true;
|
||||
break;
|
||||
case SimpleTypes::tabjcCenter:
|
||||
m_oBcw.m_oStream.WriteBYTE(g_tabtype_center);
|
||||
break;
|
||||
case SimpleTypes::tabjcClear:
|
||||
m_oBcw.m_oStream.WriteBYTE(g_tabtype_clear);
|
||||
break;
|
||||
default: m_oBcw.m_oStream.WriteBYTE(g_tabtype_left);break;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(TabItem.m_oVal->GetValue());
|
||||
}
|
||||
//pos
|
||||
if(false != TabItem.m_oPos.IsInit())
|
||||
@ -1274,14 +1261,14 @@ void Binary_pPrWriter::WriteSectPr (OOX::Logic::CSectionProperty* pSectPr)
|
||||
WritePageSettings(pSectPr);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
//Header
|
||||
if(pSectPr->m_arrHeaderReference.size() > 0)
|
||||
if(false == pSectPr->m_arrHeaderReference.empty())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_secPrType::headers);
|
||||
WriteHeaderFooter(pSectPr, pSectPr->m_arrHeaderReference, true);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
//Footer
|
||||
if(pSectPr->m_arrFooterReference.size() > 0)
|
||||
if(false == pSectPr->m_arrFooterReference.empty())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_secPrType::footers);
|
||||
WriteHeaderFooter(pSectPr, pSectPr->m_arrFooterReference, false);
|
||||
@ -1327,9 +1314,9 @@ void Binary_pPrWriter::WriteSectPr (OOX::Logic::CSectionProperty* pSectPr)
|
||||
}
|
||||
if(pSectPr->m_oRtlGutter.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_secPrType::rtlGutter);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(pSectPr->m_oRtlGutter->m_oVal.ToBool());
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_secPrType::rtlGutter);
|
||||
m_oBcw.m_oStream.WriteBOOL(pSectPr->m_oRtlGutter->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void Binary_pPrWriter::WritePageSettings(OOX::Logic::CSectionProperty* pSectPr)
|
||||
@ -1445,11 +1432,30 @@ void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr,
|
||||
const ComplexTypes::Word::CHdrFtrRef& oRef = *aRefs[i];
|
||||
if( oRef.m_oType.IsInit() && oRef.m_oId.IsInit())
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRels->Find(oRef.m_oId->GetValue());
|
||||
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
|
||||
int nIndex = 0;
|
||||
OOX::CHdrFtr* pHdrFtr = NULL;
|
||||
|
||||
OOX::CDocxFlat *docx_flat = dynamic_cast<OOX::CDocxFlat*>(m_oBinaryHeaderFooterTableWriter->m_oParamsWriter.m_pMain);
|
||||
|
||||
if (docx_flat)
|
||||
{
|
||||
std::map<std::wstring, OOX::CHdrFtr*>::iterator pFind = docx_flat->m_mapHeadersFooters.find(oRef.m_oId->GetValue());
|
||||
if (pFind != docx_flat->m_mapHeadersFooters.end())
|
||||
{
|
||||
pHdrFtr = pFind->second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRels->Find(oRef.m_oId->GetValue());
|
||||
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
|
||||
{
|
||||
pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
|
||||
}
|
||||
}
|
||||
|
||||
if (pHdrFtr)
|
||||
{
|
||||
int nIndex = 0;
|
||||
OOX::CHdrFtr* pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
|
||||
if(bHdr)
|
||||
{
|
||||
nIndex = (int)m_oBinaryHeaderFooterTableWriter->m_aHeaders.size();
|
||||
@ -2771,50 +2777,20 @@ void BinaryNumberingTableWriter::WriteLevel(const OOX::Numbering::CLvl& lvl)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
//Format
|
||||
if(false != lvl.m_oNumFmt.IsInit())
|
||||
if(lvl.m_oNumFmt.IsInit())
|
||||
{
|
||||
const ComplexTypes::Word::CNumFmt& oNumFmt = lvl.m_oNumFmt.get();
|
||||
if(false != oNumFmt.m_oVal.IsInit())
|
||||
{
|
||||
const SimpleTypes::CNumberFormat<>& oNumberFormat = oNumFmt.m_oVal.get();
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Format);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
switch(oNumberFormat.GetValue())
|
||||
{
|
||||
case SimpleTypes::numberformatNone: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_None);break;
|
||||
case SimpleTypes::numberformatBullet: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_Bullet);break;
|
||||
case SimpleTypes::numberformatDecimal: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_Decimal);break;
|
||||
case SimpleTypes::numberformatLowerRoman: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_LowerRoman);break;
|
||||
case SimpleTypes::numberformatUpperRoman: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_UpperRoman);break;
|
||||
case SimpleTypes::numberformatLowerLetter: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_LowerLetter);break;
|
||||
case SimpleTypes::numberformatUpperLetter: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_UpperLetter);break;
|
||||
case SimpleTypes::numberformatDecimalZero: m_oBcw.m_oStream.WriteLONG(numbering_numfmt_DecimalZero);break;
|
||||
default:
|
||||
m_oBcw.m_oStream.WriteLONG(oNumberFormat.GetValue() + 0x2008);break; //max our numbering
|
||||
}
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_NumFmt);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
bpPrs.WriteNumFmt(lvl.m_oNumFmt.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Jc
|
||||
if(false != lvl.m_oLvlJc.IsInit())
|
||||
if(lvl.m_oLvlJc.IsInit() && lvl.m_oLvlJc->m_oVal.IsInit())
|
||||
{
|
||||
const ComplexTypes::Word::CJc& oJc = lvl.m_oLvlJc.get();
|
||||
if(false != oJc.m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Jc);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(oJc.m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::jcCenter: m_oBcw.m_oStream.WriteBYTE(align_Center);break;
|
||||
case SimpleTypes::jcStart:
|
||||
case SimpleTypes::jcLeft: m_oBcw.m_oStream.WriteBYTE(align_Left);break;
|
||||
case SimpleTypes::jcEnd:
|
||||
case SimpleTypes::jcRight: m_oBcw.m_oStream.WriteBYTE(align_Right);break;
|
||||
case SimpleTypes::jcBoth:
|
||||
case SimpleTypes::jcThaiDistribute:
|
||||
case SimpleTypes::jcDistribute: m_oBcw.m_oStream.WriteBYTE(align_Justify);break;
|
||||
default: m_oBcw.m_oStream.WriteBYTE(align_Left);break;
|
||||
}
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Jc);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(lvl.m_oLvlJc->m_oVal->GetValue());
|
||||
}
|
||||
//LvlText
|
||||
if(false != lvl.m_oLvlText.IsInit())
|
||||
@ -3184,9 +3160,9 @@ void BinaryDocumentTableWriter::WriteDocumentContent(const std::vector<OOX::Writ
|
||||
}
|
||||
}
|
||||
}
|
||||
void BinaryDocumentTableWriter::WriteBackground (OOX::Logic::CBackground* pBackground)
|
||||
void BinaryDocumentTableWriter::WriteBackground (OOX::WritingElement* pElement)
|
||||
{
|
||||
if (pBackground == NULL) return;
|
||||
if (pElement == NULL) return;
|
||||
|
||||
std::wstring sXml;
|
||||
//if (pBackground->m_oDrawing.IsInit())
|
||||
@ -3194,19 +3170,34 @@ void BinaryDocumentTableWriter::WriteBackground (OOX::Logic::CBackground* pBackg
|
||||
// sXml = pBackground->m_oDrawing->m_sXml.get2();
|
||||
//}
|
||||
//else
|
||||
if (pBackground->m_oBackground.IsInit())
|
||||
{
|
||||
sXml = pBackground->m_oBackground->toXML();
|
||||
}
|
||||
OOX::Logic::CBackground *pBackground = dynamic_cast<OOX::Logic::CBackground*>(pElement);
|
||||
OOX::Logic::CBgPict *pBgPict = dynamic_cast<OOX::Logic::CBgPict*>(pElement);
|
||||
|
||||
if (pBackground->m_oColor.IsInit())
|
||||
if (pBackground)
|
||||
{
|
||||
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBackground->m_oColor.get());
|
||||
if (pBackground->m_oBackground.IsInit())
|
||||
{
|
||||
sXml = pBackground->m_oBackground->toXML();
|
||||
}
|
||||
if (pBackground->m_oColor.IsInit())
|
||||
{
|
||||
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBackground->m_oColor.get());
|
||||
}
|
||||
if (pBackground->m_oThemeColor.IsInit())
|
||||
{
|
||||
m_oBcw.WriteThemeColor(c_oSerBackgroundType::ColorTheme, pBackground->m_oColor, pBackground->m_oThemeColor, pBackground->m_oThemeTint, pBackground->m_oThemeShade);
|
||||
}
|
||||
}
|
||||
|
||||
if (pBackground->m_oThemeColor.IsInit())
|
||||
if (pBgPict)
|
||||
{
|
||||
m_oBcw.WriteThemeColor(c_oSerBackgroundType::ColorTheme, pBackground->m_oColor, pBackground->m_oThemeColor, pBackground->m_oThemeTint, pBackground->m_oThemeShade);
|
||||
if (pBgPict->m_oBackground.IsInit())
|
||||
{
|
||||
sXml = pBgPict->m_oBackground->toXML();
|
||||
}
|
||||
if (pBgPict->m_oColor.IsInit())
|
||||
{
|
||||
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBgPict->m_oColor.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (!sXml.empty())
|
||||
@ -3258,6 +3249,35 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
|
||||
|
||||
result = (S_OK == rtfConvert.ConvertRtfToOOX(file_name_inp, sResultDocxDir));
|
||||
}break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML:
|
||||
{
|
||||
std::wstring sResultDoctDir = NSDirectory::CreateDirectoryWithUniqueName(oAltChunkFile.filename().GetDirectory());
|
||||
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||
|
||||
std::vector<std::wstring> arFiles;
|
||||
arFiles.push_back(file_name_inp);
|
||||
try
|
||||
{
|
||||
CHtmlFile oHtmlFile;
|
||||
if (0 == oHtmlFile.Convert(arFiles, sResultDoctDir))
|
||||
{
|
||||
BinDocxRW::CDocxSerializer oCDocxSerializer;
|
||||
|
||||
std::wstring sXmlOptions;
|
||||
std::wstring sThemePath; // will be filled by 'CreateDocxFolders' method
|
||||
std::wstring sMediaPath; // will be filled by 'CreateDocxFolders' method
|
||||
std::wstring sEmbedPath; // will be filled by 'CreateDocxFolders' method
|
||||
|
||||
oCDocxSerializer.CreateDocxFolders (sResultDocxDir, sThemePath, sMediaPath, sEmbedPath);
|
||||
|
||||
result = oCDocxSerializer.loadFromFile (sResultDoctFileEditor, sResultDocxDir, sXmlOptions, sThemePath, sMediaPath, sEmbedPath);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
NSDirectory::DeleteDirectory(sResultDoctDir);
|
||||
}break;
|
||||
#endif
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
|
||||
@ -3298,6 +3318,22 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
|
||||
// m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
|
||||
oBinaryDocumentEmbTableWriter.WriteDocumentContent(oDocx.m_pDocument->m_arrItems);
|
||||
}
|
||||
else
|
||||
{
|
||||
OOX::CDocxFlat oDocxFlat = OOX::CDocxFlat(OOX::CPath(sResultDocxDir));
|
||||
if (oDocxFlat.m_pDocument.IsInit())
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriterEmb(oDocxFlat.m_pDocument.GetPointer());
|
||||
|
||||
ParamsWriter oParamsWriterEmb( m_oParamsWriter.m_pCBufferedStream,
|
||||
m_oParamsWriter.m_pFontProcessor,
|
||||
m_oParamsWriter.m_pOfficeDrawingConverter,
|
||||
m_oParamsWriter.m_pEmbeddedFontsManager);
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentEmbTableWriter(oParamsWriterEmb, oParamsDocumentWriterEmb, &oParamsWriterEmb.m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentEmbTableWriter.WriteDocumentContent(oDocxFlat.m_pDocument->m_arrItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
NSDirectory::DeleteDirectory(sResultDocxDir);
|
||||
}
|
||||
@ -3920,6 +3956,10 @@ void BinaryDocumentTableWriter::WriteHyperlink(OOX::Logic::CHyperlink* pHyperlin
|
||||
sLink = pHyperlinkFile->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
else if (pHyperlink->m_sDestinition.IsInit())
|
||||
{
|
||||
sLink = *pHyperlink->m_sDestinition;
|
||||
}
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Hyperlink);
|
||||
WriteHyperlinkContent(sLink, pHyperlink);
|
||||
@ -3939,14 +3979,14 @@ void BinaryDocumentTableWriter::WriteHyperlinkContent(std::wstring& sLink, OOX::
|
||||
if(pHyperlink->m_sAnchor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Anchor);
|
||||
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sAnchor.get2());
|
||||
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sAnchor);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Tooltip
|
||||
if(pHyperlink->m_sTooltip.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Tooltip);
|
||||
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sTooltip.get2());
|
||||
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sTooltip);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//History
|
||||
@ -3960,14 +4000,14 @@ void BinaryDocumentTableWriter::WriteHyperlinkContent(std::wstring& sLink, OOX::
|
||||
if(pHyperlink->m_sDocLocation.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::DocLocation);
|
||||
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sDocLocation.get2());
|
||||
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sDocLocation);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//TgtFrame
|
||||
if(pHyperlink->m_sTgtFrame.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::TgtFrame);
|
||||
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sTgtFrame.get2());
|
||||
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sTgtFrame);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Content
|
||||
@ -7309,6 +7349,52 @@ void BinaryDocumentTableWriter::WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oText->m_oMultiLine->ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oCheckbox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Checkbox);
|
||||
WriteSdtCheckBox(oStdPr.m_oCheckbox.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void BinaryDocumentTableWriter::WriteSdtCheckBox(const OOX::Logic::CSdtCheckBox& oSdtCheckBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtCheckBox.m_oChecked.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::CheckboxChecked);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSdtCheckBox.m_oChecked->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtCheckBox.m_oCheckedState.IsInit())
|
||||
{
|
||||
if(oSdtCheckBox.m_oCheckedState->m_oFont.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::CheckboxCheckedFont);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtCheckBox.m_oCheckedState->m_oFont.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtCheckBox.m_oCheckedState->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::CheckboxCheckedVal);
|
||||
m_oBcw.m_oStream.WriteLONG(oSdtCheckBox.m_oCheckedState->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
if(oSdtCheckBox.m_oUncheckedState.IsInit())
|
||||
{
|
||||
if(oSdtCheckBox.m_oUncheckedState->m_oFont.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::CheckboxUncheckedFont);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtCheckBox.m_oUncheckedState->m_oFont.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtCheckBox.m_oUncheckedState->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::CheckboxUncheckedVal);
|
||||
m_oBcw.m_oStream.WriteLONG(oSdtCheckBox.m_oUncheckedState->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void BinaryDocumentTableWriter::WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox)
|
||||
{
|
||||
@ -7438,17 +7524,33 @@ void BinaryDocumentTableWriter::WriteDropDownList(const OOX::Logic::CSdtDropDown
|
||||
}
|
||||
|
||||
|
||||
BinaryCommentsTableWriter::BinaryCommentsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
|
||||
BinaryCommentsTableWriter::BinaryCommentsTableWriter(ParamsWriter& oParamsWriter) :
|
||||
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
|
||||
{
|
||||
};
|
||||
void BinaryCommentsTableWriter::Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments)
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oComments);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
|
||||
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
|
||||
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
|
||||
m_pOfficeDrawingConverter->ClearShapeTypes();
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteCommentsContent(oComments, pCommentsExt, pPeople, pCommentsIds, mapIgnoreComments);
|
||||
WriteCommentsContent(oComments, pCommentsExt, pPeople, pCommentsIds, mapIgnoreComments, oParamsDocumentWriter);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
|
||||
m_pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments)
|
||||
void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments, 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();
|
||||
|
||||
std::map<std::wstring, OOX::CPerson*> mapAuthorToUserId;
|
||||
std::map<unsigned int, CCommentWriteTemp*> mapParaIdToComment;
|
||||
std::vector<CCommentWriteTemp*> aCommentsToWrite;
|
||||
@ -7554,7 +7656,7 @@ void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments,
|
||||
if(NULL != pCommentWriteTemp && NULL != pCommentWriteTemp->pComment && pCommentWriteTemp->pComment->m_oId.IsInit() && mapIgnoreComments.end() == mapIgnoreComments.find(pCommentWriteTemp->pComment->m_oId->GetValue()))
|
||||
{
|
||||
int nStart = m_oBcw.WriteItemStart(c_oSer_CommentsType::Comment);
|
||||
WriteComment(*aCommentsToWrite[i]);
|
||||
WriteComment(*aCommentsToWrite[i], oBinaryDocumentTableWriter);
|
||||
m_oBcw.WriteItemEnd(nStart);
|
||||
}
|
||||
}
|
||||
@ -7562,7 +7664,7 @@ void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments,
|
||||
for(size_t i = 0, length = aCommentsToWrite.size(); i < length; ++i)
|
||||
delete aCommentsToWrite[i];
|
||||
};
|
||||
void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment)
|
||||
void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
OOX::CComment* pComment = oComment.pComment;
|
||||
@ -7620,28 +7722,34 @@ void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment)
|
||||
}
|
||||
else
|
||||
{
|
||||
nDurableId = XmlUtils::GenerateInt();
|
||||
//numbers greater than 0x7FFFFFFE cause MS Office errors(ST_LongHexNumber by spec)
|
||||
nDurableId = XmlUtils::GenerateInt() & 0x7FFFFFFF;
|
||||
nDurableId = (0x7FFFFFFF != nDurableId) ? nDurableId : nDurableId - 1;
|
||||
}
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::DurableId);
|
||||
m_oBcw.m_oStream.WriteULONG(nDurableId);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
//----------------------------
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::CommentContent);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pComment->m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
//----------------------------
|
||||
if(oComment.aReplies.size() > 0)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Replies);
|
||||
WriteReplies(oComment.aReplies);
|
||||
WriteReplies(oComment.aReplies, oBinaryDocumentTableWriter);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
void BinaryCommentsTableWriter::WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp)
|
||||
void BinaryCommentsTableWriter::WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for(size_t i = 0, length = aCommentWriteTemp.size(); i < length; i++)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Comment);
|
||||
WriteComment(*aCommentWriteTemp[i]);
|
||||
WriteComment(*aCommentWriteTemp[i], oBinaryDocumentTableWriter);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -8192,7 +8300,7 @@ void BinarySettingsTableWriter::WriteCompatSetting(const OOX::Settings::CCompatS
|
||||
}
|
||||
|
||||
BinaryNotesTableWriter::BinaryNotesTableWriter(ParamsWriter& oParamsWriter):
|
||||
m_oBcw(oParamsWriter),m_oParamsWriter(oParamsWriter),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
|
||||
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
|
||||
{
|
||||
}
|
||||
void BinaryNotesTableWriter::WriteFootnotes(OOX::CFootnotes& oFootnotes)
|
||||
@ -8317,111 +8425,160 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
{
|
||||
NSBinPptxRW::CBinaryFileWriter& oBufferedStream = m_oBcw.m_oStream;
|
||||
|
||||
OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir));
|
||||
OOX::CDocx *pDocx = new OOX::CDocx(OOX::CPath(sDir));
|
||||
OOX::CDocxFlat *pDocxFlat = NULL;
|
||||
|
||||
m_oParamsWriter.m_poTheme = oDocx.m_pTheme;
|
||||
m_oParamsWriter.m_oSettings = oDocx.m_pSettings;
|
||||
OOX::Document *pMain = NULL;
|
||||
OOX::CDocument *pDocument = NULL;
|
||||
OOX::CStyles *pStyles = NULL;
|
||||
OOX::CFontTable *pFontTable = NULL;
|
||||
OOX::CNumbering *pNumbering = NULL;
|
||||
OOX::CComments *pComments = NULL;
|
||||
OOX::CSettings *pSettings = NULL;
|
||||
|
||||
if ((pDocx) && (pDocx->m_pDocument))
|
||||
{
|
||||
m_oParamsWriter.m_poTheme = pDocx->m_pTheme;
|
||||
m_oParamsWriter.m_oSettings = pDocx->m_pSettings;
|
||||
|
||||
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.m_pTheme);
|
||||
oBufferedStream.m_pTheme->AddRef();
|
||||
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(pDocx->m_pTheme);
|
||||
oBufferedStream.m_pTheme->AddRef();
|
||||
|
||||
if(NULL != oDocx.m_pFontTable)
|
||||
m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
|
||||
pMain = dynamic_cast<OOX::Document*>(pDocx);
|
||||
|
||||
pDocument = pDocx->m_pDocument;
|
||||
pStyles = pDocx->m_pStyles;
|
||||
pFontTable = pDocx->m_pFontTable;
|
||||
pNumbering = pDocx->m_pNumbering;
|
||||
pComments = pDocx->m_pComments;
|
||||
pSettings = pDocx->m_pSettings;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDocx) delete pDocx; pDocx = NULL;
|
||||
|
||||
//ищем первый SectPr и расставляем pageBreak
|
||||
pDocxFlat = new OOX::CDocxFlat(OOX::CPath(sDir));
|
||||
if ((pDocxFlat) && (pDocxFlat->m_pDocument.IsInit()))
|
||||
{
|
||||
pMain = dynamic_cast<OOX::Document*>(pDocxFlat);
|
||||
|
||||
pDocument = pDocxFlat->m_pDocument.GetPointer();
|
||||
pStyles = pDocxFlat->m_pStyles.GetPointer();
|
||||
pFontTable = pDocxFlat->m_pFontTable.GetPointer();
|
||||
pNumbering = pDocxFlat->m_pNumbering.GetPointer();
|
||||
pComments = &pDocxFlat->m_oComments;
|
||||
pSettings = pDocxFlat->m_pSettings.GetPointer();
|
||||
}
|
||||
}
|
||||
if (pFontTable)
|
||||
m_oParamsWriter.m_pFontProcessor->setFontTable(pFontTable);
|
||||
|
||||
if (oDocx.m_pDocument == NULL) return;
|
||||
OOX::Logic::CSectionProperty* pFirstSectPr = oDocx.m_pDocument->m_oSectPr.GetPointer();
|
||||
//ищем первый SectPr и расставляем pageBreak
|
||||
|
||||
if (pDocument == NULL)
|
||||
{
|
||||
if (pDocx) delete pDocx; pDocx = NULL;
|
||||
if (pDocxFlat) delete pDocxFlat; pDocxFlat = NULL;
|
||||
return;
|
||||
}
|
||||
OOX::Logic::CSectionProperty* pFirstSectPr = pDocument->m_oSectPr.GetPointer();
|
||||
|
||||
this->WriteMainTableStart();
|
||||
|
||||
int nCurPos = 0;
|
||||
|
||||
//Write Settings
|
||||
if(NULL != oDocx.m_pSettings)
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
if ((pDocx) && (pDocx->m_pSettings))
|
||||
{
|
||||
std::wstring sSettings = oDocx.GetCustomSettings();
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
if(!sSettings.empty())
|
||||
std::wstring sSettings = pDocx->GetCustomSettings();
|
||||
if(false == sSettings.empty())
|
||||
{
|
||||
oSettingsCustom.FromXml(sSettings);
|
||||
}
|
||||
}
|
||||
|
||||
if (pSettings)
|
||||
{
|
||||
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
|
||||
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings, oSettingsCustom);
|
||||
oBinarySettingsTableWriter.Write(*pSettings, oSettingsCustom);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write Comments
|
||||
if(NULL != oDocx.m_pComments)
|
||||
if (pComments)
|
||||
{
|
||||
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments);
|
||||
oBinaryCommentsTableWriter.Write(*oDocx.m_pComments, oDocx.m_pCommentsExt, oDocx.m_pPeople, oDocx.m_pCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
|
||||
oBinaryCommentsTableWriter.Write(*pComments, (pDocx ? pDocx->m_pCommentsExt : NULL),
|
||||
(pDocx ? pDocx->m_pPeople : NULL),
|
||||
(pDocx ? pDocx->m_pCommentsIds : NULL),
|
||||
m_oParamsWriter.m_mapIgnoreComments);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
if(NULL != oDocx.m_pDocumentComments)
|
||||
if ((pDocx) && (pDocx->m_pDocumentComments))
|
||||
{
|
||||
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::DocumentComments);
|
||||
oBinaryCommentsTableWriter.Write(*oDocx.m_pDocumentComments, oDocx.m_pDocumentCommentsExt, oDocx.m_pDocumentPeople, oDocx.m_pDocumentCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
|
||||
oBinaryCommentsTableWriter.Write(*pDocx->m_pDocumentComments, pDocx->m_pDocumentCommentsExt, pDocx->m_pDocumentPeople, pDocx->m_pDocumentCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write StyleTable
|
||||
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
|
||||
if(NULL != oDocx.m_pStyles)
|
||||
if (pStyles)
|
||||
{
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
|
||||
oBinaryStyleTableWriter.Write(*oDocx.m_pStyles);
|
||||
oBinaryStyleTableWriter.Write(*pStyles);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
//Write Numbering
|
||||
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
|
||||
if(NULL != oDocx.m_pNumbering)
|
||||
if (pNumbering)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
|
||||
oBinaryNumberingTableWriter.Write(*oDocx.m_pNumbering);
|
||||
oBinaryNumberingTableWriter.Write(*pNumbering);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
BinDocxRW::BinaryNotesTableWriter oBinaryNotesWriter(m_oParamsWriter);
|
||||
//Write Footnotes
|
||||
if(NULL != oDocx.m_pFootnotes)
|
||||
if ((pDocx) && (pDocx->m_pFootnotes))
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Footnotes);
|
||||
oBinaryNotesWriter.WriteFootnotes(*oDocx.m_pFootnotes);
|
||||
oBinaryNotesWriter.WriteFootnotes(*pDocx->m_pFootnotes);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
//Write Endnotes
|
||||
if(NULL != oDocx.m_pEndnotes)
|
||||
if ((pDocx) && (pDocx->m_pEndnotes))
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Endnotes);
|
||||
oBinaryNotesWriter.WriteEndnotes(*oDocx.m_pEndnotes);
|
||||
oBinaryNotesWriter.WriteEndnotes(*pDocx->m_pEndnotes);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write App
|
||||
if(NULL != oDocx.m_pApp)
|
||||
if ((pDocx) && (pDocx->m_pApp))
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::App);
|
||||
oDocx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
|
||||
pDocx->m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
if(NULL != oDocx.m_pCore)
|
||||
if ((pDocx) && (pDocx->m_pCore))
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Core);
|
||||
oDocx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
|
||||
pDocx->m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, oDocx.m_pDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, pDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
|
||||
//Write DocumentTable
|
||||
ParamsDocumentWriter oParamsDocumentWriter(oDocx.m_pDocument);
|
||||
ParamsDocumentWriter oParamsDocumentWriter(pDocument);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_pMain = pMain;
|
||||
|
||||
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
|
||||
@ -8430,23 +8587,30 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
m_oParamsWriter.m_pOfficeDrawingConverter->ClearShapeTypes();
|
||||
|
||||
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
|
||||
oBinaryDocumentTableWriter.pBackground = oDocx.m_pDocument->m_oBackground.GetPointer();
|
||||
oBinaryDocumentTableWriter.poDocument = oDocx.m_pDocument;
|
||||
oBinaryDocumentTableWriter.pJsaProject = oDocx.m_pJsaProject;
|
||||
oBinaryDocumentTableWriter.poDocument = pDocument;
|
||||
oBinaryDocumentTableWriter.pJsaProject = pDocx ? pDocx->m_pJsaProject : NULL;
|
||||
|
||||
if (pDocx)
|
||||
{
|
||||
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocument->m_oBackground.GetPointer());
|
||||
}
|
||||
else if (pDocxFlat)
|
||||
{
|
||||
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocxFlat->m_oBgPict.GetPointer());
|
||||
}
|
||||
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
|
||||
|
||||
//Write Vba
|
||||
if(NULL != oDocx.m_pVbaProject)
|
||||
if ((pDocx) && (pDocx->m_pVbaProject))
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
|
||||
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
|
||||
oBinaryDocumentTableWriter.WriteVbaProject(*pDocx->m_pVbaProject);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
// Write content
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
|
||||
oBinaryDocumentTableWriter.Write(oDocx.m_pDocument->m_arrItems);
|
||||
oBinaryDocumentTableWriter.Write(pDocument->m_arrItems);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::HdrFtr);
|
||||
@ -8461,6 +8625,9 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
WriteTableEnd(nCurPos);
|
||||
}
|
||||
this->WriteMainTableEnd();
|
||||
|
||||
if (pDocx) delete pDocx; pDocx = NULL;
|
||||
if (pDocxFlat) delete pDocxFlat; pDocxFlat = NULL;
|
||||
}
|
||||
void BinaryFileWriter::ParagraphAddBreak(OOX::Logic::CParagraph* pParagraph)
|
||||
{
|
||||
|
||||
@ -35,16 +35,14 @@
|
||||
|
||||
#include "BinReaderWriterDefines.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/DocxFlat.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/Settings.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
@ -76,6 +74,7 @@ namespace BinDocxRW
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
|
||||
|
||||
OOX::Document* m_pMain;
|
||||
OOX::CSettings* m_oSettings;
|
||||
PPTX::Theme* m_poTheme;
|
||||
|
||||
@ -83,8 +82,9 @@ namespace BinDocxRW
|
||||
std::map<int, bool> m_mapIgnoreComments;
|
||||
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
|
||||
m_pCBufferedStream(pCBufferedStream),m_pFontProcessor(pFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
m_pCBufferedStream(pCBufferedStream), m_pFontProcessor(pFontProcessor), m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
{
|
||||
m_pMain = NULL;
|
||||
m_oSettings = NULL;
|
||||
m_poTheme = NULL;
|
||||
m_pCurRels = NULL;
|
||||
@ -129,7 +129,6 @@ namespace BinDocxRW
|
||||
class BinaryHeaderFooterTableWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
OOX::CSettings* m_oSettings;
|
||||
|
||||
PPTX::Theme* m_poTheme;
|
||||
@ -137,14 +136,16 @@ namespace BinDocxRW
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
std::map<int, bool>* m_mapIgnoreComments;
|
||||
public:
|
||||
OOX::IFileContainer* m_oDocumentRels;
|
||||
std::vector<OOX::CHdrFtr*> m_aHeaders;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
|
||||
std::vector<OOX::CHdrFtr*> m_aFooters;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
|
||||
public:
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
OOX::IFileContainer* m_oDocumentRels;
|
||||
|
||||
std::vector<OOX::CHdrFtr*> m_aHeaders;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
|
||||
std::vector<OOX::CHdrFtr*> m_aFooters;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
|
||||
|
||||
BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRel, std::map<int, bool>* mapIgnoreComments);
|
||||
void Write();
|
||||
void WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr);
|
||||
@ -303,7 +304,7 @@ namespace BinDocxRW
|
||||
public:
|
||||
Binary_tblPrWriter btblPrs;
|
||||
OOX::Logic::CSectionProperty* pSectPr;
|
||||
OOX::Logic::CBackground * pBackground;
|
||||
OOX::WritingElement* pBackground;
|
||||
OOX::CDocument* poDocument;
|
||||
OOX::JsaProject* pJsaProject;
|
||||
|
||||
@ -315,7 +316,7 @@ namespace BinDocxRW
|
||||
void WriteVbaProject(OOX::VbaProject& oVbaProject);
|
||||
void Write(std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteBackground (OOX::Logic::CBackground* pBackground);
|
||||
void WriteBackground (OOX::WritingElement* pBackground);
|
||||
void WriteParapraph(OOX::Logic::CParagraph& par, OOX::Logic::CParagraphProperty* pPr);
|
||||
void WriteParagraphContent(const std::vector<OOX::WritingElement*> & content, bool bHyperlink = false);
|
||||
void WriteDel(const OOX::Logic::CDel& oDel);
|
||||
@ -469,6 +470,7 @@ namespace BinDocxRW
|
||||
void WriteCell(OOX::Logic::CTc& tc, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nCurColIndex, int nRows, int nCols);
|
||||
void WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols);
|
||||
void WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr);
|
||||
void WriteSdtCheckBox(const OOX::Logic::CSdtCheckBox& oSdtCheckBox);
|
||||
void WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox);
|
||||
void WriteSdtListItem(const ComplexTypes::Word::CSdtListItem& oSdtListItem);
|
||||
void WriteSdtPrDataBinding(const ComplexTypes::Word::CDataBinding& oDataBinding);
|
||||
@ -488,12 +490,14 @@ namespace BinDocxRW
|
||||
std::vector<CCommentWriteTemp*> aReplies;
|
||||
};
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
public:
|
||||
BinaryCommentsTableWriter(ParamsWriter& oParamsWriter);
|
||||
void Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
|
||||
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
|
||||
void WriteComment(CCommentWriteTemp& oComment);
|
||||
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp);
|
||||
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments, ParamsDocumentWriter& oParamsDocumentWriter);
|
||||
void WriteComment(CCommentWriteTemp& oComment, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
|
||||
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
|
||||
};
|
||||
class BinarySettingsTableWriter
|
||||
{
|
||||
|
||||
@ -163,8 +163,7 @@ namespace BinXlsxRW{
|
||||
toXlsxSheetdata(pWorksheet, *it->second, aSharedStrings);
|
||||
|
||||
OOX::Spreadsheet::CSheet* pSheet = new OOX::Spreadsheet::CSheet();
|
||||
pSheet->m_oName.Init();
|
||||
pSheet->m_oName->append(sSheetName);
|
||||
pSheet->m_oName = sSheetName;
|
||||
pSheet->m_oSheetId.Init();
|
||||
pSheet->m_oSheetId->SetValue(nSheetId++);
|
||||
|
||||
@ -212,8 +211,7 @@ namespace BinXlsxRW{
|
||||
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_oFormatCode = (it->first);
|
||||
pNumFmt->m_oNumFmtId.Init();
|
||||
pNumFmt->m_oNumFmtId->SetValue(NUMID_START + it->second);
|
||||
oXlsx.m_pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
|
||||
|
||||
@ -64,7 +64,7 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
RELEASEOBJECT(m_pParamsWriter);
|
||||
RELEASEOBJECT(m_pCurFileWriter);
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath)
|
||||
{
|
||||
OOX::CPath pathMain(sSrcFileName);
|
||||
|
||||
@ -105,6 +105,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
|
||||
oDrawingConverter.SetDstPath(pathMain.GetDirectory() + FILE_SEPARATOR_STR + L"word");
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
oDrawingConverter.SetTempPath(sTempPath);
|
||||
|
||||
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ namespace BinDocxRW
|
||||
virtual ~CDocxSerializer();
|
||||
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath);
|
||||
|
||||
bool CreateDocxFolders(std::wstring strDirectory, std::wstring& sThemePath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ public:
|
||||
{
|
||||
case 'M':
|
||||
{
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"MINYS"))
|
||||
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"MINYS"))
|
||||
{
|
||||
result += L"-"; pos += 5;
|
||||
}
|
||||
@ -159,7 +159,7 @@ public:
|
||||
}break;
|
||||
case 'T':
|
||||
{
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"ТОСHKA"))
|
||||
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"ТОСHKA"))
|
||||
{
|
||||
result += L"."; pos += 6;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public:
|
||||
}break;
|
||||
case 'V':
|
||||
{
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"VOSKL"))
|
||||
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"VOSKL"))
|
||||
{
|
||||
result += L"!"; pos += 5;
|
||||
}
|
||||
@ -181,11 +181,11 @@ public:
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
|
||||
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
|
||||
{
|
||||
result += L"("; pos += 8;
|
||||
}
|
||||
else if ((pos + 9 < size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
|
||||
else if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
|
||||
{
|
||||
result += L")"; pos += 9;
|
||||
}
|
||||
@ -196,15 +196,15 @@ public:
|
||||
}break;
|
||||
case 'K':
|
||||
{
|
||||
if ((pos + 9 < size) && (expr.substr(pos, 9) == L"KVADRATIN"))
|
||||
if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"KVADRATIN"))
|
||||
{
|
||||
result += L"["; pos += 9;
|
||||
}
|
||||
else if ((pos + 10 < size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
|
||||
else if ((pos + 10 <= size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
|
||||
{
|
||||
result += L"]"; pos += 10;
|
||||
}
|
||||
else if ((pos + 8 < size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
|
||||
else if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
|
||||
{
|
||||
result += L"\""; pos += 8;
|
||||
}
|
||||
@ -215,7 +215,7 @@ public:
|
||||
}break;
|
||||
case 'P':
|
||||
{
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"PROBEL"))
|
||||
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"PROBEL"))
|
||||
{
|
||||
result += L" "; pos += 6;
|
||||
}
|
||||
@ -226,7 +226,7 @@ public:
|
||||
}break;
|
||||
case 'A':
|
||||
{
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"APOSTROF"))
|
||||
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"APOSTROF"))
|
||||
{
|
||||
result += L"'"; pos += 8;
|
||||
}
|
||||
@ -385,6 +385,78 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
size_t getColAddressInv(const std::wstring & a_)
|
||||
{
|
||||
std::wstring a = a_;
|
||||
::boost::algorithm::to_upper(a);
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
size_t mul = 1;
|
||||
bool f = true;
|
||||
size_t res = 0;
|
||||
|
||||
for (int i = a.length() - 1; i >= 0; i--)
|
||||
{
|
||||
size_t v = a[i] - L'A';
|
||||
if (f)
|
||||
f = false;
|
||||
else
|
||||
v += 1;
|
||||
res += v * mul;
|
||||
mul *= r;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
size_t getRowAdderssInv(const std::wstring & a_)
|
||||
{
|
||||
int sz = a_.length();
|
||||
if (a_.length()>0)
|
||||
{
|
||||
return boost::lexical_cast<size_t>(a_)-1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
|
||||
{
|
||||
std::wstring a = a_;
|
||||
|
||||
std::reverse(a.begin(), a.end());
|
||||
::XmlUtils::replace_all( a, L"$", L"");
|
||||
//::XmlUtils::replace_all( a, L"'", L"");
|
||||
::boost::algorithm::to_upper(a);
|
||||
|
||||
for (size_t i = 0; i < a.length(); i++)
|
||||
{
|
||||
if (a[i] >= L'0' && a[i] <= L'9')
|
||||
row += a[i];
|
||||
else
|
||||
col += a[i];
|
||||
}
|
||||
std::reverse(col.begin(), col.end());
|
||||
std::reverse(row.begin(), row.end());
|
||||
}
|
||||
|
||||
void getCellAddressInv(const std::wstring & a_, int & col, int & row)
|
||||
{
|
||||
std::wstring colStr=L"", rowStr=L"";
|
||||
splitCellAddress(a_, colStr, rowStr);
|
||||
|
||||
col = getColAddressInv(colStr);
|
||||
row = getRowAdderssInv(rowStr);
|
||||
|
||||
if (col > 16384) col= -1;
|
||||
}
|
||||
|
||||
bool IsRefPresent(const std::wstring& ref_test)
|
||||
{
|
||||
int col = -1, row = -1;
|
||||
getCellAddressInv(ref_test, col, row);
|
||||
|
||||
if (col >= 0 && row >=0) return true;
|
||||
return false;
|
||||
}
|
||||
std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmatch const & what)
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
@ -413,8 +485,21 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
if (!c2.empty() && c2.substr(0, 1) == L":")
|
||||
c2 = c2.substr(1);
|
||||
|
||||
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
bool bRefPresent = true;
|
||||
|
||||
if (sheet.empty() && c2.empty())
|
||||
{
|
||||
bRefPresent = IsRefPresent(c1);
|
||||
}
|
||||
|
||||
if (bRefPresent)
|
||||
{
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
}
|
||||
else
|
||||
{
|
||||
s = c1;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -856,67 +941,6 @@ std::wstring oox2odf_converter::convert_spacechar(std::wstring expr)
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
size_t getColAddressInv(const std::wstring & a_)
|
||||
{
|
||||
std::wstring a = a_;
|
||||
::boost::algorithm::to_upper(a);
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
size_t mul = 1;
|
||||
bool f = true;
|
||||
size_t res = 0;
|
||||
|
||||
for (int i = a.length() - 1; i >= 0; i--)
|
||||
{
|
||||
size_t v = a[i] - L'A';
|
||||
if (f)
|
||||
f = false;
|
||||
else
|
||||
v += 1;
|
||||
res += v * mul;
|
||||
mul *= r;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
size_t getRowAdderssInv(const std::wstring & a_)
|
||||
{
|
||||
int sz = a_.length();
|
||||
if (a_.length()>0)
|
||||
{
|
||||
return boost::lexical_cast<size_t>(a_)-1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
|
||||
{
|
||||
std::wstring a = a_;
|
||||
|
||||
std::reverse(a.begin(), a.end());
|
||||
::XmlUtils::replace_all( a, L"$", L"");
|
||||
//::XmlUtils::replace_all( a, L"'", L"");
|
||||
::boost::algorithm::to_upper(a);
|
||||
|
||||
for (size_t i = 0; i < a.length(); i++)
|
||||
{
|
||||
if (a[i] >= L'0' && a[i] <= L'9')
|
||||
row += a[i];
|
||||
else
|
||||
col += a[i];
|
||||
}
|
||||
std::reverse(col.begin(), col.end());
|
||||
std::reverse(row.begin(), row.end());
|
||||
}
|
||||
|
||||
void getCellAddressInv(const std::wstring & a_, int & col, int & row)
|
||||
{
|
||||
std::wstring colStr=L"", rowStr=L"";
|
||||
splitCellAddress(a_, colStr, rowStr);
|
||||
|
||||
col = getColAddressInv(colStr);
|
||||
row = getRowAdderssInv(rowStr);
|
||||
}
|
||||
|
||||
int oox2odf_converter::get_count_value_points(std::wstring expr)
|
||||
{
|
||||
int count =0;
|
||||
|
||||
@ -238,6 +238,9 @@ enum ElementType
|
||||
typeStyleListLevelProperties,
|
||||
typeStyleListLevelLabelAlignment,
|
||||
|
||||
typeTextOutlineStyle,
|
||||
typeTextOutlineLevelStyle,
|
||||
|
||||
typeStyleTabStop,
|
||||
typeStyleTabStops,
|
||||
typeStyleDropCap,
|
||||
@ -257,6 +260,9 @@ enum ElementType
|
||||
typeStyleFooterLeft,
|
||||
typeStyleFootnoteSep,
|
||||
|
||||
typeLoextHeaderFirst,
|
||||
typeLoextFooterFirst,
|
||||
|
||||
typeStyleSectionProperties,
|
||||
typeStyleHeaderStyle,
|
||||
typeStyleFooterStyle,
|
||||
@ -595,6 +601,7 @@ enum ElementType
|
||||
typeChartStockRangeLine,
|
||||
typeChartRegressionCurve,
|
||||
typeChartEquation,
|
||||
typeChartDateScale,
|
||||
|
||||
typeStyleChartProperties,
|
||||
|
||||
|
||||
@ -216,6 +216,8 @@ SOURCES += \
|
||||
../src/odf/datatypes/dategroup.cpp \
|
||||
../src/odf/datatypes/bibliography.cpp \
|
||||
../src/odf/datatypes/commandtype.cpp \
|
||||
../src/odf/datatypes/styleprint.cpp \
|
||||
../src/odf/datatypes/charttimeunit.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
@ -476,6 +478,8 @@ HEADERS += \
|
||||
../src/odf/datatypes/xlink.h \
|
||||
../src/odf/datatypes/chartlabelposition.h \
|
||||
../src/odf/datatypes/grandtotal.h \
|
||||
../src/odf/datatypes/styleprint.h \
|
||||
../src/odf/datatypes/charttimeunit.h \
|
||||
../src/docx/docx_content_type.h \
|
||||
../src/docx/docx_conversion_context.h \
|
||||
../src/docx/docx_conversion_state.h \
|
||||
|
||||
@ -130,3 +130,4 @@
|
||||
#include "../src/odf/datatypes/commandtype.cpp"
|
||||
#include "../src/odf/datatypes/stylenumformat.cpp"
|
||||
#include "../src/odf/datatypes/bibliography.cpp"
|
||||
#include "../src/odf/datatypes/styleprint.cpp"
|
||||
|
||||
@ -198,7 +198,30 @@ std::wstring styles_map::name(const std::wstring & Name, odf_types::style_family
|
||||
}
|
||||
void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
{
|
||||
if (!state_.in_run_)
|
||||
if(false == current_process_comment_)
|
||||
{
|
||||
for (size_t i = 0; i < get_comments_context().ref_start_.size(); i++)
|
||||
{
|
||||
output_stream() << L"<w:commentRangeStart w:id=\"" << get_comments_context().ref_start_[i] << L"\"/>";
|
||||
}
|
||||
get_comments_context().ref_start_.clear();
|
||||
|
||||
if (false == get_comments_context().ref_end_.empty())
|
||||
{
|
||||
for (size_t i = 0; i < get_comments_context().ref_end_.size(); i++)
|
||||
{
|
||||
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().ref_end_[i] << L"\"/>";
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < get_comments_context().ref_end_.size(); i++)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().ref_end_[i] << L"\"/>";
|
||||
}
|
||||
|
||||
get_comments_context().ref_end_.clear();
|
||||
}
|
||||
}
|
||||
if (!state_.in_run_)
|
||||
{
|
||||
state_.in_run_ = true;
|
||||
output_stream() << L"<w:r>";
|
||||
@ -241,6 +264,20 @@ void docx_conversion_context::finish_paragraph()
|
||||
{
|
||||
end_changes();
|
||||
|
||||
if (false == current_process_comment_ && false == get_comments_context().ref_end_.empty())
|
||||
{
|
||||
for (size_t i = 0; i < get_comments_context().ref_end_.size(); i++)
|
||||
{
|
||||
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().ref_end_[i] << L"\"/>";
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < get_comments_context().ref_end_.size(); i++)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().ref_end_[i] << L"\"/>";
|
||||
}
|
||||
|
||||
get_comments_context().ref_end_.clear();
|
||||
}
|
||||
output_stream() << L"</w:p>";
|
||||
}
|
||||
|
||||
@ -254,23 +291,17 @@ void docx_conversion_context::finish_run()
|
||||
{
|
||||
if (false == state_.in_run_) return;
|
||||
|
||||
if (get_comments_context().state() == 4)
|
||||
if (false == current_process_comment_)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
get_comments_context().state(0);
|
||||
for (size_t i = 0; i < get_comments_context().ref_.size(); i++)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().ref_[i] << L"\"/>";
|
||||
}
|
||||
get_comments_context().ref_.clear();
|
||||
}
|
||||
|
||||
output_stream() << L"</w:r>";
|
||||
state_.in_run_ = false;
|
||||
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
|
||||
add_element_to_run();
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
get_comments_context().state(0);
|
||||
finish_run();
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::start_math_formula()
|
||||
{
|
||||
@ -609,34 +640,36 @@ void docx_conversion_context::back_context_state()
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
{
|
||||
finish_run();
|
||||
if (get_comments_context().state() == 1 ||
|
||||
get_comments_context().state() == 4)//??? comment in run
|
||||
{
|
||||
output_stream() << L"<w:commentRangeStart w:id=\"" << get_comments_context().current_id() << L"\" />";
|
||||
get_comments_context().state(2);//active
|
||||
}
|
||||
|
||||
add_element_to_run(parentStyleId);
|
||||
}
|
||||
|
||||
std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, bool draw)
|
||||
{
|
||||
hyperlinks::_type_place type = hyperlinks::document_place;
|
||||
|
||||
if (current_process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (current_process_note_ == footNote || current_process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (current_process_note_ == endNote || current_process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
|
||||
oox::_rels_type_place type_place = get_type_place();
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
|
||||
return hyperlinks_.add(href_correct, type, draw);
|
||||
return hyperlinks_.add(href_correct, type_place, draw);
|
||||
}
|
||||
hyperlinks::_ref docx_conversion_context::last_hyperlink()
|
||||
{
|
||||
return hyperlinks_.last();
|
||||
}
|
||||
_rels_type_place docx_conversion_context::get_type_place()
|
||||
{
|
||||
if (current_process_comment_) return oox::comment_place;
|
||||
if (current_process_note_ == footNote ||
|
||||
current_process_note_ == footNoteRefSet) return oox::footnote_place;
|
||||
if (current_process_note_ == endNote ||
|
||||
current_process_note_ == endNoteRefSet ) return oox::endnote_place;
|
||||
|
||||
if (process_headers_footers_) return oox::header_footer_place;
|
||||
|
||||
void docx_conversion_context::dump_hyperlinks(rels & Rels, hyperlinks::_type_place type)
|
||||
return oox::document_place;
|
||||
}
|
||||
void docx_conversion_context::dump_hyperlinks(rels & Rels, _rels_type_place type)
|
||||
{
|
||||
hyperlinks_.dump_rels(Rels, type);
|
||||
}
|
||||
@ -702,9 +735,12 @@ void docx_conversion_context::end_document()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
dump_bibliography();
|
||||
dump_hyperlinks (notes_context_.footnotesRels(), hyperlinks::footnote_place);
|
||||
dump_hyperlinks (notes_context_.endnotesRels(), hyperlinks::endnote_place);
|
||||
|
||||
dump_hyperlinks (notes_context_.footnotesRels(), oox::footnote_place);
|
||||
dump_hyperlinks (notes_context_.endnotesRels(), oox::endnote_place);
|
||||
|
||||
get_mediaitems()->dump_rels(notes_context_.footnotesRels(), oox::footnote_place);
|
||||
get_mediaitems()->dump_rels(notes_context_.endnotesRels(), oox::endnote_place);
|
||||
|
||||
output_document_->get_word_files().set_notes(notes_context_);
|
||||
////////////////////////
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
@ -872,21 +908,25 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type)
|
||||
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type, bool &bDisplayed)
|
||||
{
|
||||
if (!DisplayName.empty())
|
||||
bDisplayed = true;
|
||||
if (false == DisplayName.empty())
|
||||
return DisplayName;
|
||||
|
||||
if (!Name.empty())
|
||||
if (false == Name.empty())
|
||||
{
|
||||
bDisplayed = false;
|
||||
return Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(Type)
|
||||
{
|
||||
case odf_types::style_family::Paragraph:
|
||||
return L"Normal";
|
||||
break;
|
||||
default:
|
||||
bDisplayed = false;
|
||||
return std::wstring(L"DStyle_") + boost::lexical_cast<std::wstring>(odf_types::style_family( Type) );
|
||||
}
|
||||
}
|
||||
@ -928,28 +968,44 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
std::vector<int> numIds;
|
||||
|
||||
odf_reader::list_style_container::instances_array & arListStyles = list_styles.instances();
|
||||
|
||||
for (size_t i = 0; i < arListStyles.size(); i++)
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = arListStyles[i]->get_text_list_style()->get_content();
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = arListStyles[i]->get_text_list_style()->content_;
|
||||
|
||||
if (content.size() < 1)
|
||||
if (content.empty())
|
||||
continue;
|
||||
|
||||
const int abstractNumId = list_styles.id_by_name(arListStyles[i]->get_style_name());
|
||||
numIds.push_back(abstractNumId);
|
||||
|
||||
strm << L"<w:abstractNum w:abstractNumId=\"" << abstractNumId << "\">";
|
||||
numIds.push_back(abstractNumId);
|
||||
|
||||
for (size_t j = 0; j < (std::min)( content.size(), (size_t)9); j++)
|
||||
{
|
||||
start_text_list_style(arListStyles[i]->get_text_list_style()->get_style_name());
|
||||
content[j]->docx_convert(*this);
|
||||
// TODO
|
||||
start_text_list_style(arListStyles[i]->get_text_list_style()->attr_.style_name_);
|
||||
content[j]->docx_convert(*this);
|
||||
end_text_list_style();
|
||||
}
|
||||
|
||||
strm << L"</w:abstractNum>";
|
||||
}
|
||||
}
|
||||
if (list_styles.outline_style())
|
||||
{
|
||||
const int abstractNumId = list_styles.id_outline();
|
||||
numIds.push_back(abstractNumId);
|
||||
|
||||
strm << L"<w:abstractNum w:abstractNumId=\"" << abstractNumId << "\">";
|
||||
|
||||
for (size_t j = 0; j < (std::min)( list_styles.outline_style()->content_.size(), (size_t)9); j++)
|
||||
{
|
||||
start_text_list_style(L"Outline");
|
||||
list_styles.outline_style()->content_[j]->docx_convert(*this);
|
||||
end_text_list_style();
|
||||
}
|
||||
|
||||
strm << L"</w:abstractNum>";
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < numIds.size(); i++)
|
||||
{
|
||||
@ -1071,11 +1127,9 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
if (!arStyles[i]->is_automatic() &&
|
||||
(
|
||||
arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text
|
||||
))
|
||||
if (false == arStyles[i]->is_automatic() &&
|
||||
(arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text))
|
||||
{
|
||||
const std::wstring id = styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
|
||||
@ -1085,7 +1139,8 @@ void docx_conversion_context::process_styles()
|
||||
}
|
||||
_Wostream << L">";
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
|
||||
bool bDisplayed = (arStyles[i]->type() == odf_types::style_family::Paragraph);
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type(), bDisplayed);
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
|
||||
|
||||
@ -1094,12 +1149,13 @@ void docx_conversion_context::process_styles()
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
else if (false == arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
{
|
||||
bDisplayed = false;
|
||||
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else
|
||||
if (bDisplayed)
|
||||
{
|
||||
_Wostream << L"<w:qFormat/>";
|
||||
}
|
||||
@ -1524,7 +1580,8 @@ void docx_conversion_context::start_list_item(bool restart)
|
||||
list_style_renames_[curStyleName] = newStyleName;
|
||||
|
||||
odf_reader::list_style_container & lists = root()->odf_context().listStyleContainer();
|
||||
odf_reader::text_list_style * curStyle = lists.list_style_by_name(curStyleName);
|
||||
|
||||
odf_reader::text_list_style * curStyle = lists.list_style_by_name(curStyleName);
|
||||
lists.add_list_style(curStyle, newStyleName);
|
||||
end_list();
|
||||
start_list(newStyleName);
|
||||
@ -1671,6 +1728,8 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
_CP_OPT(int) outline_level = calc_outline_level(Attr->outline_level_, styleInst);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
@ -1710,11 +1769,14 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
set_rtl(false);
|
||||
}
|
||||
}
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
get_styles_context().start_process_style(styleInst);
|
||||
|
||||
if (outline_level)
|
||||
{
|
||||
set_outline_level(*Attr->outline_level_ - 1);
|
||||
set_outline_level(*outline_level);
|
||||
}
|
||||
styleContent->docx_convert(*this);
|
||||
styleContent->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
|
||||
end_automatic_style();
|
||||
|
||||
@ -1736,10 +1798,11 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
start_paragraph();
|
||||
//process_paragraph_style(Context.get_current_paragraph_style()); ??
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
if (outline_level)
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";
|
||||
output_stream() << L"</w:pPr>";
|
||||
}
|
||||
}
|
||||
@ -1747,9 +1810,10 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
if (outline_level)
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
}
|
||||
@ -1794,9 +1858,19 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
if (outline_level)
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
|
||||
odf_reader::list_style_container & list_styles = root()->odf_context().listStyleContainer();
|
||||
|
||||
if (list_style_stack_.empty() && list_styles.outline_style())
|
||||
{
|
||||
output_stream() << L"<w:numPr>";
|
||||
output_stream() << L"<w:ilvl w:val=\"" << *outline_level - 1 << L"\"/>";
|
||||
output_stream() << L"<w:numId w:val=\"" << list_styles.id_outline() << L"\"/>";
|
||||
output_stream() << L"</w:numPr>";
|
||||
}
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";
|
||||
}
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
@ -1933,8 +2007,8 @@ namespace
|
||||
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
|
||||
rels internal_rels;
|
||||
|
||||
Context.get_mediaitems()->dump_rels(internal_rels);
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
Context.get_mediaitems()->dump_rels(internal_rels, oox::header_footer_place);
|
||||
Context.dump_hyperlinks(internal_rels, oox::header_footer_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
}
|
||||
|
||||
@ -475,42 +475,56 @@ private:
|
||||
class comments_context : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
comments_context() : state_(0) {}
|
||||
comments_context(){}
|
||||
|
||||
struct _comment_desc
|
||||
{
|
||||
_comment_desc(const std::wstring & c, int _id, const std::wstring & a, const std::wstring & d) :
|
||||
content(c), id(_id), author(a), date(d)
|
||||
{}
|
||||
std::wstring content;
|
||||
int id;
|
||||
std::wstring date;
|
||||
std::wstring author;
|
||||
std::wstring initials;
|
||||
};
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, bool inRun = false)
|
||||
void end_comment(const std::wstring & name)
|
||||
{
|
||||
std::map<std::wstring, int>::iterator pFind = comments_map_.find(name);
|
||||
if (pFind != comments_map_.end())
|
||||
{
|
||||
ref_end_.push_back(pFind->second);
|
||||
}
|
||||
}
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, _CP_OPT(std::wstring) name)
|
||||
{
|
||||
int id = comments_.size() + 1;
|
||||
_comment_desc new_comment={content, id, date, author};
|
||||
_comment_desc new_comment(content, id, author, date);
|
||||
|
||||
if ((name) && (false == name->empty()))
|
||||
{
|
||||
comments_map_.insert(std::make_pair(*name, id));
|
||||
ref_start_.push_back(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
ref_.push_back(id);
|
||||
}
|
||||
comments_.push_back(new_comment);
|
||||
|
||||
state_ = inRun ? 4 : 1;
|
||||
}
|
||||
int current_id()
|
||||
{
|
||||
if (comments_.size()>0 && state_ >0 )return comments_.back().id;
|
||||
else return -1; //not set
|
||||
}
|
||||
void state(int state) {state_ = state;}
|
||||
int state(){return state_;}
|
||||
|
||||
rels& get_rels(){return internal_rels_;}
|
||||
|
||||
std::vector<_comment_desc> comments_;
|
||||
std::vector<_comment_desc> comments_;
|
||||
std::vector<int> ref_start_;
|
||||
std::vector<int> ref_end_;
|
||||
std::vector<int> ref_;
|
||||
|
||||
private:
|
||||
int state_;
|
||||
rels internal_rels_;//это для гиперлинков или медиа в комментариях
|
||||
std::map<std::wstring, int> comments_map_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class text_tracked_context
|
||||
{
|
||||
public:
|
||||
@ -784,10 +798,12 @@ public:
|
||||
|
||||
std::wstring add_hyperlink (const std::wstring & href, bool drawing);
|
||||
hyperlinks::_ref last_hyperlink ();
|
||||
void dump_hyperlinks (rels & Rels, hyperlinks::_type_place type);
|
||||
void dump_hyperlinks (rels & Rels, _rels_type_place type);
|
||||
|
||||
void dump_headers_footers (rels & Rels) const;
|
||||
void dump_notes (rels & Rels) const;
|
||||
|
||||
_rels_type_place get_type_place();
|
||||
|
||||
void dump_bibliography();
|
||||
std::wstring dump_settings_document();
|
||||
@ -934,9 +950,12 @@ public:
|
||||
void start_chart(std::wstring name);
|
||||
void end_chart ();
|
||||
|
||||
void start_comment () {current_process_comment_ = true;}
|
||||
void end_comment () {current_process_comment_ = false;}
|
||||
void start_comment_content () {current_process_comment_ = true;}
|
||||
void end_comment_content () {current_process_comment_ = false;}
|
||||
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, _CP_OPT(std::wstring) name);
|
||||
void end_comment(const std::wstring & name);
|
||||
|
||||
void start_math_formula ();
|
||||
void end_math_formula ();
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ void serialize_wrap_extent(std::wostream & strm, _docx_drawing const & val)
|
||||
if (odf_reader::GetProperty(val.additional,L"border_width_top",iVal)) CP_XML_ATTR(L"t",iVal.get());
|
||||
if (odf_reader::GetProperty(val.additional,L"border_width_right",iVal)) CP_XML_ATTR(L"r",iVal.get());
|
||||
if (odf_reader::GetProperty(val.additional,L"border_width_bottom",iVal)) CP_XML_ATTR(L"b",iVal.get());
|
||||
}
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
serialize_null_extent( strm);
|
||||
@ -151,6 +151,7 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
break;
|
||||
case odf_types::style_wrap::Left:
|
||||
case odf_types::style_wrap::Right:
|
||||
case odf_types::style_wrap::Dynamic: //Présentation_de_tib.odt
|
||||
serialize_wrap_square(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::RunThrough:
|
||||
@ -159,7 +160,6 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
case odf_types::style_wrap::None:
|
||||
serialize_wrap_top_bottom(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::Dynamic:
|
||||
default:
|
||||
CP_XML_NODE(L"wp:wrapTopAndBottom");
|
||||
break;
|
||||
@ -195,6 +195,86 @@ void _docx_drawing::serialize_text(std::wostream & strm)
|
||||
serialize_bodyPr(strm, L"wps");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void docx_serialize_media_child(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pic:pic")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:pic",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
{
|
||||
CP_XML_NODE(L"pic:nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"pic:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id + 1);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
//oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"pic:cNvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"a:picLocks") CP_XML_ATTR(L"noChangeAspect",1);
|
||||
}
|
||||
CP_XML_NODE(L"pic:nvPr")
|
||||
{
|
||||
std::wstring strNode;
|
||||
|
||||
if (val.type == typeVideo) strNode = L"a:videoFile";
|
||||
else if (val.type == typeAudio) strNode = L"a:audioFile";
|
||||
|
||||
if (false == strNode.empty())
|
||||
{
|
||||
CP_XML_NODE(strNode)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.objectId);
|
||||
}
|
||||
}
|
||||
if (false == val.extId.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:extLst")
|
||||
{
|
||||
CP_XML_NODE(L"a:ext")
|
||||
{
|
||||
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
|
||||
CP_XML_NODE(L"wp15:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:wp15", L"http://schemas.microsoft.com/office/word/2012/wordprocessingDrawing");
|
||||
if (val.extExternal)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.extId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val.fill.bitmap->name_space = L"pic";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"pic:spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
CP_XML_NODE(L"a:prstGeom")
|
||||
{
|
||||
CP_XML_ATTR(L"prst", L"rect");
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
oox_serialize_effects(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
@ -211,6 +291,8 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
//CP_XML_ATTR(L"desc text",L"");
|
||||
CP_XML_ATTR(L"id", val.id + 1);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
//oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"pic:cNvPicPr")
|
||||
{
|
||||
@ -346,6 +428,11 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
|
||||
CP_XML_ATTR(L"uri", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
docx_serialize_group_child(CP_XML_STREAM(), val);
|
||||
}
|
||||
else if (val.type == typeAudio || val.type == typeVideo || val.type == typeMedia)
|
||||
{
|
||||
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
docx_serialize_media_child(CP_XML_STREAM(), val);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
|
||||
@ -144,9 +144,9 @@ void word_files::write(const std::wstring & RootPath)
|
||||
|
||||
void word_files::update_rels(docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels(), oox::document_place);
|
||||
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), oox::document_place);
|
||||
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ struct drawing_object_description
|
||||
{
|
||||
bool bNotes_;
|
||||
|
||||
oox::RelsType type_;
|
||||
oox::_rels_type type_;
|
||||
|
||||
std::wstring name_;
|
||||
std::wstring descriptor_;
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "hyperlinks.h"
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include <xml/utils.h>
|
||||
|
||||
@ -48,7 +47,7 @@ hyperlinks::_ref hyperlinks::last()
|
||||
return r;
|
||||
}
|
||||
|
||||
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
|
||||
std::wstring hyperlinks::add(const std::wstring & href, _rels_type_place type_place, bool drawing)
|
||||
{
|
||||
std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
|
||||
|
||||
@ -60,14 +59,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place,
|
||||
}
|
||||
|
||||
|
||||
void hyperlinks::dump_rels(rels & Rels, _type_place type)
|
||||
void hyperlinks::dump_rels(rels & Rels, _rels_type_place type_place)
|
||||
{
|
||||
size_t i = 0;
|
||||
for (size_t i = 0; i < hrefs_.size(); i++)
|
||||
{
|
||||
if (hrefs_[i].used_rels)continue; // уже использовали этот релс
|
||||
|
||||
if (hrefs_[i].type_place == type)
|
||||
if (hrefs_[i].type_place == type_place)
|
||||
{
|
||||
Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
|
||||
hrefs_[i].used_rels = true;
|
||||
|
||||
@ -31,40 +31,29 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "oox_rels.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class rels;
|
||||
|
||||
class hyperlinks
|
||||
{
|
||||
public:
|
||||
enum _type_place
|
||||
{
|
||||
document_place,
|
||||
endnote_place,
|
||||
footnote_place,
|
||||
comment_place
|
||||
|
||||
};
|
||||
|
||||
struct _ref
|
||||
{
|
||||
std::wstring href;
|
||||
_type_place type_place;
|
||||
bool drawing;
|
||||
std::wstring id;
|
||||
bool used_rels;
|
||||
std::wstring href;
|
||||
_rels_type_place type_place;
|
||||
bool drawing;
|
||||
std::wstring id;
|
||||
bool used_rels;
|
||||
};
|
||||
|
||||
std::wstring add(const std::wstring & href, _type_place type_place, bool drawing);
|
||||
std::wstring add(const std::wstring & href, _rels_type_place type_place, bool drawing);
|
||||
|
||||
_ref last();
|
||||
|
||||
void dump_rels(rels & Rels, _type_place type);
|
||||
void dump_rels(rels & Rels, _rels_type_place type_place);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -41,13 +41,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace utils {
|
||||
|
||||
namespace
|
||||
{
|
||||
class Error : public std::exception {};
|
||||
class LoadFontError : public Error {};
|
||||
class MeasureError : public Error {};
|
||||
}
|
||||
|
||||
std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
|
||||
{
|
||||
if (pFontManager == NULL) return std::pair<float, float>(7,8);
|
||||
@ -73,7 +66,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
|
||||
// return std::pair<float, float>(7,8);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))//
|
||||
return std::pair<float, float>(7,8);
|
||||
|
||||
TBBox box;
|
||||
@ -96,7 +89,8 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
|
||||
}
|
||||
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
//double width = (minWidth + 2 * maxWidth) / 5./*/36.*/ /3.;
|
||||
return std::pair<float, float>(width, maxHeight);
|
||||
}
|
||||
|
||||
|
||||
@ -59,18 +59,10 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
|
||||
return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath);
|
||||
}
|
||||
|
||||
mediaitems::item::item( std::wstring const & _href,
|
||||
RelsType _type,
|
||||
std::wstring const & _outputName,
|
||||
bool _mediaInternal,
|
||||
std::wstring const & _Id
|
||||
)
|
||||
: href(_href),
|
||||
type(_type),
|
||||
outputName(_outputName),
|
||||
mediaInternal(_mediaInternal),
|
||||
Id(_Id),
|
||||
valid(true) //вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
|
||||
mediaitems::item::item(std::wstring const & _href,_rels_type _type, std::wstring const & _outputName,
|
||||
bool _mediaInternal, std::wstring const & _Id, _rels_type_place type_place_)
|
||||
: href(_href), type(_type), outputName(_outputName), mediaInternal(_mediaInternal), Id(_Id), valid(true), type_place(type_place_)
|
||||
//вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
|
||||
{
|
||||
count_add = 1;
|
||||
count_used = 0;
|
||||
@ -102,13 +94,13 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place)
|
||||
{
|
||||
std::wstring ref;
|
||||
return add_or_find(href, type, isInternal, ref);
|
||||
return add_or_find(href, type, isInternal, ref, type_place);
|
||||
}
|
||||
|
||||
std::wstring static get_default_file_name(RelsType type)
|
||||
std::wstring static get_default_file_name(_rels_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -136,7 +128,7 @@ std::wstring static get_default_file_name(RelsType type)
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType type, bool & isInternal, size_t Num)
|
||||
std::wstring mediaitems::create_file_name(const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num)
|
||||
{
|
||||
if (uri.empty()) return L"";
|
||||
|
||||
@ -206,7 +198,7 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring sub_path = L"media/";
|
||||
@ -254,6 +246,8 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
std::wstring id;
|
||||
for (size_t i = 0 ; i < items_.size(); i++)
|
||||
{
|
||||
if (items_[i].type_place != type_place) continue;
|
||||
|
||||
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
|
||||
{
|
||||
id = items_[i].Id;
|
||||
@ -313,13 +307,18 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
count_shape++;
|
||||
}
|
||||
|
||||
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id) );
|
||||
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id, type_place) );
|
||||
}
|
||||
|
||||
ref = outputPath;
|
||||
isInternal = isMediaInternal;
|
||||
return id;
|
||||
}
|
||||
void mediaitems::add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place)
|
||||
{
|
||||
items_.push_back( item(L"", type, ref, isInternal, rid, type_place) );
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
@ -330,10 +329,10 @@ std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
|
||||
oox_target = std::wstring(L"ctrlProp") + std::to_wstring(count_control) + L".xml";
|
||||
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId) );
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId, oox::document_place) );
|
||||
return rId;
|
||||
}
|
||||
void mediaitems::dump_rels(rels & Rels)
|
||||
void mediaitems::dump_rels(rels & Rels, _rels_type_place type_place)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
@ -341,8 +340,10 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
if ( items_[i].type == typeShape ) continue;
|
||||
if ( items_[i].type == typeGroupShape ) continue;
|
||||
|
||||
if (items_[i].type_place != type_place) continue;
|
||||
|
||||
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
|
||||
|
||||
|
||||
Rels.add( relationship(
|
||||
items_[i].Id,
|
||||
get_rel_type (items_[i].type),
|
||||
|
||||
@ -46,25 +46,28 @@ namespace oox {
|
||||
class mediaitems
|
||||
{
|
||||
public:
|
||||
|
||||
mediaitems(const std::wstring & odfPacket);
|
||||
virtual ~mediaitems();
|
||||
|
||||
struct item
|
||||
{
|
||||
item( std::wstring const & _href,
|
||||
RelsType _type,
|
||||
std::wstring const & _outputName,
|
||||
bool _mediaInternal,
|
||||
std::wstring const & _Id);
|
||||
item( std::wstring const & href,
|
||||
_rels_type type,
|
||||
std::wstring const & outputName,
|
||||
bool mediaInternal,
|
||||
std::wstring const & Id,
|
||||
_rels_type_place type_place);
|
||||
|
||||
std::wstring href;
|
||||
RelsType type;
|
||||
std::wstring outputName;
|
||||
bool mediaInternal;
|
||||
bool valid;
|
||||
std::wstring Id;
|
||||
int count_used;
|
||||
int count_add;
|
||||
std::wstring href;
|
||||
_rels_type type;
|
||||
_rels_type_place type_place;
|
||||
std::wstring outputName;
|
||||
bool mediaInternal;
|
||||
bool valid;
|
||||
std::wstring Id;
|
||||
int count_used;
|
||||
int count_add;
|
||||
};
|
||||
typedef std::vector< item > items_array;
|
||||
|
||||
@ -83,15 +86,17 @@ public:
|
||||
void set_font_directory(std::wstring pathFonts);
|
||||
NSFonts::IApplicationFonts *applicationFonts() {return applicationFonts_;}
|
||||
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
|
||||
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place);
|
||||
|
||||
void add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place);
|
||||
std::wstring add_control_props (std::wstring & oox_target);
|
||||
|
||||
void dump_rels(rels & Rels);
|
||||
items_array & items() { return items_; }
|
||||
void dump_rels(rels & Rels, _rels_type_place type);
|
||||
|
||||
items_array & items() { return items_; }
|
||||
|
||||
static std::wstring get_rel_type(RelsType type)
|
||||
static std::wstring get_rel_type(_rels_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -111,7 +116,7 @@ public:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
static _rels_type detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
size_t pos = fileName.rfind(L".");
|
||||
|
||||
@ -139,7 +144,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring create_file_name (const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
|
||||
items_array items_;
|
||||
|
||||
@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
|
||||
{
|
||||
bool isInternal = true;
|
||||
std::wstring ref;
|
||||
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref, oox::chart_place);
|
||||
|
||||
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
|
||||
}
|
||||
@ -75,7 +75,7 @@ void oox_chart_context::set_externalData(const std::wstring & href)
|
||||
bool isInternal = true;
|
||||
std::wstring href_out;
|
||||
|
||||
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out, oox::chart_place);
|
||||
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
|
||||
}
|
||||
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
|
||||
@ -169,6 +169,7 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
{
|
||||
if (plot_area_.current_chart_->is3D_)
|
||||
{
|
||||
plot_area_.oox_serialize_view3D(CP_XML_STREAM());
|
||||
//CP_XML_NODE(L"c:view3D");
|
||||
CP_XML_NODE(L"c:floor");
|
||||
CP_XML_NODE(L"c:backWall");
|
||||
|
||||
@ -118,10 +118,11 @@ public:
|
||||
graphic_properties_= prop;
|
||||
fill_ = fill;
|
||||
}
|
||||
void set_plot_area_properties(std::vector<odf_reader::_property> & prop, _oox_fill &fill)
|
||||
void set_plot_area_properties(std::vector<odf_reader::_property> & prop, std::vector<odf_reader::_property> & prop_3d, _oox_fill &fill)
|
||||
{
|
||||
reset_fill(fill);
|
||||
plot_area_.properties_ = prop;
|
||||
plot_area_.properties_3d_ = prop_3d;
|
||||
plot_area_.fill_ = fill;
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ namespace oox {
|
||||
|
||||
void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (!bEnabled) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:spPr")
|
||||
@ -52,8 +54,9 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
|
||||
|
||||
}
|
||||
|
||||
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop,_oox_fill & fill)
|
||||
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop, _oox_fill & fill)
|
||||
{
|
||||
bEnabled = true;
|
||||
content_ = prop;
|
||||
fill_ = fill;
|
||||
}
|
||||
|
||||
@ -46,12 +46,13 @@ void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reade
|
||||
class oox_chart_shape : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
oox_chart_shape(){}
|
||||
oox_chart_shape() : bEnabled ( false) {}
|
||||
~oox_chart_shape(){}
|
||||
|
||||
void set(std::vector<odf_reader::_property> & prop,_oox_fill & fill);
|
||||
void oox_serialize(std::wostream & _Wostream);
|
||||
|
||||
bool bEnabled;
|
||||
private:
|
||||
std::vector<odf_reader::_property> content_;
|
||||
_oox_fill fill_;
|
||||
|
||||
@ -77,7 +77,7 @@ namespace oox {
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
RelsType typeRels;
|
||||
_rels_type typeRels;
|
||||
bool highlightClick;
|
||||
};
|
||||
class _oox_drawing
|
||||
@ -86,7 +86,7 @@ namespace oox {
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), hidden(false), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
RelsType type;
|
||||
_rels_type type;
|
||||
|
||||
bool inGroup;
|
||||
size_t id;
|
||||
|
||||
@ -94,6 +94,8 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
else if (L"docx" == extension) return L"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
else if (L"doc" == extension) return L"application/msword";
|
||||
else if (L"vsd" == extension) return L"application/vnd.visio";
|
||||
else if (L"vsdx" == extension) return L"application/vnd.ms-visio.drawing";
|
||||
else return L"application/octet-stream";
|
||||
|
||||
|
||||
@ -387,16 +389,18 @@ void media::write(const std::wstring & RootPath)
|
||||
items[i].type == typeAudio ||
|
||||
items[i].type == typeVideo ))
|
||||
{
|
||||
std::wstring & file_name = items[i].href;
|
||||
std::wstring &file_name = items[i].href;
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
|
||||
|
||||
if (file_name.empty()) continue;
|
||||
|
||||
CImageFileFormatChecker svmFileChecker;
|
||||
if (svmFileChecker.isSvmFile(file_name))
|
||||
{
|
||||
ConvertSvmToImage(file_name, file_name_out, appFonts_);
|
||||
}
|
||||
else
|
||||
NSFile::CFileBinary::Copy(items[i].href, file_name_out);
|
||||
NSFile::CFileBinary::Copy(file_name, file_name_out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
#include <CPOptional.h>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
@ -120,6 +121,104 @@ void oox_plot_area::reset_cross_axis()//обязательно после все
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_plot_area::oox_serialize_view3D(std::wostream & _Wostream)
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) doubleVal;
|
||||
|
||||
odf_reader::GetProperty(properties_3d_, L"transform", strVal);
|
||||
|
||||
if (!strVal) return;
|
||||
|
||||
size_t pos_matrix = strVal->find(L"matrix(");
|
||||
|
||||
if (pos_matrix == std::wstring::npos) return;
|
||||
|
||||
size_t pos_matrix_end = strVal->find(L")", pos_matrix);
|
||||
if (pos_matrix_end == std::wstring::npos || pos_matrix_end == pos_matrix + 7) return;
|
||||
|
||||
std::wstring tmp = strVal->substr(pos_matrix + 7, pos_matrix_end - 7 - pos_matrix);
|
||||
|
||||
std::vector<std::wstring> values;
|
||||
|
||||
boost::algorithm::split(values, tmp, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
if (values.size() < 12) return;
|
||||
|
||||
double left_x = XmlUtils::GetDouble(values[0]);
|
||||
double up_x = XmlUtils::GetDouble(values[1]);
|
||||
double forward_x = XmlUtils::GetDouble(values[2]);
|
||||
double left_y = XmlUtils::GetDouble(values[3]);
|
||||
double up_y = XmlUtils::GetDouble(values[4]);
|
||||
double forward_y = XmlUtils::GetDouble(values[5]);
|
||||
double left_z = XmlUtils::GetDouble(values[6]);
|
||||
double up_z = XmlUtils::GetDouble(values[7]);
|
||||
double forward_z = XmlUtils::GetDouble(values[8]);
|
||||
|
||||
const double DEG2RAD = 3.1415926 / 180;
|
||||
double sx, sy, sz, cx, cy, cz, theta_x, theta_y, theta_z = 0;
|
||||
|
||||
sy = forward_x;
|
||||
|
||||
theta_y = (sy == 0 ? 0 : asin(sy));
|
||||
cy = cos(theta_y);
|
||||
|
||||
theta_y /= DEG2RAD;
|
||||
|
||||
sx = - forward_y / cy;
|
||||
cx = forward_z / cy;
|
||||
|
||||
theta_x = (sx == 0 ? 0 : asin(sx));
|
||||
double theta_x_test = (sx == 0 ? 0 : acos(cx));
|
||||
|
||||
theta_x /= DEG2RAD;
|
||||
|
||||
sz = - up_x / cy;
|
||||
cz = left_x / cy;
|
||||
|
||||
theta_z = (sz == 0 ? 0 : asin(sz));
|
||||
double theta_z_test = (sz == 0 ? 0 : acos(cz));
|
||||
|
||||
theta_z /= DEG2RAD;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:view3D")
|
||||
{
|
||||
CP_XML_NODE(L"c:rotX")
|
||||
{
|
||||
CP_XML_ATTR(L"val", (int) (theta_x + 0.5) );
|
||||
}
|
||||
CP_XML_NODE(L"c:rotY")
|
||||
{
|
||||
CP_XML_ATTR(L"val", (int) (theta_y + 0.5) );
|
||||
}
|
||||
CP_XML_NODE(L"c:depthPercent")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 100 );
|
||||
}
|
||||
if (theta_z == 0)
|
||||
{
|
||||
CP_XML_NODE(L"c:rAngAx")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"c:rAngAx")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 0 );
|
||||
}
|
||||
CP_XML_NODE(L"c:perspective")
|
||||
{
|
||||
CP_XML_ATTR(L"val", (int) (theta_z * 2 + 0.5) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_plot_area::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
reset_cross_axis();
|
||||
|
||||
@ -54,11 +54,13 @@ public:
|
||||
|
||||
std::vector<odf_reader::_property> graphic_properties_;
|
||||
std::vector<odf_reader::_property> properties_;
|
||||
std::vector<odf_reader::_property> properties_3d_;
|
||||
_oox_fill fill_;
|
||||
|
||||
//std::vector<odf_reader::_property> wall_graphic_properties_;
|
||||
|
||||
void oox_serialize(std::wostream & _Wostream);
|
||||
void oox_serialize_view3D(std::wostream & _Wostream);
|
||||
|
||||
void add_chart (int type);
|
||||
void add_axis (int type, odf_reader::chart::axis & content);
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
enum RelsType
|
||||
enum _rels_type
|
||||
{
|
||||
typeUnknown = 0,
|
||||
typeDefault,
|
||||
@ -63,10 +63,18 @@ enum RelsType
|
||||
typeControlProps,
|
||||
typeChartUserShapes
|
||||
};
|
||||
|
||||
enum _rels_type_place
|
||||
{
|
||||
document_place,
|
||||
endnote_place,
|
||||
footnote_place,
|
||||
comment_place,
|
||||
header_footer_place,
|
||||
chart_place
|
||||
};
|
||||
struct _rel
|
||||
{
|
||||
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, RelsType const & type_) :
|
||||
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, _rels_type const & type_) :
|
||||
is_internal(is_internal_),
|
||||
rid(rid_),
|
||||
ref(ref_),
|
||||
@ -76,7 +84,7 @@ struct _rel
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
_rels_type type;
|
||||
};
|
||||
|
||||
class relationship : public xml::element_impl<relationship>
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include "oox_types_chart.h"
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -59,8 +58,9 @@ void oox_chart::set_name(const std::wstring& val)
|
||||
}
|
||||
void oox_chart::set_content_series(odf_reader::chart::series & content)
|
||||
{
|
||||
series_.back()->content_=content;
|
||||
series_.back()->content_= content;
|
||||
}
|
||||
|
||||
void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
|
||||
{
|
||||
if (val.empty())return;
|
||||
@ -467,7 +467,21 @@ void oox_stock_chart::set_properties(std::vector<odf_reader::_property> g)
|
||||
|
||||
oox_chart::set_properties(g);
|
||||
|
||||
odf_reader::GetProperty(g, L"japanese-candle-stick",bCandleStick);
|
||||
odf_reader::GetProperty(g, L"japanese-candle-stick", bCandleStick);
|
||||
}
|
||||
void oox_stock_chart::set_stock_gain_marke(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
}
|
||||
void oox_stock_chart::set_stock_loss_marker(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
}
|
||||
void oox_stock_chart::set_stock_range_line(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
|
||||
range_line.set(obj.graphic_properties_, obj.fill_);
|
||||
}
|
||||
void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -480,10 +494,13 @@ void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
oox_serialize_common(CP_XML_STREAM());
|
||||
|
||||
//CP_XML_NODE(L"c:hiLowLines")//hiLowLines (High Low Lines) §21.2.2.80
|
||||
//{
|
||||
// //shape.oox_serialize(CP_XML_STREAM());
|
||||
//}
|
||||
if (range_line.bEnabled)
|
||||
{
|
||||
CP_XML_NODE(L"c:hiLowLines")
|
||||
{
|
||||
range_line.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"c:upDownBars")
|
||||
{
|
||||
CP_XML_NODE(L"c:gapWidth")
|
||||
|
||||
@ -31,11 +31,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <CPScopedPtr.h>
|
||||
#include <CPSharedPtr.h>
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
#include "xlsx_color.h"
|
||||
#include "oox_chart_series.h"
|
||||
@ -84,6 +82,9 @@ public:
|
||||
void set_name (const std::wstring& val);
|
||||
void set_content_series (odf_reader::chart::series & content);
|
||||
|
||||
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj){}
|
||||
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj){}
|
||||
virtual void set_stock_range_line(odf_reader::chart::simple & obj){}
|
||||
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
|
||||
//void set_showCatName(bool Val){data_labels_.set_showCatName(Val);}
|
||||
//void set_showLeaderLines(bool Val){data_labels_.set_showLeaderLines(Val);}
|
||||
@ -349,6 +350,9 @@ class oox_stock_chart: public oox_chart
|
||||
|
||||
static _CP_PTR(oox_chart) create();
|
||||
|
||||
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj);
|
||||
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj);
|
||||
virtual void set_stock_range_line(odf_reader::chart::simple & obj);
|
||||
|
||||
_CP_OPT(bool) bCandleStick;
|
||||
|
||||
@ -357,6 +361,7 @@ class oox_stock_chart: public oox_chart
|
||||
|
||||
_oox_fill fill_;
|
||||
|
||||
oox_chart_shape range_line;
|
||||
//dropLines (Drop Lines) §21.2.2.53
|
||||
//hiLowLines (High Low Lines) §21.2.2.80
|
||||
//ser (Line Chart Series) §21.2.2.171
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type)
|
||||
_rels_type type)
|
||||
{
|
||||
pptx_drawings_.push_back(d);
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type)
|
||||
_rels_type type)
|
||||
{
|
||||
|
||||
bool present = false;
|
||||
@ -153,7 +153,7 @@ void pptx_drawings::add(_pptx_drawing const & d,
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type)
|
||||
_rels_type type)
|
||||
{
|
||||
impl_->add(d, isInternal, rid, ref, type);
|
||||
}
|
||||
@ -161,7 +161,7 @@ void pptx_drawings::add(/**/
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type)
|
||||
_rels_type type)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
|
||||
@ -56,13 +56,13 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type
|
||||
_rels_type type
|
||||
);
|
||||
void add(/**/
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type
|
||||
_rels_type type
|
||||
);
|
||||
bool empty() const;
|
||||
|
||||
|
||||
@ -82,11 +82,11 @@ public:
|
||||
|
||||
bool header, footer, date_time, slideNum;
|
||||
|
||||
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
{
|
||||
pptx_drawings_->add(d, isInternal, rid, ref, type);
|
||||
}
|
||||
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
@ -359,7 +359,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
|
||||
bool isMediaInternal = false;
|
||||
std::wstring ref;
|
||||
|
||||
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
impl_->background_fill_ = fill;
|
||||
@ -413,7 +413,7 @@ void pptx_slide_context::start_action(std::wstring action)
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
void pptx_slide_context::set_link(std::wstring link, _rels_type typeRels)
|
||||
{
|
||||
++hlinks_size_;
|
||||
|
||||
@ -423,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef, oox::document_place);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
@ -578,7 +578,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
@ -586,7 +586,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -601,7 +601,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
@ -610,7 +610,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
@ -625,12 +625,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(std::wstring) sPlaceHolderType;
|
||||
@ -653,7 +653,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
@ -664,7 +664,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image, oox::document_place);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
@ -676,7 +676,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref, oox::document_place);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
@ -687,7 +687,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image, oox::document_place);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
@ -725,7 +725,7 @@ mediaitems_ptr & pptx_slide_context::get_mediaitems()
|
||||
return impl_->get_mediaitems();
|
||||
}
|
||||
|
||||
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
{
|
||||
impl_->add_additional_rels(isInternal, rid, ref, type);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void end_frame();
|
||||
|
||||
void start_action (std::wstring action);
|
||||
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
|
||||
void set_link (std::wstring link, _rels_type typeRels = typeHyperlink);
|
||||
void end_action ();
|
||||
|
||||
void start_table();
|
||||
@ -123,7 +123,7 @@ public:
|
||||
void add_rels( bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
RelsType type);
|
||||
_rels_type type);
|
||||
|
||||
void set_footer();
|
||||
void set_header();
|
||||
|
||||
@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref;
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref, oox::document_place);
|
||||
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
|
||||
}
|
||||
oox::oox_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
@ -277,29 +277,29 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
if (Level < 0)return;
|
||||
if (list_style_stack_.empty())return;
|
||||
|
||||
odf_reader::style_list_level_properties *list_properties= NULL;
|
||||
odf_reader::style_list_level_properties *list_properties = NULL;
|
||||
|
||||
odf_reader::text_list_style * text_list_style = odf_context_.listStyleContainer().list_style_by_name(list_style_stack_.back());
|
||||
|
||||
if ((text_list_style) && (Level < (int)text_list_style->get_content().size()))
|
||||
if ((text_list_style) && (Level < (int)text_list_style->content_.size()))
|
||||
{
|
||||
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
|
||||
odf_reader::office_element_ptr elm = text_list_style->content_[Level];
|
||||
odf_reader::office_element_ptr elm_list;
|
||||
|
||||
if (elm->get_type() == typeTextListLevelStyleBullet)
|
||||
{
|
||||
odf_reader::text_list_level_style_bullet* list_bullet = dynamic_cast<odf_reader::text_list_level_style_bullet *>(elm.get());
|
||||
if (list_bullet)elm_list = list_bullet->style_list_level_properties_;
|
||||
if (list_bullet)elm_list = list_bullet->list_level_properties_;
|
||||
}
|
||||
if (elm->get_type() == typeTextListLevelStyleNumber)
|
||||
{
|
||||
odf_reader::text_list_level_style_number* list_number = dynamic_cast<odf_reader::text_list_level_style_number *>(elm.get());
|
||||
if (list_number)elm_list = list_number->style_list_level_properties_;
|
||||
if (list_number)elm_list = list_number->list_level_properties_;
|
||||
}
|
||||
if (elm->get_type() == typeTextListLevelStyleImage)
|
||||
{
|
||||
odf_reader::text_list_level_style_image* list_image = dynamic_cast<odf_reader::text_list_level_style_image *>(elm.get());
|
||||
if (list_image)elm_list = list_image->style_list_level_properties_;
|
||||
if (list_image)elm_list = list_image->list_level_properties_;
|
||||
}
|
||||
////////////////////
|
||||
if (elm_list)
|
||||
@ -633,7 +633,8 @@ void pptx_text_context::Impl::start_list_item(bool restart)
|
||||
list_style_renames_[curStyleName] = newStyleName;
|
||||
|
||||
odf_reader::list_style_container & lists = odf_context_.listStyleContainer();
|
||||
odf_reader::text_list_style * curStyle = lists.list_style_by_name(curStyleName);
|
||||
|
||||
odf_reader::text_list_style * curStyle = lists.list_style_by_name(curStyleName);
|
||||
lists.add_list_style(curStyle, newStyleName);
|
||||
end_list();
|
||||
start_list(newStyleName);
|
||||
|
||||
@ -36,7 +36,7 @@ namespace oox {
|
||||
|
||||
struct XlsxCellType
|
||||
{
|
||||
enum type { null, b, n, e, s, str, inlineStr };
|
||||
enum type { null, b, n, e, s, str, inlineStr, d };
|
||||
};
|
||||
|
||||
int odf_string_to_build_in(const int value_type);
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_)
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
@ -108,7 +108,7 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_)
|
||||
{
|
||||
return impl_->add_drawing_xml(content, drawings, type_);
|
||||
}
|
||||
@ -626,14 +626,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, false, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -651,7 +651,7 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
if (drawing.inGroup)
|
||||
@ -691,7 +691,7 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
@ -705,7 +705,7 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
|
||||
}
|
||||
@ -756,7 +756,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
|
||||
|
||||
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet, false);//собственно это не объект, а доп рел и ref объекта
|
||||
@ -798,7 +798,7 @@ void xlsx_drawing_context::start_action(std::wstring action)
|
||||
impl_->object_description_.action_.enabled = true;
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
|
||||
void xlsx_drawing_context::set_link(std::wstring link, _rels_type typeRels)
|
||||
{//hyprelinks only
|
||||
++hlinks_size_;
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
xlsx_drawing_context_handle(mediaitems_ptr & items);
|
||||
~xlsx_drawing_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_ = typeDefault);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
@ -152,7 +152,7 @@ public:
|
||||
void process_objects(xlsx_table_metrics & table_metrics);
|
||||
|
||||
void start_action(std::wstring action);
|
||||
void set_link(std::wstring link, RelsType typeRels = typeHyperlink);
|
||||
void set_link(std::wstring link, _rels_type typeRels = typeHyperlink);
|
||||
void end_action();
|
||||
|
||||
private:
|
||||
|
||||
@ -44,7 +44,7 @@ namespace oox {
|
||||
class xlsx_drawings::Impl
|
||||
{
|
||||
public:
|
||||
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
|
||||
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel )//объект
|
||||
{
|
||||
if ( type == typeControlProps || type == typeComment)
|
||||
{
|
||||
@ -72,7 +72,7 @@ public:
|
||||
drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
}
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel) //не объект
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel) //не объект
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
@ -305,12 +305,12 @@ xlsx_drawings::~xlsx_drawings()
|
||||
}
|
||||
|
||||
void xlsx_drawings::add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid,
|
||||
std::wstring const & ref, RelsType type, bool sheet_rel)
|
||||
std::wstring const & ref, _rels_type type, bool sheet_rel)
|
||||
{
|
||||
impl_->add(d, isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel)
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
|
||||
}
|
||||
|
||||
@ -46,14 +46,14 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
struct drawing_elm
|
||||
{
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, _rels_type const & _type)
|
||||
: filename(_filename), content(_content), drawings(_drawings), type(_type)
|
||||
{}
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
xlsx_drawings_ptr drawings;
|
||||
RelsType type;
|
||||
_rels_type type;
|
||||
};
|
||||
|
||||
class _xlsx_drawing;
|
||||
@ -65,8 +65,8 @@ public:
|
||||
~xlsx_drawings ();
|
||||
static xlsx_drawings_ptr create(bool inGroup);
|
||||
|
||||
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
|
||||
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel);
|
||||
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
std::wstringstream header_footer_;
|
||||
std::wstringstream controls_;
|
||||
std::wstringstream protection_;
|
||||
std::wstringstream breaks_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -166,6 +167,10 @@ std::wostream & xlsx_xml_worksheet::protection()
|
||||
{
|
||||
return impl_->protection_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::breaks()
|
||||
{
|
||||
return impl_->breaks_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -259,11 +264,9 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
//или тут ??? headerFooter
|
||||
|
||||
//CP_XML_NODE(L"rowBreaks){}
|
||||
|
||||
//CP_XML_NODE(L"colBreaks){}
|
||||
CP_XML_STREAM() << impl_->breaks_.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ public:
|
||||
std::wostream & header_footer();
|
||||
std::wostream & controls();
|
||||
std::wostream & protection();
|
||||
std::wostream & breaks();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
|
||||
void xlsx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
|
||||
{
|
||||
for (unsigned int i = 0; i <repeated; ++i)
|
||||
for (unsigned int i = 0; i < repeated; ++i)
|
||||
column_default_cell_style_name_.push_back(defaultCellStyleName);
|
||||
|
||||
columns_count_ += repeated;
|
||||
@ -222,7 +222,22 @@ void xlsx_table_state::start_row(const std::wstring & StyleName, const std::wstr
|
||||
// set row style name
|
||||
table_row_style_ = StyleName;
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_column_break_before()
|
||||
{
|
||||
column_breaks_.push_back(columns_count_ - columns_.back());
|
||||
}
|
||||
void xlsx_table_state::set_column_break_after()
|
||||
{
|
||||
column_breaks_.push_back(columns_count_ + 1 - columns_.back());
|
||||
}
|
||||
void xlsx_table_state::set_row_break_before()
|
||||
{
|
||||
row_breaks_.push_back(current_table_row_);
|
||||
}
|
||||
void xlsx_table_state::set_row_break_after()
|
||||
{
|
||||
row_breaks_.push_back(current_table_row_ + 1);
|
||||
}
|
||||
void xlsx_table_state::non_empty_row()
|
||||
{
|
||||
empty_row_= false;
|
||||
@ -608,6 +623,50 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_table_state::serialize_breaks(std::wostream & strm)
|
||||
{
|
||||
if (column_breaks_.empty() && row_breaks_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (false == row_breaks_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"rowBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", row_breaks_.size());
|
||||
CP_XML_ATTR(L"manualBreakCount", row_breaks_.size());
|
||||
|
||||
for (size_t i = 0; i < row_breaks_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", row_breaks_[i]);
|
||||
CP_XML_ATTR(L"max", 16383);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (false == column_breaks_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"colBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", column_breaks_.size());
|
||||
CP_XML_ATTR(L"manualBreakCount", column_breaks_.size());
|
||||
|
||||
for (size_t i = 0; i < column_breaks_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", column_breaks_[i]);
|
||||
CP_XML_ATTR(L"max", 1048575);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_merge_cells(std::wostream & strm)
|
||||
{
|
||||
return xlsx_merge_cells_.xlsx_serialize(strm);
|
||||
|
||||
@ -130,7 +130,13 @@ public:
|
||||
|
||||
void start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
|
||||
void set_column_break_before();
|
||||
void set_column_break_after();
|
||||
|
||||
void set_row_break_before();
|
||||
void set_row_break_after();
|
||||
|
||||
void non_empty_row ();
|
||||
bool is_empty_row () const;
|
||||
void end_row ();
|
||||
@ -185,6 +191,7 @@ public:
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
void serialize_header_footer (std::wostream & _Wostream);
|
||||
void serialize_breaks (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -240,7 +247,10 @@ private:
|
||||
unsigned int columns_count_;
|
||||
double table_column_last_width_;
|
||||
|
||||
xlsx_drawing_context xlsx_drawing_context_;
|
||||
std::vector<unsigned int> column_breaks_;
|
||||
std::vector<unsigned int> row_breaks_;
|
||||
|
||||
xlsx_drawing_context xlsx_drawing_context_;
|
||||
xlsx_comments_context xlsx_comments_context_;
|
||||
xlsx_conditionalFormatting_context xlsx_conditionalFormatting_context_;
|
||||
|
||||
|
||||
@ -256,29 +256,6 @@ void xlsx_table_context::end_covered_cell()
|
||||
{
|
||||
return state()->end_covered_cell();
|
||||
}
|
||||
void xlsx_table_context::set_table_row_group(int count, bool collapsed, int level)
|
||||
{
|
||||
return state()->set_table_row_group(count, collapsed, level);
|
||||
}
|
||||
void xlsx_table_context::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
|
||||
{
|
||||
return state()->start_row(StyleName, defaultCellStyleName);
|
||||
}
|
||||
|
||||
void xlsx_table_context::non_empty_row()
|
||||
{
|
||||
return state()->non_empty_row();
|
||||
}
|
||||
|
||||
bool xlsx_table_context::is_empty_row()
|
||||
{
|
||||
return state()->is_empty_row();
|
||||
}
|
||||
|
||||
void xlsx_table_context::end_row()
|
||||
{
|
||||
return state()->end_row();
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
|
||||
{
|
||||
@ -552,6 +529,10 @@ void xlsx_table_context::serialize_controls(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_controls(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_breaks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_breaks(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels)
|
||||
{
|
||||
return state()->dump_rels_hyperlinks(Rels);
|
||||
@ -560,7 +541,6 @@ void xlsx_table_context::dump_rels_ole_objects(rels & Rels)
|
||||
{
|
||||
return state()->dump_rels_ole_objects(Rels);
|
||||
}
|
||||
|
||||
xlsx_table_metrics & xlsx_table_context::get_table_metrics()
|
||||
{
|
||||
return state()->get_table_metrics();
|
||||
|
||||
@ -73,12 +73,6 @@ public:
|
||||
int current_column();
|
||||
int current_row();
|
||||
|
||||
void set_table_row_group(int count, bool collapsed, int level);
|
||||
void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
void non_empty_row();
|
||||
bool is_empty_row();
|
||||
void end_row();
|
||||
|
||||
void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
|
||||
unsigned int columns_count();
|
||||
@ -103,6 +97,7 @@ public:
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
void serialize_header_footer (std::wostream & _Wostream);
|
||||
void serialize_breaks (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -175,7 +175,9 @@ std::wstring cellType2Str(XlsxCellType::type type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case XlsxCellType::b:
|
||||
case XlsxCellType::d:
|
||||
return L"d";
|
||||
case XlsxCellType::b:
|
||||
return L"b";
|
||||
case XlsxCellType::n:
|
||||
return L"n";
|
||||
|
||||
@ -483,6 +483,7 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
|
||||
get_table_context().serialize_data_validation (current_sheet().dataValidations());
|
||||
get_table_context().serialize_protection (current_sheet().protection());
|
||||
get_table_context().serialize_breaks (current_sheet().breaks());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
@ -577,30 +578,6 @@ void xlsx_conversion_context::end_table_column()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_table_row_group(int count, bool collapsed, int level)
|
||||
{
|
||||
get_table_context().set_table_row_group(count, collapsed, level);
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_table_row(const std::wstring & styleName, const std::wstring & defaultCellStyleName)
|
||||
{
|
||||
get_table_context().start_row(styleName, defaultCellStyleName);
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::non_empty_row()
|
||||
{
|
||||
return get_table_context().non_empty_row();
|
||||
}
|
||||
|
||||
bool xlsx_conversion_context::is_empty_row()
|
||||
{
|
||||
return get_table_context().is_empty_row();
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::end_table_row()
|
||||
{
|
||||
get_table_context().end_row();
|
||||
}
|
||||
|
||||
int xlsx_conversion_context::current_table_column()
|
||||
{
|
||||
|
||||
@ -111,14 +111,7 @@ public:
|
||||
double table_column_last_width ();
|
||||
void end_table_column ();
|
||||
|
||||
void set_table_row_group (int count, bool collapsed, int level);
|
||||
void start_table_row (const std::wstring & styleName, const std::wstring & defaultCellStyleName);
|
||||
void non_empty_row ();
|
||||
void end_table_row ();
|
||||
bool is_empty_row ();
|
||||
void set_current_row_height (size_t height_pt);
|
||||
|
||||
bool in_table_cell ();
|
||||
bool in_table_cell();
|
||||
|
||||
void start_table_cell (const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned);
|
||||
void end_table_cell ();
|
||||
|
||||
@ -155,6 +155,22 @@ paragraph_format_properties calc_paragraph_properties_content(const std::vector<
|
||||
}
|
||||
return result;
|
||||
}
|
||||
_CP_OPT(int) calc_outline_level(_CP_OPT(int) value, const style_instance * styleInstance)
|
||||
{
|
||||
if (value) return value;
|
||||
|
||||
while (styleInstance)
|
||||
{
|
||||
if (styleInstance->outline_level())
|
||||
{
|
||||
return styleInstance->outline_level();
|
||||
}
|
||||
|
||||
styleInstance = styleInstance->parent();
|
||||
}
|
||||
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context)
|
||||
{
|
||||
|
||||
@ -61,5 +61,6 @@ namespace cpdoccore
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context);
|
||||
_CP_OPT(int) calc_outline_level(_CP_OPT(int) value, const style_instance * styleInstance);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,11 +80,11 @@ using namespace chart;
|
||||
|
||||
void object_odf_context::set_pivot_source(std::wstring const & val)
|
||||
{
|
||||
bPivotChart_ = true;
|
||||
|
||||
if (val.empty()) return;
|
||||
|
||||
pivot_source_ = val;
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
bPivotChart_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void object_odf_context::set_width(double valPt)
|
||||
@ -371,8 +371,8 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
chart_context.set_floor (floor_);
|
||||
chart_context.set_legend (legend_);
|
||||
|
||||
chart_context.set_plot_area_properties (plot_area_.properties_ , plot_area_.fill_);
|
||||
chart_context.set_chart_graphic_properties (chart_graphic_properties_ , chart_fill_);
|
||||
chart_context.set_plot_area_properties (plot_area_.properties_, plot_area_.properties_3d_, plot_area_.fill_);
|
||||
chart_context.set_chart_graphic_properties (chart_graphic_properties_, chart_fill_);
|
||||
|
||||
//chart_context.set_footer(footer_);
|
||||
//chart_context.set_chart_properties(chart_graphic_properties_);
|
||||
@ -397,6 +397,10 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
|
||||
if (!current) continue;
|
||||
|
||||
current->set_stock_gain_marke(stock_gain_marker_);
|
||||
current->set_stock_loss_marker(stock_loss_marker_);
|
||||
current->set_stock_range_line(stock_range_line_);
|
||||
|
||||
if (1 == series_.size())
|
||||
{
|
||||
current->varyColors_ = false;
|
||||
@ -834,11 +838,16 @@ void process_build_object::visit(chart_plot_area& val)
|
||||
|
||||
object_odf_context_.plot_area_.cell_range_address_ = val.attlist_.table_cell_range_address_.get_value_or(L"");
|
||||
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.graphic_properties_, object_odf_context_.plot_area_.fill_);
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.text_properties_);
|
||||
}
|
||||
odf_types::common_dr3d_attlist attr_3d = val.attlist_.common_dr3d_attlist_;
|
||||
|
||||
if (attr_3d.transform_) object_odf_context_.plot_area_.properties_3d_.push_back(_property(L"transform", attr_3d.transform_.get()) );
|
||||
if (attr_3d.distance_) object_odf_context_.plot_area_.properties_3d_.push_back(_property(L"distance", attr_3d.distance_->get_value_unit(length::pt)) );
|
||||
if (attr_3d.focal_length_) object_odf_context_.plot_area_.properties_3d_.push_back(_property(L"focal", attr_3d.focal_length_->get_value_unit(length::pt)) );
|
||||
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.plot_area_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.plot_area_.graphic_properties_, object_odf_context_.plot_area_.fill_);
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.plot_area_.text_properties_);
|
||||
}
|
||||
|
||||
void process_build_object::visit(chart_axis& val)
|
||||
{
|
||||
@ -931,13 +940,34 @@ void process_build_object::visit(chart_data_point & val)
|
||||
}
|
||||
void process_build_object::visit(chart_mean_value & val)
|
||||
{
|
||||
object_odf_context_.series_.back().mean_value_.bEnabled = true;
|
||||
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.properties_);
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.graphic_properties_, object_odf_context_.series_.back().mean_value_.fill_);
|
||||
}
|
||||
void process_build_object::visit(chart_date_scale & val)
|
||||
{
|
||||
object_odf_context_.axises_.back().type_ = 4;
|
||||
}
|
||||
void process_build_object::visit(chart_error_indicator & val)
|
||||
{
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_,object_odf_context_.series_.back().error_indicator_.fill_ );
|
||||
}
|
||||
object_odf_context_.series_.back().error_indicator_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_, object_odf_context_.series_.back().error_indicator_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_range_line & val)
|
||||
{
|
||||
object_odf_context_.stock_range_line_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_range_line_.graphic_properties_, object_odf_context_.stock_range_line_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_loss_marker & val)
|
||||
{
|
||||
object_odf_context_.stock_loss_marker_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_loss_marker_.graphic_properties_, object_odf_context_.stock_loss_marker_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_gain_marker & val)
|
||||
{
|
||||
object_odf_context_.stock_gain_marker_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_gain_marker_.graphic_properties_, object_odf_context_.stock_gain_marker_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_regression_curve & val)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
@ -198,6 +198,10 @@ public:
|
||||
|
||||
chart::simple footer_;
|
||||
|
||||
chart::simple stock_gain_marker_;
|
||||
chart::simple stock_loss_marker_;
|
||||
chart::simple stock_range_line_;
|
||||
|
||||
std::vector<_property> chart_properties_;
|
||||
std::vector<_property> chart_graphic_properties_;
|
||||
oox::_oox_fill chart_fill_;
|
||||
@ -258,6 +262,9 @@ class process_build_object
|
||||
public visitor<chart_regression_curve>,
|
||||
public visitor<chart_equation>,
|
||||
public visitor<chart_error_indicator>,
|
||||
public visitor<chart_stock_range_line>,
|
||||
public visitor<chart_stock_loss_marker>,
|
||||
public visitor<chart_stock_gain_marker>,
|
||||
public visitor<chart_wall>,
|
||||
public visitor<chart_floor>,
|
||||
|
||||
@ -283,9 +290,9 @@ public:
|
||||
process_build_object(object_odf_context & object_context, odf_read_context & context);
|
||||
|
||||
private:
|
||||
void ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut);
|
||||
void ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut);
|
||||
void ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
|
||||
void ApplyChartProperties(std::wstring style, std::vector<_property> & propertiesOut);
|
||||
void ApplyTextProperties(std::wstring style, std::vector<_property> & propertiesOut);
|
||||
void ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
|
||||
|
||||
bool visit_table(std::wstring const & name);
|
||||
void visit_column(unsigned int repeated);
|
||||
@ -309,7 +316,7 @@ public:
|
||||
virtual void visit(chart_subtitle & val);
|
||||
virtual void visit(chart_footer & val);
|
||||
virtual void visit(chart_legend & val);
|
||||
virtual void visit(chart_plot_area& val);
|
||||
virtual void visit(chart_plot_area & val);
|
||||
virtual void visit(chart_axis & val);
|
||||
virtual void visit(chart_series & val);
|
||||
virtual void visit(chart_domain & val);
|
||||
@ -317,11 +324,16 @@ public:
|
||||
virtual void visit(chart_mean_value & val);
|
||||
virtual void visit(chart_error_indicator & val);
|
||||
virtual void visit(chart_regression_curve & val);
|
||||
virtual void visit(chart_stock_range_line & val);
|
||||
virtual void visit(chart_stock_loss_marker & val);
|
||||
virtual void visit(chart_stock_gain_marker & val);
|
||||
virtual void visit(chart_equation & val);
|
||||
virtual void visit(chart_categories & val);
|
||||
virtual void visit(chart_grid & val);
|
||||
virtual void visit(chart_wall & val);
|
||||
virtual void visit(chart_floor & val);
|
||||
virtual void visit(chart_date_scale & val);
|
||||
|
||||
virtual void visit(table_table & val);
|
||||
|
||||
virtual void visit(table_table_rows & val);
|
||||
|
||||
@ -100,7 +100,8 @@ namespace chart {
|
||||
};
|
||||
struct plot_area : public simple
|
||||
{
|
||||
std::wstring cell_range_address_;
|
||||
std::wstring cell_range_address_;
|
||||
std::vector<_property> properties_3d_;
|
||||
//series_in_column_or_row
|
||||
//uses_first_as_label
|
||||
};
|
||||
|
||||
@ -78,7 +78,6 @@ anchor_type anchor_type::parse(const std::wstring & Str)
|
||||
return anchor_type( AsChar );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return anchor_type( Page );
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,6 @@ border_model border_model::parse(const std::wstring & Str)
|
||||
return border_model( Separating );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return border_model( Collapsing );
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,6 @@ chart_error_category chart_error_category::parse(const std::wstring & Str)
|
||||
return chart_error_category( constant );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_error_category( none );
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ chart_interpolation chart_interpolation::parse(const std::wstring & Str)
|
||||
return chart_interpolation( bSpline );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_interpolation( none );
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,12 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef _CPDOCCORE_ODF_CHARTINTERPOLATION_H_
|
||||
#define _CPDOCCORE_ODF_CHARTINTERPOLATION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
@ -76,5 +72,3 @@ private:
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_interpolation);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -60,7 +60,6 @@ chart_label_arrangement chart_label_arrangement::parse(const std::wstring & Str)
|
||||
return chart_label_arrangement( stagger_odd );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_label_arrangement( side_by_side );
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,12 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef _CPDOCCORE_ODF_CHARTLABELARRANGEMENT_H_
|
||||
#define _CPDOCCORE_ODF_CHARTLABELARRANGEMENT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
@ -76,5 +72,3 @@ private:
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_label_arrangement);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -66,7 +66,6 @@ chart_regression_type chart_regression_type::parse(const std::wstring & Str)
|
||||
return chart_regression_type( power );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_regression_type( none );
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,18 +29,13 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef _CPDOCCORE_ODF_CHARTREGRESSION_TYPE_H_
|
||||
#define _CPDOCCORE_ODF_CHARTREGRESSION_TYPE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "odfattributes.h"
|
||||
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
class chart_regression_type
|
||||
@ -74,5 +69,3 @@ private:
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_regression_type);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -58,7 +58,6 @@ chart_series_source chart_series_source::parse(const std::wstring & Str)
|
||||
return chart_series_source( rows );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_series_source( columns );
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user