mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
359 Commits
core/devel
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| c9f2315186 | |||
| 5818f4997b | |||
| 691042c507 | |||
| d8f34224ca | |||
| dfe4541f43 | |||
| 3fa3a52c89 | |||
| 665783a6c5 | |||
| 0b15c31487 | |||
| 44fdbf6df4 | |||
| 582fce4ca1 | |||
| bde723c5cb | |||
| 97fb316248 | |||
| a607282285 | |||
| 62ea2bbc46 | |||
| 4071fa315b | |||
| 82eae7fc3e | |||
| 8efed345b0 | |||
| f5dcb1bed7 | |||
| 6b4695fc3a | |||
| bed884007c | |||
| 1aa0b03901 | |||
| e2ada4ca61 | |||
| d87649f08e | |||
| 3982ac06d2 | |||
| 0a5d0af882 | |||
| 08e97b4a68 | |||
| c4447d7396 | |||
| c55af15ccd | |||
| 333d2fdbf0 | |||
| a2bbb1640c | |||
| 7388bf871f | |||
| 493238d656 | |||
| ea8dc009c9 | |||
| 9ade820313 | |||
| 358c1613ad | |||
| b3a83ad699 | |||
| 8d4e78ed40 | |||
| bde2c73f64 | |||
| 66fe9e6447 | |||
| f6d745cd25 | |||
| 002d30454c | |||
| ae2e9a5f26 | |||
| c985d1e0a2 | |||
| 5aaf90ebf2 | |||
| ebb9c89a0a | |||
| c4765e9f2e | |||
| 3ff5233ea4 | |||
| 4c7ab6e616 | |||
| a88ad0c279 | |||
| cf5458c761 | |||
| 9115edbd78 | |||
| 3f18f96171 | |||
| 8a75916944 | |||
| da45eb4f33 | |||
| 59d75ed148 | |||
| ccc4d751d0 | |||
| a020d3dbf9 | |||
| 7852b7fbe8 | |||
| a64fd8792d | |||
| 32448298a3 | |||
| b3384f1466 | |||
| 93274395a9 | |||
| 2726e14445 | |||
| 75e32a1562 | |||
| 8c2637b89c | |||
| ef389872df | |||
| 6fc611fdfc | |||
| 0cabb63336 | |||
| f501bf7930 | |||
| 7b617dc9e9 | |||
| 245f989ae3 | |||
| 429729b979 | |||
| d709652992 | |||
| 776d799fd2 | |||
| a975cb8261 | |||
| c932b5af26 | |||
| 423e8dda86 | |||
| afcf6b079e | |||
| 3ed2224f93 | |||
| 5307855120 | |||
| 3c9a91af45 | |||
| 9f06f94c93 | |||
| 4954ef2934 | |||
| 721e8800f1 | |||
| ef8e5cab6d | |||
| 028e58ad51 | |||
| 424e0e34cc | |||
| d8988cd101 | |||
| 440a884c0a | |||
| 449bab1a70 | |||
| c1e5e33691 | |||
| 8c7515443a | |||
| 1d16f4ab8f | |||
| 122a5cd056 | |||
| b0994759e7 | |||
| 118f1c5736 | |||
| b65703ceb1 | |||
| c08c960c96 | |||
| 02ece25af8 | |||
| 435a27f6d9 | |||
| 85ea22048a | |||
| 87ae0b38fa | |||
| b93d463469 | |||
| 0aa59b0d92 | |||
| 3dbcce8c36 | |||
| cc9459359f | |||
| 465e70759b | |||
| 9f6c833af5 | |||
| f4d16b0d61 | |||
| 398dc42bb2 | |||
| 69b4a09475 | |||
| ab360be66a | |||
| 98285c225d | |||
| bab6e40c2b | |||
| 539cb2f355 | |||
| 64d6c3c872 | |||
| 7c9be7e2eb | |||
| bad2992903 | |||
| d405cd4e83 | |||
| f632855006 | |||
| 48641d5bde | |||
| d88ae6d3f4 | |||
| e9ad1202ff | |||
| 1fc9280ab3 | |||
| 9e639ec68f | |||
| 28ebf5aaa6 | |||
| 8f5967356d | |||
| bc7d73667d | |||
| a434ae2cc4 | |||
| 7e52ebca48 | |||
| 4925b47002 | |||
| afdaacb226 | |||
| 9f98f07f23 | |||
| 9e1a0e365f | |||
| 39e2b69b8e | |||
| 58c00745a7 | |||
| 4015e8ba4d | |||
| 276af55699 | |||
| ebdfcbd7ee | |||
| 867c09c85d | |||
| cd12777c68 | |||
| 0708c1f45a | |||
| ee577e629a | |||
| f230dc2555 | |||
| 11c9d74e68 | |||
| d61a955c38 | |||
| acfb96e3c3 | |||
| d2e3cc47f2 | |||
| 4f2f164af9 | |||
| 8addd6cb04 | |||
| 92cda5bc80 | |||
| 1a377d8738 | |||
| ed3e107db5 | |||
| 64d8c659bc | |||
| 3debba45b8 | |||
| b8ad1797f0 | |||
| 48587f55b3 | |||
| a505ae391d | |||
| c389801937 | |||
| 24214cb561 | |||
| b19191b286 | |||
| 77f8ab6875 | |||
| 6fc6f9ead3 | |||
| 270c1fa2ac | |||
| f76a03fab8 | |||
| 09e6d3f760 | |||
| 90d8055bcb | |||
| 01ba3b4182 | |||
| ddb67584b8 | |||
| 38ce5586bb | |||
| f6d9ce83f0 | |||
| 03edd40850 | |||
| 9ff87b3c6b | |||
| 645cbef1ef | |||
| 02238f7eea | |||
| 907e00a3ac | |||
| 2470bfd335 | |||
| 3ae52bd221 | |||
| 227d4f18d6 | |||
| 36bdbad685 | |||
| 525b828540 | |||
| f64ee80a1a | |||
| f6402813c4 | |||
| 224ac7d6e2 | |||
| 2e2bd8989d | |||
| 8f434efb95 | |||
| 244dafb02b | |||
| 149a1bdbd5 | |||
| a79d9041bc | |||
| 3954c42602 | |||
| 29dc0aee32 | |||
| d805972d6d | |||
| 549d5a46a6 | |||
| 9e867be756 | |||
| 771bf2d55c | |||
| 3c58cd96fc | |||
| e50864fa98 | |||
| c8c0924c74 | |||
| af732e4e85 | |||
| 47ffdae8cc | |||
| fd5870083b | |||
| 5ba62cb25d | |||
| 79e0588544 | |||
| a3d08cfc35 | |||
| 5caccb284a | |||
| ce19969b52 | |||
| 0f91dc392e | |||
| e9805cef30 | |||
| e3e05eb2db | |||
| c09f17cffb | |||
| ce73dd5987 | |||
| 77df8aacb9 | |||
| ce45b2802f | |||
| 7886018d6f | |||
| 5b5cb4188e | |||
| f797af5f17 | |||
| 055977535e | |||
| 6ab24f10f0 | |||
| 12a03da231 | |||
| cb7088979a | |||
| 1fb1fc6c97 | |||
| e633c3c5d1 | |||
| 0f04de34b1 | |||
| 3f8c2c293a | |||
| 2c97e743da | |||
| 2c83860c04 | |||
| c64b624de2 | |||
| 5e3990937d | |||
| 21744c1607 | |||
| 0892e2549f | |||
| cff6f305d4 | |||
| 5060071227 | |||
| d64109eaa4 | |||
| ec064bbd50 | |||
| baf952a151 | |||
| 0dd36c5e6a | |||
| 474404a8f9 | |||
| f2f6483b6f | |||
| c30161dbd0 | |||
| ec4f4fe476 | |||
| 634509ae28 | |||
| 1244048c50 | |||
| a62b69fb31 | |||
| 5eb36efb63 | |||
| fb8c4231b0 | |||
| 9774d1de46 | |||
| f5b141eeee | |||
| 1e47dc1111 | |||
| d3f4a2127d | |||
| 4d5f328c30 | |||
| b18cd44cf6 | |||
| 6705045dd4 | |||
| 533bc2c250 | |||
| 85226c0821 | |||
| fecefb672d | |||
| f91e030836 | |||
| d0591483bc | |||
| 729f9f246f | |||
| 17a6ba735b | |||
| de22fb4737 | |||
| 8197fb8900 | |||
| 751774419e | |||
| 8278609f10 | |||
| 445eedc7a3 | |||
| ed7661b93c | |||
| a17a04298a | |||
| f7ba686f0c | |||
| c41385e1ae | |||
| f582a9b690 | |||
| b36c2dbaf9 | |||
| 10b9e9e5e8 | |||
| 1beb5440f9 | |||
| 9a9ba4cc62 | |||
| 5b4c6363bb | |||
| 2026d064ef | |||
| 42257ca447 | |||
| 6f2fdcd971 | |||
| 9b4b7a26fd | |||
| 4d688b3922 | |||
| be8d427e26 | |||
| 7e0749ddda | |||
| 9f2324d208 | |||
| 6e258b85d7 | |||
| 24e55018a0 | |||
| 2352ae5d88 | |||
| 2cba43e6f3 | |||
| abcf8d0246 | |||
| c18b955467 | |||
| 7896b75001 | |||
| 7d188b2213 | |||
| 79ead484cc | |||
| be65f18a0e | |||
| 60f61109a1 | |||
| 4201bcecc6 | |||
| 7b7bfbc5dd | |||
| a70255e500 | |||
| 7e9dede9b3 | |||
| 9b7ad03465 | |||
| 3162bb0bfe | |||
| ec95648c43 | |||
| 72ac11ac07 | |||
| f70ea2b74f | |||
| db834666ba | |||
| 6ed0e13178 | |||
| 446e519110 | |||
| fb1fc01963 | |||
| 4651ae1bbb | |||
| 18606e23c6 | |||
| ed6d070d1f | |||
| f00cecbcaf | |||
| c9aee26fd6 | |||
| 32d3c0e65c | |||
| 33aeef2c02 | |||
| 7c97941acc | |||
| 01a4cd2289 | |||
| 202b58fb10 | |||
| b221150797 | |||
| 2084587e9a | |||
| 8332c28ac2 | |||
| 435a11d75c | |||
| 9a5329f5d6 | |||
| 8eecbf5fa5 | |||
| 9e1773df65 | |||
| 39e4140524 | |||
| bd90de857e | |||
| 57f2ec7b96 | |||
| 634098a6fa | |||
| bdbf208f6c | |||
| a652f5d73f | |||
| 1602843aa6 | |||
| cdb7fb8ea6 | |||
| 6387e9fa69 | |||
| 4e8097c93d | |||
| 65254b57b2 | |||
| 95899e23a8 | |||
| 5c8757d346 | |||
| 234e19d68a | |||
| 62145b7204 | |||
| 8bcc6d1501 | |||
| 09ef46f333 | |||
| 1839350526 | |||
| d7587e91b1 | |||
| 7b0a342cf9 | |||
| 3d01b0782e | |||
| fecfcfa7d2 | |||
| 29b5fa513a | |||
| f9a19badbf | |||
| d2630ea73c | |||
| a4a58c4782 | |||
| 29a3d80071 | |||
| 598bb419c0 | |||
| 087da9d2ce | |||
| c505aced48 | |||
| 959d5e5fcd | |||
| 8ee0cf4b2c | |||
| 426342074e | |||
| d2c092fe62 | |||
| a336917338 | |||
| 95c472c15c |
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,6 +20,7 @@ Common/3dParty/v8/win_32
|
||||
Common/3dParty/v8/linux_64
|
||||
Common/3dParty/v8/linux_32
|
||||
Common/3dParty/v8/mac_64
|
||||
Common/3dParty/openssl/openssl
|
||||
**/core_build
|
||||
**/Release
|
||||
**/Debug
|
||||
@ -43,3 +44,4 @@ OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
*.pdb
|
||||
*.tlb
|
||||
*.idb
|
||||
**/.hg
|
||||
|
||||
15
.travis.yml
15
.travis.yml
@ -1 +1,14 @@
|
||||
language: cpp
|
||||
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
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
namespace DocFormatUtils
|
||||
namespace DocFileFormat
|
||||
{
|
||||
typedef unsigned char Bool8;
|
||||
typedef unsigned short Bool16;
|
||||
@ -963,4 +963,3 @@ namespace DocFormatUtils
|
||||
};
|
||||
}
|
||||
|
||||
using namespace DocFormatUtils;
|
||||
|
||||
@ -76,4 +76,4 @@ namespace DocFileFormat
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,12 +68,12 @@ namespace DocFileFormat
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
|
||||
|
||||
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
|
||||
@ -290,17 +290,15 @@ namespace DocFileFormat
|
||||
std::vector<wchar_t>* chpxChars = m_document->GetChars(fcChpxStart, fcChpxEnd, cp);
|
||||
|
||||
//search for bookmarks in the chars
|
||||
std::vector<int> bookmarks = searchBookmarks(chpxChars, cp);
|
||||
|
||||
//if there are bookmarks in this run, split the run into several runs
|
||||
if (!bookmarks.empty())
|
||||
std::vector<int> annot = searchAnnot(chpxChars, cp);
|
||||
if (!annot.empty())
|
||||
{
|
||||
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks);
|
||||
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &annot);
|
||||
if (runs)
|
||||
{
|
||||
for (std::list<std::vector<wchar_t> >::iterator iter = runs->begin(); iter != runs->end(); ++iter)
|
||||
{
|
||||
if (writeBookmarks(cp))
|
||||
if (writeAnnotations(cp))
|
||||
{
|
||||
cp = writeRun(&(*iter), *cpeIter, cp);
|
||||
}
|
||||
@ -311,7 +309,30 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
cp = writeRun(chpxChars, *cpeIter, cp);
|
||||
//search for bookmarks in the chars
|
||||
std::vector<int> bookmarks = searchBookmarks(chpxChars, cp);
|
||||
|
||||
//if there are bookmarks in this run, split the run into several runs
|
||||
if (!bookmarks.empty())
|
||||
{
|
||||
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks);
|
||||
if (runs)
|
||||
{
|
||||
for (std::list<std::vector<wchar_t> >::iterator iter = runs->begin(); iter != runs->end(); ++iter)
|
||||
{
|
||||
if (writeBookmarks(cp))
|
||||
{
|
||||
cp = writeRun(&(*iter), *cpeIter, cp);
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEOBJECT(runs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cp = writeRun(chpxChars, *cpeIter, cp);
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEOBJECT(chpxChars);
|
||||
@ -811,10 +832,10 @@ namespace DocFileFormat
|
||||
{
|
||||
Symbol s = getSymbol( chpx );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
//m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
//m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
//m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
//m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
}
|
||||
else if ((TextMark::DrawnObject == code) && fSpec)
|
||||
{
|
||||
@ -948,19 +969,17 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::AnnotationReference == code)
|
||||
{
|
||||
if (typeid(*this) != typeid(CommentsMapping))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
else
|
||||
if (typeid(*this) == typeid(CommentsMapping))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:annotationRef", true );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
|
||||
_commentNr++;
|
||||
}
|
||||
else if (!FormatUtils::IsControlSymbol(c) && ((int)c != 0xFFFF))
|
||||
{
|
||||
@ -1042,6 +1061,30 @@ namespace DocFileFormat
|
||||
|
||||
return ret;
|
||||
}
|
||||
// Searches for bookmarks in the list of characters.
|
||||
std::vector<int> DocumentMapping::searchAnnot(std::vector<wchar_t>* chars, int initialCp)
|
||||
{
|
||||
std::vector<int> ret;
|
||||
|
||||
if (m_document->AnnotStartPlex->IsValid())
|
||||
{
|
||||
int cp = initialCp;
|
||||
|
||||
size_t count = chars->size();
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if ((m_document->AnnotStartPlex->IsCpExists(cp)) || (m_document->AnnotEndPlex->IsCpExists(cp)))
|
||||
{
|
||||
ret.push_back(i);
|
||||
}
|
||||
|
||||
++cp;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ParagraphPropertyExceptions* DocumentMapping::findValidPapx(int fc)
|
||||
{
|
||||
@ -1540,7 +1583,6 @@ namespace DocFileFormat
|
||||
return cpCellEnd;
|
||||
}
|
||||
|
||||
//
|
||||
bool DocumentMapping::writeBookmarks(int cp)
|
||||
{
|
||||
bool result = true;
|
||||
@ -1561,7 +1603,27 @@ namespace DocFileFormat
|
||||
|
||||
return result;
|
||||
}
|
||||
bool DocumentMapping::writeAnnotations(int cp)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
for (size_t i = 0; i < m_document->AnnotStartEndCPs.size(); i++)
|
||||
{
|
||||
if (m_document->AnnotStartEndCPs[i].first == cp)
|
||||
{
|
||||
result = writeAnnotationStart(i + 1);
|
||||
_commentNr = i + 1;
|
||||
}
|
||||
|
||||
if (m_document->AnnotStartEndCPs[i].second == cp)
|
||||
{
|
||||
result = writeAnnotationEnd(i + 1);
|
||||
_commentNr = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
bool DocumentMapping::writeBookmarkStart(short id)
|
||||
{
|
||||
// write bookmark start
|
||||
@ -1585,8 +1647,6 @@ namespace DocFileFormat
|
||||
|
||||
bool DocumentMapping::writeBookmarkEnd(short id)
|
||||
{
|
||||
// write bookmark end
|
||||
|
||||
WideString* bookmarkName = static_cast<WideString*>( m_document->BookmarkNames->operator [] ( id ) );
|
||||
|
||||
if ( ( bookmarkName != NULL ) && ( *bookmarkName != L"_PictureBullets" ) )
|
||||
@ -1602,7 +1662,27 @@ namespace DocFileFormat
|
||||
|
||||
return false;
|
||||
}
|
||||
bool DocumentMapping::writeAnnotationStart(short id)
|
||||
{
|
||||
XMLTools::XMLElement bookmarkElem(L"w:commentRangeStart");
|
||||
|
||||
bookmarkElem.AppendAttribute(L"w:id", FormatUtils::IntToWideString(id));
|
||||
|
||||
m_pXmlWriter->WriteString(bookmarkElem.GetXMLString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DocumentMapping::writeAnnotationEnd(short id)
|
||||
{
|
||||
XMLTools::XMLElement bookmarkElem( L"w:commentRangeEnd" );
|
||||
|
||||
bookmarkElem.AppendAttribute( L"w:id", FormatUtils::IntToWideString( id ));
|
||||
|
||||
m_pXmlWriter->WriteString( bookmarkElem.GetXMLString());
|
||||
|
||||
return true;
|
||||
}
|
||||
// Checks if the CHPX is special
|
||||
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
|
||||
{
|
||||
@ -1663,12 +1743,17 @@ namespace DocFileFormat
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( fontIndex ) );
|
||||
|
||||
ret.FontName = ffn->xszFtn;
|
||||
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );
|
||||
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );//-123 - ShortToFormattedWideString
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.HexValue.length() > 4)
|
||||
{
|
||||
ret.HexValue = ret.HexValue.substr(ret.HexValue.length() - 4, 4);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -99,8 +99,9 @@ namespace DocFileFormat
|
||||
void writeTextStart ( const std::wstring& textType, bool preserve_space);
|
||||
void writeTextEnd ( const std::wstring& textType );
|
||||
|
||||
// Searches for bookmarks in the list of characters.
|
||||
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
|
||||
std::vector<int> searchAnnot(std::vector<wchar_t>* chars, int initialCp);
|
||||
|
||||
ParagraphPropertyExceptions* findValidPapx( int fc );
|
||||
// Splits a list of characters into several lists
|
||||
std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices );
|
||||
@ -121,6 +122,10 @@ namespace DocFileFormat
|
||||
bool writeBookmarks ( int cp );
|
||||
bool writeBookmarkStart ( short id );
|
||||
bool writeBookmarkEnd ( short id );
|
||||
|
||||
bool writeAnnotations ( int cp );
|
||||
bool writeAnnotationStart( short id );
|
||||
bool writeAnnotationEnd ( short id );
|
||||
// Checks if the CHPX is special
|
||||
bool isSpecial( CharacterPropertyExceptions* chpx );
|
||||
// Finds the SEPX that is valid for the given CP.
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#include "DrawingPrimitives.h"
|
||||
#include "VirtualStreamReader.h"
|
||||
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
DrawingPrimitive * DrawingPrimitive::Create(VirtualStreamReader* reader, int length, short dpk)
|
||||
|
||||
@ -133,14 +133,25 @@ namespace DocFileFormat
|
||||
pos = tStream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; //by AlgIDHash -> 0x0000 || 0x8004
|
||||
crypt_data_aes.spinCount = 50000;
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
crypt_data_aes.spinCount = 0;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x0000:
|
||||
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
case 0x6801:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
|
||||
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
|
||||
break;
|
||||
case 0x660E:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
@ -156,16 +167,11 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
|
||||
switch(ProviderType)
|
||||
{
|
||||
case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
}
|
||||
|
||||
|
||||
//switch(ProviderType)
|
||||
//{
|
||||
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
//}
|
||||
}
|
||||
|
||||
//RELEASEARRAYOBJECTS( bytes );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -507,9 +507,9 @@ namespace DocFileFormat
|
||||
class FileInformationBlock
|
||||
{
|
||||
public:
|
||||
bool m_bOlderVersion;
|
||||
int m_CodePage;
|
||||
FibBase m_FibBase;
|
||||
bool m_bOlderVersion;
|
||||
int m_CodePage;
|
||||
FibBase m_FibBase;
|
||||
|
||||
RgW97 m_RgW97;
|
||||
RgLw97 m_RgLw97;
|
||||
@ -1189,9 +1189,9 @@ namespace DocFileFormat
|
||||
m_FibBase.fDot = FormatUtils::BitmaskToBool((int)flag16, 0x0001);
|
||||
m_FibBase.fGlsy = FormatUtils::BitmaskToBool((int)flag16, 0x0002);
|
||||
m_FibBase.fComplex = FormatUtils::BitmaskToBool((int)flag16, 0x0002);
|
||||
m_FibBase.fHasPic = FormatUtils::BitmaskToBool((int)flag16, 0x0008);
|
||||
m_FibBase.cQuickSaves = (WORD)(((int)flag16 & 0x00F0) >> 4);
|
||||
m_FibBase.fEncrypted = FormatUtils::BitmaskToBool((int)flag16, 0x0100);
|
||||
m_FibBase.fHasPic = FormatUtils::BitmaskToBool((int)flag16, 0x0008);
|
||||
m_FibBase.cQuickSaves = (WORD)(((int)flag16 & 0x00F0) >> 4);
|
||||
m_FibBase.fEncrypted = FormatUtils::BitmaskToBool((int)flag16, 0x0100);
|
||||
m_FibBase.fWhichTblStm = FormatUtils::BitmaskToBool((int)flag16, 0x0200);
|
||||
m_FibBase.fReadOnlyRecommended = FormatUtils::BitmaskToBool((int)flag16, 0x0400);
|
||||
m_FibBase.fWriteReservation = FormatUtils::BitmaskToBool((int)flag16, 0x0800);
|
||||
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
if (m_Data)
|
||||
{
|
||||
rdUShort = FormatUtils::BytesToUInt16 (m_Data, m_Position, m_Size);
|
||||
rdUShort = DocFileFormat::FormatUtils::BytesToUInt16 (m_Data, m_Position, m_Size);
|
||||
m_Position += sizeof(rdUShort);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
if (m_Data)
|
||||
{
|
||||
rdShort = FormatUtils::BytesToInt16 (m_Data, m_Position, m_Size);
|
||||
rdShort = DocFileFormat::FormatUtils::BytesToInt16 (m_Data, m_Position, m_Size);
|
||||
m_Position += sizeof(rdShort);
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
|
||||
if (m_Data)
|
||||
{
|
||||
rdInt = FormatUtils::BytesToInt32 (m_Data, m_Position, m_Size);
|
||||
rdInt = DocFileFormat::FormatUtils::BytesToInt32 (m_Data, m_Position, m_Size);
|
||||
m_Position += sizeof(rdInt);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
|
||||
if (m_Data )
|
||||
{
|
||||
rdUInt = FormatUtils::BytesToUInt32 (m_Data, m_Position, m_Size);
|
||||
rdUInt = DocFileFormat::FormatUtils::BytesToUInt32 (m_Data, m_Position, m_Size);
|
||||
m_Position += sizeof(rdUInt);
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ namespace DocFileFormat
|
||||
_size.cx = Right - Left;
|
||||
_size.cy = Bottom - Top;
|
||||
|
||||
rcgBounds = DocFormatUtils::Rectangle (_point, _size);
|
||||
rcgBounds = DocFileFormat::Rectangle (_point, _size);
|
||||
}
|
||||
|
||||
virtual ~ChildAnchor()
|
||||
@ -75,7 +75,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
|
||||
/// Rectangle that describes the bounds of the anchor
|
||||
DocFormatUtils::Rectangle rcgBounds;
|
||||
DocFileFormat::Rectangle rcgBounds;
|
||||
int Left;
|
||||
int Top;
|
||||
int Right;
|
||||
|
||||
@ -64,7 +64,7 @@ namespace DocFileFormat
|
||||
oSize.cx = ( right - left );
|
||||
oSize.cy = ( bottom - top );
|
||||
|
||||
rcgBounds = DocFormatUtils::Rectangle(oPoint,oSize);
|
||||
rcgBounds = DocFileFormat::Rectangle(oPoint,oSize);
|
||||
}
|
||||
|
||||
virtual ~GroupShapeRecord()
|
||||
@ -77,6 +77,6 @@ namespace DocFileFormat
|
||||
return new GroupShapeRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
DocFormatUtils::Rectangle rcgBounds;
|
||||
DocFileFormat::Rectangle rcgBounds;
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "RegularContainer.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class OfficeArtFRITContainer: public RegularContainer
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF118 = 0xF118;
|
||||
|
||||
OfficeArtFRITContainer () : RegularContainer()
|
||||
{
|
||||
}
|
||||
|
||||
OfficeArtFRITContainer (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : RegularContainer (_reader, size, typeCode, version, instance)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~OfficeArtFRITContainer()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Record* NewObject (IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance)
|
||||
{
|
||||
return new OfficeArtFRITContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -35,11 +35,23 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
struct _guides
|
||||
{
|
||||
unsigned char type;
|
||||
|
||||
unsigned char param_type1;
|
||||
unsigned char param_type2;
|
||||
unsigned char param_type3;
|
||||
|
||||
WORD param1;
|
||||
WORD param2;
|
||||
WORD param3;
|
||||
};
|
||||
class PathParser
|
||||
{
|
||||
public:
|
||||
|
||||
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize)
|
||||
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
|
||||
{
|
||||
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
|
||||
{
|
||||
@ -105,31 +117,40 @@ namespace DocFileFormat
|
||||
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
|
||||
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
|
||||
|
||||
if (0xfff0 == cb)
|
||||
{
|
||||
cb = 4;
|
||||
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
{
|
||||
POINT point;
|
||||
if (0xfff0 == cb)
|
||||
{
|
||||
POINT point;
|
||||
|
||||
cb = 4;
|
||||
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize);
|
||||
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
else
|
||||
{
|
||||
POINT point;
|
||||
|
||||
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize);
|
||||
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
if (lMinF <= point.x)
|
||||
{
|
||||
int index = (DWORD)point.x - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.x = guides[index].param3;
|
||||
}
|
||||
}
|
||||
if (lMinF <= point.y)
|
||||
{
|
||||
int index = (DWORD)point.y - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
}
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,104 +184,100 @@ namespace DocFileFormat
|
||||
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
|
||||
for (std::vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
|
||||
{
|
||||
try
|
||||
switch (iter->Type)
|
||||
{
|
||||
switch (iter->Type)
|
||||
case PathSegment::msopathLineTo:
|
||||
{
|
||||
case PathSegment::msopathLineTo:
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
if (valuePointer + 1 > (int)m_arPoints.size())
|
||||
{
|
||||
if (valuePointer >= (int)m_arPoints.size())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
|
||||
|
||||
++valuePointer;
|
||||
|
||||
//break;
|
||||
}
|
||||
else
|
||||
{
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
|
||||
|
||||
++valuePointer;
|
||||
|
||||
//break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathCurveTo:
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
else
|
||||
{
|
||||
strVmlPath += L"c";
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
|
||||
valuePointer += 3;
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathMoveTo:
|
||||
case PathSegment::msopathCurveTo:
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
{
|
||||
strVmlPath += L"m";
|
||||
if (valuePointer + 3 > (int)m_arPoints.size())
|
||||
break;
|
||||
strVmlPath += L"c";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
|
||||
valuePointer += 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathMoveTo:
|
||||
{
|
||||
if (valuePointer < (int)m_arPoints.size())
|
||||
{
|
||||
strVmlPath += L"m";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathClose:
|
||||
{
|
||||
strVmlPath += L"x";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEnd:
|
||||
{
|
||||
strVmlPath += L"e";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEscape:
|
||||
{
|
||||
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
|
||||
strVmlPath += L"nf";
|
||||
|
||||
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
|
||||
strVmlPath += L"ns";
|
||||
}
|
||||
case PathSegment::msopathClientEscape:
|
||||
case PathSegment::msopathInvalid:
|
||||
{
|
||||
//ignore escape segments and invalid segments
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// Sometimes there are more Segments than available m_arPoints.
|
||||
// Accordingly to the spec this should never happen :)
|
||||
break;
|
||||
|
||||
case PathSegment::msopathClose:
|
||||
{
|
||||
strVmlPath += L"x";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEnd:
|
||||
{
|
||||
strVmlPath += L"e";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEscape:
|
||||
{
|
||||
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
|
||||
strVmlPath += L"nf";
|
||||
|
||||
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
|
||||
strVmlPath += L"ns";
|
||||
}
|
||||
case PathSegment::msopathClientEscape:
|
||||
case PathSegment::msopathInvalid:
|
||||
{
|
||||
//ignore escape segments and invalid segments
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
#include "GroupShapeRecord.h"
|
||||
#include "OfficeArtClientTextbox.h"
|
||||
#include "UnknownRecord.h"
|
||||
#include "OfficeArtFRITContainer.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -135,6 +136,7 @@ namespace DocFileFormat
|
||||
case GroupContainer::TYPE_CODE_0xF003 : return new GroupContainer();
|
||||
case GroupShapeRecord::TYPE_CODE_0xF009 : return new GroupShapeRecord ();
|
||||
case OfficeArtClientTextbox::TYPE_CODE_0xF00D : return new OfficeArtClientTextbox ();
|
||||
case OfficeArtFRITContainer::TYPE_CODE_0xF118 : return new OfficeArtFRITContainer ();
|
||||
|
||||
default:
|
||||
return new UnknownRecord();
|
||||
|
||||
@ -106,21 +106,20 @@ namespace DocFileFormat
|
||||
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
std::list<OptionEntry> ExtractOptions() const
|
||||
std::vector<OptionEntryPtr> ExtractOptions() const
|
||||
{
|
||||
std::list<OptionEntry> ret;
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
//build the list of all option entries of this shape
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
|
||||
|
||||
if ( opt != NULL )
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
for ( size_t i = 0; i < opt->Options.size(); i++)
|
||||
{
|
||||
for ( std::vector<OptionEntry>::iterator oeIter = opt->Options.begin(); oeIter != opt->Options.end(); oeIter++ )
|
||||
{
|
||||
ret.push_back( *oeIter );
|
||||
}
|
||||
ret.push_back( opt->Options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -568,18 +568,19 @@ namespace DocFileFormat
|
||||
|
||||
struct OptionEntry
|
||||
{
|
||||
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0), opComplex(NULL)
|
||||
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyId pid;
|
||||
bool fBid;
|
||||
bool fComplex;
|
||||
unsigned int op;
|
||||
unsigned char* opComplex;
|
||||
std::shared_ptr<unsigned char> opComplex;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<OptionEntry> OptionEntryPtr;
|
||||
|
||||
class ShapeOptions: public Record
|
||||
{
|
||||
public:
|
||||
@ -587,8 +588,8 @@ namespace DocFileFormat
|
||||
static const unsigned short TYPE_CODE_0xF121 = 0xF121;
|
||||
static const unsigned short TYPE_CODE_0xF122 = 0xF122;
|
||||
|
||||
std::vector<OptionEntry> Options;
|
||||
std::map<PropertyId, OptionEntry> OptionsByID;
|
||||
std::vector<OptionEntryPtr> Options;
|
||||
std::map<PropertyId, OptionEntryPtr> OptionsByID;
|
||||
|
||||
ShapeOptions() : Record()
|
||||
{
|
||||
@ -596,8 +597,8 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ShapeOptions()
|
||||
{
|
||||
for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
|
||||
RELEASEARRAYOBJECTS( iter->opComplex );
|
||||
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
|
||||
// RELEASEARRAYOBJECTS( iter->opComplex );
|
||||
}
|
||||
|
||||
ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance)
|
||||
@ -606,16 +607,16 @@ namespace DocFileFormat
|
||||
|
||||
//instance is the count of properties stored in this record
|
||||
|
||||
OptionEntry entry;
|
||||
//parse the flags and the simple values
|
||||
for (unsigned int i = 0; i < instance; ++i)
|
||||
{
|
||||
OptionEntryPtr entry = std::shared_ptr<OptionEntry>(new OptionEntry());
|
||||
unsigned short flag = Reader->ReadUInt16();
|
||||
|
||||
entry.pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
|
||||
entry.fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
|
||||
entry.fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
|
||||
entry.op = Reader->ReadUInt32();
|
||||
entry->pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
|
||||
entry->fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
|
||||
entry->fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
|
||||
entry->op = Reader->ReadUInt32();
|
||||
|
||||
Options.push_back( entry );
|
||||
}
|
||||
@ -625,21 +626,12 @@ namespace DocFileFormat
|
||||
//of the OptionEntry arry, sorted by pid
|
||||
for (unsigned int i = 0; i < instance; ++i)
|
||||
{
|
||||
if (Options[i].fComplex)
|
||||
{
|
||||
int read_size = (int)Options[i].op + 6 ; //????
|
||||
//todooo !!!! проверить все остальные !! тут размер в зависимости от типа Complex!!!
|
||||
switch(Options[i].pid)
|
||||
{
|
||||
case PropertyId::gtextUNICODE:
|
||||
case PropertyId::gtextFont:
|
||||
read_size = (int)Options[i].op;
|
||||
break;
|
||||
}
|
||||
Options[i].opComplex = Reader->ReadBytes( read_size, true );
|
||||
if (Options[i]->fComplex && Options[i]->op > 0)
|
||||
{
|
||||
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( Options[i]->op, true ));
|
||||
}
|
||||
|
||||
OptionsByID.insert(std::pair<PropertyId, OptionEntry>(Options[i].pid, Options[i]));
|
||||
OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));
|
||||
}
|
||||
|
||||
Reader->Seek(( pos + size ), 0/*STREAM_SEEK_SET*/);
|
||||
|
||||
@ -488,7 +488,7 @@ namespace DocFileFormat
|
||||
{
|
||||
for ( unsigned int i = 0, nSize = _grid->size(); i < nSize; i++ )
|
||||
{
|
||||
if(_grid->at(i) % DocFormatUtils::gc_nZeroWidth != 0)
|
||||
if(_grid->at(i) % DocFileFormat::gc_nZeroWidth != 0)
|
||||
{
|
||||
bWriteGridCol = true;
|
||||
break;
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
using namespace DocFileFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD iType; // Record type EMR_HEADER
|
||||
@ -136,14 +138,18 @@ namespace DocFileFormat
|
||||
}
|
||||
return btWin32;
|
||||
}
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(
|
||||
NSDirectory::GetTempPath(), L"emb");
|
||||
|
||||
sTempXmlFile += L".xml";
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sTempXmlFile);
|
||||
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
|
||||
@ -186,6 +192,7 @@ namespace DocFileFormat
|
||||
if (res) break;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary::Remove(sTempXmlFile);
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
@ -236,7 +243,7 @@ namespace DocFileFormat
|
||||
std::wstring strHeight = FormatUtils::DoubleToWideString( height.ToPoints() );
|
||||
std::wstring strStyle;
|
||||
|
||||
std::list<OptionEntry> options;
|
||||
std::vector<OptionEntryPtr> options;
|
||||
|
||||
PictureFrameType type;
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
@ -277,9 +284,9 @@ namespace DocFileFormat
|
||||
}
|
||||
//todooo oбъединить с shape_mapping
|
||||
|
||||
std::list<OptionEntry>::iterator end = options.end();
|
||||
for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
OptionEntryPtr & iter = options[i];
|
||||
switch ( iter->pid )
|
||||
{
|
||||
case wzEquationXML:
|
||||
@ -287,7 +294,7 @@ namespace DocFileFormat
|
||||
m_isEquation = true;
|
||||
m_isEmbedded = true;
|
||||
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
|
||||
{
|
||||
@ -297,8 +304,13 @@ namespace DocFileFormat
|
||||
case metroBlob:
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
//{
|
||||
// m_isEmbedded = false;
|
||||
//}
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
|
||||
@ -46,7 +46,6 @@ namespace DocFileFormat
|
||||
{
|
||||
class OleObject;
|
||||
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
|
||||
class VMLPictureMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
@ -58,6 +57,7 @@ namespace DocFileFormat
|
||||
/// Writes a border element
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
|
||||
@ -143,8 +143,9 @@ namespace DocFileFormat
|
||||
ShapeContainer* groupShape = static_cast<ShapeContainer*>(container->Children[0]);
|
||||
GroupShapeRecord* gsr = static_cast<GroupShapeRecord*>(groupShape->Children[0]);
|
||||
Shape* shape = static_cast<Shape*>(groupShape->Children[1]);
|
||||
std::list<OptionEntry> options = groupShape->ExtractOptions();
|
||||
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
|
||||
|
||||
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
|
||||
std::vector<OptionEntryPtr> options = groupShape->ExtractOptions();
|
||||
|
||||
m_shapeId = GetShapeID(shape);
|
||||
|
||||
@ -155,14 +156,13 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)));
|
||||
|
||||
// Write wrap coords
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
switch (iter->pid)
|
||||
switch (options[i]->pid)
|
||||
{
|
||||
case pWrapPolygonVertices:
|
||||
case pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = getWrapCoords(*iter);
|
||||
std::wstring wrapCoords = GetWrapCoords(options[i]);
|
||||
if (wrapCoords.length())
|
||||
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
|
||||
}
|
||||
@ -226,9 +226,9 @@ namespace DocFileFormat
|
||||
bool freeform = true;
|
||||
std::wstring sShapeId;
|
||||
|
||||
std::list<OptionEntry> options = pContainer->ExtractOptions();
|
||||
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
|
||||
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
|
||||
std::vector<OptionEntryPtr> options = pContainer->ExtractOptions();
|
||||
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
|
||||
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
|
||||
|
||||
WriteBeginShapeNode (pShape);
|
||||
|
||||
@ -247,9 +247,8 @@ namespace DocFileFormat
|
||||
{
|
||||
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->Index)));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
@ -294,13 +293,17 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring sTextboxStyle;
|
||||
|
||||
std::wstring adjValues[8];
|
||||
ShadowStyleBooleanProperties shadowBoolean(0);
|
||||
std::vector<std::wstring> arrInscribe;
|
||||
|
||||
OptionEntryPtr opSegmentInfo;
|
||||
OptionEntryPtr opVerticles;
|
||||
OptionEntryPtr opInscribe;
|
||||
OptionEntryPtr opConnectAngles;
|
||||
OptionEntryPtr opConnectLocs;
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
OptionEntryPtr & iter = options[i];
|
||||
switch (iter->pid)
|
||||
{
|
||||
//BOOLEANS
|
||||
@ -335,19 +338,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case protectionBooleans:
|
||||
{
|
||||
ProtectionBooleanProperties booleans(iter->op);
|
||||
}
|
||||
break;
|
||||
|
||||
case diagramBooleans:
|
||||
{
|
||||
DiagramBooleanProperties booleans(iter->op);
|
||||
}
|
||||
break;
|
||||
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
GroupShapeBooleanProperties booleans(iter->op);
|
||||
@ -357,56 +357,80 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// GEOMETRY
|
||||
|
||||
// GEOMETRY
|
||||
case shapePath :
|
||||
{
|
||||
bHavePath = true;
|
||||
}break;
|
||||
case pVertices:
|
||||
{
|
||||
opVerticles = iter;
|
||||
}break;
|
||||
case pSegmentInfo:
|
||||
{
|
||||
opSegmentInfo = iter;
|
||||
}break;
|
||||
case pGuides:
|
||||
{
|
||||
GetGuides(iter);
|
||||
}break;
|
||||
case pConnectionSites:
|
||||
{
|
||||
opConnectLocs = iter;
|
||||
}break;
|
||||
case pConnectionSitesDir:
|
||||
{
|
||||
opConnectAngles = iter;
|
||||
}break;
|
||||
case pInscribe:
|
||||
{
|
||||
opInscribe = iter;
|
||||
}break;
|
||||
case adjustValue:
|
||||
{
|
||||
adjValues[0] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,1);
|
||||
m_nAdjValues[0] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues,1);
|
||||
}
|
||||
break;
|
||||
|
||||
case adjust2Value:
|
||||
{
|
||||
adjValues[1] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,2);
|
||||
m_nAdjValues[1] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case adjust3Value:
|
||||
{
|
||||
adjValues[2] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,3);
|
||||
m_nAdjValues[2] = (int)iter->op;
|
||||
nAdjValues =(std::max)(nAdjValues, 3);
|
||||
}break;
|
||||
case adjust4Value:
|
||||
{
|
||||
adjValues[3] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,4);
|
||||
m_nAdjValues[3] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 4);
|
||||
}break;
|
||||
case adjust5Value:
|
||||
{
|
||||
adjValues[4] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,5);
|
||||
m_nAdjValues[4] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 5);
|
||||
}break;
|
||||
case adjust6Value:
|
||||
{
|
||||
adjValues[5] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,6);
|
||||
m_nAdjValues[5] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 6);
|
||||
}break;
|
||||
case adjust7Value:
|
||||
{
|
||||
adjValues[6] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,7);
|
||||
m_nAdjValues[6] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 7);
|
||||
}break;
|
||||
case adjust8Value:
|
||||
{
|
||||
adjValues[7] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,8);
|
||||
m_nAdjValues[7] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 8);
|
||||
}break;
|
||||
case pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = getWrapCoords(*iter);
|
||||
std::wstring wrapCoords = GetWrapCoords(iter);
|
||||
|
||||
if (!wrapCoords.empty())
|
||||
{
|
||||
@ -421,14 +445,7 @@ namespace DocFileFormat
|
||||
{
|
||||
yCoord = iter->op;
|
||||
}break;
|
||||
case pGuides:
|
||||
{
|
||||
}break;
|
||||
case pInscribe:
|
||||
{
|
||||
arrInscribe = GetTextRectangles(*iter);
|
||||
}break;
|
||||
// OUTLINE
|
||||
// LINE
|
||||
case lineColor:
|
||||
{
|
||||
RGBColor lineColor((int)iter->op, RedFirst);
|
||||
@ -475,6 +492,21 @@ namespace DocFileFormat
|
||||
{
|
||||
appendValueAttribute(&m_stroke, L"startarrowwidth", getArrowWidth( iter->op ));
|
||||
}break;
|
||||
case cxstyle:
|
||||
{
|
||||
if (pShape->GetShapeType() == NULL)
|
||||
{
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute(L"type", L"#_x0000_t32");
|
||||
}
|
||||
switch(iter->op)
|
||||
{
|
||||
case 0: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"straight"); break;
|
||||
case 1: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"elbow"); break;
|
||||
case 2: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"curved"); break;
|
||||
case 3: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"none"); break;
|
||||
}
|
||||
}break;
|
||||
// FILL
|
||||
case fillColor:
|
||||
{
|
||||
@ -497,7 +529,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case fillShadeColors:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex, iter->op ));
|
||||
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex.get(), iter->op ));
|
||||
}break;
|
||||
case fillFocus:
|
||||
{
|
||||
@ -526,6 +558,14 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
}break;
|
||||
case fillBlipName:
|
||||
{
|
||||
std::wstring name;
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex.get(), iter->op, ENCODING_UTF16);
|
||||
if (!name.empty())
|
||||
appendValueAttribute(&m_fill, L"o:title", FormatUtils::XmlEncode(name));
|
||||
|
||||
}break;
|
||||
case fillOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"opacity", ( FormatUtils::IntToWideString( iter->op ) + L"f" ));
|
||||
@ -602,7 +642,7 @@ namespace DocFileFormat
|
||||
case pibName:
|
||||
{
|
||||
std::wstring name;
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UTF16);
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex.get(), iter->op, ENCODING_UTF16);
|
||||
if (!name.empty())
|
||||
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name));
|
||||
}break;
|
||||
@ -676,10 +716,10 @@ namespace DocFileFormat
|
||||
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 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:
|
||||
{
|
||||
switch(iter->op)
|
||||
@ -700,7 +740,7 @@ namespace DocFileFormat
|
||||
// Word Art
|
||||
case gtextUNICODE:
|
||||
{
|
||||
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
|
||||
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
|
||||
|
||||
text = FormatUtils::XmlEncode(text);
|
||||
|
||||
@ -713,7 +753,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case gtextFont:
|
||||
{
|
||||
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
|
||||
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
|
||||
int i = font.size();
|
||||
while (i > 0)
|
||||
{
|
||||
@ -764,31 +804,31 @@ namespace DocFileFormat
|
||||
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
|
||||
}
|
||||
}break;
|
||||
// PATH
|
||||
case shapePath :
|
||||
{
|
||||
bHavePath = true;
|
||||
|
||||
std::wstring path = ParsePath(options);
|
||||
|
||||
if (false == path.empty())
|
||||
m_pXmlWriter->WriteAttribute (L"path", path);
|
||||
}break;
|
||||
default:
|
||||
default:
|
||||
{
|
||||
int val = iter->op;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
if (false == bHavePath) // фигура может быть задана только наборами вершин и индексов
|
||||
if (opVerticles && opSegmentInfo)
|
||||
{
|
||||
std::wstring path = ParsePath(options);
|
||||
const unsigned char* pVP = opVerticles->opComplex.get();
|
||||
unsigned int nVP = opVerticles->op;
|
||||
const unsigned char* pSI = opSegmentInfo->opComplex.get();
|
||||
unsigned int nSI = opSegmentInfo->op;
|
||||
|
||||
PathParser oParser (pSI, nSI, pVP, nVP, m_arrGuides);
|
||||
std::wstring path = oParser.GetVmlPath();
|
||||
|
||||
if (false == path.empty())
|
||||
m_pXmlWriter->WriteAttribute (L"path", path);
|
||||
}
|
||||
|
||||
if (freeform && (xCoord == 0 || yCoord == 0 ))
|
||||
{
|
||||
xCoord = 21600;
|
||||
yCoord = 21600;
|
||||
}
|
||||
if ( !filled )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"filled", L"f" );
|
||||
@ -804,10 +844,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"o:allowincell", L"f");
|
||||
}
|
||||
|
||||
if ( ( xCoord > 0 ) && ( yCoord > 0 ) )
|
||||
if ( xCoord > 0 && yCoord > 0 )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( xCoord ) + L"," + FormatUtils::IntToWideString( yCoord ) ));
|
||||
}
|
||||
}
|
||||
|
||||
int nCode = 0;
|
||||
if (pShape->GetShapeType())
|
||||
@ -819,17 +859,17 @@ namespace DocFileFormat
|
||||
{
|
||||
if (nAdjValues)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", adjValues[0]);
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", m_nAdjValues[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nAdjValues)
|
||||
if (nAdjValues > 0)
|
||||
{
|
||||
std::wstring adjTag = adjValues[0];
|
||||
std::wstring adjTag = std::to_wstring(m_nAdjValues[0]);
|
||||
|
||||
for (int i = 1; i < nAdjValues; ++i)
|
||||
adjTag += std::wstring(L",") + adjValues[i];
|
||||
adjTag += L"," + std::to_wstring(m_nAdjValues[i]);
|
||||
|
||||
m_pXmlWriter->WriteAttribute(L"adj", adjTag);
|
||||
}
|
||||
@ -982,10 +1022,24 @@ namespace DocFileFormat
|
||||
}
|
||||
if (freeform)
|
||||
{
|
||||
if (arrInscribe.size())
|
||||
if (opInscribe || opConnectAngles || opConnectLocs)
|
||||
{
|
||||
std::vector<std::wstring> arrInscribe = GetTextRectangles(opInscribe);
|
||||
std::wstring strConnectAngles = GetConnectAngles(opConnectAngles);
|
||||
std::wstring strConnectLocs = GetConnectLocs(opConnectLocs);
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"v:path", true);
|
||||
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
|
||||
if (!arrInscribe.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
|
||||
if (!strConnectAngles.empty() || !strConnectLocs.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute(L"o:connecttype", L"custom");
|
||||
if (!strConnectLocs.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"o:connectlocs", strConnectLocs);
|
||||
if (!strConnectAngles.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"o:connectangles", strConnectAngles);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
}
|
||||
}
|
||||
@ -1182,11 +1236,13 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
|
||||
std::wstring VMLShapeMapping::getWrapCoords(const OptionEntry& pWrapPolygonVertices) const
|
||||
std::wstring VMLShapeMapping::GetWrapCoords(const OptionEntryPtr& pWrapPolygonVertices) const
|
||||
{
|
||||
if (!pWrapPolygonVertices) return L"";
|
||||
|
||||
std::wstring coords;
|
||||
|
||||
MemoryStream oStream(pWrapPolygonVertices.opComplex, pWrapPolygonVertices.op);
|
||||
MemoryStream oStream(pWrapPolygonVertices->opComplex.get(), pWrapPolygonVertices->op);
|
||||
std::list<int> arrVertices;
|
||||
|
||||
unsigned short nElems = oStream.ReadUInt16();
|
||||
@ -1385,7 +1441,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ((style != NULL) && (anchor != NULL))
|
||||
{
|
||||
DocFormatUtils::Rectangle bounds = anchor->rcgBounds;
|
||||
DocFileFormat::Rectangle bounds = anchor->rcgBounds;
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
@ -1498,7 +1554,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options, int zIndex) const
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::vector<OptionEntryPtr>& options, int zIndex) const
|
||||
{
|
||||
bool bRelH = false;
|
||||
bool bRelV = false;
|
||||
@ -1508,9 +1564,9 @@ namespace DocFileFormat
|
||||
|
||||
bool bZIndex = false;
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
const OptionEntryPtr & iter = options[i];
|
||||
switch (iter->pid)
|
||||
{
|
||||
// POSITIONING
|
||||
@ -1616,15 +1672,16 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex) const
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex) const
|
||||
{
|
||||
std::wstring style;
|
||||
|
||||
// Check if some properties are set that cause the dimensions to be twisted
|
||||
bool twistDimensions = false;
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
const OptionEntryPtr & iter = options[i];
|
||||
|
||||
if (geometryTextBooleanProperties == iter->pid)
|
||||
{
|
||||
GeometryTextBooleanProperties props(iter->op);
|
||||
@ -1860,61 +1917,211 @@ namespace DocFileFormat
|
||||
|
||||
return wrapType;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::ParsePath (const std::list<OptionEntry>& options) const
|
||||
std::wstring VMLShapeMapping::GetConnectAngles(const OptionEntryPtr& opAngles) const
|
||||
{
|
||||
const unsigned char* pVP = NULL;
|
||||
unsigned int nVP = 0;
|
||||
const unsigned char* pSI = NULL;
|
||||
unsigned int nSI = 0;
|
||||
if (!opAngles) return L"";
|
||||
if (!opAngles->opComplex) return L"";
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
MemoryStream reader(opAngles->opComplex.get(), opAngles->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opAngles->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
if (nElemSize < 1) return L"";
|
||||
|
||||
int count = dwSize / nElemSize;
|
||||
|
||||
std::wstring angles;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
if (iter->pid == pVertices)
|
||||
{
|
||||
pVP = iter->opComplex;
|
||||
nVP = iter->op;
|
||||
}
|
||||
|
||||
if (iter->pid == pSegmentInfo)
|
||||
{
|
||||
pSI = iter->opComplex;
|
||||
nSI = iter->op;
|
||||
}
|
||||
DWORD v = reader.ReadUInt32();
|
||||
double val = (double)((WORD)(v >> 16) + ((WORD)(v) / 65536.0));
|
||||
angles += std::to_wstring((int)val) + (i < (count - 1) ? L"," : L"");
|
||||
}
|
||||
return angles;
|
||||
}
|
||||
int VMLShapeMapping::UpdateFromGuides(const int val) const
|
||||
{
|
||||
int new_val = val;
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
if (lMinF <= val)
|
||||
{
|
||||
int index = (DWORD)val - 0x80000000;
|
||||
|
||||
if (index >= 0 && index < m_arrGuides.size())
|
||||
{
|
||||
new_val = m_arrGuides[index].param3;
|
||||
}
|
||||
|
||||
PathParser oParser (pSI, nSI, pVP, nVP);
|
||||
return oParser.GetVmlPath();
|
||||
}
|
||||
return new_val;
|
||||
}
|
||||
void VMLShapeMapping::GetGuides( const OptionEntryPtr& opGuides )
|
||||
{
|
||||
if (!opGuides) return;
|
||||
if (!opGuides->opComplex) return;
|
||||
|
||||
MemoryStream reader(opGuides->opComplex.get(), opGuides->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opGuides->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //1x (int or short)
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
_guides g;
|
||||
WORD flags = reader.ReadUInt16();
|
||||
|
||||
g.type = flags & 0x1FFF;
|
||||
|
||||
g.param_type1 = (unsigned char)(flags & 0x04);
|
||||
g.param_type2 = (unsigned char)(flags & 0x02);
|
||||
g.param_type3 = (unsigned char)(flags & 0x01);
|
||||
|
||||
g.param1 = reader.ReadUInt16();
|
||||
g.param2 = reader.ReadUInt16();
|
||||
g.param3 = reader.ReadUInt16();
|
||||
|
||||
m_arrGuides.push_back(g);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles(const OptionEntry& inscribe) const
|
||||
std::wstring VMLShapeMapping::GetConnectLocs( const OptionEntryPtr& opLocs ) const
|
||||
{
|
||||
MemoryStream reader(inscribe.opComplex, inscribe.op + 6);
|
||||
if (!opLocs) return L"";
|
||||
if (!opLocs->opComplex) return L"";
|
||||
|
||||
unsigned short elems = reader.ReadUInt16();
|
||||
unsigned short allocElems = reader.ReadUInt16();
|
||||
unsigned short cb = reader.ReadUInt16();
|
||||
|
||||
MemoryStream reader(opLocs->opComplex.get(), opLocs->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opLocs->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //2x (int or short)
|
||||
|
||||
std::wstring locs;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
if (bTruncated)
|
||||
{
|
||||
pt.x = reader.ReadInt16();
|
||||
pt.y = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.x = reader.ReadInt32();
|
||||
pt.y = reader.ReadInt32();
|
||||
}
|
||||
|
||||
pt.x = UpdateFromGuides(pt.x);
|
||||
pt.y = UpdateFromGuides(pt.y);
|
||||
|
||||
locs += std::to_wstring(pt.x) + L"," + std::to_wstring(pt.y) + (i < (count - 1) ? L";" : L"");
|
||||
}
|
||||
|
||||
return locs;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles( const OptionEntryPtr& opInscribe ) const
|
||||
{
|
||||
std::vector<std::wstring> rectangles;
|
||||
|
||||
if (!opInscribe) return rectangles;
|
||||
if (!opInscribe->opComplex) return rectangles;
|
||||
|
||||
if (16 != cb) return rectangles; // TODO: доделать
|
||||
MemoryStream reader(opInscribe->opComplex.get(), opInscribe->op);
|
||||
|
||||
int count = (inscribe.op) / 16;
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
else nElemSize = 2;
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opInscribe->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //4x (int or short)
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
rc.top = reader.ReadInt32();
|
||||
rc.left = reader.ReadInt32();
|
||||
rc.right = reader.ReadInt32();
|
||||
rc.bottom = reader.ReadInt32();
|
||||
if (bTruncated)
|
||||
{
|
||||
rc.top = reader.ReadInt16();
|
||||
rc.left = reader.ReadInt16();
|
||||
rc.right = reader.ReadInt16();
|
||||
rc.bottom = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc.top = reader.ReadInt32();
|
||||
rc.left = reader.ReadInt32();
|
||||
rc.right = reader.ReadInt32();
|
||||
rc.bottom = reader.ReadInt32();
|
||||
}
|
||||
rc.top = UpdateFromGuides(rc.top);
|
||||
rc.left = UpdateFromGuides(rc.left);
|
||||
rc.right = UpdateFromGuides(rc.right);
|
||||
rc.bottom = UpdateFromGuides(rc.bottom);
|
||||
|
||||
std::wstringstream sstream;
|
||||
sstream << boost::wformat(L"%d,%d,%d,%d") % rc.top % rc.left % rc.right % rc.bottom;
|
||||
rectangles.push_back(sstream.str());
|
||||
rectangles.push_back( std::to_wstring(rc.top) + L"," + std::to_wstring(rc.left) + L"," +
|
||||
std::to_wstring(rc.right) + L"," + std::to_wstring(rc.bottom));
|
||||
}
|
||||
|
||||
return rectangles;
|
||||
|
||||
@ -77,17 +77,10 @@ namespace DocFileFormat
|
||||
|
||||
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);
|
||||
|
||||
// Converts a group of shapes
|
||||
void WriteGroup(const GroupContainer* pContainer);
|
||||
// Converts a single shape
|
||||
void WriteShape (const ShapeContainer* pContainer);
|
||||
|
||||
/// Generates a string id for the given shape
|
||||
std::wstring GenShapeId(const Shape* pShape) const;
|
||||
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
|
||||
std::wstring getWrapCoords( const OptionEntry& pWrapPolygonVertices ) const;
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
@ -98,21 +91,22 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring getTextboxAnchor( unsigned int anchor ) const;
|
||||
|
||||
void AppendOptionsToStyle( std::wstring* style, const std::list<OptionEntry>& options, int zIndex ) const;
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring* style, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
|
||||
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex ) const;
|
||||
int UpdateFromGuides(const int val) const;
|
||||
|
||||
std::wstring getLineStyle ( unsigned int p ) const;
|
||||
std::wstring getArrowStyle ( unsigned int op ) const;
|
||||
std::wstring getArrowLength ( unsigned int op ) const;
|
||||
std::wstring getArrowWidth ( unsigned int op ) const;
|
||||
std::wstring getFillMethod ( unsigned int p ) const;
|
||||
std::wstring getFillColorString( const unsigned char* p, unsigned int size ) const;
|
||||
/// Returns the OpenXML fill type of a fill effect
|
||||
|
||||
std::wstring getFillType ( unsigned int p ) const;
|
||||
std::wstring getShadowType ( unsigned int p ) const;
|
||||
/// Returns the OpenXML wrap type of the shape
|
||||
|
||||
std::wstring getWrapType (const Spa* pSpa) const;
|
||||
std::wstring ParsePath (const std::list<OptionEntry>& options) const;
|
||||
|
||||
void WriteBeginShapeNode (const Shape* pShape);
|
||||
void WriteEndShapeNode (const Shape* pShape);
|
||||
@ -121,9 +115,15 @@ namespace DocFileFormat
|
||||
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
|
||||
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
|
||||
|
||||
std::vector<std::wstring> GetTextRectangles(const OptionEntry& inscribe) const;
|
||||
std::wstring GetWrapCoords ( const OptionEntryPtr& pOpt ) const;
|
||||
std::vector<std::wstring> GetTextRectangles ( const OptionEntryPtr& pOpt ) const;
|
||||
std::wstring GetConnectAngles ( const OptionEntryPtr& pOpt ) const;
|
||||
std::wstring GetConnectLocs ( const OptionEntryPtr& pOpt ) const;
|
||||
void GetGuides ( const OptionEntryPtr& pOpt );
|
||||
|
||||
private:
|
||||
int m_nAdjValues[8];
|
||||
std::vector<_guides> m_arrGuides;
|
||||
|
||||
bool m_isInlineShape;
|
||||
Spa* m_pSpa;
|
||||
IMapping* m_pCaller;
|
||||
|
||||
@ -197,20 +197,20 @@ public:
|
||||
int cchSize = 1;
|
||||
cch = ReadBytes( cchSize, true );
|
||||
|
||||
int xstzSize = FormatUtils::BytesToUChar( cch, 0, cchSize ) * 1;
|
||||
int xstzSize = DocFileFormat::FormatUtils::BytesToUChar( cch, 0, cchSize ) * 1;
|
||||
xstz = ReadBytes(xstzSize, true);
|
||||
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &wstrResult, xstz, xstzSize, ENCODING_WINDOWS_1250 );
|
||||
DocFileFormat::FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &wstrResult, xstz, xstzSize, ENCODING_WINDOWS_1250 );
|
||||
}
|
||||
else
|
||||
{
|
||||
int cchSize = 2;
|
||||
cch = ReadBytes( cchSize, true );
|
||||
|
||||
int xstzSize = FormatUtils::BytesToInt16( cch, 0, cchSize ) * 2;
|
||||
int xstzSize = DocFileFormat::FormatUtils::BytesToInt16( cch, 0, cchSize ) * 2;
|
||||
xstz = ReadBytes(xstzSize, true);
|
||||
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &wstrResult, xstz, xstzSize, ENCODING_UTF16 );
|
||||
DocFileFormat::FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &wstrResult, xstz, xstzSize, ENCODING_UTF16 );
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(xstz);
|
||||
@ -234,7 +234,7 @@ public:
|
||||
//dont read the terminating zero
|
||||
unsigned char* stringBytes = ReadBytes( ( cch * 2 ), true );
|
||||
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &result, stringBytes, ( ( cch * 2 ) - 2 ), ENCODING_UTF16 );
|
||||
DocFileFormat::FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &result, stringBytes, ( ( cch * 2 ) - 2 ), ENCODING_UTF16 );
|
||||
|
||||
RELEASEARRAYOBJECTS( stringBytes );
|
||||
}
|
||||
@ -278,7 +278,7 @@ public:
|
||||
//dont read the terminating zero
|
||||
stringBytes = ReadBytes( cch, true );
|
||||
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &result, stringBytes, ( cch - 1 ), ENCODING_WINDOWS_1250);
|
||||
DocFileFormat::FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &result, stringBytes, ( cch - 1 ), ENCODING_WINDOWS_1250);
|
||||
|
||||
}
|
||||
RELEASEARRAYOBJECTS( stringBytes );
|
||||
|
||||
@ -52,7 +52,8 @@ namespace DocFileFormat
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL)
|
||||
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
|
||||
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
|
||||
{
|
||||
m_pCallFunc = pCallFunc;
|
||||
m_sTempFolder = sTempFolder;
|
||||
@ -139,7 +140,7 @@ namespace DocFileFormat
|
||||
|
||||
if (encryptionHeader->bStandard)
|
||||
{
|
||||
CRYPT::RC4Decryptor Decryptor(encryptionHeader->crypt_data_rc4, m_sPassword, 1);
|
||||
CRYPT::RC4Decryptor Decryptor(encryptionHeader->crypt_data_rc4, m_sPassword);
|
||||
|
||||
if (Decryptor.IsVerify() == false)
|
||||
{
|
||||
@ -275,12 +276,17 @@ namespace DocFileFormat
|
||||
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, bOlderVersion);
|
||||
|
||||
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, bOlderVersion);
|
||||
|
||||
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, bOlderVersion);
|
||||
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, bOlderVersion);
|
||||
|
||||
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, bOlderVersion);
|
||||
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, bOlderVersion);
|
||||
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, bOlderVersion);
|
||||
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, bOlderVersion);
|
||||
|
||||
|
||||
for (size_t i = 0; i < BookmarkStartPlex->Elements.size(); ++i)
|
||||
{
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(BookmarkStartPlex->Elements[i]);
|
||||
@ -289,7 +295,14 @@ namespace DocFileFormat
|
||||
BookmarkStartEndCPs.push_back(std::make_pair(BookmarkStartPlex->CharacterPositions[i], BookmarkEndPlex->CharacterPositions[pBookmark->GetIndex()]));
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < AnnotStartPlex->Elements.size(); ++i)
|
||||
{
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
if (pBookmark)
|
||||
{
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[pBookmark->GetIndex()]));
|
||||
}
|
||||
}
|
||||
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
|
||||
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
|
||||
@ -470,6 +483,7 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
@ -484,9 +498,12 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DecryptStream(Decryptor, *it, storageIn, storageOut);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
|
||||
@ -508,9 +525,7 @@ namespace DocFileFormat
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool WordDocument::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
bool WordDocument::CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
@ -524,24 +539,59 @@ namespace DocFileFormat
|
||||
unsigned char* data_stream = new unsigned char[sz_stream];
|
||||
stream->read(data_stream, sz_stream);
|
||||
|
||||
streamNew->write(data_stream, sz_stream);
|
||||
|
||||
RELEASEARRAYOBJECTS(data_stream);
|
||||
|
||||
streamNew->flush();
|
||||
|
||||
delete streamNew;
|
||||
delete stream;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool WordDocument::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
if (!streamNew) return false;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[size_stream];
|
||||
stream->read(data_stream, size_stream);
|
||||
|
||||
unsigned char* data_store = NULL;
|
||||
int sz_data_store = 0;
|
||||
int size_data_store = 0;
|
||||
|
||||
if ("WordDocument" == streamName)
|
||||
{
|
||||
sz_data_store = 68;
|
||||
data_store = new unsigned char[sz_data_store];
|
||||
size_data_store = 68;
|
||||
data_store = new unsigned char[size_data_store];
|
||||
}
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_store, data_stream, sz_data_store);
|
||||
memcpy(data_store, data_stream, size_data_store);
|
||||
|
||||
int size_block = 0x200;
|
||||
for (int pos = 0, block = 0 ; pos < size_stream; pos += size_block, block++)
|
||||
{
|
||||
if (pos + size_block > size_stream)
|
||||
size_block = size_stream - pos;
|
||||
|
||||
Decryptor->Decrypt((char*)data_stream + pos, size_block, block);
|
||||
}
|
||||
|
||||
Decryptor->Decrypt((char*)data_stream, sz_stream, 0);
|
||||
|
||||
if (data_store)
|
||||
memcpy(data_stream, data_store, sz_data_store);
|
||||
memcpy(data_stream, data_store, size_data_store);
|
||||
|
||||
streamNew->write(data_stream, sz_stream);
|
||||
streamNew->write(data_stream, size_stream);
|
||||
|
||||
RELEASEARRAYOBJECTS(data_store);
|
||||
RELEASEARRAYOBJECTS(data_stream);
|
||||
@ -622,6 +672,8 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(SectionPlex);
|
||||
RELEASEOBJECT(BookmarkStartPlex);
|
||||
RELEASEOBJECT(BookmarkEndPlex);
|
||||
RELEASEOBJECT(AnnotStartPlex);
|
||||
RELEASEOBJECT(AnnotEndPlex);
|
||||
RELEASEOBJECT(AutoTextPlex);
|
||||
RELEASEOBJECT(ListPlex);
|
||||
RELEASEOBJECT(Styles);
|
||||
|
||||
@ -86,6 +86,7 @@ namespace DocFileFormat
|
||||
friend class Table;
|
||||
friend class TableRow;
|
||||
friend class VMLShapeMapping;
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
|
||||
@ -102,6 +103,7 @@ namespace DocFileFormat
|
||||
private:
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
bool DecryptStream (CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
|
||||
bool CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
|
||||
|
||||
inline StructuredStorageReader* GetStorage() const
|
||||
{
|
||||
@ -160,7 +162,9 @@ namespace DocFileFormat
|
||||
std::vector<int> * AllPapxVector;// A vector to quick find in AllPapx
|
||||
|
||||
std::map<int, int> PictureBulletsCPsMap;
|
||||
|
||||
std::vector<std::pair<int, int>> BookmarkStartEndCPs;
|
||||
std::vector<std::pair<int, int>> AnnotStartEndCPs;
|
||||
|
||||
FileInformationBlock * FIB;
|
||||
StyleSheet * Styles; // The style sheet of the document
|
||||
@ -202,7 +206,10 @@ namespace DocFileFormat
|
||||
Plex<SectionDescriptor> *SectionPlex; // A Plex containing all section descriptors
|
||||
|
||||
Plex<BookmarkFirst> *BookmarkStartPlex;
|
||||
Plex<EmptyStructure> *BookmarkEndPlex;
|
||||
Plex<EmptyStructure> *BookmarkEndPlex;
|
||||
|
||||
Plex<BookmarkFirst> *AnnotStartPlex;
|
||||
Plex<EmptyStructure> *AnnotEndPlex;
|
||||
|
||||
Plex<ListNumCache> *ListPlex;
|
||||
Plex<FieldCharacter> *FieldsPlex;
|
||||
|
||||
@ -405,6 +405,8 @@ public:
|
||||
std::wstring Fill;
|
||||
std::wstring Del;
|
||||
std::wstring Ins;
|
||||
std::wstring MoveFrom;
|
||||
std::wstring MoveTo;
|
||||
std::wstring rPrChange;
|
||||
|
||||
bool bBold;
|
||||
@ -492,13 +494,15 @@ public:
|
||||
Fill.clear();
|
||||
Del.clear();
|
||||
Ins.clear();
|
||||
MoveFrom.clear();
|
||||
MoveTo.clear();
|
||||
rPrChange.clear();
|
||||
}
|
||||
bool IsNoEmpty()
|
||||
{
|
||||
return bBold || bItalic || bUnderline || bStrikeout || bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontSize || bColor || bVertAlign || bHighLight || bShd ||
|
||||
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !rPrChange.empty();
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty();
|
||||
}
|
||||
void Write(XmlUtils::CStringWriter* pCStringWriter)
|
||||
{
|
||||
@ -749,6 +753,10 @@ public:
|
||||
pCStringWriter->WriteString(Del);
|
||||
if (!Ins.empty())
|
||||
pCStringWriter->WriteString(Ins);
|
||||
if (!MoveFrom.empty())
|
||||
pCStringWriter->WriteString(MoveFrom);
|
||||
if (!MoveTo.empty())
|
||||
pCStringWriter->WriteString(MoveTo);
|
||||
if (!rPrChange.empty())
|
||||
pCStringWriter->WriteString(rPrChange);
|
||||
pCStringWriter->WriteString(L"</w:rPr>");
|
||||
@ -1575,6 +1583,7 @@ public:
|
||||
std::wstring UserName;
|
||||
std::wstring UserId;
|
||||
std::wstring Date;
|
||||
std::wstring OOData;
|
||||
bool Solved;
|
||||
std::wstring Text;
|
||||
std::wstring m_sParaId;
|
||||
@ -1698,9 +1707,16 @@ public:
|
||||
{
|
||||
std::wstring sDate = XmlUtils::EncodeXmlString(pComment->Date);
|
||||
sRes += L" w:date=\"";
|
||||
sRes += sDate;
|
||||
sRes += sDate;
|
||||
sRes += L"\"";
|
||||
}
|
||||
if(false == pComment->OOData.empty())
|
||||
{
|
||||
std::wstring sData = XmlUtils::EncodeXmlString(pComment->OOData);
|
||||
sRes += L" oodata=\"";
|
||||
sRes += sData;
|
||||
sRes += L"\"";
|
||||
}
|
||||
if(false == sInitials.empty())
|
||||
{
|
||||
sInitials = XmlUtils::EncodeXmlString(sInitials);
|
||||
|
||||
@ -61,6 +61,26 @@ enum ETblStyleOverrideType
|
||||
tblstyleoverridetypeSwCell = 11,
|
||||
tblstyleoverridetypeWholeTable = 12
|
||||
};
|
||||
class SdtWraper
|
||||
{
|
||||
public:
|
||||
|
||||
OOX::Logic::CSdt m_oSdt;
|
||||
rPr* m_oEndPr;
|
||||
rPr* m_oRPr;
|
||||
int m_nType;
|
||||
SdtWraper(int nType)
|
||||
{
|
||||
m_nType = nType;
|
||||
m_oEndPr = NULL;
|
||||
m_oRPr = NULL;
|
||||
}
|
||||
~SdtWraper()
|
||||
{
|
||||
RELEASEOBJECT(m_oEndPr)
|
||||
RELEASEOBJECT(m_oRPr)
|
||||
}
|
||||
};
|
||||
|
||||
#define READ1_DEF(stLen, fReadFunction, arg, res) {\
|
||||
res = c_oSerConstants::ReadOk;\
|
||||
@ -550,6 +570,20 @@ public:
|
||||
orPr->Ins = oIns.ToString(_T("w:ins"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::MoveFrom:
|
||||
{
|
||||
TrackRevision oMoveFrom;
|
||||
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
|
||||
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::MoveTo:
|
||||
{
|
||||
TrackRevision oMoveTo;
|
||||
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
|
||||
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo"));
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::rPrChange:
|
||||
{
|
||||
TrackRevision oRPrChange;
|
||||
@ -3005,6 +3039,11 @@ public:
|
||||
std::wstring Date(m_oBufferedStream.GetString3(length));
|
||||
pComment->Date = Date;
|
||||
}
|
||||
else if ( c_oSer_CommentsType::OOData == type )
|
||||
{
|
||||
std::wstring Data(m_oBufferedStream.GetString3(length));
|
||||
pComment->OOData = Data;
|
||||
}
|
||||
else if ( c_oSer_CommentsType::Text == type )
|
||||
{
|
||||
std::wstring Text(m_oBufferedStream.GetString3(length));
|
||||
@ -3635,6 +3674,11 @@ public:
|
||||
//сбрасываем Shd
|
||||
oBinary_tblPrReader.m_sCurTableShd.clear();
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(0);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else if ( c_oSerParType::sectPr == type )
|
||||
{
|
||||
SectPr oSectPr;
|
||||
@ -3746,6 +3790,47 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveFrom == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:moveFrom"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveTo == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:moveTo"));
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeStart oMoveFromRangeStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveFromRangeStart, this, &oMoveFromRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveFromRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveFromRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveFromRangeEnd oMoveToRangeEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveFromRangeEnd, this, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeStart == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeStart oMoveToRangeStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveToRangeStart, this, &oMoveToRangeStart);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::MoveToRangeEnd == type )
|
||||
{
|
||||
OOX::Logic::CMoveToRangeEnd oMoveToRangeEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMoveToRangeEnd, this, &oMoveToRangeEnd);
|
||||
GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML());
|
||||
}
|
||||
else if(c_oSerParType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(1);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3767,23 +3852,368 @@ public:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveFromRangeStart(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(poResult);
|
||||
if (c_oSerMoveRange::Author == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sAuthor.Init();
|
||||
pMoveFromRangeStart->m_sAuthor->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::ColFirst == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oColFirst.Init();
|
||||
pMoveFromRangeStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::ColLast == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oColLast.Init();
|
||||
pMoveFromRangeStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Date == type)
|
||||
{
|
||||
std::wstring strValue = m_oBufferedStream.GetString3(length);
|
||||
|
||||
pMoveFromRangeStart->m_oDate.Init();
|
||||
pMoveFromRangeStart->m_oDate->SetValue(strValue);
|
||||
}
|
||||
else if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oDisplacedByCustomXml.Init();
|
||||
pMoveFromRangeStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_oId.Init();
|
||||
pMoveFromRangeStart->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Name == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sName.Init();
|
||||
pMoveFromRangeStart->m_sName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::UserId == type)
|
||||
{
|
||||
pMoveFromRangeStart->m_sUserId.Init();
|
||||
pMoveFromRangeStart->m_sUserId->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveToRangeStart(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(poResult);
|
||||
if (c_oSerMoveRange::Author == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sAuthor.Init();
|
||||
pMoveToRangeStart->m_sAuthor->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::ColFirst == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oColFirst.Init();
|
||||
pMoveToRangeStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::ColLast == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oColLast.Init();
|
||||
pMoveToRangeStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Date == type)
|
||||
{
|
||||
std::wstring strValue = m_oBufferedStream.GetString3(length);
|
||||
|
||||
pMoveToRangeStart->m_oDate.Init();
|
||||
pMoveToRangeStart->m_oDate->SetValue(strValue);
|
||||
}
|
||||
else if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oDisplacedByCustomXml.Init();
|
||||
pMoveToRangeStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveToRangeStart->m_oId.Init();
|
||||
pMoveToRangeStart->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if (c_oSerMoveRange::Name == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sName.Init();
|
||||
pMoveToRangeStart->m_sName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerMoveRange::UserId == type)
|
||||
{
|
||||
pMoveToRangeStart->m_sUserId.Init();
|
||||
pMoveToRangeStart->m_sUserId->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveFromRangeEnd(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(poResult);
|
||||
if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveFromRangeEnd->m_oDisplacedByCustomXml.Init();
|
||||
pMoveFromRangeEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveFromRangeEnd->m_oId.Init();
|
||||
pMoveFromRangeEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadMoveToRangeEnd(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(poResult);
|
||||
if (c_oSerMoveRange::DisplacedByCustomXml == type)
|
||||
{
|
||||
pMoveToRangeEnd->m_oDisplacedByCustomXml.Init();
|
||||
pMoveToRangeEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerMoveRange::Id == type)
|
||||
{
|
||||
pMoveToRangeEnd->m_oId.Init();
|
||||
pMoveToRangeEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFldSimple(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
CFldSimple* pFldSimple = static_cast<CFldSimple*>(poResult);
|
||||
if ( c_oSer_HyperlinkType::Link == type )
|
||||
if ( c_oSer_FldSimpleType::Instr == type )
|
||||
pFldSimple->sInstr = m_oBufferedStream.GetString3(length);
|
||||
else if ( c_oSer_HyperlinkType::Content == type )
|
||||
else if ( c_oSer_FldSimpleType::Content == type )
|
||||
{
|
||||
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
|
||||
m_pCurWriter = &pFldSimple->writer;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
|
||||
m_pCurWriter = pPrevWriter;
|
||||
}
|
||||
else if ( c_oSer_FldSimpleType::FFData == type )
|
||||
{
|
||||
OOX::Logic::CFFData oFFData;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFData, this, &oFFData);
|
||||
pFldSimple->writer.WriteString(oFFData.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFData(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFData* pFFData = static_cast<OOX::Logic::CFFData*>(poResult);
|
||||
if ( c_oSerFFData::CalcOnExit == type )
|
||||
{
|
||||
pFFData->m_oCalcOnExit.Init();
|
||||
pFFData->m_oCalcOnExit->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CheckBox == type )
|
||||
{
|
||||
pFFData->m_oCheckBox.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFCheckBox, this, pFFData->m_oCheckBox.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::DDList == type )
|
||||
{
|
||||
pFFData->m_oDDList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDDList, this, pFFData->m_oDDList.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Enabled == type )
|
||||
{
|
||||
pFFData->m_oEnabled.Init();
|
||||
pFFData->m_oEnabled->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::EntryMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oEntryMacro.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::ExitMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oExitMacro.Init();
|
||||
pFFData->m_oExitMacro->m_oVal.Init();
|
||||
pFFData->m_oExitMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::HelpText == type )
|
||||
{
|
||||
pFFData->m_oHelpText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFHelpText, this, pFFData->m_oHelpText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Label == type )
|
||||
{
|
||||
pFFData->m_oLabel.Init();
|
||||
pFFData->m_oLabel->m_oVal.Init();
|
||||
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::Name == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oName.Init();
|
||||
pFFData->m_oName->m_oVal.Init();
|
||||
pFFData->m_oName->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::StatusText == type )
|
||||
{
|
||||
pFFData->m_oStatusText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFStatusText, this, pFFData->m_oStatusText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::TabIndex == type )
|
||||
{
|
||||
pFFData->m_oTabIndex.Init();
|
||||
pFFData->m_oTabIndex->m_oVal.Init();
|
||||
pFFData->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TextInput == type )
|
||||
{
|
||||
pFFData->m_oTextInput.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadTextInput, this, pFFData->m_oTextInput.GetPointer());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFCheckBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFCheckBox* pFFCheckBox = static_cast<OOX::Logic::CFFCheckBox*>(poResult);
|
||||
if ( c_oSerFFData::CBChecked == type )
|
||||
{
|
||||
pFFCheckBox->m_oChecked.Init();
|
||||
pFFCheckBox->m_oChecked->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBDefault == type )
|
||||
{
|
||||
pFFCheckBox->m_oDefault.Init();
|
||||
pFFCheckBox->m_oDefault->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSize == type )
|
||||
{
|
||||
pFFCheckBox->m_oSize.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal->FromHps(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSizeAuto == type )
|
||||
{
|
||||
pFFCheckBox->m_oSizeAuto.Init();
|
||||
pFFCheckBox->m_oSizeAuto->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDDList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFDDList* pDDList = static_cast<OOX::Logic::CFFDDList*>(poResult);
|
||||
if ( c_oSerFFData::DLDefault == type )
|
||||
{
|
||||
pDDList->m_oDefault.Init();
|
||||
pDDList->m_oDefault->m_oVal.Init();
|
||||
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLResult == type )
|
||||
{
|
||||
pDDList->m_oResult.Init();
|
||||
pDDList->m_oResult->m_oVal.Init();
|
||||
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLListEntry == type )
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
|
||||
pVal->m_sVal.Init();
|
||||
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
pDDList->m_arrListEntry.push_back(pVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFHelpText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFHelpText* pHelpText = static_cast<ComplexTypes::Word::CFFHelpText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pHelpText->m_oType.Init();
|
||||
pHelpText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pHelpText->m_oVal.Init();
|
||||
pHelpText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFStatusText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFStatusText* pStatusText = static_cast<ComplexTypes::Word::CFFStatusText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pStatusText->m_oType.Init();
|
||||
pStatusText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pStatusText->m_oVal.Init();
|
||||
pStatusText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadTextInput(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFTextInput* pTextInput = static_cast<OOX::Logic::CFFTextInput*>(poResult);
|
||||
if ( c_oSerFFData::TIDefault == type )
|
||||
{
|
||||
pTextInput->m_oDefault.Init();
|
||||
pTextInput->m_oDefault->m_sVal.Init();
|
||||
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIFormat == type )
|
||||
{
|
||||
pTextInput->m_oFormat.Init();
|
||||
pTextInput->m_oFormat->m_sVal.Init();
|
||||
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIMaxLength == type )
|
||||
{
|
||||
pTextInput->m_oMaxLength.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TIType == type )
|
||||
{
|
||||
pTextInput->m_oType.Init();
|
||||
pTextInput->m_oType->m_oVal.Init();
|
||||
pTextInput->m_oType->m_oVal->SetValue((SimpleTypes::EFFTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
|
||||
int ReadHyperlink(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
@ -6412,6 +6842,11 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::Read_Row, this, poResult);
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:tr>")));
|
||||
}
|
||||
else if(c_oSerDocTableType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(2);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6444,6 +6879,11 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadCell, this, poResult);
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:tc>")));
|
||||
}
|
||||
else if(c_oSerDocTableType::Sdt == type)
|
||||
{
|
||||
SdtWraper oSdt(3);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -7147,6 +7587,309 @@ public:
|
||||
{
|
||||
return oBinary_pPrReader.Read_SecPr(type, length, poResult);
|
||||
}
|
||||
int ReadSdt(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
SdtWraper* pSdt = static_cast<SdtWraper*>(poResult);
|
||||
if (c_oSerSdt::Pr == type)
|
||||
{
|
||||
pSdt->m_oSdt.m_oSdtPr.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPr, this, pSdt);
|
||||
}
|
||||
else if (c_oSerSdt::EndPr == type)
|
||||
{
|
||||
pSdt->m_oEndPr = new rPr(m_oFontTableWriter.m_mapFonts);
|
||||
res = oBinary_rPrReader.Read(length, pSdt->m_oEndPr);
|
||||
}
|
||||
else if (c_oSerSdt::Content == type)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdt>");
|
||||
if ( pSdt->m_oSdt.m_oSdtPr.IsInit() )
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLStart());
|
||||
if (NULL != pSdt->m_oRPr)
|
||||
{
|
||||
pSdt->m_oRPr->Write(&m_oDocumentWriter.m_oContent);
|
||||
}
|
||||
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLEnd());
|
||||
}
|
||||
if (NULL != pSdt->m_oEndPr)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtEndPr>");
|
||||
pSdt->m_oEndPr->Write(&m_oDocumentWriter.m_oContent);
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtEndPr>");
|
||||
}
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtContent>");
|
||||
switch(pSdt->m_nType)
|
||||
{
|
||||
case 0:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocumentContent, this, this);
|
||||
break;
|
||||
case 1:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, this);
|
||||
break;
|
||||
case 2:
|
||||
res = Read1(length, &Binary_DocumentTableReader::Read_TableContent, this, &m_oDocumentWriter.m_oContent);
|
||||
break;
|
||||
case 3:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadRowContent, this, &m_oDocumentWriter.m_oContent);
|
||||
break;
|
||||
}
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtContent>");
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdt>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPr(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
SdtWraper* pSdtWraper = static_cast<SdtWraper*>(poResult);
|
||||
OOX::Logic::CSdtPr* pSdtPr = pSdtWraper->m_oSdt.m_oSdtPr.GetPointer();
|
||||
if (c_oSerSdt::Type == type)
|
||||
{
|
||||
pSdtPr->m_eType = (OOX::Logic::ESdtType)m_oBufferedStream.GetUChar();
|
||||
}
|
||||
else if (c_oSerSdt::Alias == type)
|
||||
{
|
||||
pSdtPr->m_oAlias.Init();
|
||||
pSdtPr->m_oAlias->m_sVal.Init();
|
||||
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::ComboBox == type)
|
||||
{
|
||||
pSdtPr->m_oComboBox.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtComboBox, this, pSdtPr->m_oComboBox.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DataBinding == type)
|
||||
{
|
||||
pSdtPr->m_oDataBinding.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDataBinding, this, pSdtPr->m_oDataBinding.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::PrDate == type)
|
||||
{
|
||||
pSdtPr->m_oDate.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDate, this, pSdtPr->m_oDate.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DocPartList == type)
|
||||
{
|
||||
pSdtPr->m_oDocPartList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartList.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DocPartObj == type)
|
||||
{
|
||||
pSdtPr->m_oDocPartObj.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartObj.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::DropDownList == type)
|
||||
{
|
||||
pSdtPr->m_oDropDownList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDropDownList, this, pSdtPr->m_oDropDownList.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::Id == type)
|
||||
{
|
||||
pSdtPr->m_oId.Init();
|
||||
pSdtPr->m_oId->m_oVal.Init();
|
||||
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Label == type)
|
||||
{
|
||||
pSdtPr->m_oLabel.Init();
|
||||
pSdtPr->m_oLabel->m_oVal.Init();
|
||||
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Lock == type)
|
||||
{
|
||||
pSdtPr->m_oLock.Init();
|
||||
pSdtPr->m_oLock->m_oVal.SetValue((SimpleTypes::ELock)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerSdt::PlaceHolder == type)
|
||||
{
|
||||
pSdtPr->m_oPlaceHolder.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::RPr == type)
|
||||
{
|
||||
pSdtWraper->m_oRPr = new rPr(m_oFontTableWriter.m_mapFonts);
|
||||
res = oBinary_rPrReader.Read(length, pSdtWraper->m_oRPr);
|
||||
}
|
||||
else if (c_oSerSdt::ShowingPlcHdr == type)
|
||||
{
|
||||
pSdtPr->m_oShowingPlcHdr.Init();
|
||||
pSdtPr->m_oShowingPlcHdr->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::TabIndex == type)
|
||||
{
|
||||
pSdtPr->m_oTabIndex.Init();
|
||||
pSdtPr->m_oTabIndex->m_oVal.Init();
|
||||
pSdtPr->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Tag == type)
|
||||
{
|
||||
pSdtPr->m_oTag.Init();
|
||||
pSdtPr->m_oTag->m_sVal.Init();
|
||||
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Temporary == type)
|
||||
{
|
||||
pSdtPr->m_oTemporary.Init();
|
||||
pSdtPr->m_oTemporary->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if (c_oSerSdt::MultiLine == type)
|
||||
{
|
||||
pSdtPr->m_oText.Init();
|
||||
pSdtPr->m_oText->m_oMultiLine.Init();
|
||||
pSdtPr->m_oText->m_oMultiLine->FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtComboBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtComboBox* pSdtComboBox = static_cast<OOX::Logic::CSdtComboBox*>(poResult);
|
||||
if (c_oSerSdt::LastValue == type)
|
||||
{
|
||||
pSdtComboBox->m_sLastValue.Init();
|
||||
pSdtComboBox->m_sLastValue->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::SdtListItem == type)
|
||||
{
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
|
||||
pSdtComboBox->m_arrListItem.push_back(pSdtListItem); }
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtListItem(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
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));
|
||||
}
|
||||
else if (c_oSerSdt::Value == type)
|
||||
{
|
||||
pSdtListItem->m_sValue.Init();
|
||||
pSdtListItem->m_sValue->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPrDataBinding(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
ComplexTypes::Word::CDataBinding* pDataBinding = static_cast<ComplexTypes::Word::CDataBinding*>(poResult);
|
||||
if (c_oSerSdt::PrefixMappings == type)
|
||||
{
|
||||
pDataBinding->m_sPrefixMappings.Init();
|
||||
pDataBinding->m_sPrefixMappings->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::StoreItemID == type)
|
||||
{
|
||||
pDataBinding->m_sStoreItemID.Init();
|
||||
pDataBinding->m_sStoreItemID->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::XPath == type)
|
||||
{
|
||||
pDataBinding->m_sXPath.Init();
|
||||
pDataBinding->m_sXPath->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadSdtPrDate(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CDate* pDate = static_cast<OOX::Logic::CDate*>(poResult);
|
||||
if (c_oSerSdt::FullDate == type)
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
|
||||
pDate->m_oFullDate.Init();
|
||||
pDate->m_oFullDate->SetValue(sVal);
|
||||
}
|
||||
else if (c_oSerSdt::Calendar == type)
|
||||
{
|
||||
pDate->m_oCalendar.Init();
|
||||
pDate->m_oCalendar->m_oVal.SetValue((SimpleTypes::ECalendarType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerSdt::DateFormat == type)
|
||||
{
|
||||
pDate->m_oDateFormat.Init();
|
||||
pDate->m_oDateFormat->m_sVal.Init();
|
||||
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Lid == type)
|
||||
{
|
||||
pDate->m_oLid.Init();
|
||||
pDate->m_oLid->m_oVal.Init();
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pDate->m_oLid->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if (c_oSerSdt::StoreMappedDataAs == type)
|
||||
{
|
||||
pDate->m_oStoreMappedDateAs.Init();
|
||||
pDate->m_oStoreMappedDateAs->m_oVal.SetValue((SimpleTypes::ESdtDateMappingType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDocPartList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
OOX::Logic::CSdtDocPart* pDocPart = static_cast<OOX::Logic::CSdtDocPart*>(poResult);
|
||||
if (c_oSerSdt::DocPartCategory == type)
|
||||
{
|
||||
pDocPart->m_oDocPartCategory.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartGallery == type)
|
||||
{
|
||||
pDocPart->m_oDocPartGallery.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartUnique == type)
|
||||
{
|
||||
pDocPart->m_oDocPartUnique.Init();
|
||||
pDocPart->m_oDocPartUnique->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDropDownList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = 0;
|
||||
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));
|
||||
}
|
||||
else if (c_oSerSdt::SdtListItem == type)
|
||||
{
|
||||
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
|
||||
pDropDownList->m_arrListItem.push_back(pSdtListItem);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
class Binary_NotesTableReader : public Binary_CommonReader<Binary_NotesTableReader>
|
||||
{
|
||||
|
||||
@ -125,6 +125,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
|
||||
|
||||
const static wchar_t* g_sFormatSignature = L"DOCY";
|
||||
const int g_nFormatVersion = 5;
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
extern int g_nCurFormatVersion;
|
||||
namespace c_oAscWrapStyle{enum c_oSerFormat
|
||||
{
|
||||
@ -381,7 +382,9 @@ extern int g_nCurFormatVersion;
|
||||
TextFill = 32,
|
||||
Del = 33,
|
||||
Ins = 34,
|
||||
rPrChange = 35
|
||||
rPrChange = 35,
|
||||
MoveFrom = 36,
|
||||
MoveTo = 37
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
@ -463,7 +466,14 @@ extern int g_nCurFormatVersion;
|
||||
FldSimple = 11,
|
||||
Del = 12,
|
||||
Ins = 13,
|
||||
Background = 14
|
||||
Background = 14,
|
||||
Sdt = 15,
|
||||
MoveFrom = 16,
|
||||
MoveTo = 17,
|
||||
MoveFromRangeStart = 18,
|
||||
MoveFromRangeEnd = 19,
|
||||
MoveToRangeStart = 20,
|
||||
MoveToRangeEnd = 21
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -477,7 +487,8 @@ extern int g_nCurFormatVersion;
|
||||
Cell = 6,
|
||||
Cell_Pr = 7,
|
||||
Cell_Content = 8,
|
||||
tblGridChange = 9
|
||||
tblGridChange = 9,
|
||||
Sdt = 10
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -705,7 +716,8 @@ extern int g_nCurFormatVersion;
|
||||
Text = 6,
|
||||
QuoteText = 7,
|
||||
Solved = 8,
|
||||
Replies = 9
|
||||
Replies = 9,
|
||||
OOData = 10
|
||||
};}
|
||||
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -910,7 +922,8 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSer_FldSimpleType{ enum c_oSer_FldSimpleType
|
||||
{
|
||||
Content = 0,
|
||||
Instr = 1
|
||||
Instr = 1,
|
||||
FFData = 2
|
||||
};}
|
||||
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
|
||||
{
|
||||
@ -1003,6 +1016,84 @@ extern int g_nCurFormatVersion;
|
||||
Data = 1,
|
||||
Program = 2
|
||||
};}
|
||||
namespace c_oSerSdt{enum c_oSerSdt
|
||||
{
|
||||
Pr = 0,
|
||||
EndPr = 1,
|
||||
Content = 2,
|
||||
Type = 3,
|
||||
Alias = 4,
|
||||
ComboBox = 5,
|
||||
LastValue = 6,
|
||||
SdtListItem = 7,
|
||||
DisplayText = 8,
|
||||
Value = 9,
|
||||
DataBinding = 10,
|
||||
PrefixMappings = 11,
|
||||
StoreItemID = 12,
|
||||
XPath = 13,
|
||||
PrDate = 14,
|
||||
FullDate = 15,
|
||||
Calendar = 16,
|
||||
DateFormat = 17,
|
||||
Lid = 18,
|
||||
StoreMappedDataAs = 19,
|
||||
DocPartList = 20,
|
||||
DocPartObj = 21,
|
||||
DocPartCategory = 22,
|
||||
DocPartGallery = 23,
|
||||
DocPartUnique = 24,
|
||||
DropDownList = 25,
|
||||
Id = 26,
|
||||
Label = 27,
|
||||
Lock = 28,
|
||||
PlaceHolder = 29,
|
||||
RPr = 30,
|
||||
ShowingPlcHdr = 31,
|
||||
TabIndex = 32,
|
||||
Tag = 33,
|
||||
Temporary = 34,
|
||||
MultiLine = 35
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
CalcOnExit = 0,
|
||||
CheckBox = 1,
|
||||
DDList = 2,
|
||||
Enabled = 3,
|
||||
EntryMacro = 4,
|
||||
ExitMacro = 5,
|
||||
HelpText = 6,
|
||||
Label = 7,
|
||||
Name = 8,
|
||||
StatusText = 9,
|
||||
TabIndex = 10,
|
||||
TextInput = 11,
|
||||
CBChecked = 12,
|
||||
CBDefault = 13,
|
||||
CBSize = 14,
|
||||
CBSizeAuto = 15,
|
||||
DLDefault = 16,
|
||||
DLResult = 17,
|
||||
DLListEntry = 18,
|
||||
HTType = 19,
|
||||
HTVal = 20,
|
||||
TIDefault = 21,
|
||||
TIFormat = 22,
|
||||
TIMaxLength = 23,
|
||||
TIType = 24,
|
||||
};}
|
||||
namespace c_oSerMoveRange{enum c_oSerMoveRange
|
||||
{
|
||||
Author = 0,
|
||||
ColFirst = 1,
|
||||
ColLast = 2,
|
||||
Date = 3,
|
||||
DisplacedByCustomXml = 4,
|
||||
Id = 5,
|
||||
Name = 6,
|
||||
UserId = 7
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -831,6 +831,22 @@ namespace BinDocxRW
|
||||
Write_rPrChange(rPr.m_oRPrChange.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(rPr.m_oMoveFrom.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::MoveFrom);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
m_oBcw.WriteTrackRevision(rPr.m_oMoveFrom.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(rPr.m_oMoveTo.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::MoveTo);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
m_oBcw.WriteTrackRevision(rPr.m_oMoveTo.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void Write_rPrChange(const OOX::Logic::CRPrChange& rPrChange)
|
||||
{
|
||||
@ -3047,8 +3063,9 @@ namespace BinDocxRW
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
|
||||
WriteSdt(pStd, 0, NULL, 0, 0, 0);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}break;
|
||||
case OOX::et_w_smartTag:
|
||||
{
|
||||
@ -3189,8 +3206,9 @@ namespace BinDocxRW
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
|
||||
WriteSdt(pStd, 1, NULL, 0, 0, 0);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_smartTag:
|
||||
@ -3227,6 +3245,22 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveFrom:
|
||||
{
|
||||
OOX::Logic::CMoveFrom* pMoveFrom = static_cast<OOX::Logic::CMoveFrom*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFrom);
|
||||
WriteMoveFrom(*pMoveFrom);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_moveTo:
|
||||
{
|
||||
OOX::Logic::CMoveTo* pMoveTo = static_cast<OOX::Logic::CMoveTo*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveTo);
|
||||
WriteMoveTo(*pMoveTo);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_commentRangeStart:
|
||||
{
|
||||
OOX::Logic::CCommentRangeStart* pCommentRangeStart = static_cast<OOX::Logic::CCommentRangeStart*>(item);
|
||||
@ -3239,6 +3273,39 @@ namespace BinDocxRW
|
||||
WriteComment(OOX::et_w_commentRangeEnd, pCommentRangeEnd->m_oId);
|
||||
break;
|
||||
}
|
||||
//todo moveRange on all levels(body, p ...)
|
||||
// case OOX::et_w_moveFromRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeStart* pMoveFromRangeStart = static_cast<OOX::Logic::CMoveFromRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveFromRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveFromRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveFromRangeEnd* pMoveFromRangeEnd = static_cast<OOX::Logic::CMoveFromRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveFromRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveFromRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeStart:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeStart* pMoveToRangeStart = static_cast<OOX::Logic::CMoveToRangeStart*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeStart);
|
||||
// WriteMoveRangeStart(*pMoveToRangeStart);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
// case OOX::et_w_moveToRangeEnd:
|
||||
// {
|
||||
// OOX::Logic::CMoveToRangeEnd* pMoveToRangeEnd = static_cast<OOX::Logic::CMoveToRangeEnd*>(item);
|
||||
// nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MoveToRangeEnd);
|
||||
// WriteMoveRangeEnd(*pMoveToRangeEnd);
|
||||
// m_oBcw.WriteItemEnd(nCurPos);
|
||||
// break;
|
||||
// }
|
||||
case OOX::et_m_oMathPara:
|
||||
{
|
||||
OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item);
|
||||
@ -3278,6 +3345,92 @@ namespace BinDocxRW
|
||||
WriteParagraphContent(oIns.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteMoveFrom(const OOX::Logic::CMoveFrom& oMoveFrom)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
m_oBcw.WriteTrackRevision(oMoveFrom);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::Content);
|
||||
WriteParagraphContent(oMoveFrom.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteMoveTo(const OOX::Logic::CMoveTo& oMoveTo)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
m_oBcw.WriteTrackRevision(oMoveTo);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_RevisionType::Content);
|
||||
WriteParagraphContent(oMoveTo.m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
template<typename T> void WriteMoveRangeStart(const T& elem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (elem.m_sAuthor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Author);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sAuthor.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oColFirst.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::ColFirst);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oColFirst->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oColLast.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::ColLast);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oColLast->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Date);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_oDate->ToString());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oDisplacedByCustomXml.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::DisplacedByCustomXml);
|
||||
m_oBcw.m_oStream.WriteBYTE(elem.m_oDisplacedByCustomXml->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Id);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_sName.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Name);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sName.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_sUserId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::UserId);
|
||||
m_oBcw.m_oStream.WriteStringW3(elem.m_sUserId.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
template<typename T> void WriteMoveRangeEnd(const T& elem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (elem.m_oDisplacedByCustomXml.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::DisplacedByCustomXml);
|
||||
m_oBcw.m_oStream.WriteBYTE(elem.m_oDisplacedByCustomXml->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (elem.m_oId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerMoveRange::Id);
|
||||
m_oBcw.m_oStream.WriteLONG(elem.m_oId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteComment(OOX::EElementType eType, nullable<SimpleTypes::CDecimalNumber<>>& oId)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
@ -3319,11 +3472,208 @@ namespace BinDocxRW
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Instr);
|
||||
m_oBcw.m_oStream.WriteStringW3(*pFldSimple->m_sInstr);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
//FFData
|
||||
if(pFldSimple->m_oFFData.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::FFData);
|
||||
WriteFFData(pFldSimple->m_oFFData.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Content
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Content);
|
||||
WriteParagraphContent(pFldSimple->m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteFFData(const OOX::Logic::CFFData& oFFData)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oFFData.m_oCalcOnExit.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CalcOnExit);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oCalcOnExit->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oCheckBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CheckBox);
|
||||
WriteFFCheckBox(oFFData.m_oCheckBox.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oDDList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DDList);
|
||||
WriteDDList(oFFData.m_oDDList.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEnabled.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Enabled);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oEnabled->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEntryMacro.IsInit() && oFFData.m_oEntryMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::EntryMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oEntryMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oExitMacro.IsInit() && oFFData.m_oExitMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::ExitMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oExitMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oHelpText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HelpText);
|
||||
WriteFFHelpText(oFFData.m_oHelpText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oLabel.IsInit() && oFFData.m_oLabel->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Label);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oLabel->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oName.IsInit() && oFFData.m_oName->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Name);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oName->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oStatusText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::StatusText);
|
||||
WriteFFStatusText(oFFData.m_oStatusText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTabIndex.IsInit() && oFFData.m_oTabIndex->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TabIndex);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oTabIndex->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTextInput.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TextInput);
|
||||
WriteTextInput(oFFData.m_oTextInput.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFCheckBox(const OOX::Logic::CFFCheckBox& oCheckBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oCheckBox.m_oChecked.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBChecked);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oChecked->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oDefault.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBDefault);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oDefault->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSize.IsInit() && oCheckBox.m_oSize->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSize);
|
||||
m_oBcw.m_oStream.WriteULONG(oCheckBox.m_oSize->m_oVal->ToHps());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSizeAuto.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSizeAuto);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oSizeAuto->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDDList(const OOX::Logic::CFFDDList& oDDList)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDDList.m_oDefault.IsInit() && oDDList.m_oDefault->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLDefault);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oDefault->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oDDList.m_oResult.IsInit() && oDDList.m_oResult->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLResult);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
|
||||
if(pVal->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLListEntry);
|
||||
m_oBcw.m_oStream.WriteStringW3(pVal->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteFFHelpText(const ComplexTypes::Word::CFFHelpText& oHelpText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oHelpText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oHelpText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oHelpText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oHelpText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFStatusText(const ComplexTypes::Word::CFFStatusText& oStatusText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oStatusText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStatusText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oStatusText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStatusText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteTextInput(const OOX::Logic::CFFTextInput& oTextInput)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oTextInput.m_oDefault.IsInit() && oTextInput.m_oDefault->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIDefault);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oDefault->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oFormat.IsInit() && oTextInput.m_oFormat->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIFormat);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oFormat->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oMaxLength.IsInit() && oTextInput.m_oMaxLength->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIMaxLength);
|
||||
m_oBcw.m_oStream.WriteLONG(oTextInput.m_oMaxLength->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oType.IsInit() && oTextInput.m_oType->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oTextInput.m_oType->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteHyperlink(OOX::Logic::CHyperlink* pHyperlink)
|
||||
{
|
||||
@ -5388,6 +5738,8 @@ namespace BinDocxRW
|
||||
OOX::Logic::CDrawing* pGraphicDrawing = NULL;
|
||||
PPTX::Logic::GraphicFrame* pGraphic = NULL;
|
||||
|
||||
m_oBcw.m_oStream.ClearCurShapePositionAndSizes();
|
||||
|
||||
if(OOX::et_mc_alternateContent == pElementType)
|
||||
{
|
||||
OOX::WritingElement* we = NULL;
|
||||
@ -6366,8 +6718,9 @@ namespace BinDocxRW
|
||||
else if(OOX::et_w_sdt == item->getType())
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
|
||||
WriteSdt(pStd, 2, pTblPr, 0, nRows, nCols);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_smartTag == item->getType())
|
||||
{
|
||||
@ -6425,8 +6778,9 @@ namespace BinDocxRW
|
||||
else if(OOX::et_w_sdt == item->getType())
|
||||
{
|
||||
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
|
||||
WriteSdt(pStd, 3, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else if(OOX::et_w_smartTag == item->getType())
|
||||
{
|
||||
@ -6462,6 +6816,287 @@ namespace BinDocxRW
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
void WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(pStd->m_oSdtPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Pr);
|
||||
WriteSdtPr(pStd->m_oSdtPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pStd->m_oSdtEndPr.IsInit() && pStd->m_oSdtEndPr->m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::EndPr);
|
||||
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(pStd->m_oSdtContent.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Content);
|
||||
switch(type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, m_oParamsDocumentWriter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Type);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_eType);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
if(oStdPr.m_oAlias.IsInit() && oStdPr.m_oAlias->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Alias);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oComboBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
|
||||
WriteSdtComboBox(oStdPr.m_oComboBox.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDataBinding.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);
|
||||
WriteSdtPrDataBinding(oStdPr.m_oDataBinding.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrDate);
|
||||
WriteSdtPrDate(oStdPr.m_oDate.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDocPartList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartList);
|
||||
WriteDocPartList(oStdPr.m_oDocPartList.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDocPartObj.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartObj);
|
||||
WriteDocPartList(oStdPr.m_oDocPartObj.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDropDownList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DropDownList);
|
||||
WriteDropDownList(oStdPr.m_oDropDownList.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oId.IsInit() && oStdPr.m_oId->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Id);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oId->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oLabel.IsInit() && oStdPr.m_oLabel->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Label);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oLabel->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oLock.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lock);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oLock->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oPlaceHolder.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PlaceHolder);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oRPr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::RPr);
|
||||
brPrs.Write_rPr(oStdPr.m_oRPr.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oShowingPlcHdr.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ShowingPlcHdr);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oShowingPlcHdr->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTabIndex.IsInit() && oStdPr.m_oTabIndex->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TabIndex);
|
||||
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oTabIndex->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTag.IsInit() && oStdPr.m_oTag->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Tag);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oTag->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oTemporary.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Temporary);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oTemporary->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oText.IsInit() && oStdPr.m_oText->m_oMultiLine.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::MultiLine);
|
||||
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oText->m_oMultiLine->ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtComboBox.m_sLastValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtComboBox.m_sLastValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
for(size_t i = 0; i < oSdtComboBox.m_arrListItem.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
|
||||
WriteSdtListItem(*oSdtComboBox.m_arrListItem[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtListItem(const ComplexTypes::Word::CSdtListItem& oSdtListItem)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtListItem.m_sDisplayText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DisplayText);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sDisplayText.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtListItem.m_sValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Value);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPrDataBinding(const ComplexTypes::Word::CDataBinding& oDataBinding)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDataBinding.m_sPrefixMappings.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrefixMappings);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sPrefixMappings.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDataBinding.m_sStoreItemID.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreItemID);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sStoreItemID.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDataBinding.m_sXPath.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::XPath);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sXPath.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteSdtPrDate(const OOX::Logic::CDate& oDate)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDate.m_oFullDate.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::FullDate);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oFullDate->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oCalendar.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Calendar);
|
||||
m_oBcw.m_oStream.WriteBYTE(oDate.m_oCalendar->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oDateFormat.IsInit() && oDate.m_oDateFormat->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DateFormat);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oDateFormat->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oLid.IsInit() && oDate.m_oLid->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lid);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDate.m_oLid->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oDate.m_oStoreMappedDateAs.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreMappedDataAs);
|
||||
m_oBcw.m_oStream.WriteBYTE(oDate.m_oStoreMappedDateAs->m_oVal.GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSdtDocPart.m_oDocPartCategory.IsInit() && oSdtDocPart.m_oDocPartCategory->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartCategory);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartCategory->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtDocPart.m_oDocPartGallery.IsInit() && oSdtDocPart.m_oDocPartGallery->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartGallery);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartGallery->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSdtDocPart.m_oDocPartUnique.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartUnique);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSdtDocPart.m_oDocPartUnique->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDropDownList.m_sLastValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(oDropDownList.m_sLastValue.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
for(size_t i = 0; i < oDropDownList.m_arrListItem.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
|
||||
WriteSdtListItem(*oDropDownList.m_arrListItem[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
};
|
||||
class BinaryCommentsTableWriter
|
||||
{
|
||||
@ -6587,6 +7222,11 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_CommentsType::Date);
|
||||
m_oBcw.m_oStream.WriteStringW(pComment->m_oDate->ToString());
|
||||
}
|
||||
if(pComment->m_oOOData.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_CommentsType::OOData);
|
||||
m_oBcw.m_oStream.WriteStringW(pComment->m_oOOData.get2());
|
||||
}
|
||||
if(pComment->m_oId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Id);
|
||||
@ -6909,80 +7549,96 @@ namespace BinDocxRW
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteColorSchemeMapping(const OOX::Settings::CColorSchemeMapping& oColorSchemeMapping)
|
||||
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping)
|
||||
{
|
||||
int re_index[] = {0, 1, 2, 3, 4, 5, 10, 11, 6, 7, 8, 9, 10, 11, 10, 6, 7};
|
||||
|
||||
int nCurPos = 0;
|
||||
if(oColorSchemeMapping.m_oAccent1.IsInit())
|
||||
std::map<std::wstring, PPTX::Limit::ColorSchemeIndex>::const_iterator pFind;
|
||||
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent3.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent3");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent3);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent3->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent4.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent4");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent4);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent4->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent5.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent5");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent5);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent5->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oAccent6.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"accent6");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent6);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent6->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oBg1.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"bg1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oBg2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"bg2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oFollowedHyperlink.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"folHlink");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::FollowedHyperlink);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oFollowedHyperlink->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oHyperlink.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"hlink");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Hyperlink);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oHyperlink->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oT1.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"tx1");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T1);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT1->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
if(oColorSchemeMapping.m_oT2.IsInit())
|
||||
pFind = oColorSchemeMapping.ColorMap.find(L"tx2");
|
||||
if(pFind != oColorSchemeMapping.ColorMap.end())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT2->GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -7063,9 +7719,9 @@ namespace BinDocxRW
|
||||
m_nLastFilePos = 0;
|
||||
m_nRealTableCount = 0;
|
||||
}
|
||||
static std::wstring WriteFileHeader(long nDataSize)
|
||||
static std::wstring WriteFileHeader(long nDataSize, int version)
|
||||
{
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(g_nFormatVersion) + L";" + std::to_wstring(nDataSize) + L";";
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(version) + L";" + std::to_wstring(nDataSize) + L";";
|
||||
return sHeader;
|
||||
}
|
||||
void WriteMainTableStart()
|
||||
|
||||
@ -47,6 +47,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
|
||||
m_pCurFileWriter = NULL;
|
||||
|
||||
m_bIsNoBase64Save = false;
|
||||
m_bIsNoBase64 = false;
|
||||
m_bSaveChartAsImg = false;
|
||||
}
|
||||
BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
@ -54,52 +55,6 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
RELEASEOBJECT(m_pParamsWriter);
|
||||
RELEASEOBJECT(m_pCurFileWriter);
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
|
||||
{
|
||||
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
|
||||
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
|
||||
std::wstring strEditorBin = NSSystemPath::Combine(strDirDst, L"Editor.bin");
|
||||
|
||||
NSDirectory::CreateDirectory(strDirSrc);
|
||||
NSDirectory::CreateDirectory(strDirDst);
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
|
||||
if(saveToFile(strEditorBin, strDirSrc, sXMLOptions))
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
|
||||
{
|
||||
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
|
||||
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, L"Editor.bin");
|
||||
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
|
||||
|
||||
NSDirectory::CreateDirectory(strDirSrc);
|
||||
NSDirectory::CreateDirectory(strDirDst);
|
||||
|
||||
std::wstring sEditorBin = strEditorBin;
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
|
||||
{
|
||||
std::wstring sMediaPath;
|
||||
std::wstring sThemePath;
|
||||
std::wstring sEmbedPath;
|
||||
|
||||
CreateDocxFolders(strDirDst, sThemePath, sMediaPath, sEmbedPath);
|
||||
|
||||
if(loadFromFile(sEditorBin, strDirDst, sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
|
||||
{
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, true))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
OOX::CPath pathMain(sSrcFileName);
|
||||
@ -144,13 +99,17 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
|
||||
BinaryFileWriter oBinaryFileWriter(*m_pParamsWriter);
|
||||
|
||||
if (m_bIsNoBase64)
|
||||
{
|
||||
oBufferedStream.WriteStringUtf8(oBinaryFileWriter.WriteFileHeader(0, g_nFormatVersionNoBase64));
|
||||
}
|
||||
oBinaryFileWriter.intoBindoc(sDstPath);
|
||||
|
||||
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
|
||||
int nBinBufferLen = oBufferedStream.GetPosition();
|
||||
|
||||
|
||||
if (m_bIsNoBase64Save)
|
||||
if (m_bIsNoBase64 || m_bIsNoBase64Save)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sSrcFileName);
|
||||
@ -166,7 +125,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sSrcFileName);
|
||||
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen));
|
||||
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen, g_nFormatVersion));
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
@ -268,27 +227,42 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
else
|
||||
dst_len += _c;
|
||||
}
|
||||
|
||||
int nDataSize = atoi(dst_len.c_str());
|
||||
BYTE* pData = new BYTE[nDataSize];
|
||||
|
||||
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(!version.empty())
|
||||
{
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
version = version.substr(1);
|
||||
g_nCurFormatVersion = nVersion = std::stoi(version.c_str());
|
||||
}
|
||||
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
|
||||
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(!version.empty())
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
|
||||
int nDataSize = 0;
|
||||
BYTE* pData = NULL;
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
nDataSize = atoi(dst_len.c_str());
|
||||
pData = new BYTE[nDataSize];
|
||||
if(Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
{
|
||||
version = version.substr(1);
|
||||
int nTempVersion = atoi(version.c_str());
|
||||
if(0 != nTempVersion)
|
||||
{
|
||||
g_nCurFormatVersion = nVersion = nTempVersion;
|
||||
}
|
||||
}
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nDataSize = nBase64DataSize;
|
||||
pData = pBase64Data;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
oBufferedStream.Seek(nIndex);
|
||||
}
|
||||
|
||||
|
||||
if (NULL != pData)
|
||||
{
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
|
||||
@ -343,6 +317,11 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
bResultOk = true;
|
||||
|
||||
}
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBase64Data);
|
||||
}
|
||||
@ -472,6 +451,10 @@ void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool bIsNoBase64Save)
|
||||
{
|
||||
m_bIsNoBase64Save = bIsNoBase64Save;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setSaveChartAsImg(bool bSaveChartAsImg)
|
||||
{
|
||||
m_bSaveChartAsImg = bSaveChartAsImg;
|
||||
|
||||
@ -54,6 +54,7 @@ namespace BinDocxRW
|
||||
std::wstring m_sFontDir;
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
bool m_bIsNoBase64Save;
|
||||
bool m_bIsNoBase64;
|
||||
bool m_bSaveChartAsImg;
|
||||
ParamsWriter* m_pParamsWriter;
|
||||
Writers::FileWriter* m_pCurFileWriter;
|
||||
@ -61,9 +62,6 @@ namespace BinDocxRW
|
||||
CDocxSerializer();
|
||||
virtual ~CDocxSerializer();
|
||||
|
||||
bool ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
|
||||
bool ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
|
||||
|
||||
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);
|
||||
|
||||
@ -78,6 +76,7 @@ namespace BinDocxRW
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setIsNoBase64Save (bool bIsNoBase64Save);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
void setSaveChartAsImg (bool bSaveChartAsImg);
|
||||
};
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ namespace BinXlsxRW{
|
||||
CXlsxSerializer::CXlsxSerializer()
|
||||
{
|
||||
m_pExternalDrawingConverter = NULL;
|
||||
m_bIsNoBase64 = false;
|
||||
}
|
||||
CXlsxSerializer::~CXlsxSerializer()
|
||||
{
|
||||
@ -134,7 +135,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions);
|
||||
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return true;
|
||||
@ -178,7 +179,9 @@ namespace BinXlsxRW{
|
||||
{
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
|
||||
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
|
||||
|
||||
writeChartXlsx(sXlsxPath, oChartSpace);
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rId;
|
||||
@ -224,6 +227,11 @@ namespace BinXlsxRW{
|
||||
{
|
||||
m_pExternalDrawingConverter = pDrawingConverter;
|
||||
}
|
||||
void CXlsxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
|
||||
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
|
||||
{
|
||||
//анализируем chart
|
||||
|
||||
@ -55,6 +55,7 @@ namespace BinXlsxRW {
|
||||
std::wstring m_sFontDir;
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pExternalDrawingConverter;
|
||||
bool m_bIsNoBase64;
|
||||
public:
|
||||
CXlsxSerializer();
|
||||
~CXlsxSerializer();
|
||||
@ -69,6 +70,7 @@ namespace BinXlsxRW {
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
|
||||
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
|
||||
};
|
||||
|
||||
@ -49,8 +49,8 @@
|
||||
6967917D1D9E8AEE002CA4BA /* BinReaderWriterDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 696791791D9E8AEE002CA4BA /* BinReaderWriterDefines.h */; };
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967917A1D9E8AEE002CA4BA /* BinWriters.cpp */; };
|
||||
6967917F1D9E8AEE002CA4BA /* BinWriters.h in Headers */ = {isa = PBXBuildFile; fileRef = 6967917B1D9E8AEE002CA4BA /* BinWriters.h */; };
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */; };
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
|
||||
69F181B51C77276D00B2952B /* FileDownloader_curl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -97,8 +97,8 @@
|
||||
696791791D9E8AEE002CA4BA /* BinReaderWriterDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinReaderWriterDefines.h; path = ../../BinWriter/BinReaderWriterDefines.h; sourceTree = "<group>"; };
|
||||
6967917A1D9E8AEE002CA4BA /* BinWriters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BinWriters.cpp; path = ../../BinWriter/BinWriters.cpp; sourceTree = "<group>"; };
|
||||
6967917B1D9E8AEE002CA4BA /* BinWriters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinWriters.h; path = ../../BinWriter/BinWriters.h; sourceTree = "<group>"; };
|
||||
69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; name = FileDownloader_mac.mm; path = ../../../Common/FileDownloader/FileDownloader_mac.mm; sourceTree = "<group>"; };
|
||||
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
|
||||
69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader_curl.cpp; path = ../../../Common/FileDownloader/FileDownloader_curl.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -230,7 +230,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
69F181AD1C77274E00B2952B /* FileDownloader.h */,
|
||||
69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */,
|
||||
69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */,
|
||||
);
|
||||
name = Common;
|
||||
sourceTree = "<group>";
|
||||
@ -339,7 +339,6 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
69F181B51C77276D00B2952B /* FileDownloader_curl.cpp in Sources */,
|
||||
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
|
||||
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
|
||||
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
|
||||
@ -348,6 +347,7 @@
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
@ -379,6 +379,7 @@
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
_XCODE,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
@ -416,6 +417,7 @@
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
_XCODE,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
||||
@ -54,7 +54,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx docx
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx docx
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="OdfFileReaderTest"
|
||||
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
|
||||
RootNamespace="ASCOfficeOdfFileTest"
|
||||
|
||||
@ -87,9 +87,10 @@ public:
|
||||
std::wstring convert_conditional_formula(std::wstring const & expr);
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
std::wstring convert_named_ref(std::wstring const & expr);
|
||||
std::wstring convert_named_ref (std::wstring const & expr);
|
||||
std::wstring convert_named_formula(std::wstring const & expr);
|
||||
|
||||
std::wstring find_base_cell(std::wstring const & expr);
|
||||
std::wstring get_base_cell_formula(std::wstring const & expr);
|
||||
|
||||
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
|
||||
std::wstring convert_chart_distance(std::wstring const & expr);
|
||||
|
||||
@ -57,6 +57,7 @@ namespace formulasconvert {
|
||||
static std::wstring replace_named_ref_formater1(boost::wsmatch const & what);
|
||||
static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
|
||||
|
||||
void replace_named_formula(std::wstring & expr, bool w = true);
|
||||
void replace_named_ref(std::wstring & expr, bool w = true);
|
||||
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
@ -156,6 +157,13 @@ namespace formulasconvert {
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
if (std::wstring::npos != sheet1.find(L" "))
|
||||
{
|
||||
if (sheet1[0] != L'\'')
|
||||
{
|
||||
sheet1 = L"'" + sheet1 + L"'";
|
||||
}
|
||||
}
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
}
|
||||
else
|
||||
@ -209,7 +217,7 @@ namespace formulasconvert {
|
||||
{
|
||||
convert_with_TableName = withTableName;
|
||||
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
|
||||
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}\\]");
|
||||
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
|
||||
/*
|
||||
[ $ Sheet2 . A1 : . B5 ]
|
||||
*/
|
||||
@ -226,7 +234,7 @@ namespace formulasconvert {
|
||||
convert_with_TableName = withTableName;
|
||||
|
||||
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
|
||||
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
@ -263,15 +271,12 @@ namespace formulasconvert {
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
// TODO
|
||||
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
// TODO: проверить как сохраняются кавычки в строке
|
||||
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
{
|
||||
const std::wstring res = boost::regex_replace(
|
||||
@ -581,10 +586,14 @@ namespace formulasconvert {
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
bool isFormula = impl_->check_formula(workstr);
|
||||
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
expr,
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
@ -605,6 +614,11 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (!isFormula)
|
||||
{
|
||||
workstr = L"\"" + workstr + L"\"";
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ namespace formulasconvert {
|
||||
class oox2odf_converter::Impl
|
||||
{
|
||||
public:
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_formula(const std::wstring& expr);
|
||||
std::wstring convert_conditional_formula(const std::wstring& expr);
|
||||
@ -59,93 +60,17 @@ public:
|
||||
static std::wstring replace_arguments(boost::wsmatch const & what);
|
||||
static std::wstring convert_scobci(boost::wsmatch const & what);
|
||||
|
||||
std::wstring replace_arguments1(std::wstring & workstr);
|
||||
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
void replace_named_formula(std::wstring & expr);
|
||||
|
||||
std::wstring find_base_cell(const std::wstring & expr);
|
||||
static bool isFindBaseCell_;
|
||||
|
||||
// bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
//bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
static std::wstring base_cell_formula_;
|
||||
};
|
||||
////Table!.$A$1:$A2 -> ref $A$1 -> ref $A$2
|
||||
//bool oox2odf_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
//{
|
||||
// std::vector< std::wstring > splitted;
|
||||
//
|
||||
// boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
//
|
||||
// if (splitted.size()>2)
|
||||
// {
|
||||
// table = splitted[0];
|
||||
// ref_first = splitted[1];
|
||||
// ref_last = splitted[2];
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
// // =[.A1]+[.B1] -> table = ""; ref = "A1"
|
||||
// // of:=['Sheet2 A'.B2] -> table= "Sheet2 A"; ref = "B2"
|
||||
//
|
||||
//bool oox2odf_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
//{
|
||||
// boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([a-zA-Z\\$]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
|
||||
// boost::wsmatch result;
|
||||
// bool b = boost::regex_search(expr, result, re);
|
||||
//
|
||||
// size_t sz = result.size();
|
||||
// if (sz == 4 && !result[1].matched)
|
||||
// {
|
||||
// table = L"";
|
||||
// ref = result[2].str();
|
||||
// return true;
|
||||
// }
|
||||
// else if (sz == 4 && result[1].matched)
|
||||
// {
|
||||
// table = result[1].str();
|
||||
// XmlUtils::replace_all( table, L"$", L"");
|
||||
// XmlUtils::replace_all( table, L"'", L"");
|
||||
// ref = result[2].str();
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
//
|
||||
//namespace
|
||||
//{
|
||||
//
|
||||
//std::wstring replace_cell_range_formater(boost::wsmatch const & what)
|
||||
//{
|
||||
// const size_t sz = what.size();
|
||||
// if (sz == 4 && !what[1].matched)
|
||||
// {
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// else if (sz == 4 && what[1].matched)
|
||||
// {
|
||||
// std::wstring sheet1 = what[1].str();
|
||||
// XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// return L"";
|
||||
//}
|
||||
//
|
||||
//}
|
||||
//
|
||||
|
||||
// заменяем формат адресации ячеек НАОБОРОТ
|
||||
// [.A1] -> A1
|
||||
// [.A1:.B5] -> A1:B5
|
||||
// [Sheet2.A1:B5] -> Sheet2!A1:B5
|
||||
// [Sheet2.A1] -> Sheet2!A1
|
||||
// [$'Sheet2 A'.$B2] -> 'Sheet2 A'!$B2
|
||||
bool oox2odf_converter::Impl::isFindBaseCell_ = false;
|
||||
std::wstring oox2odf_converter::Impl::base_cell_formula_ = L"";
|
||||
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
{
|
||||
boost::wregex re(L"([:$!])+");
|
||||
@ -155,8 +80,10 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
|
||||
if (b)
|
||||
{
|
||||
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]*\\d*)\\:?([a-zA-Z$]*\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
std::wstring workstr = expr;
|
||||
|
||||
std::wstring res = boost::regex_replace(
|
||||
@ -178,19 +105,28 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz>3)
|
||||
if (sz > 3)
|
||||
{
|
||||
std::wstring sheet1 = what[1].matched ? what[1].str() : L"";
|
||||
XmlUtils::replace_all( sheet1, L"!", L"");
|
||||
std::wstring s;
|
||||
std::wstring sheet = what[1].matched ? what[1].str() : L"";
|
||||
|
||||
std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
int res=0;
|
||||
if (sheet1.length() > 0 && (res = c1.find(L"$")) >=0) sheet1 = L"$" + sheet1;
|
||||
|
||||
if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
const std::wstring s = std::wstring(L"[") + sheet1 + L"." +
|
||||
c1 +
|
||||
(c2.empty() ? L"" : (L":" + sheet1 + L"." + c2) ) + std::wstring(L"]");
|
||||
if (isFindBaseCell_ && base_cell_formula_.empty() && !sheet.empty())
|
||||
{
|
||||
base_cell_formula_ = sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
s = std::wstring(L"[") + sheet + L"." +
|
||||
c1 +
|
||||
(c2.empty() ? L"" : (L":" + sheet + L"." + c2) ) + std::wstring(L"]");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
else
|
||||
@ -209,7 +145,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz>2)
|
||||
if (sz > 2)
|
||||
{
|
||||
const std::wstring c1 = what[1].str();
|
||||
const std::wstring c2 = what[2].str();
|
||||
@ -222,39 +158,22 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
return L"";
|
||||
|
||||
}
|
||||
|
||||
//namespace {
|
||||
//
|
||||
//std::wstring replace_named_ref_formater(boost::wsmatch const & what)
|
||||
//{
|
||||
// const size_t sz = what.size();
|
||||
//
|
||||
// if (sz == 4 && !what[1].matched)
|
||||
// {
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// else if (sz == 4 && what[1].matched)
|
||||
// {
|
||||
// std::wstring sheet1 = what[1].str();
|
||||
// XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// return L"";
|
||||
//}
|
||||
//
|
||||
//}
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
expr = convert_formula(expr);
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
std::wstring workstr = expr, out;
|
||||
|
||||
replace_vertical(workstr);
|
||||
@ -264,8 +183,10 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
|
||||
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
BOOST_FOREACH(std::wstring &d, distance)
|
||||
for (size_t i = 0; i < distance.size(); i++)
|
||||
{
|
||||
std::wstring &d = distance[i];
|
||||
|
||||
XmlUtils::replace_all( d, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( d, L")", L"SCOBCAOUT");
|
||||
XmlUtils::replace_all( d, L" ", L"PROBEL");
|
||||
@ -283,21 +204,9 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
out = out + d + std::wstring(L";");
|
||||
}
|
||||
|
||||
if (out.length()>0) expr = out.substr(0,out.length()-1);
|
||||
if (!out.empty()) expr = out.substr(0, out.length() - 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::wstring oox2odf_converter::Impl::find_base_cell(const std::wstring & expr)
|
||||
{
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L"!"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size()>1)
|
||||
{
|
||||
return splitted[0] + L".$A$1";
|
||||
}
|
||||
else return L"";
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
|
||||
|
||||
@ -440,32 +349,6 @@ std::wstring replace_(boost::wsmatch const & what)
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring oox2odf_converter::Impl::replace_arguments1(std::wstring & workstr1)
|
||||
{
|
||||
std::wstring out;
|
||||
|
||||
std::wstring workstr = workstr1;
|
||||
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
|
||||
std::vector<std::wstring> distance;
|
||||
|
||||
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
BOOST_FOREACH(std::wstring &d, distance)
|
||||
{
|
||||
|
||||
replace_cells_range(d);
|
||||
|
||||
out = out + d + std::wstring(L";");
|
||||
}
|
||||
|
||||
if (out.length()>0) out = out.substr(0,out.length()-1);
|
||||
|
||||
|
||||
return out ;
|
||||
}
|
||||
std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
@ -506,33 +389,31 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const &
|
||||
|
||||
int sz = what.size();
|
||||
|
||||
std::wstring c1= what[1].str();
|
||||
std::wstring c2= what[2].str();
|
||||
std::wstring c3= what[3].str();
|
||||
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring workstr = what[1].str();
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
|
||||
out = what[1].str();
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
out = what[2].str();
|
||||
}
|
||||
if (!out.empty())
|
||||
{
|
||||
std::vector<std::wstring> distance;
|
||||
|
||||
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(distance, out, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
BOOST_FOREACH(std::wstring &d, distance)
|
||||
{
|
||||
|
||||
replace_cells_range(d);
|
||||
out = L"";
|
||||
for (size_t i = 0; i < distance.size(); i++)
|
||||
{
|
||||
replace_cells_range(distance[i]);
|
||||
|
||||
out = out + d + std::wstring(L";");
|
||||
out = out + distance[i] + std::wstring(L";");
|
||||
}
|
||||
|
||||
if (out.length()>0) out = out.substr(0,out.length()-1);
|
||||
if (!out.empty()) out = out.substr(0, out.length() - 1);
|
||||
|
||||
}
|
||||
else if (what[2].matched)
|
||||
out = what[2].str();
|
||||
else if (what[3].matched)
|
||||
out = what[3].str();
|
||||
return out ;
|
||||
@ -560,7 +441,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
std::wstring res = boost::regex_replace(
|
||||
res1,
|
||||
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
|
||||
boost::wregex(L"(?!([a-zA-Z]+\\d*\\())(([a-zA-Z]+\\!)?\\$?[a-zA-Z]*\\$?\\d*(\\:\\$?[a-zA-Z]*\\$?\\d*){0,1})"),
|
||||
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
|
||||
|
||||
if (res1 == res)
|
||||
@ -572,10 +453,6 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
boost::wregex(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?"),
|
||||
&replace_cells_range_formater1,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
@ -584,12 +461,16 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
XmlUtils::replace_all( res, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( res, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( res, L"PROBEL", L" ");
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
|
||||
XmlUtils::replace_all( res, L"PROBEL", L" ");
|
||||
|
||||
return std::wstring(L"of:=") + res;
|
||||
|
||||
}
|
||||
@ -600,12 +481,12 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
|
||||
std::wstring res1 = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&oox2odf_converter::Impl::convert_scobci,boost::match_default | boost::format_all);
|
||||
&oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
std::wstring res = boost::regex_replace(
|
||||
res1,
|
||||
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
|
||||
&oox2odf_converter::Impl::replace_arguments,boost::match_default | boost::format_all);
|
||||
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
|
||||
|
||||
if (res1 == res)
|
||||
{
|
||||
@ -614,20 +495,21 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
|
||||
&replace_cells_range_formater1,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( res, L"PROBEL", L" ");
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
|
||||
return res;
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
|
||||
XmlUtils::replace_all( res, L"PROBEL", L" ");
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
//Sheet2!C3:C19,Sheet2!L27:L34
|
||||
@ -726,9 +608,15 @@ std::wstring oox2odf_converter::convert_named_ref(const std::wstring& expr)
|
||||
impl_->replace_named_ref(workstr);
|
||||
return workstr;
|
||||
}
|
||||
std::wstring oox2odf_converter::find_base_cell(const std::wstring& expr)
|
||||
std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
|
||||
{
|
||||
return impl_->find_base_cell(expr);
|
||||
std::wstring workstr = expr;
|
||||
impl_->replace_named_formula(workstr);
|
||||
return workstr;
|
||||
}
|
||||
std::wstring oox2odf_converter::get_base_cell_formula(const std::wstring& expr)
|
||||
{
|
||||
return impl_->base_cell_formula_;
|
||||
}
|
||||
|
||||
|
||||
@ -840,14 +728,6 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
|
||||
return count;
|
||||
}
|
||||
|
||||
//bool oox2odf_converter::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
//{
|
||||
// return impl_->find_first_ref(expr, table, ref);
|
||||
//}
|
||||
//bool oox2odf_converter::find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last)
|
||||
//{
|
||||
// return impl_->find_first_last_ref(expr, table, ref_first,ref_last);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,6 +105,7 @@ SOURCES += \
|
||||
../src/odf/table_calculation_settings.cpp \
|
||||
../src/odf/table_docx.cpp \
|
||||
../src/odf/table_named_expressions.cpp \
|
||||
../src/odf/table_data_pilot_tables.cpp \
|
||||
../src/odf/table_pptx.cpp \
|
||||
../src/odf/table_xlsx.cpp \
|
||||
../src/odf/templates.cpp \
|
||||
@ -209,6 +210,13 @@ SOURCES += \
|
||||
../src/odf/datatypes/wrapoption.cpp \
|
||||
../src/odf/datatypes/writingmode.cpp \
|
||||
../src/odf/datatypes/xlink.cpp \
|
||||
../src/odf/datatypes/chartlabelposition.cpp \
|
||||
../src/odf/datatypes/grandtotal.cpp \
|
||||
../src/odf/datatypes/membertype.cpp \
|
||||
../src/odf/datatypes/tabletype.cpp \
|
||||
../src/odf/datatypes/tableorientation.cpp \
|
||||
../src/odf/datatypes/tablefunction.cpp \
|
||||
../src/odf/datatypes/tableorder.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
@ -278,6 +286,7 @@ SOURCES += \
|
||||
../src/docx/xlsx_table_metrics.cpp \
|
||||
../src/docx/xlsx_table_state.cpp \
|
||||
../src/docx/xlsx_textcontext.cpp \
|
||||
../src/docx/xlsx_pivots_context.cpp \
|
||||
../src/docx/xlsx_utils.cpp \
|
||||
../src/docx/xlsx_xf.cpp
|
||||
}
|
||||
@ -462,6 +471,8 @@ HEADERS += \
|
||||
../src/odf/datatypes/wrapoption.h \
|
||||
../src/odf/datatypes/writingmode.h \
|
||||
../src/odf/datatypes/xlink.h \
|
||||
../src/odf/datatypes/chartlabelposition.h \
|
||||
../src/odf/datatypes/grandtotal.h \
|
||||
../src/docx/docx_content_type.h \
|
||||
../src/docx/docx_conversion_context.h \
|
||||
../src/docx/docx_conversion_state.h \
|
||||
|
||||
@ -88,6 +88,7 @@
|
||||
#include "../src/odf/table_calculation_settings.cpp"
|
||||
#include "../src/odf/table_docx.cpp"
|
||||
#include "../src/odf/table_named_expressions.cpp"
|
||||
#include "../src/odf/table_data_pilot_tables.cpp"
|
||||
#include "../src/odf/table_pptx.cpp"
|
||||
#include "../src/odf/table_xlsx.cpp"
|
||||
#include "../src/odf/templates.cpp"
|
||||
|
||||
@ -119,3 +119,10 @@
|
||||
#include "../src/odf/datatypes/wrapoption.cpp"
|
||||
#include "../src/odf/datatypes/writingmode.cpp"
|
||||
#include "../src/odf/datatypes/xlink.cpp"
|
||||
#include "../src/odf/datatypes/chartlabelposition.cpp"
|
||||
#include "../src/odf/datatypes/grandtotal.cpp"
|
||||
#include "../src/odf/datatypes/membertype.cpp"
|
||||
#include "../src/odf/datatypes/tabletype.cpp"
|
||||
#include "../src/odf/datatypes/tableorientation.cpp"
|
||||
#include "../src/odf/datatypes/tablefunction.cpp"
|
||||
#include "../src/odf/datatypes/tableorder.cpp"
|
||||
|
||||
@ -100,3 +100,4 @@
|
||||
#include "../src/docx/xlsx_textcontext.cpp"
|
||||
#include "../src/docx/xlsx_utils.cpp"
|
||||
#include "../src/docx/xlsx_xf.cpp"
|
||||
#include "../src/docx/xlsx_pivots_context.cpp"
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "docx_content_type.h"
|
||||
#include "namespaces.h"
|
||||
|
||||
@ -86,14 +84,14 @@ std::wostream & content_type_content::xml_to_stream(std::wostream & _Wostream) c
|
||||
CP_XML_ATTR(L"xmlns", xmlns::types.value);
|
||||
|
||||
|
||||
BOOST_FOREACH(const xml::element_wc & elm, default_)
|
||||
for (size_t i = 0; i < default_.size(); i++)
|
||||
{
|
||||
elm.xml_to_stream(CP_XML_STREAM());
|
||||
default_[i].xml_to_stream(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const xml::element_wc & elm, override_)
|
||||
for (size_t i = 0; i < override_.size(); i++)
|
||||
{
|
||||
elm.xml_to_stream(CP_XML_STREAM());
|
||||
override_[i].xml_to_stream(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family:
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = std::wstring(L"style") + boost::lexical_cast<std::wstring>(count_++);
|
||||
const std::wstring id = std::wstring(L"style") + std::to_wstring(count_++);
|
||||
map_.insert(std::make_pair(n, id));
|
||||
return id;
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ void docx_conversion_context::start_list_item(bool restart)
|
||||
if (restart && !list_style_stack_.empty())
|
||||
{
|
||||
const std::wstring curStyleName = current_list_style();
|
||||
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++);
|
||||
const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
|
||||
list_style_renames_[curStyleName] = newStyleName;
|
||||
|
||||
odf_reader::list_style_container & lists = root()->odf_context().listStyleContainer();
|
||||
@ -1195,7 +1195,7 @@ void docx_conversion_context::process_headers_footers()
|
||||
// проходим по всем page layout
|
||||
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
|
||||
{
|
||||
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring & styleName = page->attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
|
||||
add_page_properties(masterPageNameLayout);
|
||||
|
||||
@ -1240,7 +1240,7 @@ std::wstring notes_context::add(const std::wstring & Content, const std::wstring
|
||||
std::wstring notes_context::next_id()
|
||||
{
|
||||
instances_map & map = (type_ == odf_types::noteclass::Endnote) ? instances_endnotes_ : instances_footnotes_;
|
||||
const std::wstring s = boost::lexical_cast<std::wstring>(map.size() + 1);
|
||||
const std::wstring s = std::to_wstring(map.size() + 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -1291,14 +1291,14 @@ void docx_conversion_context::start_text_changes (std::wstring id)
|
||||
if (state.type == 1)
|
||||
{
|
||||
|
||||
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">";
|
||||
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
|
||||
}
|
||||
|
||||
if (state.type == 2)
|
||||
{
|
||||
for (size_t i = 0 ; i < state.content.size(); i++)
|
||||
{
|
||||
output_stream() << L"<w:del" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">";
|
||||
output_stream() << L"<w:del" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
|
||||
|
||||
output_stream() << state.content[i];
|
||||
|
||||
@ -1330,7 +1330,7 @@ void docx_conversion_context::start_changes()
|
||||
std::wstring change_attr;
|
||||
change_attr += L" w:date=\"" + state.date + L"\"";
|
||||
change_attr += L" w:author=\"" + state.author + L"\"";
|
||||
change_attr += L" w:id=\"" + boost::lexical_cast<std::wstring>(current_id_changes++) + L"\"";
|
||||
change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
|
||||
|
||||
if (state.type == 1)
|
||||
{
|
||||
|
||||
@ -317,7 +317,8 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
CP_XML_ATTR(L"id", val.id + 1);
|
||||
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks);
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"wp:cNvGraphicFramePr")
|
||||
@ -529,7 +530,7 @@ mso-position-vertical-relative:text;";
|
||||
strStyle += L"margin-top:" + boost::lexical_cast<std::wstring>(val.y / 12700.) + L"pt;";
|
||||
strStyle += L"width:" + boost::lexical_cast<std::wstring>(val.cx / 12700.) + L"pt;";
|
||||
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
|
||||
strStyle += L"z-index:" + boost::lexical_cast<std::wstring>(0xF000800 - val.id);
|
||||
strStyle += L"z-index:" + std::to_wstring(0xF000800 - val.id);
|
||||
|
||||
CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id));
|
||||
CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "docx_package.h"
|
||||
#include "docx_conversion_context.h"
|
||||
@ -218,26 +219,25 @@ void docx_charts_files::write(const std::wstring & RootPath)
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
BOOST_FOREACH(const chart_content_ptr & item, charts_)
|
||||
for (int i = 0 ; i < charts_.size(); i++)
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
|
||||
if (!charts_[i]) continue;
|
||||
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, item->str()).write(path);
|
||||
|
||||
rels_files relFiles;
|
||||
package::simple_element(fileName, charts_[i]->str()).write(path);
|
||||
|
||||
rels_files relFiles;
|
||||
|
||||
item->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
|
||||
relFiles.add_rel_file(item->get_rel_file());
|
||||
relFiles.write(path);
|
||||
}
|
||||
charts_[i]->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
|
||||
relFiles.add_rel_file(charts_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
}
|
||||
}
|
||||
///////////////////////////
|
||||
@ -307,6 +307,7 @@ namespace
|
||||
content << L"<w:" << Node << L"s \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/CPSharedPtr.h>
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "docx_conversion_context.h"
|
||||
#include "logging.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
#include "../odf/odfcontext.h"
|
||||
|
||||
@ -49,6 +49,8 @@ struct _rect
|
||||
|
||||
struct drawing_object_description
|
||||
{
|
||||
bool bNotes_;
|
||||
|
||||
oox::RelsType type_;
|
||||
|
||||
std::wstring name_;
|
||||
@ -60,7 +62,9 @@ struct drawing_object_description
|
||||
double anchor_x_;
|
||||
double anchor_y_;
|
||||
|
||||
_action_desc action_;
|
||||
std::vector<_hlink_desc> hlinks_;
|
||||
|
||||
std::vector<odf_reader::_property> additional_; //shape properties
|
||||
|
||||
std::wstring xlink_href_; //ссылка на внешний объект
|
||||
|
||||
@ -39,13 +39,13 @@ namespace oox {
|
||||
|
||||
std::wstring headers_footers::create_id(size_t i)
|
||||
{
|
||||
return std::wstring(L"rHFId") + boost::lexical_cast<std::wstring>(i);
|
||||
return std::wstring(L"rHFId") + std::to_wstring(i);
|
||||
}
|
||||
|
||||
std::wstring headers_footers::create_name(size_t i, headers_footers::Type _Type)
|
||||
{
|
||||
return ((_Type == header || _Type == headerLeft || _Type == headerFirst) ? std::wstring(L"header") : std::wstring(L"footer") )
|
||||
+ boost::lexical_cast<std::wstring>(i) + L".xml";
|
||||
+ std::to_wstring(i) + L".xml";
|
||||
}
|
||||
|
||||
std::wstring headers_footers::add(const std::wstring & StyleName,
|
||||
@ -64,9 +64,10 @@ std::wstring headers_footers::add(const std::wstring & StyleName,
|
||||
}
|
||||
instance_ptr inst = instance_ptr( new instance(id, Content, type, name) );
|
||||
|
||||
BOOST_FOREACH(const relationship & r, _rels.relationships())
|
||||
std::vector<relationship> & rels = _rels.relationships();
|
||||
for (size_t i = 0; i < rels.size(); i++)
|
||||
{
|
||||
inst->rels_.add(r);
|
||||
inst->rels_.add(rels[i]);
|
||||
}
|
||||
instances_[StyleName].push_back(inst);
|
||||
return id;
|
||||
|
||||
@ -33,9 +33,6 @@
|
||||
#include "hyperlinks.h"
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -44,7 +41,8 @@ namespace oox {
|
||||
hyperlinks::_ref hyperlinks::last()
|
||||
{
|
||||
_ref r={};
|
||||
if (hrefs_.size()>0)
|
||||
|
||||
if (!hrefs_.empty())
|
||||
r = hrefs_.back();
|
||||
|
||||
return r;
|
||||
@ -52,9 +50,9 @@ hyperlinks::_ref hyperlinks::last()
|
||||
|
||||
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
|
||||
{
|
||||
std::wstring id = std::wstring(L"rHpId") + boost::lexical_cast<std::wstring>(hrefs_.size()+1);
|
||||
std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
|
||||
|
||||
_ref r ={xml::utils::replace_text_to_xml(href), type_place, drawing, id, false};
|
||||
_ref r = {xml::utils::replace_text_to_xml(href), type_place, drawing, id};
|
||||
|
||||
hrefs_.push_back(r);
|
||||
|
||||
@ -65,14 +63,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place,
|
||||
void hyperlinks::dump_rels(rels & Rels, _type_place type)
|
||||
{
|
||||
size_t i = 0;
|
||||
BOOST_FOREACH(_ref & elm, hrefs_)
|
||||
for (size_t i = 0; i < hrefs_.size(); i++)
|
||||
{
|
||||
if (elm.used_rels)continue; // уже использовали этот релс
|
||||
if (hrefs_[i].used_rels)continue; // уже использовали этот релс
|
||||
|
||||
if (elm.type_place == type)
|
||||
if (hrefs_[i].type_place == type)
|
||||
{
|
||||
Rels.add( relationship(elm.id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", elm.href, L"External" ) );
|
||||
elm.used_rels = true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
|
||||
// for (int i = 0; i <= 9; ++i)
|
||||
{
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( boost::lexical_cast<std::wstring>(i), 0, 0)))
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
|
||||
// return std::pair<float, float>(7,8);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
|
||||
|
||||
@ -33,9 +33,6 @@
|
||||
#include "mediaitems.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
|
||||
@ -92,12 +89,18 @@ std::wstring static get_default_file_name(RelsType type)
|
||||
return L"image";
|
||||
case typeChart:
|
||||
return L"chart";
|
||||
case typeMedia:
|
||||
return L"media";
|
||||
case typeMsObject:
|
||||
return L"msObject";
|
||||
case typeOleObject:
|
||||
return L"oleObject";
|
||||
case typeMedia:
|
||||
return L"media";
|
||||
case typeSlide:
|
||||
return L"slide";
|
||||
case typeVideo:
|
||||
return L"video";
|
||||
case typeAudio:
|
||||
return L"audio";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
@ -140,10 +143,9 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
|
||||
if (type == typeOleObject && sExt.empty())
|
||||
sExt = L".bin";
|
||||
|
||||
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
|
||||
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
|
||||
}
|
||||
|
||||
std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
|
||||
std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
{
|
||||
CFile file;
|
||||
|
||||
@ -187,6 +189,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
else if ( type == typeImage) number = count_image + 1;
|
||||
else if ( type == typeShape) number = count_shape + 1;
|
||||
else if ( type == typeMedia) number = count_media + 1;
|
||||
else if ( type == typeAudio) number = count_audio + 1;
|
||||
else if ( type == typeVideo) number = count_video + 1;
|
||||
else if ( type == typeSlide) number = count_slide + 1;
|
||||
else if ( type == typeMsObject ||
|
||||
type == typeOleObject) number = count_object + 1;
|
||||
else
|
||||
@ -219,7 +224,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
{
|
||||
if ( type == typeChart)
|
||||
{
|
||||
id = std::wstring(L"chId") + boost::lexical_cast<std::wstring>(count_charts + 1);
|
||||
id = std::wstring(L"chId") + std::to_wstring(count_charts + 1);
|
||||
count_charts++;
|
||||
}
|
||||
else if ( type == typeImage)
|
||||
@ -230,19 +235,34 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
outputPath = outputPath.substr(0, n_svm) + L".png";
|
||||
}
|
||||
//------------------------------------------------
|
||||
if (inputFileName.empty()) return L"";
|
||||
//if (inputFileName.empty()) return L""; - Book 27.ods - пустые линки на картинки
|
||||
|
||||
id = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image + 1);
|
||||
id = std::wstring(L"picId") + std::to_wstring(count_image + 1);
|
||||
count_image++;
|
||||
}
|
||||
else if ( type == typeMsObject || type == typeOleObject)
|
||||
{
|
||||
id = std::wstring(L"objId") + boost::lexical_cast<std::wstring>(count_object + 1);
|
||||
id = std::wstring(L"objId") + std::to_wstring(count_object + 1);
|
||||
count_object++;
|
||||
}
|
||||
else if ( type == typeAudio)
|
||||
{
|
||||
id = std::wstring(L"aId") + std::to_wstring(count_audio + 1);
|
||||
count_audio++;
|
||||
}
|
||||
else if ( type == typeVideo)
|
||||
{
|
||||
id = std::wstring(L"vId") + std::to_wstring(count_video + 1);
|
||||
count_video++;
|
||||
}
|
||||
else if ( type == typeMedia)
|
||||
{
|
||||
id = std::wstring(L"mId") + std::to_wstring(count_media + 1);
|
||||
count_media++;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = std::wstring(L"rId") + boost::lexical_cast<std::wstring>(count_shape + 1);
|
||||
id = std::wstring(L"rId") + std::to_wstring(count_shape + 1);
|
||||
count_shape++;
|
||||
}
|
||||
|
||||
|
||||
@ -31,11 +31,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -50,6 +49,9 @@ public:
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -74,6 +76,9 @@ public:
|
||||
size_t count_charts;
|
||||
size_t count_image;
|
||||
size_t count_media;
|
||||
size_t count_audio;
|
||||
size_t count_video;
|
||||
size_t count_slide;
|
||||
size_t count_shape;
|
||||
size_t count_tables;
|
||||
size_t count_object;
|
||||
@ -88,20 +93,47 @@ public:
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
|
||||
case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
||||
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
|
||||
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||
default:
|
||||
return L"";
|
||||
case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
|
||||
case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
||||
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
|
||||
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||
case typeMedia: return L"http://schemas.microsoft.com/office/2007/relationships/media";
|
||||
case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
|
||||
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
|
||||
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
int pos = fileName.rfind(L".");
|
||||
|
||||
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
|
||||
|
||||
if (sExt.empty()) return typeMedia;
|
||||
|
||||
sExt = XmlUtils::GetLower(sExt);
|
||||
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"avi") return typeVideo;
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"wma") return typeAudio;
|
||||
if (sExt == L"wav") return typeAudio;
|
||||
|
||||
if (sExt == L"mp3") return typeAudio;
|
||||
if (sExt == L"m4a") return typeAudio;
|
||||
if (sExt == L"m4v") return typeVideo;
|
||||
if (sExt == L"mp4") return typeVideo;
|
||||
if (sExt == L"mov") return typeVideo;
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (std::wstring &fileName);
|
||||
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
|
||||
items_array items_;
|
||||
std::wstring odf_packet_;
|
||||
|
||||
|
||||
@ -31,10 +31,8 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "oox_chart_axis.h"
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "oox_title.h"
|
||||
#include "oox_chart_shape.h"
|
||||
@ -181,18 +179,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(odf_reader::chart::axis::grid & g, content_.grids_)
|
||||
for (size_t i = 0; i < content_.grids_.size(); i++)
|
||||
{
|
||||
_oox_fill fill_null;
|
||||
shape.set(g.graphic_properties_, fill_null);
|
||||
shape.set(content_.grids_[i].graphic_properties_, fill_null);
|
||||
|
||||
if (g.type_ == odf_reader::chart::axis::grid::major)
|
||||
if (content_.grids_[i].type_ == odf_reader::chart::axis::grid::major)
|
||||
{
|
||||
CP_XML_NODE(L"c:majorGridlines")
|
||||
{
|
||||
shape.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
|
||||
odf_reader::GetProperty(content_.properties_, L"display_label", boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_NODE(L"c:majorTickMark")
|
||||
@ -201,7 +199,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g.type_ == odf_reader::chart::axis::grid::minor)
|
||||
if (content_.grids_[i].type_ == odf_reader::chart::axis::grid::minor)
|
||||
{
|
||||
CP_XML_NODE(L"c:minorGridlines")
|
||||
{
|
||||
@ -234,11 +232,11 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
|
||||
oox_serialize_default_text(_Wostream, content_.text_properties_);
|
||||
|
||||
BOOST_FOREACH(int const & ii, cross_id_)
|
||||
for (size_t i = 0; i < cross_id_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:crossAx")
|
||||
{
|
||||
CP_XML_ATTR(L"val", ii);
|
||||
CP_XML_ATTR(L"val", cross_id_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -124,6 +124,7 @@ void oox_chart_series::parse_properties()
|
||||
data_labels_->set_showCatName(*boolVal);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"data-label-number", intVal);
|
||||
|
||||
if (intVal)
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
@ -131,6 +132,13 @@ void oox_chart_series::parse_properties()
|
||||
if (*intVal == 1) data_labels_->set_showVal(true);
|
||||
if (*intVal == 2) data_labels_->set_showPercent(true);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
|
||||
if (intVal)
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
|
||||
data_labels_->set_position(*intVal);
|
||||
}
|
||||
}
|
||||
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
|
||||
{
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "oox_conversion_context.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
@ -144,7 +143,8 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
}
|
||||
namespace oox
|
||||
{
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) : base_font_size_(12), fonts_container_(fonts)
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts)
|
||||
{
|
||||
graphRPR_ = graphic;
|
||||
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
#include "oox_data_labels.h"
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -51,6 +49,8 @@ oox_data_labels::oox_data_labels()//подписи на значениях
|
||||
showPercent_ = false;
|
||||
showSerName_ = false;
|
||||
showVal_ = false;
|
||||
|
||||
position_ = -1; //not set
|
||||
}
|
||||
|
||||
void oox_data_labels::set_common_dLbl ( std::vector<odf_reader::_property> & text_properties)
|
||||
@ -107,6 +107,29 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (position_ >= 0 && position_ < 13)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLblPos")
|
||||
{
|
||||
switch (position_)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"val", L"bestFit");break;
|
||||
case 1: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 2: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 3: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
|
||||
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
|
||||
case 6: CP_XML_ATTR(L"val", L"l"); break;
|
||||
case 7: CP_XML_ATTR(L"val", L"inBase"); break;
|
||||
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
|
||||
case 9: CP_XML_ATTR(L"val", L"r"); break;
|
||||
case 10: CP_XML_ATTR(L"val", L"t"); break;
|
||||
case 11: CP_XML_ATTR(L"val", L"t"); break;
|
||||
case 12: CP_XML_ATTR(L"val", L"t"); break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"c:showLegendKey")
|
||||
{
|
||||
|
||||
@ -59,8 +59,10 @@ public:
|
||||
void set_showSerName (bool Val){showSerName_ = Val;}
|
||||
void set_showVal (bool Val){showVal_ = Val;}
|
||||
|
||||
void add_dLbl(int ind, std::vector<odf_reader::_property> & text_properties);
|
||||
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
|
||||
void set_position (int Val){position_ = Val;}
|
||||
|
||||
void add_dLbl (int ind, std::vector<odf_reader::_property> & text_properties);
|
||||
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
|
||||
|
||||
private:
|
||||
|
||||
@ -72,6 +74,8 @@ private:
|
||||
bool showSerName_; // (Show Series Name) §21.2.2.188
|
||||
bool showVal_; // (Show Value) §21.2.2.189
|
||||
|
||||
int position_;
|
||||
|
||||
std::vector<odf_reader::_property> textPr_;
|
||||
std::map<int, std::vector<odf_reader::_property>> dLbls_;
|
||||
|
||||
|
||||
@ -57,9 +57,25 @@ namespace svg_path
|
||||
{
|
||||
CP_XML_NODE(val.command)
|
||||
{
|
||||
for (size_t i = 0; i < val.points.size(); i++)
|
||||
{
|
||||
oox_serialize(CP_XML_STREAM(), val.points[i]);
|
||||
if (val.command == L"a:ArcTo")
|
||||
{
|
||||
if (val.points.size() > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"wR", (int)(val.points[0].x.get()));
|
||||
CP_XML_ATTR(L"hR", (int)(val.points[0].y.get()));
|
||||
}
|
||||
if (val.points.size() > 1)
|
||||
{
|
||||
CP_XML_ATTR(L"stAng", (int)(val.points[1].x.get() * 60000));
|
||||
CP_XML_ATTR(L"swAng", (int)(val.points[1].y.get() * 60000));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < val.points.size(); i++)
|
||||
{
|
||||
oox_serialize(CP_XML_STREAM(), val.points[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,6 +107,7 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"path",
|
||||
L"custGeom",//uses sub-sub type,
|
||||
L"polygon",
|
||||
L"roundRect",
|
||||
};
|
||||
|
||||
|
||||
@ -112,7 +129,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
_CP_OPT(std::wstring) strStrokeColor;
|
||||
_CP_OPT(int) iStroke;
|
||||
_CP_OPT(double) dStrokeWidth;
|
||||
_CP_OPT(double) dStrokeOpacity;
|
||||
_CP_OPT(double) dStrokeOpacity;
|
||||
_CP_OPT(bool) bWordArt;
|
||||
|
||||
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
|
||||
@ -151,15 +168,23 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
{
|
||||
if (fill != L"a:noFill")
|
||||
{
|
||||
if (color.length() < 1 && always_draw) color = L"000000";
|
||||
else if (color.length() <1 ) color = L"ffffff";
|
||||
if ( color.empty() )
|
||||
{
|
||||
if (always_draw) color = L"000000";
|
||||
else color = L"ffffff";
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
{
|
||||
CP_XML_ATTR(L"val",color);
|
||||
|
||||
if (dStrokeOpacity) CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", *dStrokeOpacity);}
|
||||
|
||||
if (dStrokeOpacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", (int)(*dStrokeOpacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,69 +212,33 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
|
||||
{
|
||||
_CP_OPT(int) iShapeIndex;
|
||||
_CP_OPT(bool) bWordArt;
|
||||
|
||||
odf_reader::GetProperty(prop, L"wordArt" , bWordArt);
|
||||
odf_reader::GetProperty(prop, L"odf-custom-draw-index" , iShapeIndex);
|
||||
|
||||
int count_values = 0, min_value = 0, max_value = 0;
|
||||
|
||||
if (!bWordArt && iShapeIndex)
|
||||
{
|
||||
count_values = _OO_OOX_custom_shapes[*iShapeIndex].count_values;
|
||||
min_value = _OO_OOX_custom_shapes[*iShapeIndex].min;
|
||||
max_value = _OO_OOX_custom_shapes[*iShapeIndex].max;
|
||||
}
|
||||
else if (iShapeIndex)
|
||||
{
|
||||
count_values = _OO_OOX_wordart[*iShapeIndex].count_values;
|
||||
min_value = _OO_OOX_wordart[*iShapeIndex].min;
|
||||
max_value = _OO_OOX_wordart[*iShapeIndex].max;
|
||||
}
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:avLst")
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
if (odf_reader::GetProperty(prop,L"draw-modifiers",strVal) && iShapeIndex)
|
||||
_CP_OPT(bool) bModifiers;
|
||||
_CP_OPT(std::wstring) strModifiers;
|
||||
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
|
||||
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
|
||||
if (strModifiers)
|
||||
{
|
||||
std::vector< std::wstring > values;
|
||||
boost::algorithm::split(values, strVal.get(), boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(values, strModifiers.get(), boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
if( count_values >0 && values.size()>0 && count_values < 3)//временное ограниечение .. хз как там свойства путаются
|
||||
{//если не заданы доп свойства - нефиг мучится
|
||||
int i=1;
|
||||
if (!values.empty() && values.back().empty()) values.pop_back();
|
||||
|
||||
_CP_OPT(int) iMax,iMin;
|
||||
odf_reader::GetProperty(prop,L"draw-modifiers-min",iMin);
|
||||
odf_reader::GetProperty(prop,L"draw-modifiers-max",iMax);
|
||||
values.resize(count_values);
|
||||
|
||||
BOOST_FOREACH(std::wstring & v, values)
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i].empty()) continue;
|
||||
CP_XML_NODE(L"a:gd")
|
||||
{
|
||||
CP_XML_NODE(L"a:gd")
|
||||
{
|
||||
if (values.size() >1)
|
||||
CP_XML_ATTR(L"name",(L"adj" + boost::lexical_cast<std::wstring>(i++)));
|
||||
else
|
||||
CP_XML_ATTR(L"name",L"adj");
|
||||
double val=0;
|
||||
if (v.length()>0)val= boost::lexical_cast<double>(v);
|
||||
|
||||
if (iMin && iMax && iShapeIndex)
|
||||
{
|
||||
if (min_value < max_value)
|
||||
{
|
||||
double W = *iMax - *iMin;
|
||||
val = (val- (*iMin))/W * (max_value - min_value) + min_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CP_XML_ATTR(L"fmla",L"val " + boost::lexical_cast<std::wstring>(static_cast<int>(val)));
|
||||
}
|
||||
if (values.size() > 1 || bModifiers)
|
||||
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их
|
||||
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1));
|
||||
else
|
||||
CP_XML_ATTR(L"name", L"adj");
|
||||
|
||||
CP_XML_ATTR(L"fmla", L"val " + values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -342,37 +331,39 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
|
||||
void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) dVal;
|
||||
_CP_OPT(int) iOoxShapeIndex;
|
||||
_CP_OPT(bool) bWordArt, bOoxShape;
|
||||
_CP_OPT(std::wstring) sCustomPath;
|
||||
|
||||
odf_reader::GetProperty(additional, L"wordArt", bWordArt);
|
||||
odf_reader::GetProperty(additional, L"oox-geom-index", iOoxShapeIndex);
|
||||
odf_reader::GetProperty(additional, L"oox-geom", bOoxShape);
|
||||
|
||||
std::wstring shapeType;
|
||||
_CP_OPT(bool) bWordArt;
|
||||
|
||||
odf_reader::GetProperty(additional,L"wordArt", bWordArt);
|
||||
odf_reader::GetProperty(additional, L"custom_path", sCustomPath);
|
||||
|
||||
std::wstring shapeGeomPreset;
|
||||
|
||||
if (sub_type == 7)//custom
|
||||
{
|
||||
_CP_OPT(int) iVal;
|
||||
odf_reader::GetProperty(additional, L"odf-custom-draw-index",iVal);
|
||||
|
||||
if (iVal)
|
||||
shapeType = _OO_OOX_custom_shapes[*iVal].oox;
|
||||
else
|
||||
if (iOoxShapeIndex)
|
||||
shapeGeomPreset = _OO_OOX_custom_shapes[*iOoxShapeIndex].oox;
|
||||
else if (sCustomPath)
|
||||
sub_type = 6; //path
|
||||
|
||||
if (shapeType == L"textBox")
|
||||
if (shapeGeomPreset == L"textBox")
|
||||
{
|
||||
sub_type = 1;
|
||||
shapeType = L"rect";
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type < 9 && sub_type >= 0)
|
||||
else if (sub_type < 10 && sub_type >= 0)
|
||||
{
|
||||
shapeType = _ooxShapeType[sub_type];
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
|
||||
if (bWordArt) sub_type = 1;
|
||||
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (sub_type == 6 || sub_type == 8)
|
||||
@ -391,36 +382,44 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
CP_XML_ATTR(L"t", 0);
|
||||
}
|
||||
//<a:rect b="b" l="0" r="r" t="0"/>
|
||||
if (odf_reader::GetProperty(additional, L"custom_path", strVal))
|
||||
{
|
||||
_CP_OPT(int) w, h;
|
||||
odf_reader::GetProperty(additional, L"custom_path_w", w);
|
||||
odf_reader::GetProperty(additional, L"custom_path_h", h);
|
||||
_CP_OPT(int) w, h;
|
||||
odf_reader::GetProperty(additional, L"custom_path_w", w);
|
||||
odf_reader::GetProperty(additional, L"custom_path_h", h);
|
||||
|
||||
CP_XML_NODE(L"a:pathLst")
|
||||
{
|
||||
CP_XML_NODE(L"a:path")
|
||||
{
|
||||
CP_XML_ATTR(L"w", w ? *w : cx);
|
||||
CP_XML_ATTR(L"h", h ? *h : cy);
|
||||
|
||||
CP_XML_STREAM() << strVal.get();
|
||||
|
||||
CP_XML_NODE(L"a:pathLst")
|
||||
{
|
||||
CP_XML_NODE(L"a:path")
|
||||
{
|
||||
CP_XML_ATTR(L"w", w ? *w : cx);
|
||||
CP_XML_ATTR(L"h", h ? *h : cy);
|
||||
|
||||
if (sCustomPath)
|
||||
{
|
||||
CP_XML_STREAM() << *sCustomPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shapeType.length() < 1)
|
||||
if (shapeGeomPreset.empty())
|
||||
{
|
||||
shapeType = L"rect";
|
||||
sub_type = 2;
|
||||
shapeGeomPreset = L"rect";
|
||||
sub_type = 2;
|
||||
}
|
||||
CP_XML_NODE(L"a:prstGeom")//автофигура
|
||||
{
|
||||
CP_XML_ATTR(L"prst", shapeType);
|
||||
if (!bWordArt) oox_serialize_aLst(CP_XML_STREAM(), additional);
|
||||
CP_XML_ATTR(L"prst", shapeGeomPreset);
|
||||
if (!bWordArt)
|
||||
{
|
||||
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus"))
|
||||
{
|
||||
additional.push_back(odf_reader::_property(L"bModifiers", true));
|
||||
}
|
||||
oox_serialize_aLst(CP_XML_STREAM(), additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bWordArt)
|
||||
@ -518,22 +517,32 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_hlink(std::wostream & strm, std::vector<_hlink_desc> const & val)
|
||||
void oox_serialize_action(std::wostream & strm, _action_desc const & val)
|
||||
{
|
||||
if (val.enabled == false) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
BOOST_FOREACH(const _hlink_desc & h, val)
|
||||
CP_XML_NODE(L"a:hlinkClick")
|
||||
{
|
||||
if (h.in_object == true)
|
||||
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
if (!val.action.empty())
|
||||
CP_XML_ATTR(L"action", val.action);
|
||||
|
||||
if (val.highlightClick)
|
||||
CP_XML_ATTR(L"highlightClick", val.highlightClick);
|
||||
|
||||
CP_XML_ATTR(L"r:id", val.hId);
|
||||
|
||||
if (!val.hSoundId.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:hlinkClick")
|
||||
CP_XML_NODE(L"a:snd")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
CP_XML_ATTR(L"r:id", h.hId);
|
||||
CP_XML_ATTR(L"r:embed", val.hSoundId);
|
||||
CP_XML_ATTR(L"name", L"sound");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,10 +51,35 @@ namespace oox {
|
||||
{
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
bool in_object;
|
||||
};
|
||||
};
|
||||
struct _action_desc
|
||||
{
|
||||
_action_desc() : enabled(false), highlightClick(false) {}
|
||||
void clear()
|
||||
{
|
||||
enabled = false;
|
||||
highlightClick = false;
|
||||
|
||||
hSoundId.clear();
|
||||
hSoundRef.clear();
|
||||
|
||||
hId.clear();
|
||||
hRef.clear();
|
||||
|
||||
action.clear();
|
||||
}
|
||||
bool enabled;
|
||||
std::wstring action;
|
||||
|
||||
std::wstring hSoundId;
|
||||
std::wstring hSoundRef;
|
||||
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
RelsType typeRels;
|
||||
bool highlightClick;
|
||||
};
|
||||
class _oox_drawing
|
||||
{
|
||||
public:
|
||||
@ -74,10 +99,14 @@ namespace oox {
|
||||
|
||||
_oox_fill fill;
|
||||
|
||||
std::wstring objectId;
|
||||
std::wstring objectProgId;
|
||||
std::wstring objectId;
|
||||
std::wstring objectProgId;
|
||||
|
||||
std::wstring extId;
|
||||
|
||||
_action_desc action;
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
std::vector<odf_reader::_property> additional;
|
||||
|
||||
virtual void serialize (std::wostream & strm) = 0;
|
||||
@ -90,7 +119,7 @@ namespace oox {
|
||||
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
|
||||
void oox_serialize_hlink (std::wostream & strm, const std::vector<_hlink_desc> & val);
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)(*opacity)*1000));// + L"%");
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_type
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)opacity->get_value()*1000));// + L"%");
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "oox_layout.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "oox_package.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <cpdoccore/utf8cpp/utf8.h>
|
||||
@ -71,7 +70,18 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"tif" == extension) return L"image/x-tiff";
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
else if (L"wma" == extension) return L"audio/x-ms-wma";
|
||||
else if (L"m4a" == extension) return L"audio/unknown";
|
||||
|
||||
else if (L"avi" == extension) return L"video/avi";
|
||||
else if (L"wmv" == extension) return L"video/x-ms-wmv";
|
||||
else if (L"mov" == extension) return L"video/unknown";
|
||||
else if (L"mp4" == extension) return L"video/unknown";
|
||||
else if (L"m4v" == extension) return L"video/unknown";
|
||||
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
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";
|
||||
@ -130,7 +140,7 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
{
|
||||
std::vector<override_content_type> & override_ = content_type_content_.get_override();
|
||||
|
||||
for (int i = 0 ; i < override_.size(); i++)
|
||||
for (size_t i = 0 ; i < override_.size(); i++)
|
||||
{
|
||||
if (override_[i].part_name() == fileName)
|
||||
return true;
|
||||
@ -158,14 +168,18 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
|
||||
void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
BOOST_FOREACH( mediaitems::item & item, _Mediaitems.items() )
|
||||
std::vector<mediaitems::item> & items_ = _Mediaitems.items();
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ((item.type == typeImage || item.type == typeMedia) && item.mediaInternal)
|
||||
if ((items_[i].type == typeImage ||
|
||||
items_[i].type == typeMedia ||
|
||||
items_[i].type == typeVideo ||
|
||||
items_[i].type == typeAudio) && items_[i].mediaInternal)
|
||||
{
|
||||
int n = item.outputName.rfind(L".");
|
||||
int n = items_[i].outputName.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(item.outputName.substr(n+1, item.outputName.length() - n));
|
||||
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,9 +334,12 @@ void media::write(const std::wstring & RootPath)
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
mediaitems::items_array & items = mediaitems_.items();
|
||||
for (int i = 0; i < items.size(); i++ )
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if (items[i].mediaInternal && items[i].valid && (items[i].type == typeImage || items[i].type == typeMedia))
|
||||
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
|
||||
items[i].type == typeMedia ||
|
||||
items[i].type == typeAudio ||
|
||||
items[i].type == typeVideo ))
|
||||
{
|
||||
std::wstring & file_name = items[i].href;
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
|
||||
@ -359,7 +376,7 @@ void embeddings::write(const std::wstring & RootPath)
|
||||
content_types_file & content_types = get_main_document()->get_content_types_file();
|
||||
|
||||
mediaitems::items_array & items = embeddingsitems_.items();
|
||||
for (int i = 0; i < items.size(); i++ )
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if ( items[i].mediaInternal && items[i].valid &&
|
||||
(items[i].type == typeMsObject || items[i].type == typeOleObject))
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "oox_rels.h"
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include "namespaces.h"
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -56,18 +55,6 @@ std::wostream & relationship::xml_to_stream(std::wostream & _Wostream) const
|
||||
CP_XML_ATTR(L"TargetMode", target_mode());
|
||||
}
|
||||
}
|
||||
|
||||
//_Wostream << L"<Relationship ";
|
||||
//CP_XML_SERIALIZE_ATTR(L"Id", id());
|
||||
//CP_XML_SERIALIZE_ATTR(L"Type", type());
|
||||
//CP_XML_SERIALIZE_ATTR(L"Target", target());
|
||||
//
|
||||
//if (!target_mode().empty())
|
||||
//{
|
||||
// CP_XML_SERIALIZE_ATTR(L"TargetMode", target_mode());
|
||||
//}
|
||||
|
||||
//_Wostream << L" />";
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
@ -82,23 +69,12 @@ std::wostream & rels::xml_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", xmlns::rels.value);
|
||||
|
||||
BOOST_FOREACH(const relationship & r, relationship_)
|
||||
for (size_t i = 0; i < relationship_.size(); i++)
|
||||
{
|
||||
r.xml_to_stream(CP_XML_STREAM());
|
||||
relationship_[i].xml_to_stream(CP_XML_STREAM());
|
||||
}
|
||||
} // "Relationships"
|
||||
}
|
||||
}
|
||||
|
||||
//_Wostream << L"<Relationships ";
|
||||
//CP_XML_SERIALIZE_ATTR(L"xmlns", xmlns::rels.value);
|
||||
//_Wostream << L">";
|
||||
|
||||
//BOOST_FOREACH(const relationship & r, relationship_)
|
||||
//{
|
||||
// r.xml_to_stream(_Wostream);
|
||||
//}
|
||||
|
||||
//_Wostream << L"</Relationships>";
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,10 @@ enum RelsType
|
||||
typeMedia,
|
||||
typeGroupShape,
|
||||
typeMsObject,
|
||||
typeOleObject
|
||||
typeOleObject,
|
||||
typeSlide,
|
||||
typeVideo,
|
||||
typeAudio
|
||||
};
|
||||
|
||||
struct _rel
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "oox_title.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -30,12 +30,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "oox_types_chart.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "oox_types_chart.h"
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -104,15 +100,15 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"val", grouping_);
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(oox_series_ptr const & s, series_)
|
||||
for (size_t i = 0; i < series_.size(); i++)
|
||||
{
|
||||
s->oox_serialize(_Wostream);
|
||||
series_[i]->oox_serialize(_Wostream);
|
||||
}
|
||||
BOOST_FOREACH(int const & i, axisId_)
|
||||
for (size_t i = 0; i < axisId_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:axId")
|
||||
{
|
||||
CP_XML_ATTR(L"val", i);
|
||||
CP_XML_ATTR(L"val", axisId_[i]);
|
||||
}
|
||||
}
|
||||
data_labels_.oox_serialize(_Wostream);
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "pptx_comments.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <vector>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "oox_rels.h"
|
||||
@ -53,23 +52,23 @@ public:
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
|
||||
BOOST_FOREACH(_pptx_comment const & c, pptx_comment_)
|
||||
for (size_t i = 0; i < pptx_comment_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"p:cm")
|
||||
{
|
||||
CP_XML_ATTR(L"idx",c.idx_);
|
||||
CP_XML_ATTR(L"idx", pptx_comment_[i].idx_);
|
||||
|
||||
CP_XML_ATTR(L"authorId", c.author_id_);
|
||||
CP_XML_ATTR(L"dt", c.date_);
|
||||
CP_XML_ATTR(L"authorId", pptx_comment_[i].author_id_);
|
||||
CP_XML_ATTR(L"dt", pptx_comment_[i].date_);
|
||||
|
||||
CP_XML_NODE(L"p:pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", c.x_);
|
||||
CP_XML_ATTR(L"y", c.y_);
|
||||
CP_XML_ATTR(L"x", pptx_comment_[i].x_);
|
||||
CP_XML_ATTR(L"y", pptx_comment_[i].y_);
|
||||
}
|
||||
CP_XML_NODE(L"p:text")
|
||||
{
|
||||
CP_XML_STREAM() << c.content_;
|
||||
CP_XML_STREAM() << pptx_comment_[i].content_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "pptx_comments_context.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include "../odf/datatypes/length.h"
|
||||
#include "xlsx_utils.h"
|
||||
@ -54,13 +53,13 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++);
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
const std::wstring fileName = std::wstring(L"comment") + file_id + L".xml";
|
||||
|
||||
comments_.push_back(pptx_comment_elm(fileName, content, comments));
|
||||
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ void pptx_conversion_context::process_layouts()
|
||||
type == odf_types::presentation_class::header ||
|
||||
type == odf_types::presentation_class::page_number)
|
||||
{
|
||||
if (frame->idx_in_owner <0)
|
||||
if (frame->idx_in_owner < 0)
|
||||
frame->idx_in_owner = last_idx_placeHolder++;
|
||||
|
||||
frame->pptx_convert_placeHolder(*this);
|
||||
@ -153,7 +153,9 @@ void pptx_conversion_context::process_master_pages()
|
||||
get_text_context().set_process_layouts(true);
|
||||
|
||||
//берем только актуальные
|
||||
for (size_t master_index =0; master_index < masters.content.size();master_index++)
|
||||
odf_reader::office_element_ptr master_notes_;
|
||||
|
||||
for (size_t master_index = 0; master_index < masters.content.size(); master_index++)
|
||||
{
|
||||
start_master(master_index);
|
||||
|
||||
@ -163,10 +165,21 @@ void pptx_conversion_context::process_master_pages()
|
||||
if (master)
|
||||
{
|
||||
master->pptx_convert(*this);
|
||||
|
||||
if (!master_notes_ && master->presentation_notes_)
|
||||
master_notes_ = master->presentation_notes_;
|
||||
}
|
||||
|
||||
|
||||
end_master();
|
||||
}
|
||||
|
||||
if (master_notes_)
|
||||
{
|
||||
start_master_notes();
|
||||
master_notes_->pptx_convert(*this);
|
||||
end_master_notes();
|
||||
}
|
||||
process_masters_ = false;
|
||||
get_text_context().set_process_layouts(false);
|
||||
|
||||
@ -180,15 +193,15 @@ void pptx_conversion_context::process_theme(std::wstring name)
|
||||
{
|
||||
int current = themes_.size() + 1;
|
||||
|
||||
if (name.length()<1)
|
||||
if (name.empty())
|
||||
{
|
||||
name = L"User Theme: " + boost::lexical_cast<std::wstring>(current);
|
||||
name = L"User Theme: " + std::to_wstring(current);
|
||||
}
|
||||
start_theme(name);
|
||||
//
|
||||
pptx_serialize_clrScheme(current_theme().clrSchemeData());
|
||||
pptx_serialize_fmtScheme(current_theme().fmtSchemeData());
|
||||
pptx_serialize_fontScheme(current_theme().fontSchemeData());
|
||||
pptx_serialize_clrScheme (current_theme().clrSchemeData());
|
||||
pptx_serialize_fmtScheme (current_theme().fmtSchemeData());
|
||||
pptx_serialize_fontScheme (current_theme().fontSchemeData());
|
||||
//
|
||||
end_theme();
|
||||
|
||||
@ -209,8 +222,6 @@ void pptx_conversion_context::start_document()
|
||||
|
||||
void pptx_conversion_context::end_document()
|
||||
{
|
||||
unsigned int count = 1;
|
||||
|
||||
for (size_t i = 0; i < slideMasters_.size(); i++)
|
||||
{
|
||||
pptx_xml_slideMaster_ptr& slideM = slideMasters_[i];
|
||||
@ -230,10 +241,11 @@ void pptx_conversion_context::end_document()
|
||||
CP_XML_ATTR(L"r:id", slideM->rId());
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (!slideMasters_.empty())
|
||||
presentation_.slidesProperties() << slideMasters_[0]->Sizes().str();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
count=0;
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
pptx_xml_slide_ptr& slide = slides_[i];
|
||||
@ -249,13 +261,12 @@ void pptx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_NODE(L"p:sldId")
|
||||
{
|
||||
CP_XML_ATTR(L"id", 0x100 + count);
|
||||
CP_XML_ATTR(L"id", 0x100 + i);
|
||||
CP_XML_ATTR(L"r:id", slide->rId());
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------
|
||||
for (size_t i = 0; i < slideLayouts_.size(); i++)
|
||||
{
|
||||
pptx_xml_slideLayout_ptr& slideL = slideLayouts_[i];
|
||||
@ -267,30 +278,42 @@ void pptx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_ppt_files().add_slideLayout(content);//slideMaster.xml
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//размеры страниц в презентации
|
||||
odf_reader::odf_read_context & context = root()->odf_context();
|
||||
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
|
||||
|
||||
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
|
||||
{
|
||||
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_.get();
|
||||
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
|
||||
//----------------------------------------------------------------------------------
|
||||
for (size_t i = 0; i < notes_.size(); i++)
|
||||
{
|
||||
pptx_xml_slideNotes_ptr& slideN = notes_[i];
|
||||
|
||||
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
|
||||
|
||||
if (pages_layouts)pages_layouts->pptx_convert(*this);
|
||||
package::slide_content_ptr content = package::slide_content::create();
|
||||
|
||||
slideN->write_to(content->content());
|
||||
content->add_rels(slideN->Rels());//media & links rels
|
||||
|
||||
output_document_->get_ppt_files().add_notes(content);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
pptx_serialize_size(current_presentation().notesSlidesSize(),6858000,9144000,L"p:notesSz");
|
||||
if (slideNotesMaster_)
|
||||
{
|
||||
package::slide_content_ptr content = package::slide_content::create();
|
||||
|
||||
slideNotesMaster_->write_to(content->content());
|
||||
content->add_rels(slideNotesMaster_->Rels());//media & links rels
|
||||
|
||||
output_document_->get_ppt_files().add_notesMaster(content);
|
||||
|
||||
CP_XML_WRITER(presentation_.slideNotesMastersData())//presentation.xml
|
||||
{
|
||||
CP_XML_NODE(L"p:notesMasterId")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", slideNotesMaster_->rId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//else
|
||||
pptx_serialize_size(current_presentation().slidesNotesProperties(), 6858000, 9144000, L"p:notesSz");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//добавляем диаграммы
|
||||
|
||||
count = 0;
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
|
||||
charts_[i]->serialize(content->content());
|
||||
@ -300,7 +323,6 @@ void pptx_conversion_context::end_document()
|
||||
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//добавляем темы
|
||||
for (size_t i=0; i < themes_.size(); i++)
|
||||
{
|
||||
output_document_->get_ppt_files().add_theme(themes_[i]);
|
||||
@ -308,10 +330,10 @@ void pptx_conversion_context::end_document()
|
||||
}
|
||||
package::ppt_comments_files_ptr comments = package::ppt_comments_files::create(comments_context_handle_.content());
|
||||
|
||||
output_document_->get_ppt_files().set_presentation(presentation_);
|
||||
output_document_->get_ppt_files().set_comments(comments);
|
||||
output_document_->get_ppt_files().set_authors_comments(authors_comments_);
|
||||
output_document_->get_ppt_files().set_media(get_mediaitems(), applicationFonts_);
|
||||
output_document_->get_ppt_files().set_presentation (presentation_);
|
||||
output_document_->get_ppt_files().set_comments (comments);
|
||||
output_document_->get_ppt_files().set_authors_comments (authors_comments_);
|
||||
output_document_->get_ppt_files().set_media (get_mediaitems(), applicationFonts_);
|
||||
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
}
|
||||
@ -321,7 +343,28 @@ void pptx_conversion_context::start_body()
|
||||
|
||||
void pptx_conversion_context::end_body()
|
||||
{}
|
||||
|
||||
pptx_xml_slideNotesMaster & pptx_conversion_context::current_notesMaster()
|
||||
{
|
||||
if (slideNotesMaster_)
|
||||
{
|
||||
return *slideNotesMaster_;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
pptx_xml_slideNotes & pptx_conversion_context::current_notes()
|
||||
{
|
||||
if (!notes_.empty())
|
||||
{
|
||||
return *notes_.back().get();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
pptx_xml_slide & pptx_conversion_context::current_slide()
|
||||
{
|
||||
if (!slides_.empty())
|
||||
@ -384,9 +427,18 @@ pptx_xml_slideMaster & pptx_conversion_context::current_master()
|
||||
}
|
||||
void pptx_conversion_context::create_new_slide(std::wstring const & name)
|
||||
{
|
||||
pptx_xml_slide_ptr s = pptx_xml_slide::create(name,slides_.size()+1);
|
||||
pptx_xml_slide_ptr s = pptx_xml_slide::create(name,slides_.size() + 1);
|
||||
slides_.push_back(s);
|
||||
}
|
||||
void pptx_conversion_context::create_new_slideNotes()
|
||||
{
|
||||
pptx_xml_slideNotes_ptr s = pptx_xml_slideNotes::create( notes_.size() + 1);
|
||||
notes_.push_back(s);
|
||||
}
|
||||
void pptx_conversion_context::create_new_slideNotesMaster()
|
||||
{
|
||||
slideNotesMaster_ = pptx_xml_slideNotesMaster::create();
|
||||
}
|
||||
void pptx_conversion_context::create_new_slideLayout(int id)
|
||||
{
|
||||
pptx_xml_slideLayout_ptr s = pptx_xml_slideLayout::create(id);
|
||||
@ -397,7 +449,6 @@ void pptx_conversion_context::create_new_slideMaster(int id)
|
||||
pptx_xml_slideMaster_ptr s = pptx_xml_slideMaster::create(id);
|
||||
slideMasters_.push_back(s);
|
||||
}
|
||||
|
||||
bool pptx_conversion_context::start_page(const std::wstring & pageName, const std::wstring & pageStyleName,
|
||||
const std::wstring & pageLayoutName,
|
||||
const std::wstring & pageMasterName)
|
||||
@ -414,7 +465,7 @@ bool pptx_conversion_context::start_page(const std::wstring & pageName, const st
|
||||
root()->odf_context().styleContainer().presentation_layouts().add_or_find(pageLayoutName,pageMasterName);
|
||||
|
||||
current_slide().Rels().add(relationship(layout_id.second, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",
|
||||
std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(layout_id.first) + L".xml"));
|
||||
std::wstring(L"../slideLayouts/slideLayout") + std::to_wstring(layout_id.first) + L".xml"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -438,7 +489,7 @@ bool pptx_conversion_context::start_layout(int layout_index)
|
||||
root()->odf_context().styleContainer().presentation_masters().add_layout_to(layouts.content[layout_index].master_name,layouts.content[layout_index]);
|
||||
|
||||
current_layout().Rels().add(relationship(L"smId1"/*master_id.second*/, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster",
|
||||
std::wstring(L"../slideMasters/slideMaster") + boost::lexical_cast<std::wstring>(master_id.first) + L".xml"));
|
||||
std::wstring(L"../slideMasters/slideMaster") + std::to_wstring(master_id.first) + L".xml"));
|
||||
|
||||
//
|
||||
}
|
||||
@ -506,6 +557,14 @@ bool pptx_conversion_context::start_master(int master_index)
|
||||
current_master().add_layout(masters.content[master_index].layouts[i].Id, masters.content[master_index].layouts[i].rId, 0x80000000 + last_uniq_big_id++);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//размеры страниц в презентации
|
||||
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masters.content[master_index].master_name);
|
||||
|
||||
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
|
||||
|
||||
if (pages_layouts)
|
||||
pages_layouts->pptx_serialize(current_master().Sizes(), *this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -530,6 +589,59 @@ void pptx_conversion_context::end_page()
|
||||
|
||||
get_slide_context().end_slide();
|
||||
}
|
||||
bool pptx_conversion_context::start_page_notes()
|
||||
{
|
||||
create_new_slideNotes( );
|
||||
|
||||
current_slide().Rels().add(relationship(notes_.back()->rId(), L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",
|
||||
L"../notesSlides/notesSlide" + std::to_wstring(notes_.size()) + L".xml"));
|
||||
|
||||
get_slide_context().start_slide();
|
||||
|
||||
current_notes().Rels().add(relationship(L"nId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide",
|
||||
L"../slides/slide" + std::to_wstring(slides_.size()) + L".xml"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pptx_conversion_context::end_page_notes()
|
||||
{
|
||||
get_slide_context().serialize_background(current_notes().Background());
|
||||
get_slide_context().serialize_objects(current_notes().Data());
|
||||
|
||||
get_slide_context().dump_rels(current_notes().Rels());//hyperlinks, mediaitems, ...
|
||||
|
||||
get_slide_context().end_slide();
|
||||
}
|
||||
bool pptx_conversion_context::start_master_notes()
|
||||
{
|
||||
create_new_slideNotesMaster( );
|
||||
|
||||
get_slide_context().start_slide();
|
||||
|
||||
process_theme(L"");//add default theme - одинаковые но под разными именами
|
||||
current_notesMaster().add_theme(current_theme().id(), L"tId1");
|
||||
|
||||
get_slide_context().start_slide();
|
||||
return true;
|
||||
}
|
||||
|
||||
void pptx_conversion_context::end_master_notes()
|
||||
{
|
||||
get_slide_context().serialize_background(current_notesMaster().Background());
|
||||
get_slide_context().serialize_objects(current_notesMaster().Data());
|
||||
|
||||
get_slide_context().dump_rels(current_notesMaster().Rels());//hyperlinks, mediaitems, ...
|
||||
|
||||
get_slide_context().end_slide();
|
||||
|
||||
for (size_t i = 0; i < notes_.size(); i++)
|
||||
{
|
||||
notes_[i]->Rels().add(relationship(L"nmId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster",
|
||||
L"../notesMasters/notesMaster1.xml"));
|
||||
}
|
||||
}
|
||||
void pptx_conversion_context::end_layout()
|
||||
{
|
||||
get_slide_context().serialize_objects(current_layout().Data());
|
||||
|
||||
@ -88,6 +88,12 @@ public:
|
||||
const std::wstring & pageMasterName);
|
||||
void end_page();
|
||||
|
||||
bool start_page_notes();
|
||||
void end_page_notes();
|
||||
|
||||
bool start_master_notes();
|
||||
void end_master_notes();
|
||||
|
||||
bool start_layout( int layout_index);
|
||||
void end_layout();
|
||||
|
||||
@ -107,10 +113,13 @@ public:
|
||||
return odf_document_;
|
||||
}
|
||||
|
||||
pptx_xml_slide & current_slide();
|
||||
pptx_xml_slideLayout & current_layout();
|
||||
pptx_xml_slideMaster & current_master();
|
||||
pptx_xml_theme & current_theme();
|
||||
pptx_xml_slide & current_slide();
|
||||
pptx_xml_slideLayout & current_layout();
|
||||
pptx_xml_slideMaster & current_master();
|
||||
pptx_xml_theme & current_theme();
|
||||
pptx_xml_slideNotes & current_notes();
|
||||
pptx_xml_slideNotesMaster & current_notesMaster();
|
||||
|
||||
pptx_xml_presentation & current_presentation();//собственно она одна
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
@ -138,6 +147,8 @@ private:
|
||||
void create_new_slide(std::wstring const & name);
|
||||
void create_new_slideLayout(int id);
|
||||
void create_new_slideMaster(int id);
|
||||
void create_new_slideNotes();
|
||||
void create_new_slideNotesMaster();
|
||||
|
||||
package::pptx_document * output_document_;
|
||||
odf_reader::odf_document * odf_document_;
|
||||
@ -152,10 +163,12 @@ private:
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
std::vector<pptx_xml_slide_ptr> slides_;
|
||||
std::vector<pptx_xml_slideNotes_ptr> notes_;
|
||||
std::vector<pptx_xml_slideMaster_ptr> slideMasters_;
|
||||
std::vector<pptx_xml_slideLayout_ptr> slideLayouts_;
|
||||
std::vector<pptx_xml_theme_ptr> themes_;
|
||||
|
||||
pptx_xml_slideNotesMaster_ptr slideNotesMaster_;
|
||||
pptx_xml_authors_comments_ptr authors_comments_;
|
||||
pptx_xml_presentation presentation_;
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks);
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvPicPr")
|
||||
@ -109,6 +109,75 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:pic")
|
||||
{
|
||||
CP_XML_NODE(L"p:nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"p:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvPicPr")
|
||||
{
|
||||
}
|
||||
CP_XML_NODE(L"p:nvPr")
|
||||
{
|
||||
std::wstring strNode;
|
||||
|
||||
if (val.type == typeVideo) strNode = L"a:videoFile";
|
||||
else if (val.type == typeAudio) strNode = L"a:audioFile";
|
||||
|
||||
if (strNode.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(strNode)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.objectId);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:extLst")
|
||||
{
|
||||
CP_XML_NODE(L"p:ext")
|
||||
{
|
||||
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
|
||||
CP_XML_NODE(L"p14:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.fill.bitmap)
|
||||
val.fill.bitmap->name_space = L"p";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"p:spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
|
||||
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);
|
||||
}
|
||||
//_CP_OPT(std::wstring) strTextContent;
|
||||
//odf::GetProperty(properties,L"text-content",strTextContent);
|
||||
//pptx_serialize_text(CP_XML_STREAM(),val.additional);
|
||||
//на картинке тект нельзя... - выше сменили тип на рект с заливкой
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
@ -123,7 +192,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
|
||||
oox_serialize_action(CP_XML_STREAM(),val.action);
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
@ -155,8 +224,11 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
odf_reader::GetProperty(val.additional,L"no_rect",bNoRect);
|
||||
|
||||
if (!bNoRect)
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
{
|
||||
if (val.cx != 0 || val.cy != 0) //layout
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
}
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
@ -307,11 +379,14 @@ void _pptx_drawing::serialize(std::wostream & strm)
|
||||
{
|
||||
pptx_serialize_table(strm, *this);
|
||||
}
|
||||
else if (type == typeMsObject ||
|
||||
type == typeOleObject)
|
||||
else if (type == typeMsObject || type == typeOleObject)
|
||||
{
|
||||
pptx_serialize_object(strm, *this);
|
||||
}
|
||||
else if (type == typeMedia || type == typeAudio || type == typeVideo )
|
||||
{
|
||||
pptx_serialize_media(strm, *this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <vector>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -65,11 +64,16 @@ public:
|
||||
{
|
||||
pptx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
for (int i = 0; i < d.hlinks.size(); i++)
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
pptx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
}
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
{
|
||||
bool bInternal = (d.action.typeRels != typeHyperlink);
|
||||
pptx_drawing_rels_.push_back(_rel(bInternal, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
}
|
||||
|
||||
void add(/**/
|
||||
bool isInternal,
|
||||
@ -120,10 +124,13 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring ref = pptx_drawing_rels_[i].ref;
|
||||
if (pptx_drawing_rels_[i].is_internal && ref != L"NULL")
|
||||
{
|
||||
ref = L"../" + ref;
|
||||
}
|
||||
Rels.add(relationship( pptx_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(pptx_drawing_rels_[i].type),
|
||||
(pptx_drawing_rels_[i].is_internal ? std::wstring(L"../") + pptx_drawing_rels_[i].ref : pptx_drawing_rels_[i].ref),
|
||||
(pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
mediaitems::get_rel_type(pptx_drawing_rels_[i].type), ref, (pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
@ -41,7 +40,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
std::wstring pptx_xml_slide::name() const
|
||||
{
|
||||
return name_;
|
||||
@ -53,8 +52,8 @@ std::wstring pptx_xml_slide::rId() const
|
||||
|
||||
pptx_xml_slide_ptr pptx_xml_slide::create(std::wstring const & name,int id)
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(id);
|
||||
return boost::make_shared<pptx_xml_slide>(name,rId);
|
||||
const std::wstring rId = std::wstring(L"sId") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slide>(name, rId);
|
||||
}
|
||||
|
||||
pptx_xml_slide::pptx_xml_slide(std::wstring const & name,std::wstring const & id)
|
||||
@ -68,15 +67,15 @@ pptx_xml_slide::~pptx_xml_slide()
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Data()
|
||||
{
|
||||
return slideData_;
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Background()
|
||||
{
|
||||
return slideBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Timing()
|
||||
{
|
||||
return slideTiming_;
|
||||
return strmTiming_;
|
||||
}
|
||||
rels & pptx_xml_slide::Rels()
|
||||
{
|
||||
@ -100,14 +99,14 @@ void pptx_xml_slide::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"name", name());
|
||||
|
||||
CP_XML_STREAM() << slideBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << slideTiming_.str();
|
||||
CP_XML_STREAM() << strmTiming_.str();
|
||||
CP_XML_NODE(L"p:clrMapOvr")
|
||||
{
|
||||
CP_XML_NODE(L"a:masterClrMapping");
|
||||
@ -115,7 +114,7 @@ void pptx_xml_slide::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
std::wstring pptx_xml_slideLayout::rId() const
|
||||
{
|
||||
return rId_;
|
||||
@ -123,7 +122,7 @@ std::wstring pptx_xml_slideLayout::rId() const
|
||||
|
||||
pptx_xml_slideLayout_ptr pptx_xml_slideLayout::create(int id)
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"lrId") + boost::lexical_cast<std::wstring>(id);
|
||||
const std::wstring rId = std::wstring(L"lrId") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slideLayout>(rId);
|
||||
}
|
||||
|
||||
@ -137,7 +136,7 @@ pptx_xml_slideLayout::~pptx_xml_slideLayout()
|
||||
}
|
||||
std::wostream & pptx_xml_slideLayout::Data()
|
||||
{
|
||||
return slideLayoutData_;
|
||||
return strmData_;
|
||||
}
|
||||
rels & pptx_xml_slideLayout::Rels()
|
||||
{
|
||||
@ -166,7 +165,7 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideLayoutData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
|
||||
//в slideLayoutData_
|
||||
//contentPart (Content Part) §19.3.1.14
|
||||
@ -189,7 +188,7 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
std::wstring pptx_xml_slideMaster::rId() const
|
||||
{
|
||||
return rId_;
|
||||
@ -197,7 +196,7 @@ std::wstring pptx_xml_slideMaster::rId() const
|
||||
|
||||
pptx_xml_slideMaster_ptr pptx_xml_slideMaster::create(int id)
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"smId") + boost::lexical_cast<std::wstring>(id);
|
||||
const std::wstring rId = std::wstring(L"smId") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slideMaster>(rId,id);
|
||||
}
|
||||
|
||||
@ -212,15 +211,19 @@ pptx_xml_slideMaster::~pptx_xml_slideMaster()
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::Data()
|
||||
{
|
||||
return slideMasterData_;
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::DataExtra()
|
||||
{
|
||||
return slideMasterDataExtra_;
|
||||
return strmDataExtra_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::Background()
|
||||
{
|
||||
return slideMasterBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wstringstream & pptx_xml_slideMaster::Sizes()
|
||||
{
|
||||
return strmSizes_;
|
||||
}
|
||||
rels & pptx_xml_slideMaster::Rels()
|
||||
{
|
||||
@ -229,7 +232,7 @@ rels & pptx_xml_slideMaster::Rels()
|
||||
void pptx_xml_slideMaster::add_theme(int id, const std::wstring & tId)
|
||||
{
|
||||
rels_.add(relationship( tId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
||||
std::wstring(L"../theme/theme") + boost::lexical_cast<std::wstring>(id) + L".xml"));
|
||||
std::wstring(L"../theme/theme") + std::to_wstring(id) + L".xml"));
|
||||
}
|
||||
|
||||
void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId, const unsigned int & uniqId)
|
||||
@ -237,7 +240,7 @@ void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId, const un
|
||||
layoutsId_.push_back(std::pair<std::wstring, unsigned int>(rId, uniqId));
|
||||
|
||||
rels_.add(relationship( rId,L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",
|
||||
std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(id) + L".xml"));
|
||||
std::wstring(L"../slideLayouts/slideLayout") + std::to_wstring(id) + L".xml"));
|
||||
}
|
||||
|
||||
void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
@ -255,11 +258,11 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMap")
|
||||
@ -269,7 +272,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
CP_XML_ATTR(L"accent6",L"accent6");
|
||||
CP_XML_ATTR(L"accent5",L"accent5");
|
||||
CP_XML_ATTR(L"accent4",L"accent4");
|
||||
CP_XML_ATTR(L"accent3",L"accent5");
|
||||
CP_XML_ATTR(L"accent3",L"accent3");
|
||||
CP_XML_ATTR(L"accent2",L"accent2");
|
||||
CP_XML_ATTR(L"accent1",L"accent1");
|
||||
CP_XML_ATTR(L"tx2",L"dk2");
|
||||
@ -279,7 +282,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
}
|
||||
CP_XML_NODE(L"p:sldLayoutIdLst")
|
||||
{
|
||||
for (int i = 0; i < layoutsId_.size(); i++)
|
||||
for (size_t i = 0; i < layoutsId_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"p:sldLayoutId")
|
||||
{
|
||||
@ -288,7 +291,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << slideMasterDataExtra_.str();
|
||||
CP_XML_STREAM() << strmDataExtra_.str();
|
||||
CP_XML_NODE(L"p:txStyles")
|
||||
{
|
||||
CP_XML_NODE(L"p:titleStyle");
|
||||
@ -299,6 +302,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
pptx_xml_theme_ptr pptx_xml_theme::create(std::wstring const & name,int id)
|
||||
{
|
||||
return boost::make_shared<pptx_xml_theme>(name,id);
|
||||
@ -336,6 +340,7 @@ void pptx_xml_theme::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
pptx_xml_authors_comments_ptr pptx_xml_authors_comments::create()
|
||||
{
|
||||
return boost::make_shared<pptx_xml_authors_comments>();
|
||||
@ -399,6 +404,7 @@ void pptx_xml_authors_comments::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -412,14 +418,22 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
CP_XML_NODE(L"p:sldMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slideMastersData_.str();
|
||||
}
|
||||
}
|
||||
std::wstring notesMaster = slideNotesMastersData_.str();
|
||||
if (notesMaster.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"p:notesMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << notesMaster;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:sldIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slidesData_.str();
|
||||
}
|
||||
CP_XML_STREAM() << slidesProperties_.str();
|
||||
|
||||
CP_XML_STREAM() << notesSlidesSize_.str();
|
||||
CP_XML_STREAM() << slidesNotesProperties_.str();
|
||||
|
||||
CP_XML_NODE(L"p:defaultTextStyle")//??
|
||||
{
|
||||
@ -428,5 +442,155 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
std::wstring pptx_xml_slideNotes::rId() const
|
||||
{
|
||||
return rId_;
|
||||
}
|
||||
|
||||
pptx_xml_slideNotes_ptr pptx_xml_slideNotes::create(int id)
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"nId") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slideNotes>(rId);
|
||||
}
|
||||
|
||||
pptx_xml_slideNotes::pptx_xml_slideNotes(std::wstring const & id)
|
||||
{
|
||||
rId_ = id;
|
||||
}
|
||||
|
||||
pptx_xml_slideNotes::~pptx_xml_slideNotes()
|
||||
{
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotes::Data()
|
||||
{
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotes::Background()
|
||||
{
|
||||
return strmBackground_;
|
||||
}
|
||||
|
||||
rels & pptx_xml_slideNotes::Rels()
|
||||
{
|
||||
return rels_;
|
||||
}
|
||||
|
||||
void pptx_xml_slideNotes::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:notes")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMapOvr")
|
||||
{
|
||||
CP_XML_NODE(L"a:masterClrMapping");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
std::wstring pptx_xml_slideNotesMaster::rId() const
|
||||
{
|
||||
return rId_;
|
||||
}
|
||||
|
||||
pptx_xml_slideNotesMaster_ptr pptx_xml_slideNotesMaster::create()
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"nmId1");
|
||||
return boost::make_shared<pptx_xml_slideNotesMaster>(rId, 1);
|
||||
}
|
||||
|
||||
pptx_xml_slideNotesMaster::pptx_xml_slideNotesMaster(std::wstring const & rId, int id)
|
||||
{
|
||||
rId_ = rId;
|
||||
id_ = id;
|
||||
}
|
||||
|
||||
pptx_xml_slideNotesMaster::~pptx_xml_slideNotesMaster()
|
||||
{
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotesMaster::Data()
|
||||
{
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotesMaster::Background()
|
||||
{
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotesMaster::Sizes()
|
||||
{
|
||||
return strmSizes_;
|
||||
}
|
||||
rels & pptx_xml_slideNotesMaster::Rels()
|
||||
{
|
||||
return rels_;
|
||||
}
|
||||
void pptx_xml_slideNotesMaster::add_theme(int id, const std::wstring & tId)
|
||||
{
|
||||
rels_.add(relationship( tId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
||||
std::wstring(L"../theme/theme") + std::to_wstring(id) + L".xml"));
|
||||
}
|
||||
|
||||
void pptx_xml_slideNotesMaster::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:notesMaster")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMap")
|
||||
{
|
||||
CP_XML_ATTR(L"folHlink",L"folHlink");
|
||||
CP_XML_ATTR(L"hlink",L"hlink");
|
||||
CP_XML_ATTR(L"accent6",L"accent6");
|
||||
CP_XML_ATTR(L"accent5",L"accent5");
|
||||
CP_XML_ATTR(L"accent4",L"accent4");
|
||||
CP_XML_ATTR(L"accent3",L"accent5");
|
||||
CP_XML_ATTR(L"accent2",L"accent2");
|
||||
CP_XML_ATTR(L"accent1",L"accent1");
|
||||
CP_XML_ATTR(L"tx2",L"dk2");
|
||||
CP_XML_ATTR(L"tx1",L"dk1");
|
||||
CP_XML_ATTR(L"bg2",L"lt2");
|
||||
CP_XML_ATTR(L"bg1",L"lt1");
|
||||
}
|
||||
CP_XML_NODE(L"p:notesStyle")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class pptx_xml_slide: noncopyable
|
||||
public:
|
||||
pptx_xml_slide(std::wstring const & name,std::wstring const & id);
|
||||
~pptx_xml_slide();
|
||||
public:
|
||||
|
||||
std::wstring name() const;
|
||||
std::wstring rId() const;
|
||||
|
||||
@ -65,41 +65,68 @@ public:
|
||||
|
||||
private:
|
||||
std::wstring name_;
|
||||
std::wstringstream slideData_;
|
||||
std::wstringstream slideBackground_;
|
||||
std::wstringstream slideTiming_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmTiming_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_slideNotes;
|
||||
typedef _CP_PTR(pptx_xml_slideNotes) pptx_xml_slideNotes_ptr;
|
||||
|
||||
class pptx_xml_slideNotes: noncopyable
|
||||
{
|
||||
public:
|
||||
pptx_xml_slideNotes(std::wstring const & id);
|
||||
~pptx_xml_slideNotes();
|
||||
|
||||
std::wstring rId() const;
|
||||
|
||||
std::wostream & Data();
|
||||
std::wostream & Background();
|
||||
|
||||
rels & Rels();
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
static pptx_xml_slideNotes_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_presentation: noncopyable
|
||||
{
|
||||
public:
|
||||
pptx_xml_presentation(){}
|
||||
~pptx_xml_presentation(){}
|
||||
|
||||
std::wstringstream & slidesData(){return slidesData_;}
|
||||
std::wstringstream & slideMastersData(){return slideMastersData_;}
|
||||
std::wstringstream & notesSlidesData(){return notesSlidesData_;}
|
||||
std::wstringstream & slidesData() {return slidesData_;}
|
||||
std::wstringstream & slideMastersData() {return slideMastersData_;}
|
||||
std::wstringstream & slideNotesMastersData() {return slideNotesMastersData_;}
|
||||
|
||||
std::wstringstream & slidesProperties(){return slidesProperties_;}
|
||||
std::wstringstream & notesSlidesSize(){return notesSlidesSize_;}
|
||||
std::wstringstream & slidesProperties() {return slidesProperties_;}
|
||||
std::wstringstream & slidesNotesProperties() {return slidesNotesProperties_;}
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
private:
|
||||
std::wstringstream slidesProperties_;
|
||||
std::wstringstream notesSlidesSize_;
|
||||
|
||||
std::wstringstream slidesNotesProperties_;
|
||||
|
||||
std::wstringstream slidesData_;
|
||||
std::wstringstream slideMastersData_;
|
||||
std::wstringstream notesSlidesData_;
|
||||
std::wstringstream handoutMasterData_;
|
||||
std::wstringstream slideNotesMastersData_;
|
||||
std::wstringstream slideHandoutMasterData_;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_slideLayout;
|
||||
typedef _CP_PTR(pptx_xml_slideLayout) pptx_xml_slideLayout_ptr;
|
||||
|
||||
@ -121,12 +148,12 @@ public:
|
||||
static pptx_xml_slideLayout_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream slideLayoutData_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_slideMaster;
|
||||
typedef _CP_PTR(pptx_xml_slideMaster) pptx_xml_slideMaster_ptr;
|
||||
|
||||
@ -135,12 +162,13 @@ class pptx_xml_slideMaster: noncopyable
|
||||
public:
|
||||
pptx_xml_slideMaster(std::wstring const & rId, int id);
|
||||
~pptx_xml_slideMaster();
|
||||
public:
|
||||
|
||||
std::wstring rId() const;
|
||||
|
||||
std::wostream & Data();
|
||||
std::wostream & DataExtra();
|
||||
std::wostream & Background();
|
||||
std::wostream & Data();
|
||||
std::wostream & DataExtra();
|
||||
std::wostream & Background();
|
||||
std::wstringstream & Sizes();
|
||||
rels & Rels();
|
||||
|
||||
void add_layout(int id, const std::wstring & rId, const unsigned int & uniqId);
|
||||
@ -151,9 +179,10 @@ public:
|
||||
static pptx_xml_slideMaster_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream slideMasterData_;
|
||||
std::wstringstream slideMasterDataExtra_;
|
||||
std::wstringstream slideMasterBackground_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmDataExtra_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmSizes_;
|
||||
|
||||
std::vector<std::pair<std::wstring, unsigned int>> layoutsId_;
|
||||
std::wstring rId_;
|
||||
@ -163,7 +192,42 @@ private:
|
||||
|
||||
rels rels_;
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_slideNotesMaster;
|
||||
typedef _CP_PTR(pptx_xml_slideNotesMaster) pptx_xml_slideNotesMaster_ptr;
|
||||
|
||||
class pptx_xml_slideNotesMaster: noncopyable
|
||||
{
|
||||
public:
|
||||
pptx_xml_slideNotesMaster(std::wstring const & rId, int id);
|
||||
~pptx_xml_slideNotesMaster();
|
||||
|
||||
std::wstring rId() const;
|
||||
|
||||
std::wostream & Data();
|
||||
std::wostream & Background();
|
||||
std::wostream & Sizes();
|
||||
rels & Rels();
|
||||
|
||||
void add_theme(int id, const std::wstring & tId);
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
static pptx_xml_slideNotesMaster_ptr create();
|
||||
|
||||
private:
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmSizes_;
|
||||
|
||||
std::wstring rId_;
|
||||
int id_;
|
||||
|
||||
std::wstring themeId_;
|
||||
|
||||
rels rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_theme;
|
||||
typedef _CP_PTR(pptx_xml_theme) pptx_xml_theme_ptr;
|
||||
|
||||
@ -192,7 +256,7 @@ private:
|
||||
std::wstring name_;
|
||||
int id_;
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
class pptx_xml_authors_comments;
|
||||
typedef _CP_PTR(pptx_xml_authors_comments) pptx_xml_authors_comments_ptr;
|
||||
|
||||
|
||||
@ -100,15 +100,16 @@ void slide_content::add_rels(rels & _r)
|
||||
{
|
||||
std::vector<relationship> & r = _r.relationships();
|
||||
|
||||
for (int i = 0; i < r.size(); i++)
|
||||
for (size_t i = 0; i < r.size(); i++)
|
||||
{
|
||||
rels_->get_rels().add(r[i]);
|
||||
}
|
||||
}
|
||||
////////////
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
slides_files::slides_files()
|
||||
{}
|
||||
{
|
||||
rels_ = NULL;
|
||||
}
|
||||
|
||||
void slides_files::add_slide(slide_content_ptr slide)
|
||||
{
|
||||
@ -127,13 +128,13 @@ void slides_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"slide") + boost::lexical_cast<std::wstring>( i + 1 ) + L".xml";
|
||||
const std::wstring fileName = std::wstring(L"slide") + std::to_wstring( i + 1 ) + L".xml";
|
||||
|
||||
contentTypes->add_override(std::wstring(L"/ppt/slides/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>( i + 1);
|
||||
const std::wstring id = std::wstring(L"sId") + std::to_wstring( i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
||||
const std::wstring fileRef = std::wstring(L"slides/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
@ -149,7 +150,42 @@ void slides_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
//---------------------------------------------------------------------------
|
||||
void notes_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesSlides" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"notesSlide") + std::to_wstring( i + 1 ) + L".xml";
|
||||
|
||||
contentTypes->add_override(std::wstring(L"/ppt/notesSlides/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"nId") + std::to_wstring( i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
||||
const std::wstring fileRef = std::wstring(L"notesSlides/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
slides_[i]->get_rel_file()->set_file_name(fileName + L".rels");//внитренние релсы
|
||||
|
||||
rels_files relFiles;
|
||||
relFiles.add_rel_file(slides_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
|
||||
package::simple_element(fileName, slides_[i]->str()).write(path);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
slideMasters_files::slideMasters_files()
|
||||
{}
|
||||
|
||||
@ -170,12 +206,12 @@ void slideMasters_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"slideMaster") + boost::lexical_cast<std::wstring>( i + 1 ) + L".xml";
|
||||
const std::wstring fileName = std::wstring(L"slideMaster") + std::to_wstring( i + 1 ) + L".xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/slideMasters/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"smId") + boost::lexical_cast<std::wstring>( i + 1);
|
||||
const std::wstring id = std::wstring(L"smId") + std::to_wstring( i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
||||
const std::wstring fileRef = std::wstring(L"slideMasters/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
@ -191,7 +227,41 @@ void slideMasters_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
//---------------------------------------------------------------------------
|
||||
void notesMaster_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesMasters" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"notesMaster") + std::to_wstring( i + 1 ) + L".xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/notesMasters/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"nmId") + std::to_wstring( i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
||||
const std::wstring fileRef = std::wstring(L"notesMasters/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
slides_[i]->get_rel_file()->set_file_name(fileName + L".rels");//внитренние релсы
|
||||
|
||||
rels_files relFiles;
|
||||
relFiles.add_rel_file(slides_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
|
||||
package::simple_element(fileName, slides_[i]->str()).write(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
slideLayouts_files::slideLayouts_files()
|
||||
{}
|
||||
|
||||
@ -209,7 +279,7 @@ void slideLayouts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"slideLayout") + boost::lexical_cast<std::wstring>( i + 1 ) + L".xml";
|
||||
const std::wstring fileName = std::wstring(L"slideLayout") + std::to_wstring( i + 1 ) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
@ -225,7 +295,7 @@ void slideLayouts_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------
|
||||
authors_comments_element::authors_comments_element(pptx_xml_authors_comments_ptr & authors_comments) : authors_comments_(authors_comments)
|
||||
{
|
||||
}
|
||||
@ -261,7 +331,7 @@ void ppt_charts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (!charts_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>( i + 1 ) + L".xml";
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring( i + 1 ) + L".xml";
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
@ -291,7 +361,7 @@ void ppt_themes_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (!themes_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"theme") + boost::lexical_cast<std::wstring>( i + 1) + L".xml";
|
||||
const std::wstring fileName = std::wstring(L"theme") + std::to_wstring( i + 1) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.theme+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
@ -345,6 +415,12 @@ void ppt_files::write(const std::wstring & RootPath)
|
||||
slideMasters_files_.set_main_document( this->get_main_document() );
|
||||
slideMasters_files_.write(path);
|
||||
|
||||
notes_files_.set_main_document( this->get_main_document() );
|
||||
notes_files_.write(path);
|
||||
|
||||
notesMaster_files_.set_rels(&rels_files_);
|
||||
notesMaster_files_.set_main_document( this->get_main_document() );
|
||||
notesMaster_files_.write(path);
|
||||
|
||||
//rels_files_.add( relationship( L"hId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"ppt/presentation.xml" ) );
|
||||
|
||||
@ -412,6 +488,10 @@ void ppt_files::add_slide(slide_content_ptr slide)
|
||||
{
|
||||
slides_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::add_notes(slide_content_ptr slide)
|
||||
{
|
||||
notes_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::add_slideLayout(slide_content_ptr slide)
|
||||
{
|
||||
slideLayouts_files_.add_slide(slide);
|
||||
@ -420,7 +500,10 @@ void ppt_files::add_slideMaster(slide_content_ptr slide)
|
||||
{
|
||||
slideMasters_files_.add_slide(slide);
|
||||
}
|
||||
|
||||
void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
|
||||
@ -41,8 +41,10 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class pptx_xml_presentation;
|
||||
|
||||
class pptx_xml_theme;
|
||||
typedef _CP_PTR(pptx_xml_theme) pptx_xml_theme_ptr;
|
||||
|
||||
class pptx_xml_authors_comments;
|
||||
typedef _CP_PTR(pptx_xml_authors_comments) pptx_xml_authors_comments_ptr;
|
||||
|
||||
@ -55,7 +57,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------
|
||||
class slide_content;
|
||||
typedef _CP_PTR(slide_content) slide_content_ptr;
|
||||
|
||||
@ -72,11 +74,10 @@ public:
|
||||
static _CP_PTR(slide_content) create();
|
||||
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
|
||||
// slides_files
|
||||
//------------------------------------------------------------------------------
|
||||
class slides_files : public element
|
||||
{
|
||||
public:
|
||||
@ -92,12 +93,18 @@ public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
void set_slide_ref(const std::wstring & ref_file_path,const std::wstring & ref_file_name);
|
||||
|
||||
public:
|
||||
std::vector<slide_content_ptr> slides_;
|
||||
rels_files * rels_;
|
||||
|
||||
};
|
||||
// slideLayouts_files
|
||||
//------------------------------------------------------------------------------
|
||||
class notes_files : public slides_files
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
class slideLayouts_files : public element
|
||||
{
|
||||
public:
|
||||
@ -107,12 +114,9 @@ public:
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
public:
|
||||
std::vector<slide_content_ptr> slides_;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class authors_comments_element : public element
|
||||
{
|
||||
public:
|
||||
@ -123,9 +127,7 @@ private:
|
||||
pptx_xml_authors_comments_ptr & authors_comments_;
|
||||
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// slideMasters_files
|
||||
//------------------------------------------------------------------------------
|
||||
class slideMasters_files : public element
|
||||
{
|
||||
public:
|
||||
@ -140,16 +142,19 @@ public:
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
public:
|
||||
std::vector<slide_content_ptr> slides_;
|
||||
rels_files * rels_;
|
||||
};
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class notesMaster_files : public slideMasters_files
|
||||
{
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
class ppt_comments_files;
|
||||
typedef _CP_PTR(ppt_comments_files) ppt_comments_files_ptr;
|
||||
|
||||
// ppt_comments
|
||||
class ppt_comments_files: public element
|
||||
{
|
||||
public:
|
||||
@ -165,9 +170,7 @@ private:
|
||||
const std::vector<pptx_comment_elm> & comments_;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ppt_charts_files
|
||||
//------------------------------------------------------------------------------
|
||||
class ppt_charts_files : public element
|
||||
{
|
||||
public:
|
||||
@ -179,8 +182,8 @@ public:
|
||||
std::vector<chart_content_ptr> charts_;
|
||||
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ppt_theme_files
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class ppt_themes_files : public element
|
||||
{
|
||||
public:
|
||||
@ -192,13 +195,12 @@ public:
|
||||
std::vector<pptx_xml_theme_ptr> themes_;
|
||||
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------
|
||||
class ppt_files : public element
|
||||
{
|
||||
public:
|
||||
ppt_files();
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
void set_presentation(pptx_xml_presentation & presentation);
|
||||
@ -206,9 +208,11 @@ public:
|
||||
void set_styles(element_ptr Element);
|
||||
void set_comments(element_ptr Element);
|
||||
|
||||
void add_slide(slide_content_ptr sheet);
|
||||
void add_slide (slide_content_ptr sheet);
|
||||
void add_slideLayout(slide_content_ptr sheet);
|
||||
void add_slideMaster(slide_content_ptr sheet);
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
@ -217,25 +221,21 @@ public:
|
||||
void set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
rels_files rels_files_;
|
||||
|
||||
slides_files slides_files_;
|
||||
slideLayouts_files slideLayouts_files_;
|
||||
slideMasters_files slideMasters_files_;
|
||||
slides_files slides_files_;
|
||||
slideLayouts_files slideLayouts_files_;
|
||||
slideMasters_files slideMasters_files_;
|
||||
notes_files notes_files_;
|
||||
notesMaster_files notesMaster_files_;
|
||||
|
||||
//slides_files handoutMasters_files_;
|
||||
ppt_themes_files themes_files_;
|
||||
|
||||
ppt_charts_files charts_files_;
|
||||
//slides_files notesSlides_files_;
|
||||
//slides_files notesMasters_files_;
|
||||
//slides_files handoutMasters_files_;
|
||||
|
||||
element_ptr authors_comments_;
|
||||
|
||||
element_ptr authors_comments_;
|
||||
element_ptr presentation_;
|
||||
|
||||
element_ptr tableStyles_;
|
||||
|
||||
element_ptr comments_;
|
||||
element_ptr media_;
|
||||
element_ptr embeddings_;
|
||||
@ -247,7 +247,6 @@ class pptx_document : public document
|
||||
public:
|
||||
pptx_document();
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
virtual content_types_file & get_content_types_file() { return content_type_file_; }
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
@ -53,7 +52,6 @@ typedef _CP_PTR(pptx_drawings) pptx_drawings_ptr;
|
||||
class pptx_slide_context::Impl
|
||||
{
|
||||
public:
|
||||
|
||||
struct _transition
|
||||
{
|
||||
bool Enabled;
|
||||
@ -61,12 +59,13 @@ public:
|
||||
|
||||
_CP_OPT(std::wstring) Speed;
|
||||
_CP_OPT(int) Time;
|
||||
_CP_OPT(int) PageTime;
|
||||
_CP_OPT(std::wstring) Dir;
|
||||
_CP_OPT(std::wstring) Param;
|
||||
bool onClick;
|
||||
};
|
||||
|
||||
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket),odfPacket_(odfPacket)
|
||||
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -75,24 +74,17 @@ public:
|
||||
std::vector<drawing_object_description> objects_;
|
||||
|
||||
_CP_OPT(_oox_fill) background_fill_;
|
||||
|
||||
_transition transition_;
|
||||
bool use_image_replacement_;
|
||||
|
||||
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, RelsType 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, RelsType type)
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
@ -107,16 +99,16 @@ public:
|
||||
{
|
||||
objects_.clear();
|
||||
|
||||
background_fill_ = boost::none;
|
||||
background_fill_ = boost::none;
|
||||
|
||||
header=false;
|
||||
footer=false;
|
||||
date_time=false;
|
||||
slideNum=false;
|
||||
header = false;
|
||||
footer = false;
|
||||
date_time = false;
|
||||
slideNum = false;
|
||||
|
||||
rId_ = 1;
|
||||
|
||||
pptx_drawings_ = pptx_drawings::create();
|
||||
pptx_drawings_ = pptx_drawings::create();
|
||||
|
||||
transition_.Enabled = false;
|
||||
transition_.Speed = boost::none;
|
||||
@ -127,7 +119,6 @@ public:
|
||||
{
|
||||
return rId_++;;
|
||||
}
|
||||
|
||||
pptx_drawings_ptr get_drawings()
|
||||
{
|
||||
return pptx_drawings_;
|
||||
@ -137,22 +128,24 @@ public:
|
||||
void process_drawings();
|
||||
|
||||
private:
|
||||
void process_common_properties(drawing_object_description& obj,_pptx_drawing & drawing);
|
||||
void process_common_properties(drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
void process_shape (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_image (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_chart (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_table (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_object (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
pptx_drawings_ptr pptx_drawings_;
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
pptx_drawings_ptr pptx_drawings_;
|
||||
pptx_drawings_ptr pptx_notes_drawings_;
|
||||
};
|
||||
|
||||
void pptx_slide_context::Impl::process_drawings()
|
||||
{
|
||||
for (int i = 0; i < objects_.size(); i++)
|
||||
for (size_t i = 0; i < objects_.size(); i++)
|
||||
{
|
||||
_pptx_drawing drawing =_pptx_drawing();
|
||||
|
||||
@ -168,6 +161,7 @@ void pptx_slide_context::Impl::process_drawings()
|
||||
case typeChart: process_chart(objects_[i], drawing); break;
|
||||
case typeShape: process_shape(objects_[i], drawing); break;
|
||||
case typeTable: process_table(objects_[i], drawing); break;
|
||||
case typeMedia: process_media(objects_[i], drawing); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject: process_object(objects_[i], drawing); break;
|
||||
}
|
||||
@ -175,17 +169,19 @@ void pptx_slide_context::Impl::process_drawings()
|
||||
}
|
||||
|
||||
pptx_slide_context::pptx_slide_context(pptx_conversion_context & Context)
|
||||
: impl_(new pptx_slide_context::Impl(Context.root()->get_folder()))
|
||||
: impl_(new pptx_slide_context::Impl(Context.root()->get_folder()))
|
||||
{
|
||||
hlinks_size_ = 0;
|
||||
hlinks_size_ = 0;
|
||||
}
|
||||
void pptx_slide_context::start_slide()
|
||||
{
|
||||
impl_->clear(); // objects
|
||||
hlinks_size_ = 0;
|
||||
|
||||
hlinks_size_ = 0;
|
||||
|
||||
default_set(); //for current object
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void pptx_slide_context::start_slide_animation()
|
||||
{
|
||||
@ -202,10 +198,10 @@ void pptx_slide_context::start_slide_animation()
|
||||
|
||||
void pptx_slide_context::set_transitionFilter(std::wstring & type,_CP_OPT(std::wstring) & dir,_CP_OPT(std::wstring) & dop,_CP_OPT(int) & time)
|
||||
{
|
||||
impl_->transition_.Type = type;
|
||||
impl_->transition_.Time = time; // не путать длительность перехода с длительностью эффекта перехода (в oo его нет)
|
||||
impl_->transition_.Dir = dir;
|
||||
impl_->transition_.Param = dop;
|
||||
impl_->transition_.Type = type;
|
||||
impl_->transition_.Time = time; // не путать длительность перехода с длительностью эффекта перехода (в oo его нет)
|
||||
impl_->transition_.Dir = dir;
|
||||
impl_->transition_.Param = dop;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_transitionAction(bool val)
|
||||
@ -215,8 +211,8 @@ void pptx_slide_context::set_transitionAction(bool val)
|
||||
|
||||
void pptx_slide_context::set_transitionSpeed(std::wstring val)
|
||||
{
|
||||
if (val == L"medium")impl_->transition_.Speed=L"med";
|
||||
else impl_->transition_.Speed= val;//fast / slow
|
||||
if (val == L"medium") impl_->transition_.Speed = L"med";
|
||||
else impl_->transition_.Speed = val;//fast / slow
|
||||
}
|
||||
|
||||
|
||||
@ -227,12 +223,15 @@ void pptx_slide_context::default_set()
|
||||
impl_->object_description_.name_ = L"";
|
||||
impl_->object_description_.descriptor_ = L"";
|
||||
impl_->object_description_.anchor_ = L"";
|
||||
|
||||
impl_->object_description_.additional_.clear();
|
||||
|
||||
impl_->object_description_.clipping_string_= L"";
|
||||
impl_->object_description_.svg_rect_ = boost::none;
|
||||
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
|
||||
impl_->object_description_.additional_.clear();
|
||||
|
||||
impl_->object_description_.fill_.clear();
|
||||
@ -247,10 +246,10 @@ void pptx_slide_context::set_use_image_replacement()
|
||||
|
||||
void pptx_slide_context::set_placeHolder_type(std::wstring typeHolder)
|
||||
{
|
||||
if (typeHolder == L"ftr") impl_->footer= true;
|
||||
if (typeHolder == L"hdr") impl_->header= true;
|
||||
if (typeHolder == L"dt") impl_->date_time= true;
|
||||
if (typeHolder == L"sldNum")impl_->slideNum= true;
|
||||
if (typeHolder == L"ftr") impl_->footer = true;
|
||||
if (typeHolder == L"hdr") impl_->header = true;
|
||||
if (typeHolder == L"dt") impl_->date_time = true;
|
||||
if (typeHolder == L"sldNum")impl_->slideNum = true;
|
||||
|
||||
impl_->object_description_.additional_.push_back(odf_reader::_property(L"PlaceHolderType",typeHolder));
|
||||
}
|
||||
@ -328,15 +327,15 @@ void pptx_slide_context::set_fill(_oox_fill & fill)
|
||||
impl_->object_description_.fill_= fill;
|
||||
}
|
||||
|
||||
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href,bool object)
|
||||
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href)
|
||||
{
|
||||
++hlinks_size_;
|
||||
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_);
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
|
||||
_hlink_desc desc={hId, href_correct, object};
|
||||
_hlink_desc desc = {hId, href_correct};
|
||||
impl_->object_description_.hlinks_.push_back(desc);
|
||||
|
||||
return hId;
|
||||
@ -352,14 +351,12 @@ void pptx_slide_context::add_background(_oox_fill & fill)
|
||||
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
impl_->background_fill_ = fill;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_name(std::wstring const & name)
|
||||
{
|
||||
impl_->object_description_.name_ = name;
|
||||
|
||||
}
|
||||
|
||||
void pptx_slide_context::start_shape(int type)
|
||||
@ -367,6 +364,74 @@ void pptx_slide_context::start_shape(int type)
|
||||
impl_->object_description_.type_ = typeShape;
|
||||
impl_->object_description_.shape_type_ = type; //2,3...
|
||||
}
|
||||
void pptx_slide_context::start_action(std::wstring action)
|
||||
{
|
||||
impl_->object_description_.action_.enabled = true;
|
||||
|
||||
if (action == L"sound")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://noaction";
|
||||
impl_->object_description_.action_.typeRels = typeAudio;
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
else if (action == L"next-page")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=nextslide";
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
else if (action == L"previous-page")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=previousslide";
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
else if (action == L"first-page")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=firstslide";
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
else if (action == L"last-page")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=lastslide";
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
//ppaction://hlinkshowjump?jump=endshow
|
||||
else if (action == L"execute")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://program";
|
||||
impl_->object_description_.action_.typeRels = typeHyperlink;
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
++hlinks_size_;
|
||||
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
|
||||
if (typeRels == typeAudio)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->object_description_.action_.typeRels = typeRels;
|
||||
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
link = xml::utils::replace_text_to_xml(link);
|
||||
|
||||
if (typeRels == typeHyperlink)
|
||||
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
|
||||
|
||||
impl_->object_description_.action_.hId = hId;
|
||||
impl_->object_description_.action_.hRef = link;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::end_action()
|
||||
{
|
||||
}
|
||||
|
||||
void pptx_slide_context::start_table()
|
||||
{
|
||||
@ -390,6 +455,20 @@ void pptx_slide_context::set_ole_object(const std::wstring & path, const std::ws
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
impl_->object_description_.descriptor_ = progId;
|
||||
}
|
||||
void pptx_slide_context::set_media(const std::wstring & path)
|
||||
{
|
||||
if (path.empty()) return;
|
||||
|
||||
impl_->object_description_.type_ = typeMedia;
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
|
||||
impl_->object_description_.action_.enabled = true;
|
||||
impl_->object_description_.action_.action = L"ppaction://media";
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
|
||||
{
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_image(const std::wstring & path)
|
||||
{
|
||||
@ -445,7 +524,7 @@ void pptx_slide_context::process_drawings()
|
||||
return impl_->process_drawings();
|
||||
}
|
||||
|
||||
void pptx_slide_context::Impl::process_image(drawing_object_description& pic, _pptx_drawing & drawing)
|
||||
void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
int pos_replaicement = 0, pos_preview = 0;
|
||||
|
||||
@ -453,22 +532,22 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& pic, _p
|
||||
drawing.fill.type = 2;
|
||||
|
||||
_CP_OPT(std::wstring) sTextContent;
|
||||
GetProperty(pic.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
drawing.type = typeShape;
|
||||
drawing.sub_type = 2;//rect
|
||||
}
|
||||
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + pic.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(pic.clipping_string_,fileName,drawing.fill.bitmap->cropRect, NULL);
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, NULL);
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(pic.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
@ -476,11 +555,13 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& pic, _p
|
||||
|
||||
isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
}else if (!drawing.fill.bitmap->rId.empty())
|
||||
}
|
||||
else if (!drawing.fill.bitmap->rId.empty())
|
||||
{
|
||||
add_drawing(drawing, isMediaInternal, drawing.fill.bitmap->rId , ref, drawing.type);//объект
|
||||
add_drawing(drawing, isMediaInternal, drawing.fill.bitmap->rId, ref, drawing.type);//объект
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _pptx_drawing & drawing)
|
||||
@ -488,8 +569,9 @@ 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);
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
|
||||
void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _pptx_drawing & drawing)
|
||||
@ -499,6 +581,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
}
|
||||
|
||||
void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _pptx_drawing & drawing)
|
||||
@ -511,6 +594,7 @@ 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);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
@ -532,7 +616,6 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);
|
||||
}
|
||||
|
||||
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -541,41 +624,59 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
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.extId = L"ext" + drawing.objectId;
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( true, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
|
||||
{
|
||||
if (pic.svg_rect_)
|
||||
{
|
||||
//todooo непонятки с отрицательными значениями
|
||||
int val = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.x = val;
|
||||
if ( val >= 0) drawing.x = val;
|
||||
|
||||
val = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.y = val;
|
||||
if ( val >= 0 ) drawing.y = val;
|
||||
|
||||
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >=0) drawing.cx = val;
|
||||
if ( val >=0 ) drawing.cx = val;
|
||||
|
||||
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >=0) drawing.cy = val;
|
||||
if ( val >=0 ) drawing.cy = val;
|
||||
}
|
||||
|
||||
drawing.additional = pic.additional_;
|
||||
|
||||
drawing.hlinks = pic.hlinks_;
|
||||
|
||||
drawing.fill = pic.fill_;
|
||||
drawing.additional = pic.additional_;
|
||||
drawing.hlinks = pic.hlinks_;
|
||||
drawing.action = pic.action_;
|
||||
drawing.fill = pic.fill_;
|
||||
}
|
||||
|
||||
|
||||
void pptx_slide_context::dump_rels(rels & Rels)
|
||||
{
|
||||
impl_->get_drawings()->dump_rels(Rels);
|
||||
@ -590,6 +691,7 @@ void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, st
|
||||
{
|
||||
impl_->add_additional_rels(isInternal, rid, ref, type);
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_footer()
|
||||
{
|
||||
impl_->footer = true;
|
||||
@ -608,7 +710,7 @@ void pptx_slide_context::set_date_time()
|
||||
}
|
||||
void pptx_slide_context::serialize_background(std::wostream & strm, bool always)
|
||||
{
|
||||
if (!always && ( (!impl_->background_fill_) || (impl_->background_fill_->type==0))) return;
|
||||
if (!always && ( (!impl_->background_fill_) || (impl_->background_fill_->type == 0))) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -618,7 +720,7 @@ void pptx_slide_context::serialize_background(std::wostream & strm, bool always)
|
||||
{
|
||||
if (impl_->background_fill_)
|
||||
{
|
||||
oox_serialize_fill(CP_XML_STREAM(),impl_->background_fill_.get());
|
||||
oox_serialize_fill(CP_XML_STREAM(), impl_->background_fill_.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -644,8 +746,12 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
}
|
||||
if (impl_->transition_.Time)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm",impl_->transition_.Time.get());
|
||||
}
|
||||
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
|
||||
}
|
||||
if (impl_->transition_.PageTime)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
|
||||
}
|
||||
CP_XML_ATTR(L"advClick", impl_->transition_.onClick);
|
||||
|
||||
CP_XML_NODE(std::wstring(L"p:" + impl_->transition_.Type))
|
||||
@ -668,9 +774,22 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
//p:sndAc
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"p:timing")- последовательности p:par
|
||||
//{
|
||||
//}
|
||||
CP_XML_NODE(L"p:timing")
|
||||
{
|
||||
CP_XML_NODE(L"p:tnLst")
|
||||
{
|
||||
CP_XML_NODE(L"p:par")
|
||||
{
|
||||
CP_XML_NODE(L"p:cTn")
|
||||
{
|
||||
CP_XML_ATTR(L"nodeType", L"tmRoot");
|
||||
CP_XML_ATTR(L"id", 1);
|
||||
CP_XML_ATTR(L"dur", L"indefinite");
|
||||
CP_XML_ATTR(L"restart", L"never");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,7 +808,6 @@ void pptx_slide_context::serialize_HeaderFooter(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_slide_context::serialize_objects(std::wostream & strm)
|
||||
{
|
||||
int next_id = impl_->next_rId();
|
||||
@ -701,8 +819,8 @@ void pptx_slide_context::serialize_objects(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"name",L"noGroup");
|
||||
CP_XML_ATTR(L"id",next_id);
|
||||
CP_XML_ATTR(L"name", L"noGroup");
|
||||
CP_XML_ATTR(L"id", next_id);
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvGrpSpPr");
|
||||
CP_XML_NODE(L"p:nvPr");
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
void set_placeHolder_type (std::wstring typeHolder);
|
||||
void set_placeHolder_idx (int idx);
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref, bool object);
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
|
||||
void start_frame();
|
||||
void set_image (const std::wstring & path);
|
||||
@ -83,22 +83,31 @@ public:
|
||||
void set_ms_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_ole_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_text_box ();
|
||||
void set_media (const std::wstring & path);
|
||||
void set_media_param(std::wstring name, std::wstring value);
|
||||
void end_frame();
|
||||
|
||||
void start_action (std::wstring action);
|
||||
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
|
||||
void end_action ();
|
||||
|
||||
void start_table();
|
||||
void end_table();
|
||||
|
||||
void start_shape(int type);
|
||||
void end_shape();
|
||||
void end_shape ();
|
||||
|
||||
void set_use_image_replacement();
|
||||
|
||||
bool empty() const;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void serialize_objects(std::wostream & strm);
|
||||
void serialize_HeaderFooter(std::wostream & strm);
|
||||
void serialize_background(std::wostream & strm, bool always=false);
|
||||
void serialize_animations(std::wostream & strm);
|
||||
|
||||
void serialize_HeaderFooter (std::wostream & strm);
|
||||
void serialize_animations (std::wostream & strm);
|
||||
|
||||
void serialize_objects (std::wostream & strm);
|
||||
|
||||
void serialize_background (std::wostream & strm, bool always = false);
|
||||
|
||||
void dump_rels(rels & Rels);
|
||||
|
||||
@ -106,7 +115,7 @@ public:
|
||||
|
||||
mediaitems & get_mediaitems();
|
||||
|
||||
void add_background(_oox_fill & fill);
|
||||
void add_background (_oox_fill & fill);
|
||||
|
||||
void add_rels( bool isInternal,
|
||||
std::wstring const & rid,
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
@ -631,7 +630,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
|
||||
if (restart && !list_style_stack_.empty())
|
||||
{
|
||||
const std::wstring curStyleName = current_list_style();
|
||||
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++);
|
||||
const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
|
||||
list_style_renames_[curStyleName] = newStyleName;
|
||||
|
||||
odf_reader::list_style_container & lists = odf_context_.listStyleContainer();
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "xlsx_border.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "xlsx_cell_format.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
@ -31,8 +31,6 @@
|
||||
*/
|
||||
#include <vector>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "xlsx_cell_styles.h"
|
||||
@ -69,9 +67,9 @@ void xlsx_cell_styles::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_ATTR(L"count", impl_->cell_styles_.size());
|
||||
|
||||
BOOST_FOREACH(const xlsx_cell_style & s, impl_->cell_styles_)
|
||||
{
|
||||
oox::xlsx_serialize(CP_XML_STREAM(), s);
|
||||
for (size_t i = 0; i < impl_->cell_styles_.size(); i++)
|
||||
{
|
||||
oox::xlsx_serialize(CP_XML_STREAM(), impl_->cell_styles_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
|
||||
#include "xlsx_font.h"
|
||||
|
||||
@ -143,9 +143,9 @@ public:
|
||||
|
||||
std::wstring style = std::wstring(L"position:absolute;");
|
||||
|
||||
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
|
||||
|
||||
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
|
||||
@ -227,14 +227,14 @@ public:
|
||||
if (c.author_ == author_list_[i])
|
||||
{
|
||||
find=true;
|
||||
c.author_ = boost::lexical_cast<std::wstring>(i);
|
||||
c.author_ = std::to_wstring(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find)
|
||||
{
|
||||
author_list_.push_back(c.author_);
|
||||
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
|
||||
c.author_ = std::to_wstring(author_list_.size()-1);
|
||||
}
|
||||
xlsx_comment_.push_back(c);
|
||||
}
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "xlsx_comments_context.h"
|
||||
#include "xlsx_table_metrics.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include "../odf/datatypes/length.h"
|
||||
#include "xlsx_utils.h"
|
||||
@ -54,21 +53,21 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++);
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
|
||||
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
|
||||
|
||||
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
|
||||
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
|
||||
{
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvPicPr")
|
||||
@ -158,7 +158,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <iostream>
|
||||
@ -68,7 +67,7 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
{
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings));
|
||||
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
|
||||
@ -173,6 +172,7 @@ void xlsx_drawing_context::clear()
|
||||
|
||||
impl_->object_description_.additional_.clear();
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
impl_->object_description_.additional_.clear();
|
||||
|
||||
impl_->use_image_replacement_ = false;
|
||||
@ -399,16 +399,17 @@ void xlsx_drawing_context::set_fill(_oox_fill & fill)
|
||||
impl_->object_description_.fill_= fill;
|
||||
}
|
||||
|
||||
std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href,bool object)
|
||||
std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href)
|
||||
{
|
||||
++hlinks_size_;
|
||||
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_);
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
|
||||
_hlink_desc desc = {hId, href_correct, object}; //корректность написания ссылки важна для ms office и не важна для open office ->
|
||||
//todooo
|
||||
//корректность написания ссылки важна для ms office и не важна для open office ->
|
||||
//todooo
|
||||
_hlink_desc desc = {hId, href_correct};
|
||||
impl_->object_description_.hlinks_.push_back(desc);
|
||||
|
||||
return hId;
|
||||
@ -464,6 +465,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
|
||||
drawing.additional = obj.additional_;
|
||||
drawing.hlinks = obj.hlinks_;
|
||||
drawing.action = obj.action_;
|
||||
}
|
||||
void xlsx_drawing_context::process_position_properties(drawing_object_description & obj, xlsx_table_metrics & table_metrics,xlsx_table_position & from,xlsx_table_position & to)
|
||||
{
|
||||
@ -512,7 +514,7 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
|
||||
}
|
||||
|
||||
|
||||
void xlsx_drawing_context::process_image(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
if (!drawing.fill.bitmap)
|
||||
{
|
||||
@ -662,11 +664,33 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
impl_->serialize(strm);
|
||||
}
|
||||
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
|
||||
{
|
||||
return impl_->get_drawings();
|
||||
}
|
||||
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)
|
||||
{//hyprelinks only
|
||||
++hlinks_size_;
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
|
||||
link = xml::utils::replace_text_to_xml(link);
|
||||
|
||||
if (typeRels == typeHyperlink)
|
||||
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
|
||||
|
||||
impl_->object_description_.action_.hId = hId;
|
||||
impl_->object_description_.action_.hRef = link;
|
||||
impl_->object_description_.action_.typeRels = typeRels;
|
||||
}
|
||||
void xlsx_drawing_context::end_action()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
|
||||
std::vector<odf_reader::_property> & get_properties();
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref, bool object);
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
|
||||
void set_use_image_replacement();
|
||||
|
||||
@ -125,6 +125,10 @@ 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 end_action();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
@ -50,10 +50,12 @@ public:
|
||||
|
||||
add (isInternal, rid, ref, type, sheet_rel);
|
||||
|
||||
for (int i = 0 ; i < d.hlinks.size(); i++)
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
xlsx_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) //не объект
|
||||
{
|
||||
|
||||
@ -175,13 +175,6 @@ void xlsx_fills::serialize(std::wostream & _Wostream) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//_Wostream << L"<fills count=\"" << inst_array.size() << L"\" >";
|
||||
//BOOST_FOREACH(const xlsx_fill & f, inst_array)
|
||||
//{
|
||||
// ::cpdoccore::oox::xlsx_serialize(_Wostream, f);
|
||||
//}
|
||||
//_Wostream << L"</fills>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,9 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "xlsx_hyperlinks.h"
|
||||
@ -60,11 +57,12 @@ public:
|
||||
|
||||
void dump_rels(rels & Rels) const
|
||||
{
|
||||
BOOST_FOREACH(const record & rec, records_)
|
||||
for (size_t i = 0; i < records_.size(); i++)
|
||||
{
|
||||
if (rec.type == L"External")
|
||||
if (records_[i].type == L"External")
|
||||
{
|
||||
Rels.add( relationship(rec.id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", rec.location, rec.type) );
|
||||
Rels.add( relationship(records_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
||||
records_[i].location, records_[i].type) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +80,7 @@ public:
|
||||
record r;
|
||||
r.ref = ref;
|
||||
r.display = display;
|
||||
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1);
|
||||
r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
|
||||
|
||||
int pos_target = target.find(L"#");
|
||||
if (pos_target == 0)//ссыль на страницу или метку в текущем документе
|
||||
@ -109,23 +107,23 @@ public:
|
||||
|
||||
void xlsx_serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
BOOST_FOREACH(record const & r, records_)
|
||||
for (size_t i = 0; i < records_.size(); i++)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"hyperlink")
|
||||
{
|
||||
CP_XML_ATTR(L"ref", r.ref);
|
||||
CP_XML_ATTR(L"display", r.display);
|
||||
CP_XML_ATTR(L"ref", records_[i].ref);
|
||||
CP_XML_ATTR(L"display", records_[i].display);
|
||||
|
||||
if (!r.location.empty() && r.type == L"Internal")
|
||||
if (!records_[i].location.empty() && records_[i].type == L"Internal")
|
||||
{
|
||||
CP_XML_ATTR(L"location", r.location);
|
||||
CP_XML_ATTR(L"location", records_[i].location);
|
||||
}
|
||||
|
||||
if (!r.id.empty() && r.type == L"External")
|
||||
if (!records_[i].id.empty() && records_[i].type == L"External")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", r.id);
|
||||
CP_XML_ATTR(L"r:id", records_[i].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,9 +55,9 @@ public:
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
|
||||
rels hyperlinks_rels_;
|
||||
rels ole_objects_rels_;
|
||||
rels sheet_rels_;
|
||||
|
||||
std::wstring drawingName_;
|
||||
std::wstring drawingId_;
|
||||
@ -134,15 +134,17 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
|
||||
{
|
||||
return impl_->ole_objects_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::hyperlinks_rels()
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
return impl_->hyperlinks_rels_;
|
||||
}
|
||||
rels & xlsx_xml_worksheet::ole_objects_rels()
|
||||
{
|
||||
return impl_->ole_objects_rels_;
|
||||
return impl_->sheet_rels_;
|
||||
}
|
||||
|
||||
void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -183,8 +185,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (impl_->commentsId_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
@ -196,9 +204,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"oleObjects")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
//CP_XML_NODE(L"rowBreaks){}
|
||||
|
||||
@ -49,8 +49,8 @@ class xlsx_xml_worksheet: noncopyable
|
||||
public:
|
||||
xlsx_xml_worksheet(std::wstring const & name);
|
||||
~xlsx_xml_worksheet();
|
||||
public:
|
||||
std::wstring name() const;
|
||||
|
||||
std::wstring name() const;
|
||||
|
||||
std::wostream & cols();
|
||||
std::wostream & sheetFormat();
|
||||
@ -63,10 +63,10 @@ public:
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
rels & hyperlinks_rels();
|
||||
rels & ole_objects_rels();
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
void set_drawing_link (std::wstring const & fileName, std::wstring const & id);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user