mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 20:36:10 +08:00
Compare commits
209 Commits
core-windo
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 8197fb8900 |
1
.gitignore
vendored
1
.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
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
@ -29,39 +29,32 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma once
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
#include "RegularContainer.h"
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class OfficeArtFRITContainer: public RegularContainer
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF118 = 0xF118;
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("492b3cfa-599e-4bd7-be7f-66de3e48c1cb")]
|
||||
OfficeArtFRITContainer () : RegularContainer()
|
||||
{
|
||||
}
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
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 );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -184,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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>())
|
||||
{
|
||||
@ -446,7 +445,7 @@ namespace DocFileFormat
|
||||
{
|
||||
yCoord = iter->op;
|
||||
}break;
|
||||
// OUTLINE
|
||||
// LINE
|
||||
case lineColor:
|
||||
{
|
||||
RGBColor lineColor((int)iter->op, RedFirst);
|
||||
@ -493,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:
|
||||
{
|
||||
@ -544,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" ));
|
||||
@ -1419,7 +1441,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ((style != NULL) && (anchor != NULL))
|
||||
{
|
||||
DocFormatUtils::Rectangle bounds = anchor->rcgBounds;
|
||||
DocFileFormat::Rectangle bounds = anchor->rcgBounds;
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -103,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
|
||||
{
|
||||
@ -161,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
|
||||
@ -203,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>");
|
||||
|
||||
@ -570,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;
|
||||
@ -3771,6 +3785,42 @@ 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);
|
||||
@ -3797,6 +3847,142 @@ 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;
|
||||
|
||||
@ -381,7 +381,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
|
||||
{
|
||||
@ -464,7 +466,13 @@ extern int g_nCurFormatVersion;
|
||||
Del = 12,
|
||||
Ins = 13,
|
||||
Background = 14,
|
||||
Sdt = 15
|
||||
Sdt = 15,
|
||||
MoveFrom = 16,
|
||||
MoveTo = 17,
|
||||
MoveFromRangeStart = 18,
|
||||
MoveFromRangeEnd = 19,
|
||||
MoveToRangeStart = 20,
|
||||
MoveToRangeEnd = 21
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -1073,6 +1081,17 @@ extern int g_nCurFormatVersion;
|
||||
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)
|
||||
{
|
||||
@ -3229,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);
|
||||
@ -3241,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);
|
||||
@ -3280,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;
|
||||
@ -5587,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;
|
||||
|
||||
@ -178,7 +178,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;
|
||||
|
||||
@ -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 = (
|
||||
|
||||
@ -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);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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") + 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);
|
||||
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"
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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"";
|
||||
}
|
||||
@ -142,8 +145,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
|
||||
|
||||
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
|
||||
@ -240,6 +245,21 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
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") + std::to_wstring(count_shape + 1);
|
||||
|
||||
@ -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;
|
||||
@ -93,7 +98,7 @@ public:
|
||||
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.openxmlformats.org/officeDocument/2006/relationships/media";
|
||||
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";
|
||||
@ -101,10 +106,34 @@ public:
|
||||
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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
#include "oox_data_labels.h"
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
@ -107,6 +107,7 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"path",
|
||||
L"custGeom",//uses sub-sub type,
|
||||
L"polygon",
|
||||
L"roundRect",
|
||||
};
|
||||
|
||||
|
||||
@ -355,7 +356,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type < 9 && sub_type >= 0)
|
||||
else if (sub_type < 10 && sub_type >= 0)
|
||||
{
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
@ -526,14 +527,23 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
|
||||
{
|
||||
//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", val.hId);
|
||||
|
||||
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:snd")
|
||||
{
|
||||
CP_XML_ATTR(L"r:embed", val.hSoundId);
|
||||
CP_XML_ATTR(L"name", L"sound");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,15 +60,22 @@ namespace oox {
|
||||
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;
|
||||
std::wstring action;
|
||||
|
||||
RelsType typeRels;
|
||||
bool highlightClick;
|
||||
@ -95,6 +102,8 @@ namespace oox {
|
||||
std::wstring objectId;
|
||||
std::wstring objectProgId;
|
||||
|
||||
std::wstring extId;
|
||||
|
||||
_action_desc action;
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -130,9 +130,29 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
CP_XML_NODE(L"p:nvPr")
|
||||
{
|
||||
CP_XML_NODE(L"a:videoFile")
|
||||
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_ATTR(L"r:link", val.objectId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -359,12 +379,11 @@ 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)
|
||||
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>
|
||||
|
||||
@ -71,7 +70,8 @@ public:
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
{
|
||||
pptx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
bool bInternal = (d.action.typeRels != typeHyperlink);
|
||||
pptx_drawing_rels_.push_back(_rel(bInternal, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,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>
|
||||
@ -54,7 +53,7 @@ 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") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slide>(name,rId);
|
||||
return boost::make_shared<pptx_xml_slide>(name, rId);
|
||||
}
|
||||
|
||||
pptx_xml_slide::pptx_xml_slide(std::wstring const & name,std::wstring const & id)
|
||||
@ -273,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");
|
||||
@ -283,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")
|
||||
{
|
||||
@ -420,10 +419,14 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << slideMastersData_.str();
|
||||
}
|
||||
CP_XML_NODE(L"p:notesMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slideNotesMastersData_.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();
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
@ -60,6 +59,7 @@ 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;
|
||||
@ -135,6 +135,7 @@ private:
|
||||
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_;
|
||||
@ -160,7 +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:
|
||||
case typeMedia: process_media(objects_[i], drawing); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject: process_object(objects_[i], drawing); break;
|
||||
}
|
||||
@ -369,6 +370,7 @@ void pptx_slide_context::start_action(std::wstring action)
|
||||
|
||||
if (action == L"sound")
|
||||
{
|
||||
impl_->object_description_.action_.action = L"ppaction://noaction";
|
||||
impl_->object_description_.action_.typeRels = typeAudio;
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
@ -403,18 +405,29 @@ void pptx_slide_context::start_action(std::wstring action)
|
||||
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
++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_.highlightClick = true;
|
||||
|
||||
impl_->object_description_.action_.hId = hId;
|
||||
impl_->object_description_.action_.hRef = link;
|
||||
impl_->object_description_.action_.typeRels = typeRels;
|
||||
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()
|
||||
{
|
||||
@ -620,7 +633,26 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
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_)
|
||||
@ -714,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))
|
||||
@ -738,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,8 +189,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")
|
||||
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
//CP_XML_NODE(L"rowBreaks){}
|
||||
|
||||
@ -31,8 +31,6 @@
|
||||
*/
|
||||
#include <vector>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
|
||||
#include "xlsx_sharedstrings.h"
|
||||
@ -55,10 +53,10 @@ void xlsx_shared_strings::Impl::serialize(std::wostream & _Wostream) const
|
||||
_Wostream << L"<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"" <<
|
||||
strings_.size() << "\" uniqueCount=\"" << strings_.size() << "\">";
|
||||
|
||||
BOOST_FOREACH(const std::wstring & str, strings_)
|
||||
for (size_t i = 0; i < strings_.size(); i++)
|
||||
{
|
||||
_Wostream << L"<si>";
|
||||
_Wostream << str;
|
||||
_Wostream << strings_[i];
|
||||
_Wostream << L"</si>";
|
||||
}
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <iostream>
|
||||
#include <iosfwd>
|
||||
#include <cpdoccore/CPScopedPtr.h>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -232,9 +232,9 @@ void xlsx_style_manager::Impl::serialize_xf(std::wostream & _Wostream, const xls
|
||||
std::sort(xfs_.begin(), xfs_.end(), compare_xlsx_xf());
|
||||
|
||||
_Wostream << L"<" << nodeName << L" count=\"" << xfs_.size() << L"\">";
|
||||
BOOST_FOREACH(const xlsx_xf & xfRecord, xfs_)
|
||||
for (size_t i = 0; i < xfs_.size(); i++)
|
||||
{
|
||||
cpdoccore::oox::xlsx_serialize(_Wostream, xfRecord);
|
||||
cpdoccore::oox::xlsx_serialize(_Wostream, xfs_[i]);
|
||||
}
|
||||
_Wostream << L"</" << nodeName << L">";
|
||||
}
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "xlsx_table_metrics.h"
|
||||
|
||||
#include <vector>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "logging.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "xlsx_sharedstrings.h"
|
||||
#include <list>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
|
||||
@ -303,15 +303,15 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
if (filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "../docx/xlsx_textcontext.h"
|
||||
#include "../docx/xlsx_num_format_context.h"
|
||||
|
||||
@ -275,12 +277,12 @@ void object_odf_context::calc_cache_series(std::wstring adress, std::vector<std:
|
||||
oox::getCellAddressInv(ref_1, col_1,row_1);
|
||||
oox::getCellAddressInv(ref_2, col_2,row_2);
|
||||
|
||||
BOOST_FOREACH(_cell & val,cash_values)
|
||||
for (size_t i = 0; i < cash_values.size(); i++)
|
||||
{
|
||||
if (val.col>=col_1 && val.col<=col_2 &&
|
||||
val.row>=row_1 && val.row<=row_2)
|
||||
if (cash_values[i].col >= col_1 && cash_values[i].col <= col_2 &&
|
||||
cash_values[i].row >= row_1 && cash_values[i].row <= row_2)
|
||||
{
|
||||
cash.push_back(val.val);
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,12 +317,12 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
chart_context.add_chart(class_);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(series & s, series_)
|
||||
for (size_t i = 0; i < series_.size(); i++)
|
||||
{
|
||||
if (s.class_ != last_set_type) //разные типы серий в диаграмме - например бар и линия.
|
||||
if (series_[i].class_ != last_set_type) //разные типы серий в диаграмме - например бар и линия.
|
||||
{
|
||||
chart_context.add_chart(s.class_);
|
||||
last_set_type = s.class_;
|
||||
chart_context.add_chart(series_[i].class_);
|
||||
last_set_type = series_[i].class_;
|
||||
}
|
||||
oox::oox_chart_ptr current = chart_context.get_current_chart();
|
||||
|
||||
@ -331,11 +333,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
|
||||
current->add_series(series_id++);
|
||||
|
||||
if (s.cell_range_address_.empty() )
|
||||
s.cell_range_address_ = plot_area_.cell_range_address_; //SplitByColumn (ind_ser,range);
|
||||
if (series_[i].cell_range_address_.empty() )
|
||||
series_[i].cell_range_address_ = plot_area_.cell_range_address_; //SplitByColumn (ind_ser,range);
|
||||
//SplitByRow (ind_ser,range);
|
||||
if (s.cell_range_address_.empty())
|
||||
s.cell_range_address_ = domain_cell_range_adress2_;
|
||||
if (series_[i].cell_range_address_.empty())
|
||||
series_[i].cell_range_address_ = domain_cell_range_adress2_;
|
||||
|
||||
//тут данные нужно поделить по столбцам или строкам - так как в плот-ареа общий диапазон
|
||||
//первый столбец-строка МОЖЕт использоваться для подписей
|
||||
@ -347,7 +349,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
std::vector<std::wstring> cat_cash;
|
||||
|
||||
calc_cache_series (domain_cell_range_adress_, domain_cash);
|
||||
calc_cache_series (s.cell_range_address_, cell_cash);
|
||||
calc_cache_series (series_[i].cell_range_address_, cell_cash);
|
||||
|
||||
if (categories_.size() >0)
|
||||
calc_cache_series (categories_[0], cat_cash);
|
||||
@ -356,8 +358,8 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(bool) boolVal;
|
||||
|
||||
odf_reader::GetProperty(s.properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(s.properties_, L"link-data-style-to-source", boolVal);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", boolVal);
|
||||
|
||||
if ((strVal) && (strVal->length() > 1))
|
||||
{
|
||||
@ -371,7 +373,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (4, domain_cash);
|
||||
//y
|
||||
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
else
|
||||
@ -379,13 +381,13 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (2, domain_cash);
|
||||
//y
|
||||
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //common
|
||||
current->set_formula_series(1, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series(1, cell_cash);
|
||||
}
|
||||
|
||||
@ -394,9 +396,9 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
current->set_formula_series(0, categories_[0], L"General", true);
|
||||
current->set_values_series(0, cat_cash);
|
||||
}
|
||||
current->set_name(s.name_);
|
||||
current->set_name(series_[i].name_);
|
||||
|
||||
current->set_content_series(s);
|
||||
current->set_content_series(series_[i]);
|
||||
}
|
||||
|
||||
std::sort(axises_.begin(), axises_.end(), axises_sort());//file_1_ (1).odp
|
||||
@ -501,9 +503,9 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
|
||||
|
||||
if (!properties)return;
|
||||
|
||||
BOOST_FOREACH(_property const & p, properties->content_)
|
||||
for (size_t i = 0; i < properties->content_.size(); i++)
|
||||
{
|
||||
propertiesOut.push_back(p);
|
||||
propertiesOut.push_back(properties->content_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,10 +86,10 @@ static const class_type_pair class_type_str[] =
|
||||
|
||||
chart::class_type static get_series_class_type(std::wstring const & str)
|
||||
{
|
||||
BOOST_FOREACH(class_type_pair const & p, class_type_str)
|
||||
for (size_t i = 0; i < 12/*class_type_str.size()*/; i++)
|
||||
{
|
||||
if (p.class_type_str_ == str)
|
||||
return p.class_type_;
|
||||
if (class_type_str[i].class_type_str_ == str)
|
||||
return class_type_str[i].class_type_;
|
||||
}
|
||||
return chart::chart_bar; //лучше хоть какой назначить чем никакой !!
|
||||
}
|
||||
|
||||
@ -84,22 +84,22 @@ std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
|
||||
bool parseTime(std::wstring Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::match_results<std::wstring::const_iterator> res;
|
||||
|
||||
//Full clock values:
|
||||
// 02:30:03 = 2 hours, 30 minutes and 3 seconds
|
||||
// 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds
|
||||
|
||||
boost::match_results<std::wstring::const_iterator> res1;
|
||||
boost::wregex r1 (L"([\\d]+):([\\d]+):([\\d+(\\.\\d{0,})?]+)");
|
||||
if (boost::regex_match(Time, res, r1))
|
||||
if (boost::regex_match(Time, res1, r1))
|
||||
{
|
||||
Hours = boost::lexical_cast<int>(res[1].str());
|
||||
Minutes = boost::lexical_cast<int>(res[2].str());
|
||||
Seconds = boost::lexical_cast<double>(res[3].str());
|
||||
Hours = boost::lexical_cast<int>(res1[1].str());
|
||||
Minutes = boost::lexical_cast<int>(res1[2].str());
|
||||
Seconds = boost::lexical_cast<double>(res1[3].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -107,11 +107,12 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
|
||||
// 02:33 = 2 minutes and 33 seconds
|
||||
// 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds
|
||||
std::wstring Time2 = L"00:10.5";
|
||||
boost::match_results<std::wstring::const_iterator> res2;
|
||||
boost::wregex r2 (L"([\\d]+):([\\d+(\\.\\d{0,})?]+)");
|
||||
if (boost::regex_match(Time, res, r2))
|
||||
if (boost::regex_match(Time, res2, r2))
|
||||
{
|
||||
Minutes = boost::lexical_cast<int>(res[1].str());
|
||||
Seconds = boost::lexical_cast<double>(res[2].str());
|
||||
Minutes = boost::lexical_cast<int>(res2[1].str());
|
||||
Seconds = boost::lexical_cast<double>(res2[2].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -121,32 +122,51 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
|
||||
// 30s = 30 seconds
|
||||
// 5ms = 5 milliseconds
|
||||
// 12.467 = 12 seconds and 467 milliseconds
|
||||
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]{0,})");
|
||||
if (boost::regex_match(Time, res, r3))
|
||||
{
|
||||
if (!res[2].str().empty())
|
||||
std::vector<std::wstring> values;
|
||||
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]+)");
|
||||
if (boost::regex_split(std::back_inserter(values), Time, r3, boost::match_default | boost::format_all))
|
||||
{
|
||||
int val = -1;
|
||||
for (size_t i = 0; i < values.size() ; i++ )
|
||||
{
|
||||
std::wstring n = res[2].str();
|
||||
std::transform(n.begin(), n.end(), n.begin(), ::tolower);
|
||||
if (n == L"h")
|
||||
if (values[i].empty()) continue;
|
||||
|
||||
if (values[i] == L"h")
|
||||
{
|
||||
Hours = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Hours = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"min")
|
||||
else if (values[i] == L"min")
|
||||
{
|
||||
Minutes = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Minutes = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"s")
|
||||
else if (values[i] == L"s")
|
||||
{
|
||||
Seconds = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Seconds = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"ms")
|
||||
else if (values[i] == L"ms")
|
||||
{
|
||||
Ms = boost::lexical_cast<int>(res[1].str());
|
||||
if (val >= 0)
|
||||
Ms = val;
|
||||
val = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
val = boost::lexical_cast<double>(values[i]);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Seconds = boost::lexical_cast<double>(res[1].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -687,6 +687,7 @@ void common_shape_draw_attlist::add_attributes( const xml::attributes_wc_ptr & A
|
||||
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
|
||||
CP_APPLY_ATTR(L"draw:name", draw_name_);
|
||||
CP_APPLY_ATTR(L"draw:text-style-name", draw_text_style_name_);
|
||||
CP_APPLY_ATTR(L"drawooo:display", drawooo_display_);
|
||||
}
|
||||
void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Other)
|
||||
{
|
||||
@ -698,6 +699,7 @@ void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Oth
|
||||
_CP_APPLY_PROP2(draw_transform_);
|
||||
_CP_APPLY_PROP2(draw_name_);
|
||||
_CP_APPLY_PROP2(draw_text_style_name_);
|
||||
_CP_APPLY_PROP2(drawooo_display_);
|
||||
}
|
||||
|
||||
void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
|
||||
@ -710,6 +712,7 @@ void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
|
||||
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:display", drawooo_display_);
|
||||
}
|
||||
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
|
||||
@ -501,6 +501,7 @@ public:
|
||||
_CP_OPT(std::wstring) draw_layer_;
|
||||
_CP_OPT(std::wstring) draw_transform_;
|
||||
_CP_OPT(int) draw_z_index_;
|
||||
_CP_OPT(std::wstring) drawooo_display_;
|
||||
};
|
||||
|
||||
class common_draw_position_attlist
|
||||
|
||||
@ -235,7 +235,7 @@ void Compute_HatchFill(draw_hatch * image_style,oox::oox_hatch_fill_ptr fill)
|
||||
int style =0;
|
||||
if (image_style->draw_style_)style = image_style->draw_style_->get_type();
|
||||
|
||||
int angle = (int)(0.5 + *image_style->draw_rotation_/10.);
|
||||
int angle = image_style->draw_rotation_ ? (int)(0.5 + *image_style->draw_rotation_/10.) : 0;
|
||||
|
||||
if (image_style->draw_color_)fill->color_ref = image_style->draw_color_->get_hex_value();
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
@ -67,9 +66,9 @@ namespace odf_reader {
|
||||
namespace {
|
||||
bool IsExistProperty(std::vector<_property> Heap,const std::wstring Name)
|
||||
{
|
||||
BOOST_FOREACH(_property const & p, Heap)
|
||||
for (size_t i = 0; i < Heap.size(); i++)
|
||||
{
|
||||
int res = p.name_.find(Name);
|
||||
int res = Heap[i].name_.find(Name);
|
||||
if (res>=0)
|
||||
{
|
||||
return true;
|
||||
@ -1166,10 +1165,10 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
Context.set_drawing_state_content(true);
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = elm->get_type();
|
||||
elm->docx_convert(Context);
|
||||
ElementType type = content_[i]->get_type();
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
@ -1284,10 +1283,10 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = elm->get_type();
|
||||
elm->docx_convert(Context);
|
||||
ElementType type = content_[i]->get_type();
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.h>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
@ -368,18 +367,18 @@ void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
void draw_plugin::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
// Context.get_slide_context().set_use_image_replacement();
|
||||
//
|
||||
// std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
// std::wstring folderPath = Context.root()->get_folder();
|
||||
// std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
//
|
||||
// Context.get_slide_context().set_media(href);
|
||||
////params
|
||||
// for (size_t i = 0; i < content_.size(); i++)
|
||||
// {
|
||||
// content_[i]->pptx_convert(Context);
|
||||
// }
|
||||
Context.get_slide_context().set_use_image_replacement();
|
||||
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
Context.get_slide_context().set_media(href);
|
||||
//params
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ void draw_shape::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
}
|
||||
void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:id", draw_id_);//или сюда draw_shape_attlist_???
|
||||
CP_APPLY_ATTR(L"draw:id", draw_id_);//или сюда draw_shape_attlist_???
|
||||
|
||||
common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
|
||||
common_draw_attlists_.position_.add_attributes(Attributes);
|
||||
@ -87,6 +87,7 @@ void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_rect_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
CP_APPLY_ATTR(L"draw:corner-radius",draw_corner_radius_);
|
||||
}
|
||||
|
||||
const wchar_t * draw_rect::ns = L"draw";
|
||||
@ -98,6 +99,9 @@ void draw_rect::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 2;
|
||||
|
||||
if (draw_rect_attlist_.draw_corner_radius_)
|
||||
sub_type_ = 9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -101,7 +101,8 @@ public:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) draw_filter_name_;
|
||||
_CP_OPT(std::wstring) draw_filter_name_;
|
||||
_CP_OPT(odf_types::length) draw_corner_radius_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -80,13 +80,13 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
//сначала элементы графики потом все остальное
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = elm->get_type();
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type == typeDrawCustomShape) // || ....
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,13 +95,13 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = elm->get_type();
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type != typeDrawCustomShape)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,9 +120,16 @@ void draw_rect::docx_convert(oox::docx_conversion_context & Context)
|
||||
return;
|
||||
}
|
||||
common_docx_convert(Context);
|
||||
//...
|
||||
draw_shape::docx_convert(Context);
|
||||
|
||||
if (draw_rect_attlist_.draw_corner_radius_)
|
||||
{
|
||||
draw_shape * shape = Context.get_drawing_context().get_current_shape();//owner
|
||||
|
||||
double val = draw_rect_attlist_.draw_corner_radius_->get_value() * 6500;
|
||||
shape->additional_.push_back(_property(L"oox-draw-modifiers", std::to_wstring((int)val)));
|
||||
}
|
||||
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
void draw_ellipse::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -157,6 +164,7 @@ void draw_line::docx_convert(oox::docx_conversion_context & Context)
|
||||
reset_svg_attributes();
|
||||
|
||||
common_docx_convert(Context);
|
||||
//...
|
||||
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
|
||||
@ -136,9 +136,9 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
properties.apply_to(Context.get_slide_context().get_properties());
|
||||
|
||||
BOOST_FOREACH(odf_reader::_property const & p, additional_)
|
||||
for (size_t i = 0; i < additional_.size(); i++)
|
||||
{
|
||||
Context.get_slide_context().set_property(p);
|
||||
Context.get_slide_context().set_property(additional_[i]);
|
||||
}
|
||||
if (!textStyleName.empty())
|
||||
{
|
||||
@ -162,9 +162,9 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_object();
|
||||
BOOST_FOREACH(office_element_ptr const & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
|
||||
|
||||
@ -122,9 +122,9 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
properties.apply_to(Context.get_drawing_context().get_properties());
|
||||
|
||||
BOOST_FOREACH(odf_reader::_property const & p, additional_)
|
||||
for (size_t i = 0; i < additional_.size(); i++)
|
||||
{
|
||||
Context.get_drawing_context().set_property(p);
|
||||
Context.get_drawing_context().set_property(additional_[i]);
|
||||
}
|
||||
|
||||
oox::_oox_fill fill;
|
||||
@ -134,9 +134,9 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_drawing_content();
|
||||
|
||||
BOOST_FOREACH(office_element_ptr const & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
|
||||
@ -244,9 +244,9 @@ xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
mc:Ignorable=\"w14\">";
|
||||
|
||||
BOOST_FOREACH(office_element_ptr elm, style_font_face_)
|
||||
for (size_t i = 0; i < style_font_face_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
style_font_face_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
strm << L"</w:fonts>";
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "list.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -68,10 +66,9 @@ const wchar_t * list_item::name = L"list-item";
|
||||
|
||||
std::wostream & list_item::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
// TODO!!!!
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
parElement->text_to_stream(_Wostream);
|
||||
content_[i]->text_to_stream(_Wostream);
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -104,9 +101,9 @@ void list_item::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.start_list_item(restart);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.end_list_item();
|
||||
@ -123,9 +120,9 @@ void list_item::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
Context.get_text_context().start_list_item(restart);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
|
||||
Context.get_text_context().end_list_item();
|
||||
@ -143,9 +140,9 @@ void list_header::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstring s = Context.current_list_style();
|
||||
Context.end_list();
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.start_list(s, true);
|
||||
@ -156,9 +153,9 @@ void list_header::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
//заголовок это не элемент списка
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
|
||||
}
|
||||
@ -166,10 +163,9 @@ void list_header::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
std::wostream & list_header::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
// TODO!!!!
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
parElement->text_to_stream(_Wostream);
|
||||
content_[i]->text_to_stream(_Wostream);
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "math_elementaries.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "math_elements.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include "math_token_elements.h"
|
||||
#include "style_text_properties.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
@ -342,7 +340,7 @@ void math_menclose::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
|
||||
void math_menclose::oox_convert(oox::math_context & Context)
|
||||
{//0* elements
|
||||
//BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
//for (size_t i = 0; i < content_.size(); i++)
|
||||
//{
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(elm.get());
|
||||
//math_element->oox_convert(Context);
|
||||
@ -368,7 +366,7 @@ void math_mfenced::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
|
||||
void math_mfenced::oox_convert(oox::math_context & Context)
|
||||
{//0* elements
|
||||
//BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
//for (size_t i = 0; i < content_.size(); i++)
|
||||
//{
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(elm.get());
|
||||
//math_element->oox_convert(Context);
|
||||
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
#include "math_limit_elements.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
using namespace odf_types;
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "math_table_elements.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
|
||||
@ -33,8 +33,6 @@
|
||||
#include "math_token_elements.h"
|
||||
#include "style_text_properties.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "note.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -55,9 +54,9 @@ std::wostream & note_citation::text_to_stream(std::wostream & _Wostream) const
|
||||
if (!text_label_.empty())
|
||||
_Wostream << text_label_;
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & element, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
element->text_to_stream(_Wostream);
|
||||
content_[i]->text_to_stream(_Wostream);
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -80,9 +79,9 @@ void note_citation::add_text(const std::wstring & Text)
|
||||
|
||||
void note_citation::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +92,9 @@ const wchar_t * note_body::name = L"note-body";
|
||||
|
||||
std::wostream & note_body::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
BOOST_FOREACH(const office_element_ptr & element, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
element->text_to_stream(_Wostream);
|
||||
content_[i]->text_to_stream(_Wostream);
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -129,9 +128,9 @@ void note_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
Context.set_process_headers_footers (false);
|
||||
Context.set_run_state (runState);
|
||||
|
||||
@ -411,9 +411,9 @@ void number_text::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wstringstream strm;
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, text_)
|
||||
for (size_t i = 0; i < text_.size(); i++)
|
||||
{
|
||||
elm->text_to_stream(strm);
|
||||
text_[i]->text_to_stream(strm);
|
||||
}
|
||||
|
||||
std::wstring text_ = strm.str();
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "odfcontext.h"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#include "office_annotation.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -141,9 +139,9 @@ void office_annotation::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool pState = Context.get_paragraph_state();
|
||||
Context.set_paragraph_state(false);
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.set_run_state(runState);
|
||||
@ -191,9 +189,9 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
|
||||
Context.get_text_context().start_comment_content();
|
||||
BOOST_FOREACH(office_element_ptr const & elm, content_)//текст + текстовый стиль
|
||||
for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.get_comments_context().add_author(author);
|
||||
Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
|
||||
@ -268,9 +266,9 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_comments_context().start_comment(x, y,id_idx.first,id_idx.second);//author & idx (uniq number for author
|
||||
|
||||
Context.get_text_context().start_comment_content();
|
||||
BOOST_FOREACH(office_element_ptr const & elm, content_)//текст + текстовый стиль
|
||||
for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
|
||||
Context.get_comments_context().add_date(date);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user