mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-13 11:25:56 +08:00
Compare commits
311 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 3adcfecfb9 | |||
| db50e87fe0 | |||
| 36bdc7376a | |||
| 1321211336 | |||
| 8c834c5041 | |||
| c75aacaed8 | |||
| a4445cacaa | |||
| d6ad9e84e2 | |||
| d9687387f9 | |||
| eaa01c7995 | |||
| 597f360336 | |||
| d502206726 | |||
| d0d90c641c | |||
| 14fa14de3f | |||
| cced8f4912 | |||
| 2e40b96ed9 | |||
| 50ee7d7cc1 | |||
| f9b54bffd4 | |||
| a52a8e982e | |||
| 128529ba80 | |||
| a571c88798 | |||
| 34bb84a792 | |||
| 92d0d0d7ea | |||
| 449e3fc131 | |||
| ce9fdb33b5 | |||
| 2591f0a202 | |||
| 6bc04fc06f | |||
| 047850dbd6 | |||
| 465b903ec5 | |||
| 6afa54ebef | |||
| 27a0e77ef1 | |||
| c7b45910f8 | |||
| ab1abb96fe | |||
| 566d9e68e4 | |||
| 243b8eccdd | |||
| 76b682063e | |||
| effdab1ff4 | |||
| 658040f77b | |||
| 48aa99af83 | |||
| a1b738fc42 | |||
| 00e9ce56df | |||
| 2a4ce1f93f | |||
| 261e48227d | |||
| 29e3f90ebf | |||
| d4a70d306f | |||
| b9b843f25d | |||
| d7e2bedc6b | |||
| 234459f37c | |||
| 58cd45f4ee | |||
| 33f7ee49df | |||
| e7ed48af49 | |||
| cbd79c902e | |||
| 40c24b1577 | |||
| 95a49140cb | |||
| aad12cf471 | |||
| f0ffb7f14c | |||
| da329135e1 | |||
| 60ca9a2347 | |||
| 5fdace28d2 | |||
| 85549c5b20 | |||
| 4c8bc2227a | |||
| 23ca735f23 | |||
| 4acefb020f | |||
| 684d697cae | |||
| 1aa604c584 | |||
| 51569b626f | |||
| 89d7eb559d | |||
| f6b3a78fe8 | |||
| 1900e2f0a0 | |||
| d0e1785086 | |||
| 221d1ecbb5 | |||
| 2fc3b140d0 | |||
| bdb2ca8241 | |||
| 4055201322 | |||
| 5b305ec75d | |||
| 433686c01f | |||
| ccfc921883 | |||
| 6b0d6fe890 | |||
| 5ae20c58ed | |||
| 7b45fb8931 | |||
| d0ffc6f555 | |||
| 54e5bb8419 | |||
| f7bb1766c0 | |||
| f0bb87ba14 | |||
| a484dc1fd7 | |||
| 19cc78060c | |||
| 2682eda9c6 | |||
| 8d750adb7b | |||
| c517b3ac19 | |||
| f57b28cd24 | |||
| b8215e9e82 | |||
| f6305fca21 | |||
| 4cb984684d | |||
| 903d903aad | |||
| fe53ae9b11 | |||
| 8ca218d600 | |||
| 87a9542fc7 | |||
| 48a1f01220 | |||
| 8a2923e534 | |||
| 0ab7e55add | |||
| cb1cb43a0b | |||
| 0ca3432d05 | |||
| 50208be48d | |||
| c796f4a0f6 | |||
| 618da3c8cc | |||
| 9b4568e81a | |||
| 752acf1e46 | |||
| d9afc49bb3 | |||
| 4c6ba8ed41 | |||
| a0b32c1523 | |||
| a2cc70233e | |||
| 42c35a9803 | |||
| a395420d59 | |||
| c4ca4b5613 | |||
| 8100a2860f | |||
| dd83971001 | |||
| c4abf6d149 | |||
| c749cbf081 | |||
| c7accf4370 | |||
| b49e43c4cb | |||
| 322bc72ad1 | |||
| 33bf2df39d | |||
| aa344408b0 | |||
| 2a5d29c874 | |||
| 50ae01723c | |||
| c05ea1bd21 | |||
| 887905570a | |||
| ce76a7b075 | |||
| 6dda731502 | |||
| 3e9e70655c | |||
| ed9a6e7e5c | |||
| 284b04574a | |||
| 67eb5ac139 | |||
| 563014f8d7 | |||
| 290d845d7a | |||
| 935e9396af | |||
| 4de2649dcd | |||
| a8bcd38bce | |||
| 46bc4e5e96 | |||
| 56475b7e8a | |||
| 69a69d9fc2 | |||
| b470120075 | |||
| 7d2f96d284 | |||
| 0de5fb6bfc | |||
| e753476826 | |||
| 983873d010 | |||
| af037642dd | |||
| 68122490bf | |||
| 4833c652d8 | |||
| af0e9be136 | |||
| d987233335 | |||
| 5f100d4ea0 | |||
| d4e34e244f | |||
| 4b8bc2c8e7 | |||
| b04f44ee2c | |||
| fb3b6aff47 | |||
| 531460e37d | |||
| 09407b08ba | |||
| 83bc1b18b6 | |||
| 56279f7465 | |||
| 566eeb06ae | |||
| 7dc6d70b8a | |||
| f5c359650f | |||
| d665d9449e | |||
| 3c93563027 | |||
| b525e1deb4 | |||
| d5b80e2fa3 | |||
| 2bc2039c01 | |||
| a0fdb1cbcc | |||
| 664007983d | |||
| a15aee3244 | |||
| 5e034e2877 | |||
| 8d77cdaf24 | |||
| e73b5c29b2 | |||
| 6a3b4d12a5 | |||
| 992e62b8c8 | |||
| 021e01af4e | |||
| 55a1a2ca59 | |||
| e644ef4062 | |||
| 05bf38a35d | |||
| 45d51a0002 | |||
| 247f0a7d89 | |||
| 7c621a4a81 | |||
| 62ba68aaa8 | |||
| 0a816a2d6d | |||
| c64a33f42d | |||
| 0599018f99 | |||
| bf8bea5d07 | |||
| d9bd1cdb32 | |||
| e1a8bd3b3d | |||
| a8f7a1f044 | |||
| 17e8cfcaa8 | |||
| 5d4bdccbac | |||
| 5c43b5743d | |||
| 0af0739792 | |||
| a2034c19c7 | |||
| 5ae24e7e32 | |||
| cc69c8c1b4 | |||
| d0b2acb6b3 | |||
| 7df5ff1aeb | |||
| 7ea2b40585 | |||
| 163fc24ad6 | |||
| a7058f0dbd | |||
| bac1fee526 | |||
| eeb7d2ce09 | |||
| 4bbca69cf0 | |||
| dd43fe62d9 | |||
| 5631c4d57d | |||
| 7fd99856c4 | |||
| 88cde2bbfb | |||
| 61cadf944f | |||
| b86c6785dd | |||
| 1322918d6b | |||
| 9c602642e1 | |||
| d55edaad17 | |||
| 7dc887ff51 | |||
| 140b511c7e | |||
| eade6a9377 | |||
| 020557281c | |||
| 01f30301ed | |||
| 758ae9a1da | |||
| 99bcce647c | |||
| dcf6fadcad | |||
| 7ed3410362 | |||
| 0b3c1b8d55 | |||
| 628cb55e9b | |||
| b6ad4dd76c | |||
| bbb46566d6 | |||
| a17fa6ea9a | |||
| bb7f417889 | |||
| e6adb77560 | |||
| fa94d74a1d | |||
| cd83fa27b9 | |||
| 1db705b00d | |||
| 45237ad7d4 | |||
| d44aa0d28a | |||
| 405396afca | |||
| 3ec6827f76 | |||
| dfc92584f7 | |||
| 743488b7a5 | |||
| fca8c8b09c | |||
| 2b36fe96a2 | |||
| ed90117493 | |||
| f0cd60b93c | |||
| ca9e385bbc | |||
| cfe9398ff0 | |||
| 16728b5195 | |||
| c53b93b24c | |||
| c3cd1afa85 | |||
| 84f1c05d5f | |||
| 49aa15a751 | |||
| 0c5410df72 | |||
| 9b3c92d5f5 | |||
| a4881cd241 | |||
| 4b6a14f617 | |||
| c4013d747c | |||
| 98e31947cc | |||
| 86378add6a | |||
| d00536d05d | |||
| 377d79cfc6 | |||
| cfe59582fc | |||
| 2256d3ae5d | |||
| a8b57060ce | |||
| 655dd97626 | |||
| 451b4920c7 | |||
| b214dc93d8 | |||
| a2d0c4ad7d | |||
| 43f29d2877 | |||
| 5f5f22a0f0 | |||
| 5256afe04c | |||
| b9080eb9c2 | |||
| 5649fb3e2e | |||
| 348b8e4045 | |||
| 2087e9f195 | |||
| ccd84e1850 | |||
| 08ca56873e | |||
| 72761a21e3 | |||
| 9e5a1f004e | |||
| 57fea23de4 | |||
| bc67fc8e55 | |||
| 4aae1b21e9 | |||
| ae69f892f1 | |||
| 93d8634ca3 | |||
| bdd4b68f43 | |||
| a9a674c895 | |||
| ed575b3b68 | |||
| 016d46d030 | |||
| 486685e4b4 | |||
| 26a6a77b8d | |||
| 90aa7973ed | |||
| b2363c02c0 | |||
| 32b59120aa | |||
| 7186b56b64 | |||
| 6247490047 | |||
| f30e14c421 | |||
| e340a2af22 | |||
| 6a5cddf0ce | |||
| 312728fe9a | |||
| 182da130da | |||
| eb3ba8c42e | |||
| dec099b19b | |||
| 44491bbbb4 | |||
| d44ef86319 | |||
| 2f42dc2c35 | |||
| ffeb03e0d0 | |||
| cf4d74a7e3 | |||
| 90c0633212 | |||
| 3ea4898939 | |||
| 1d00c343c6 | |||
| 2a408f0e2b | |||
| 047d0567e1 |
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -58,6 +58,9 @@
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
|
||||
#define GETBIT(from, num) ((from & (1 << num)) != 0)
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
typedef unsigned char Bool8;
|
||||
@ -638,14 +641,12 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
std::string sCodePage;
|
||||
for (int i = 0; i < UNICODE_CONVERTER_ENCODINGS_COUNT; ++i)
|
||||
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
|
||||
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
|
||||
{
|
||||
if (code_page == NSUnicodeConverter::Encodings[i].WindowsCodePage)
|
||||
{
|
||||
sCodePage = NSUnicodeConverter::Encodings[i].Name;
|
||||
break;
|
||||
}
|
||||
sCodePage = pFind->second;
|
||||
}
|
||||
|
||||
if (sCodePage.empty())
|
||||
sCodePage = "CP1250"/* + std::to_string(code_page)*/;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -41,7 +41,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
AnnotationOwnerList(FileInformationBlock* fib, POLE::Stream* tableStream) : std::vector<std::wstring>()
|
||||
{
|
||||
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcGrpXstAtnOwners > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -40,7 +40,7 @@ namespace DocFileFormat
|
||||
|
||||
//read the user initials (LPXCharBuffer9)
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
short cch = reader->ReadByte();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -41,9 +41,9 @@ namespace DocFileFormat
|
||||
static const int STRUCTURE_SIZE = 30;
|
||||
static const int STRUCTURE_SIZE_OLD = 20;
|
||||
|
||||
static const int GetSize(bool bOldVersion)
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return bOldVersion ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
inline std::wstring GetUserInitials() const
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -118,70 +118,78 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
/// Creates a new BorderCode with default values
|
||||
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
{
|
||||
}
|
||||
|
||||
/// Parses the unsigned char for a BRC
|
||||
BorderCode( unsigned char* bytes, int size ):
|
||||
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
{
|
||||
if ( FormatUtils::ArraySum( bytes, size ) == ( size * 255 ) )
|
||||
{
|
||||
this->fNil = true;
|
||||
fNil = true;
|
||||
}
|
||||
else if ( size == 8 )
|
||||
{
|
||||
//it's a border code of Word 2000/2003
|
||||
this->cv = FormatUtils::BytesToInt32( bytes, 0, size );
|
||||
this->ico = std::wstring( Global::ColorIdentifier[0] );
|
||||
cv = FormatUtils::BytesToInt32( bytes, 0, size );
|
||||
ico = std::wstring( Global::ColorIdentifier[0] );
|
||||
|
||||
this->dptLineWidth = bytes[4];
|
||||
this->brcType = bytes[5];
|
||||
dptLineWidth = bytes[4];
|
||||
brcType = bytes[5];
|
||||
|
||||
short val = FormatUtils::BytesToInt16( bytes, 6, size );
|
||||
this->dptSpace = val & 0x001F;
|
||||
dptSpace = val & 0x001F;
|
||||
|
||||
//not sure if this is correct, the values from the spec are definitly wrong:
|
||||
this->fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
|
||||
this->fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
|
||||
fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
|
||||
fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
|
||||
}
|
||||
else if ( size == 4 )
|
||||
{
|
||||
//it's a border code of Word 97
|
||||
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
|
||||
this->dptLineWidth = (unsigned char)( val & 0x00FF );
|
||||
this->brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
|
||||
|
||||
dptLineWidth = (unsigned char)( val & 0x00FF );
|
||||
brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
|
||||
|
||||
val = FormatUtils::BytesToUInt16( bytes, 2, size );
|
||||
this->ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorIdentifier[0][0], 17, 12 );
|
||||
this->dptSpace = ( val & 0x1F00 ) >> 8;
|
||||
|
||||
ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorNameIdentifier[0][0], 17, 12 );
|
||||
dptSpace = ( val & 0x1F00 ) >> 8;
|
||||
}
|
||||
else
|
||||
else if (size == 2)
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct BRC, the length of the struct doesn't match");
|
||||
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
|
||||
|
||||
dptLineWidth = GETBITS(val, 0, 2);
|
||||
brcType = GETBITS(val, 3, 4);
|
||||
fShadow = GETBIT(val, 5);
|
||||
ico = FormatUtils::MapValueToWideString(GETBITS(val, 6, 10), &Global::ColorNameIdentifier[0][0], 17, 12 );
|
||||
dptSpace = GETBITS(val, 11, 15);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BorderCode( const BorderCode& bc )
|
||||
{
|
||||
if ( this != &bc )
|
||||
{
|
||||
this->cv = bc.cv;
|
||||
this->dptLineWidth = bc.dptLineWidth;
|
||||
this->brcType = bc.brcType;
|
||||
this->ico = bc.ico;
|
||||
this->dptSpace = bc.dptSpace;
|
||||
this->fShadow = bc.fShadow;
|
||||
this->fFrame = bc.fFrame;
|
||||
this->fNil = bc.fNil;
|
||||
cv = bc.cv;
|
||||
dptLineWidth = bc.dptLineWidth;
|
||||
brcType = bc.brcType;
|
||||
ico = bc.ico;
|
||||
dptSpace = bc.dptSpace;
|
||||
fShadow = bc.fShadow;
|
||||
fFrame = bc.fFrame;
|
||||
fNil = bc.fNil;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator == ( const BorderCode& bc )
|
||||
{
|
||||
if ( ( this->cv == bc.cv ) && ( this->dptLineWidth == bc.dptLineWidth ) && ( this->brcType == bc.brcType ) &&
|
||||
( this->ico == bc.ico ) && ( this->dptSpace == bc.dptSpace ) && ( this->fShadow == bc.fShadow ) &&
|
||||
( this->fFrame == bc.fFrame ) && ( this->fNil == bc.fNil ) )
|
||||
if ( ( cv == bc.cv ) && ( dptLineWidth == bc.dptLineWidth ) && ( brcType == bc.brcType ) &&
|
||||
( ico == bc.ico ) && ( dptSpace == bc.dptSpace ) && ( fShadow == bc.fShadow ) &&
|
||||
( fFrame == bc.fFrame ) && ( fNil == bc.fNil ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -129,357 +129,360 @@ namespace DocFileFormat
|
||||
parent->AppendChild( *webHidden );
|
||||
RELEASEOBJECT( webHidden );
|
||||
}
|
||||
std::list<SinglePropertyModifier>::iterator end = sprms->end();
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
|
||||
if ((sprms) && (!sprms->empty()))
|
||||
{
|
||||
int nProperty = 0; //for unknown test
|
||||
|
||||
switch ( (int)( iter->OpCode ) )
|
||||
std::list<SinglePropertyModifier>::iterator end = sprms->end();
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
|
||||
{
|
||||
case sprmOldCIstd :
|
||||
case sprmCIstd : // style id
|
||||
int nProperty = 0; //for unknown test
|
||||
|
||||
switch ( (int)( iter->OpCode ) )
|
||||
{
|
||||
if (_isRunStyleNeeded && !_webHidden)
|
||||
case sprmOldCIstd :
|
||||
case sprmCIstd : // style id
|
||||
{
|
||||
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (_currentIstd < _doc->Styles->Styles->size())
|
||||
if (_isRunStyleNeeded && !_webHidden)
|
||||
{
|
||||
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
|
||||
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (_currentIstd < _doc->Styles->Styles->size())
|
||||
{
|
||||
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCFBiDi :
|
||||
appendFlagElement( parent, *iter, L"rtl", true );
|
||||
_isRTL = true;
|
||||
break;
|
||||
|
||||
case sprmOldCFBold :
|
||||
case sprmCFBold :
|
||||
appendFlagElement( parent, *iter, L"b", true );
|
||||
break;
|
||||
|
||||
case sprmCFBoldBi :
|
||||
appendFlagElement( parent, *iter, L"bCs", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFCaps :
|
||||
case sprmCFCaps :
|
||||
appendFlagElement( parent, *iter, L"caps", true );
|
||||
break;
|
||||
|
||||
case sprmCFComplexScripts :
|
||||
appendFlagElement( parent, *iter, L"cs", true );
|
||||
break;
|
||||
|
||||
case sprmCFDStrike :
|
||||
appendFlagElement( parent, *iter, L"dstrike", true );
|
||||
break;
|
||||
|
||||
case sprmCFEmboss :
|
||||
appendFlagElement( parent, *iter, L"emboss", true );
|
||||
break;
|
||||
|
||||
case sprmCFImprint :
|
||||
appendFlagElement( parent, *iter, L"imprint", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFItalic :
|
||||
case sprmCFItalic :
|
||||
appendFlagElement( parent, *iter, L"i", true );
|
||||
break;
|
||||
|
||||
case sprmCFItalicBi:
|
||||
appendFlagElement( parent, *iter, L"iCs", true );
|
||||
break;
|
||||
|
||||
case 0x0875:
|
||||
appendFlagElement( parent, *iter, L"noProof", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFOutline:
|
||||
case sprmCFOutline:
|
||||
appendFlagElement( parent, *iter, L"outline", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFShadow:
|
||||
case sprmCFShadow:
|
||||
appendFlagElement( parent, *iter, L"shadow", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFSmallCaps:
|
||||
case sprmCFSmallCaps:
|
||||
appendFlagElement( parent, *iter, L"smallCaps", true );
|
||||
break;
|
||||
|
||||
case sprmCFSpecVanish:
|
||||
appendFlagElement( parent, *iter, L"specVanish", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFStrike:
|
||||
case sprmCFStrike:
|
||||
appendFlagElement( parent, *iter, L"strike", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFVanish:
|
||||
case sprmCFVanish:
|
||||
appendFlagElement( parent, *iter, L"vanish", true );
|
||||
break;
|
||||
|
||||
case 0x0811:
|
||||
appendFlagElement( parent, *iter, L"webHidden", true );
|
||||
break;
|
||||
|
||||
case sprmOldCIss:
|
||||
case sprmCIss:
|
||||
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
|
||||
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
|
||||
break;
|
||||
|
||||
case sprmCRgLid0_80:
|
||||
case sprmCRgLid0:
|
||||
{ //latin
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
{ //east asia
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCBrc80:
|
||||
case sprmCBrc:
|
||||
{ //borders
|
||||
XMLTools::XMLElement bdr( L"w:bdr" );
|
||||
BorderCode bc( iter->Arguments, iter->argumentsSize );
|
||||
appendBorderAttributes( &bc, &bdr );
|
||||
parent->AppendChild( bdr );
|
||||
}break;
|
||||
|
||||
case sprmCShd80:
|
||||
case sprmCShd:
|
||||
{ //shading
|
||||
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
appendShading( parent, desc );
|
||||
}break;
|
||||
|
||||
case sprmOldCIco:
|
||||
case sprmCIco:
|
||||
case sprmCIcoBi:
|
||||
{//color
|
||||
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
|
||||
}break;
|
||||
|
||||
case sprmCCv:
|
||||
{
|
||||
std::wstringstream sstream;
|
||||
|
||||
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
|
||||
colorVal->SetValue(sstream.str());
|
||||
}break;
|
||||
|
||||
case sprmCOldHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
case sprmCHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCDxaSpace:
|
||||
case sprmCDxaSpace:
|
||||
{
|
||||
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCFtcBi :
|
||||
{//default from FontTable
|
||||
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
if (ffn)
|
||||
m_sDefaultFont = ffn->xszFtn;
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCHpsBi :
|
||||
{
|
||||
appendValueElement( parent, L"szCs",
|
||||
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}
|
||||
break;
|
||||
// Font Size in points (2~3276) default 20-half-points
|
||||
case sprmOldCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
|
||||
true );
|
||||
}break;
|
||||
case sprmCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCMajority :
|
||||
{ //for complex props
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
case sprmCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
{
|
||||
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sAsciiFont = ffn->xszFtn;
|
||||
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
|
||||
rFonts->AppendAttribute( *ascii );
|
||||
RELEASEOBJECT( ascii );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sEastAsiaFont = ffn->xszFtn;
|
||||
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
|
||||
rFonts->AppendAttribute( *eastAsia );
|
||||
RELEASEOBJECT( eastAsia );
|
||||
}
|
||||
}
|
||||
}break;
|
||||
break;
|
||||
|
||||
case sprmCFBiDi :
|
||||
appendFlagElement( parent, *iter, L"rtl", true );
|
||||
_isRTL = true;
|
||||
break;
|
||||
|
||||
case sprmOldCFBold :
|
||||
case sprmCFBold :
|
||||
appendFlagElement( parent, *iter, L"b", true );
|
||||
break;
|
||||
|
||||
case sprmCFBoldBi :
|
||||
appendFlagElement( parent, *iter, L"bCs", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFCaps :
|
||||
case sprmCFCaps :
|
||||
appendFlagElement( parent, *iter, L"caps", true );
|
||||
break;
|
||||
|
||||
case sprmCFComplexScripts :
|
||||
appendFlagElement( parent, *iter, L"cs", true );
|
||||
break;
|
||||
|
||||
case sprmCFDStrike :
|
||||
appendFlagElement( parent, *iter, L"dstrike", true );
|
||||
break;
|
||||
|
||||
case sprmCFEmboss :
|
||||
appendFlagElement( parent, *iter, L"emboss", true );
|
||||
break;
|
||||
|
||||
case sprmCFImprint :
|
||||
appendFlagElement( parent, *iter, L"imprint", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFItalic :
|
||||
case sprmCFItalic :
|
||||
appendFlagElement( parent, *iter, L"i", true );
|
||||
break;
|
||||
|
||||
case sprmCFItalicBi:
|
||||
appendFlagElement( parent, *iter, L"iCs", true );
|
||||
break;
|
||||
|
||||
case 0x0875:
|
||||
appendFlagElement( parent, *iter, L"noProof", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFOutline:
|
||||
case sprmCFOutline:
|
||||
appendFlagElement( parent, *iter, L"outline", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFShadow:
|
||||
case sprmCFShadow:
|
||||
appendFlagElement( parent, *iter, L"shadow", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFSmallCaps:
|
||||
case sprmCFSmallCaps:
|
||||
appendFlagElement( parent, *iter, L"smallCaps", true );
|
||||
break;
|
||||
|
||||
case sprmCFSpecVanish:
|
||||
appendFlagElement( parent, *iter, L"specVanish", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFStrike:
|
||||
case sprmCFStrike:
|
||||
appendFlagElement( parent, *iter, L"strike", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFVanish:
|
||||
case sprmCFVanish:
|
||||
appendFlagElement( parent, *iter, L"vanish", true );
|
||||
break;
|
||||
|
||||
case 0x0811:
|
||||
appendFlagElement( parent, *iter, L"webHidden", true );
|
||||
break;
|
||||
|
||||
case sprmOldCIss:
|
||||
case sprmCIss:
|
||||
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
|
||||
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
|
||||
break;
|
||||
|
||||
case sprmCRgLid0_80:
|
||||
case sprmCRgLid0:
|
||||
{ //latin
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
{ //east asia
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCBrc80:
|
||||
case sprmCBrc:
|
||||
{ //borders
|
||||
XMLTools::XMLElement bdr( L"w:bdr" );
|
||||
BorderCode bc( iter->Arguments, iter->argumentsSize );
|
||||
appendBorderAttributes( &bc, &bdr );
|
||||
parent->AppendChild( bdr );
|
||||
}break;
|
||||
|
||||
case sprmCShd80:
|
||||
case sprmCShd:
|
||||
{ //shading
|
||||
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
appendShading( parent, desc );
|
||||
}break;
|
||||
|
||||
case sprmOldCIco:
|
||||
case sprmCIco:
|
||||
case sprmCIcoBi:
|
||||
{//color
|
||||
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
|
||||
}break;
|
||||
|
||||
case sprmCCv:
|
||||
{
|
||||
std::wstringstream sstream;
|
||||
|
||||
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
|
||||
colorVal->SetValue(sstream.str());
|
||||
}break;
|
||||
|
||||
case sprmCOldHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
case sprmCHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCDxaSpace:
|
||||
case sprmCDxaSpace:
|
||||
{
|
||||
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCFtcBi :
|
||||
{//default from FontTable
|
||||
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
if (ffn)
|
||||
m_sDefaultFont = ffn->xszFtn;
|
||||
}
|
||||
}break;
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
case sprmCHpsBi :
|
||||
{
|
||||
appendValueElement( parent, L"szCs",
|
||||
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}
|
||||
break;
|
||||
// Font Size in points (2~3276) default 20-half-points
|
||||
case sprmOldCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
|
||||
true );
|
||||
}break;
|
||||
case sprmCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCMajority :
|
||||
{ //for complex props
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
case sprmCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
{
|
||||
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sAsciiFont = ffn->xszFtn;
|
||||
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
|
||||
rFonts->AppendAttribute( *ascii );
|
||||
RELEASEOBJECT( ascii );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sEastAsiaFont = ffn->xszFtn;
|
||||
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
|
||||
rFonts->AppendAttribute( *eastAsia );
|
||||
RELEASEOBJECT( eastAsia );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_shAnsiFont = ffn->xszFtn;
|
||||
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
|
||||
rFonts->AppendAttribute( *ansi );
|
||||
RELEASEOBJECT( ansi );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
{ //Underlining
|
||||
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCCharScale:
|
||||
{ //char width
|
||||
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCSfxText:
|
||||
{ //animation
|
||||
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
|
||||
}break;
|
||||
|
||||
case sprmCIdctHint:
|
||||
{
|
||||
switch(iter->Arguments[0])
|
||||
{
|
||||
case 0: break; // default
|
||||
case 1: break; // eastAsia
|
||||
case 2: break; // cs
|
||||
case 0xFF: break; //No ST_Hint equivalent
|
||||
}
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCPbiIBullet:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (nIndex >=0)
|
||||
{
|
||||
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
|
||||
if (it != _doc->PictureBulletsCPsMap.end())
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
//добавить
|
||||
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_shAnsiFont = ffn->xszFtn;
|
||||
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
|
||||
rFonts->AppendAttribute( *ansi );
|
||||
RELEASEOBJECT( ansi );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
{ //Underlining
|
||||
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
|
||||
}
|
||||
}break;
|
||||
break;
|
||||
|
||||
case sprmCPbiGrf:
|
||||
{
|
||||
//used picture bullet
|
||||
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
case sprmCCharScale:
|
||||
{ //char width
|
||||
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCSfxText:
|
||||
{ //animation
|
||||
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
|
||||
}break;
|
||||
|
||||
}break;
|
||||
case sprmCIdctHint:
|
||||
{
|
||||
switch(iter->Arguments[0])
|
||||
{
|
||||
case 0: break; // default
|
||||
case 1: break; // eastAsia
|
||||
case 2: break; // cs
|
||||
case 0xFF: break; //No ST_Hint equivalent
|
||||
}
|
||||
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
}break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}else
|
||||
if (iter->argumentsSize == 1)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
case sprmCPbiIBullet:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (nIndex >=0)
|
||||
{
|
||||
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
|
||||
if (it != _doc->PictureBulletsCPsMap.end())
|
||||
{
|
||||
//добавить
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCPbiGrf:
|
||||
{
|
||||
//used picture bullet
|
||||
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}else
|
||||
if (iter->argumentsSize == 1)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -35,19 +35,188 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class CharacterPropertyExceptions: public PropertyExceptions
|
||||
{
|
||||
public:
|
||||
/// Creates a CHPX wich doesn't modify anything.
|
||||
/// The grpprl list is empty
|
||||
CharacterPropertyExceptions(): PropertyExceptions()
|
||||
{
|
||||
}
|
||||
class CharacterPropertyExceptions: public PropertyExceptions
|
||||
{
|
||||
public:
|
||||
/// Creates a CHPX wich doesn't modify anything.
|
||||
/// The grpprl list is empty
|
||||
CharacterPropertyExceptions(): PropertyExceptions()
|
||||
{
|
||||
}
|
||||
|
||||
/// Parses the bytes to retrieve a CHPX
|
||||
CharacterPropertyExceptions( unsigned char* bytes, int size, bool oldVersion) :
|
||||
PropertyExceptions( bytes, size, oldVersion )
|
||||
{
|
||||
}
|
||||
};
|
||||
/// Parses the bytes to retrieve a CHPX
|
||||
CharacterPropertyExceptions( unsigned char* bytes, int size, int nWordVersion) :
|
||||
PropertyExceptions( bytes, size, nWordVersion )
|
||||
{
|
||||
if (nWordVersion > 1)
|
||||
{
|
||||
RELEASEOBJECT( grpprl );
|
||||
grpprl = new std::list<SinglePropertyModifier>();
|
||||
|
||||
MemoryStream oStream(bytes, size);
|
||||
int pos = 0;
|
||||
|
||||
if (nWordVersion == 3)
|
||||
{
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned char val;
|
||||
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
|
||||
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
|
||||
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
|
||||
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
|
||||
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
|
||||
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
|
||||
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
|
||||
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
|
||||
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
|
||||
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
|
||||
|
||||
bool fsIco = GETBIT(fChar, 10);
|
||||
bool fsFtc = GETBIT(fChar, 11);
|
||||
bool fsHps = GETBIT(fChar, 12);
|
||||
bool fsKul = GETBIT(fChar, 13);
|
||||
bool fsPos = GETBIT(fChar, 14);
|
||||
bool fsSpace = GETBIT(fChar, 15);
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
int fff = oStream.ReadUInt16(); pos += 2;//?????
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
|
||||
|
||||
if (hps > 0)
|
||||
{
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
|
||||
}
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fText = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned short qpsSpace = GETBITS(fText, 0, 5);
|
||||
unsigned char wSpare2 = GETBITS(fText, 6, 7);
|
||||
unsigned char ico = GETBITS(fText, 8, 11);
|
||||
unsigned char kul = GETBITS(fText, 12, 14);
|
||||
bool fSysVanish = GETBIT(fChar, 15);
|
||||
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
|
||||
|
||||
//sizeof(CHP) == 12 == 0xC
|
||||
if (pos + 4 > size) return;
|
||||
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char fnPic = oStream.ReadByte(); pos += 1;
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
|
||||
}
|
||||
else if (nWordVersion == 2)
|
||||
{
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned char val;
|
||||
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
|
||||
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
|
||||
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCIbstRMark, 1, &val));
|
||||
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
|
||||
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
|
||||
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
|
||||
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
|
||||
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
|
||||
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
|
||||
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
|
||||
val = GETBIT(fChar, 10); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
|
||||
val = GETBIT(fChar, 11); grpprl->push_back(SinglePropertyModifier(sprmOldCFObj, 1, &val));
|
||||
val = GETBIT(fChar, 12); grpprl->push_back(SinglePropertyModifier(sprmCFBoldBi, 1, &val));
|
||||
val = GETBIT(fChar, 13); grpprl->push_back(SinglePropertyModifier(sprmCFItalicBi, 1, &val));
|
||||
val = GETBIT(fChar, 14); grpprl->push_back(SinglePropertyModifier(sprmCFBiDi, 1, &val));
|
||||
val = GETBIT(fChar, 15); grpprl->push_back(SinglePropertyModifier(sprmCFDiacColor, 1, &val));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar2 = oStream.ReadUInt16(); pos += 2;
|
||||
bool fsIco = GETBIT(fChar2, 0);
|
||||
bool fsFtc = GETBIT(fChar2, 1);
|
||||
bool fsHps = GETBIT(fChar2, 2);
|
||||
bool fsKul = GETBIT(fChar2, 3);
|
||||
bool fsPos = GETBIT(fChar2, 4);
|
||||
bool fsSpace = GETBIT(fChar2, 5);
|
||||
bool fsLid = GETBIT(fChar2, 6);
|
||||
bool fsIcoBi = GETBIT(fChar2, 7);
|
||||
bool fsFtcBi = GETBIT(fChar2, 8);
|
||||
bool fsHpsBi = GETBIT(fChar2, 9);
|
||||
bool fsLidBi = GETBIT(fChar2, 10);
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
|
||||
|
||||
if (hps > 0)
|
||||
{
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
|
||||
}
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fText = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned short qpsSpace = GETBITS(fText, 0, 5);
|
||||
unsigned char wSpare2 = GETBITS(fText, 6, 7);
|
||||
unsigned char ico = GETBITS(fText, 8, 11);
|
||||
unsigned char kul = GETBITS(fText, 12, 14);
|
||||
bool fSysVanish = GETBIT(fChar, 15);
|
||||
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
|
||||
|
||||
//if (pos + 1 > size) return;
|
||||
//unsigned char icoBi = oStream.ReadUInt16(); pos += 1;//wSpare3
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short lid = oStream.ReadUInt16(); pos += 2;
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCLid, 2, (BYTE*)&lid));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftcBi = oStream.ReadUInt16(); pos += 2;
|
||||
grpprl->push_back(SinglePropertyModifier(sprmCFtcBi, 4, (BYTE*)&ftcBi));
|
||||
|
||||
//if (pos + 2 > size) return;
|
||||
//unsigned short hpsBi = oStream.ReadUInt16(); pos += 2;
|
||||
//grpprl->push_back(SinglePropertyModifier(sprmCHpsBi, 4, (BYTE*)&hpsBi));
|
||||
|
||||
//if (pos + 2 > size) return;
|
||||
//unsigned short lidBi = oStream.ReadUInt16(); pos += 2;
|
||||
//grpprl->push_back(SinglePropertyModifier(sprmCLidBi, 2, (BYTE*)&lidBi));
|
||||
|
||||
if (pos + 4 > size) return;
|
||||
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char fnPic = oStream.ReadByte(); pos += 1;
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -72,10 +72,14 @@ namespace DocFileFormat
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
|
||||
unsigned short index_author = atrdPre10->GetAuthorIndex();
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
|
||||
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
|
||||
//!!!TODO!!!
|
||||
@ -95,7 +99,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx(fc);
|
||||
TableInfo tai(papx);
|
||||
TableInfo tai(papx, m_document->nWordVersion);
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -107,7 +111,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph(cp);
|
||||
cp = writeParagraph(cp, 0x7fffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -163,6 +163,7 @@ namespace OpenXmlRelationshipTypes
|
||||
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
|
||||
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
|
||||
static const wchar_t* Hyperlink = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||
}
|
||||
|
||||
namespace MicrosoftWordRelationshipTypes
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -59,29 +59,30 @@ namespace DocFileFormat
|
||||
short wdy;
|
||||
|
||||
public:
|
||||
/// Creates a new DateAndTime with default values
|
||||
DateAndTime()
|
||||
{
|
||||
setDefaultValues();
|
||||
}
|
||||
|
||||
/// Parses the unsigned char sto retrieve a DateAndTime
|
||||
DateAndTime( unsigned char* bytes, int size )
|
||||
{
|
||||
if ( size == 4 )
|
||||
{
|
||||
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
|
||||
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
|
||||
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
|
||||
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
|
||||
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
|
||||
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
DateAndTime()
|
||||
{
|
||||
setDefaultValues();
|
||||
}
|
||||
DateAndTime( unsigned int val )
|
||||
{
|
||||
DateAndTime((unsigned char*)&val, 4);
|
||||
}
|
||||
DateAndTime( unsigned char* bytes, int size )
|
||||
{
|
||||
if ( size == 4 )
|
||||
{
|
||||
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
|
||||
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
|
||||
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
|
||||
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
|
||||
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
|
||||
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
SYSTEMTIME ToSYSTEMTIME()
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -39,10 +39,12 @@
|
||||
#include "../Common/TextMark.h"
|
||||
#include "../Common/FormatUtils.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
_fldCharCounter(0), AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
@ -50,17 +52,15 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
|
||||
//--------------------------------------------
|
||||
_embeddedObject = false;
|
||||
_writeInstrText = false;
|
||||
}
|
||||
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
|
||||
_fldCharCounter(0), AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
|
||||
_commentNr(0), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
@ -68,7 +68,6 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
_embeddedObject = false;
|
||||
@ -90,6 +89,11 @@ namespace DocFileFormat
|
||||
//if cp is the last char of a section, the next section will start at cp +1
|
||||
size_t current = 0;
|
||||
|
||||
if (m_document->SectionPlex->CharacterPositions.empty())
|
||||
{
|
||||
return cp;
|
||||
}
|
||||
|
||||
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
|
||||
{
|
||||
if (cp < *iter)
|
||||
@ -141,7 +145,7 @@ namespace DocFileFormat
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
|
||||
int DocumentMapping::writeParagraph(int cp)
|
||||
int DocumentMapping::writeParagraph(int cp, int cpEnd)
|
||||
{
|
||||
//search the paragraph end
|
||||
int cpParaEnd = cp;
|
||||
@ -171,7 +175,7 @@ namespace DocFileFormat
|
||||
{
|
||||
cpParaEnd++;
|
||||
|
||||
return writeParagraph(cp, cpParaEnd, false);
|
||||
return writeParagraph(cp, (std::min)(cpEnd, cpParaEnd), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,8 +191,8 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos(cp);
|
||||
int fcEnd = m_document->FindFileCharPos(cpEnd);
|
||||
|
||||
if (fc < 0 || fcEnd < 0)
|
||||
return 0;
|
||||
if (fc < 0 || fcEnd < 0 || fc == fcEnd)
|
||||
return -1;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx(fc);
|
||||
|
||||
@ -496,7 +500,7 @@ namespace DocFileFormat
|
||||
{
|
||||
textType = std::wstring(L"delText");
|
||||
}
|
||||
else if (_writeInstrText)
|
||||
else if ((!_fieldLevels.empty()) && (_fieldLevels.back().bBegin && !_fieldLevels.back().bSeparate))
|
||||
{
|
||||
textType = std::wstring(L"instrText");
|
||||
}
|
||||
@ -534,8 +538,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::PageBreakOrSectionMark == code)
|
||||
{
|
||||
//write page break, section breaks are written by writeParagraph() method
|
||||
if (/*!isSectionEnd(c)*/_isSectionPageBreak == 0)
|
||||
if (_isSectionPageBreak == 0)
|
||||
{
|
||||
writeTextElement(text, textType);
|
||||
|
||||
@ -559,32 +562,44 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteString(elem.GetXMLString());
|
||||
}
|
||||
else if (TextMark::FieldBeginMark == code)
|
||||
{//todooo в отдельный mapping
|
||||
{
|
||||
_fieldLevels.push_back(fieldLevels());
|
||||
|
||||
int cpFieldStart = initialCp + i;
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
std::wstring f;
|
||||
std::wstring f, sFieldString;
|
||||
if (cpFieldEnd < (int)m_document->Text->size())
|
||||
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
sFieldString = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
|
||||
std::wstring EMBED ( L" EMBED" );
|
||||
std::wstring LINK ( L" LINK" );
|
||||
std::wstring FORM ( L" FORM" );
|
||||
std::wstring Excel ( L" Excel" );
|
||||
std::wstring Word ( L" Word" );
|
||||
std::wstring opendocument(L" opendocument" );
|
||||
std::wstring Equation ( L" Equation" );
|
||||
std::wstring MERGEFORMAT( L" MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L" QUOTE" );
|
||||
std::vector<std::wstring> arField;
|
||||
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
|
||||
|
||||
std::wstring EMBED ( L"EMBED" );
|
||||
std::wstring embed ( L"embed" );
|
||||
std::wstring LINK ( L"LINK" );
|
||||
std::wstring FORM ( L"FORM" );
|
||||
std::wstring Excel ( L"Excel" );
|
||||
std::wstring Word ( L"Word" );
|
||||
std::wstring opendocument(L"opendocument" );
|
||||
std::wstring Equation ( L"Equation" );
|
||||
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L"QUOTE" );
|
||||
std::wstring chart ( L"Chart" );
|
||||
std::wstring PBrush ( L" PBrush" );
|
||||
std::wstring TOC ( L" TOC" );
|
||||
std::wstring HYPERLINK ( L" HYPERLINK" );
|
||||
std::wstring PAGEREF ( L" PAGEREF" );
|
||||
std::wstring PBrush ( L"PBrush" );
|
||||
std::wstring TOC ( L"TOC" );
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
else
|
||||
f = sFieldString;
|
||||
|
||||
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
|
||||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
|
||||
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
|
||||
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
|
||||
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
|
||||
@ -592,11 +607,21 @@ namespace DocFileFormat
|
||||
bool bExcel = search( f.begin(), f.end(), Excel.begin(), Excel.end()) != f.end();
|
||||
bool bWord = search( f.begin(), f.end(), Word.begin(), Word.end()) != f.end();
|
||||
bool bHYPERLINK = search( f.begin(), f.end(), HYPERLINK.begin(), HYPERLINK.end()) != f.end();
|
||||
bool bPAGEREF = search( f.begin(), f.end(), PAGEREF.begin(), PAGEREF.end()) != f.end();
|
||||
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = !bPAGEREF && search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
bPAGEREF = search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end();
|
||||
}
|
||||
|
||||
if (bTOC)
|
||||
_bContentWrite = true;
|
||||
|
||||
if ( bFORM )
|
||||
{
|
||||
std::wstring FORMTEXT ( L" FORMTEXT" );
|
||||
@ -634,9 +659,7 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_writeInstrText = true;
|
||||
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( ( bMERGEFORMAT || bExcel || bWord || bOpendocument )
|
||||
&&
|
||||
@ -650,61 +673,72 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_writeInstrText = true;
|
||||
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( (bHYPERLINK && bPAGEREF) || bPAGE)
|
||||
else if (bHYPERLINK && bPAGEREF)
|
||||
{
|
||||
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
|
||||
std::vector<std::wstring> toc;
|
||||
|
||||
if ((search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end()) || bPAGE)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
if (arField.size() > 1)
|
||||
f = arField[1];
|
||||
|
||||
_writeInstrText = true;
|
||||
_fldCharCounter++;
|
||||
if ( _bContentWrite )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( cpFieldSep2 < cpFieldEnd)
|
||||
for (size_t i = 1; i < arField.size(); i++)
|
||||
{
|
||||
cpFieldSep2 = searchNextTextMark(m_document->Text, cpFieldSep1 + 1, TextMark::FieldSeparator);
|
||||
std::wstring f1( ( m_document->Text->begin() + cpFieldSep1 ), ( m_document->Text->begin() + cpFieldSep2 + 1 ) );
|
||||
toc.push_back(f1);
|
||||
|
||||
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
|
||||
{
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
std::wstring f1 = arField[1];
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
_writeWebHidden = true;
|
||||
std::wstring _writeTocLink =f1.substr(d + 9);
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun += _writeTocLink;
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
|
||||
//if (_writeInstrText == true)
|
||||
//{
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:fldChar" ), true );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:fldCharType" ), L"separate" );
|
||||
// m_pXmlWriter->WriteNodeEnd( L"" ), true );
|
||||
//}
|
||||
_writeInstrText = false;
|
||||
|
||||
break;
|
||||
//cp = cpFieldSep1;
|
||||
}
|
||||
cpFieldSep1 = cpFieldSep2;
|
||||
//cpFieldSep1 = cpFieldSep2;
|
||||
}
|
||||
_skipRuns = 5; //with separator
|
||||
}
|
||||
}
|
||||
else if ( bEMBED || bLINK || bQUOTE)
|
||||
//else if ( bHYPERLINK )
|
||||
//{//todooo - выделение гиперссылки отдельно
|
||||
// std::vector<std::wstring> arRefs;
|
||||
// boost::algorithm::split(arRefs, f, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
//
|
||||
// std::wstring sLink = arRefs[2];
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:hyperlink", true );
|
||||
|
||||
// int relID = m_context->_docx->RegisterHyperlink(_caller, sLink);
|
||||
// m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:history", 1 );
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
// if (arRefs.size() > 2)
|
||||
// {
|
||||
// writeTextElement(arRefs[3].substr(1, arRefs[3].length() - 2), textType);
|
||||
// }
|
||||
// m_pXmlWriter->WriteNodeEnd( L"w:hyperlink", false, true );
|
||||
|
||||
// _skipRuns = 1;
|
||||
//}
|
||||
else if ( bEMBED || (bLINK && !bHYPERLINK)|| bQUOTE)
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
@ -732,9 +766,9 @@ namespace DocFileFormat
|
||||
if (!m_shapeIdOwner.empty()) //4571833.doc
|
||||
oVmlMapper.m_shapeId = m_shapeIdOwner;
|
||||
|
||||
if (m_document->bOlderVersion)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
if (m_document->nWordVersion > 0)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
|
||||
@ -750,7 +784,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
|
||||
@ -768,7 +802,7 @@ namespace DocFileFormat
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
OleObject ole ( chpxSep, m_document);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
@ -808,15 +842,16 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_writeInstrText = true;
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
}
|
||||
else if (TextMark::FieldSeparator == code)
|
||||
{
|
||||
if (_fldCharCounter > 0)
|
||||
if (!_fieldLevels.empty())
|
||||
{
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
_fieldLevels.back().bSeparate = true;
|
||||
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"separate" );
|
||||
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString() );
|
||||
@ -825,33 +860,34 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::FieldEndMark == code)
|
||||
{
|
||||
if (_fldCharCounter > 0)
|
||||
{
|
||||
if (_writeInstrText == true && !text.empty())
|
||||
if (!_fieldLevels.empty())
|
||||
{
|
||||
if (!text.empty())
|
||||
{
|
||||
writeTextElement(text, textType);
|
||||
text.clear();
|
||||
}
|
||||
_writeInstrText = false;
|
||||
}
|
||||
if (_fieldLevels.back().bBegin)
|
||||
{
|
||||
_fieldLevels.back().bEnd = true;
|
||||
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"end" );
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"end" );
|
||||
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString());
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString());
|
||||
}
|
||||
|
||||
_fldCharCounter--;
|
||||
_fieldLevels.pop_back();
|
||||
}
|
||||
if (_writeWebHidden)
|
||||
{
|
||||
_writeAfterRun = std::wstring (L"</w:hyperlink>");
|
||||
}
|
||||
_writeWebHidden = false;
|
||||
|
||||
if ( _fldCharCounter == 0 )
|
||||
{
|
||||
_writeInstrText = false;
|
||||
}
|
||||
_writeWebHidden = false;
|
||||
_embeddedObject = false;
|
||||
|
||||
if (_fieldLevels.empty())
|
||||
_bContentWrite = false;
|
||||
}
|
||||
else if ((TextMark::Symbol == code) && fSpec)
|
||||
{
|
||||
@ -877,7 +913,7 @@ namespace DocFileFormat
|
||||
|
||||
if (pSpa)
|
||||
{
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
|
||||
|
||||
if (pShape)
|
||||
@ -899,9 +935,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((TextMark::Picture == code) && fSpec )
|
||||
else if (TextMark::Picture == code && fSpec)
|
||||
{
|
||||
PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor oPicture (chpx, m_document->nWordVersion > 0 ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
bool isInline = _isTextBoxContent;
|
||||
|
||||
@ -937,7 +973,7 @@ namespace DocFileFormat
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
@ -1138,20 +1174,7 @@ namespace DocFileFormat
|
||||
if ( fc >= nMinVal )
|
||||
{
|
||||
ret = m_document->AllPapx->find(nMinVal)->second;
|
||||
//? if (!ret && m_document->AllPapx->size() > 0)
|
||||
//? {
|
||||
//? map<int, ParagraphPropertyExceptions*>::iterator it = m_document->AllPapx->end();
|
||||
//? it--;
|
||||
//? do
|
||||
//? {
|
||||
//? if (it->first < nMinVal && it->second)
|
||||
//? break;
|
||||
//? it--;
|
||||
//? }
|
||||
//? while(it != m_document->AllPapx->begin());
|
||||
//?
|
||||
//? ret = it->second;
|
||||
//? }
|
||||
|
||||
_lastValidPapx = ret;
|
||||
}
|
||||
}
|
||||
@ -1198,22 +1221,23 @@ namespace DocFileFormat
|
||||
int fc2 = m_document->FindFileCharPos( cp );
|
||||
int fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//build the table grid
|
||||
std::vector<short> grid, grid_write;
|
||||
buildTableGrid( cp, nestingLevel, grid, grid_write );
|
||||
std::vector<short> grid;
|
||||
buildTableGrid( cp, nestingLevel, grid);
|
||||
|
||||
//find first row end
|
||||
int fcRowEnd = findRowEndFc( cp, nestingLevel );
|
||||
|
||||
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
|
||||
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
|
||||
|
||||
//start table
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
|
||||
|
||||
//Convert it
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid, &grid_write );
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid);
|
||||
|
||||
row1Tapx.Convert( tpMapping );
|
||||
|
||||
@ -1226,11 +1250,11 @@ namespace DocFileFormat
|
||||
//only convert the cells with the given nesting level
|
||||
while ( tai.iTap == nestingLevel )
|
||||
{
|
||||
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, nestingLevel );
|
||||
//?fc = m_document->FindFileCharPos(cp );
|
||||
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1239,11 +1263,11 @@ namespace DocFileFormat
|
||||
//convert until the end of table is reached
|
||||
while ( tai.fInTable )
|
||||
{
|
||||
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, nestingLevel );
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1254,94 +1278,97 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write)
|
||||
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid)
|
||||
{
|
||||
ParagraphPropertyExceptions* backup = _lastValidPapx;
|
||||
|
||||
std::vector<short> boundaries;
|
||||
std::vector<short> boundaries_all;
|
||||
std::map<short, short> boundaries;
|
||||
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
int fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
|
||||
ParagraphPropertyExceptions* papx_prev = NULL;
|
||||
|
||||
short max_boundary = -1;
|
||||
|
||||
bool fEndNestingLevel = false;
|
||||
|
||||
unsigned int iTap_current = 1;
|
||||
|
||||
while ( tai.fInTable )
|
||||
{
|
||||
//check all SPRMs of this TAPX
|
||||
iTap_current = 1;
|
||||
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
DWORD code = iter->OpCode;
|
||||
|
||||
switch(iter->OpCode)
|
||||
{
|
||||
case sprmTDefTable:
|
||||
case sprmOldTDefTable:
|
||||
{
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
while(boundaries.size() < itcMac + 1)
|
||||
boundaries.push_back(-0x7fff);
|
||||
|
||||
short boundary0 = -0x7fff;
|
||||
for (unsigned char i = 0; i < itcMac; i++)
|
||||
case sprmPFInnerTableCell:
|
||||
case sprmPFInnerTtp:
|
||||
{
|
||||
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
|
||||
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
|
||||
fEndNestingLevel = ( iter->Arguments[0] == 1 ) ? (true) : (false);
|
||||
}break;
|
||||
|
||||
if (boundary2 - boundary1 > 1 && boundary1 - boundary0 > 1)
|
||||
case sprmPItap:
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if (nestingLevel == iTap_current)
|
||||
{
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
DWORD code = iter->OpCode;
|
||||
|
||||
switch(iter->OpCode)
|
||||
{
|
||||
case sprmTDefTable:
|
||||
case sprmOldTDefTable:
|
||||
{
|
||||
if ( boundaries[i] == -0x7fff || boundaries[i+1] == -0x7fff)
|
||||
{
|
||||
boundaries[i] = boundary1;
|
||||
boundaries[i+1] = boundary2;
|
||||
}
|
||||
}
|
||||
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary1 ) == boundaries_all.end() )
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
short boundary1, boundary2;
|
||||
for (unsigned char i = 0; i < itcMac; i++)
|
||||
{
|
||||
boundaries_all.push_back( boundary1 );
|
||||
}
|
||||
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
|
||||
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
|
||||
|
||||
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary2 ) == boundaries_all.end() )
|
||||
{
|
||||
boundaries_all.push_back( boundary2 );
|
||||
}
|
||||
boundary0 = boundary1;
|
||||
AddBoundary(boundary1, boundary2, boundaries);
|
||||
}
|
||||
if (max_boundary < boundary2)
|
||||
max_boundary = boundary2;
|
||||
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nestingLevel > 1 && fEndNestingLevel && !boundaries.empty())
|
||||
break;
|
||||
//get the next papx
|
||||
papx = findValidPapx( fcRowEnd );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
|
||||
|
||||
if (papx_prev && papx_prev == papx )
|
||||
break;//file(12).doc
|
||||
papx_prev = papx;
|
||||
}
|
||||
|
||||
//build the grid based on the boundaries
|
||||
sort( boundaries_all.begin(), boundaries_all.end() );
|
||||
}
|
||||
|
||||
if ( !boundaries.empty() )
|
||||
{
|
||||
for ( size_t i = 0; i < ( boundaries.size() - 1 ); i++ )
|
||||
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
|
||||
{
|
||||
grid_write.push_back( boundaries[i + 1] - boundaries[i] );
|
||||
}
|
||||
}
|
||||
if ( !boundaries_all.empty() )
|
||||
{
|
||||
for ( size_t i = 0; i < ( boundaries_all.size() - 1 ); i++ )
|
||||
{
|
||||
grid.push_back( boundaries_all[i + 1] - boundaries_all[i] );
|
||||
grid.push_back( it->second );
|
||||
}
|
||||
}
|
||||
_lastValidPapx = backup;
|
||||
@ -1349,6 +1376,40 @@ namespace DocFileFormat
|
||||
return true;
|
||||
}
|
||||
|
||||
void DocumentMapping::AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries)
|
||||
{
|
||||
if (boundary2 - boundary1 < 3)
|
||||
return;
|
||||
|
||||
std::map<short, short>::iterator pFind = boundaries.find(boundary1);
|
||||
|
||||
while(true)
|
||||
{
|
||||
if (pFind == boundaries.end())
|
||||
{
|
||||
boundaries.insert(std::make_pair(boundary1, boundary2 - boundary1));
|
||||
break;
|
||||
}
|
||||
else if (pFind->second != boundary2 - boundary1)
|
||||
{
|
||||
if (pFind->second > boundary2 - boundary1)
|
||||
{
|
||||
short new_size = boundary2 - boundary1;
|
||||
boundary1 = boundary2;
|
||||
boundary2 = pFind->second + pFind->first;
|
||||
pFind->second = new_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
boundary1 = pFind->second + pFind->first;
|
||||
}
|
||||
pFind = boundaries.find(boundary1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Finds the FC of the next row end mark.
|
||||
int DocumentMapping::findRowEndFc(int initialCp, int& rowEndCp, unsigned int nestingLevel )
|
||||
{
|
||||
@ -1356,7 +1417,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( nestingLevel > 1 )
|
||||
{
|
||||
@ -1372,7 +1433,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
|
||||
cp++;
|
||||
}
|
||||
@ -1395,7 +1456,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
@ -1414,7 +1475,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( nestingLevel > 1 )
|
||||
{
|
||||
@ -1434,7 +1495,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
|
||||
cp++;
|
||||
}
|
||||
@ -1457,7 +1518,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
@ -1466,20 +1527,20 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
/// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel)
|
||||
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, unsigned int nestingLevel)
|
||||
{
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//start w:tr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tr" );
|
||||
|
||||
//convert the properties
|
||||
int fcRowEnd = findRowEndFc( cp, nestingLevel );
|
||||
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
|
||||
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
|
||||
TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) );
|
||||
@ -1496,14 +1557,14 @@ namespace DocFileFormat
|
||||
//Write until the first "inner trailer paragraph" is reached
|
||||
while ( !( ( m_document->Text->at( cp ) == TextMark::ParagraphEnd ) && ( tai.fInnerTtp ) ) && tai.fInTable )
|
||||
{
|
||||
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
|
||||
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
|
||||
cellIndex++;
|
||||
|
||||
//each cell has it's own PAPX
|
||||
fc = m_document->FindFileCharPos(cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1513,14 +1574,14 @@ namespace DocFileFormat
|
||||
while ( !( ( m_document->Text->at( cp ) == TextMark::CellOrRowMark ) && ( tai.fTtp ) )
|
||||
&& tai.fInTable )
|
||||
{
|
||||
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
|
||||
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
|
||||
cellIndex++;
|
||||
|
||||
//each cell has it's own PAPX
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1536,15 +1597,13 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark
|
||||
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel )
|
||||
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel )
|
||||
{
|
||||
int cp = initialCp;
|
||||
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
|
||||
|
||||
//start w:tc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
|
||||
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, grid_write, gridIndex, cellIndex );
|
||||
XMLTools::CStringXmlWriter writerTcPr;
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( &writerTcPr, grid, gridIndex, cellIndex, nestingLevel );
|
||||
|
||||
if ( tapx != NULL )
|
||||
{
|
||||
@ -1553,8 +1612,19 @@ namespace DocFileFormat
|
||||
|
||||
gridIndex = gridIndex + tcpMapping->GetGridSpan();
|
||||
|
||||
bool bCoverCell = tcpMapping->IsCoverCell();
|
||||
|
||||
RELEASEOBJECT( tcpMapping );
|
||||
|
||||
if (bCoverCell)
|
||||
{
|
||||
return cpCellEnd;
|
||||
}
|
||||
|
||||
//start w:tc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
|
||||
m_pXmlWriter->WriteString(writerTcPr.GetXmlString());
|
||||
|
||||
//write the paragraphs of the cell
|
||||
while ( cp < cpCellEnd )
|
||||
{
|
||||
@ -1562,7 +1632,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//cp = writeParagraph(cp);
|
||||
|
||||
@ -1582,7 +1652,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1601,7 +1671,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( initialCp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
while ( !tai.fInnerTableCell )
|
||||
{
|
||||
@ -1610,7 +1680,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cpCellEnd );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
|
||||
cpCellEnd++;
|
||||
@ -1731,13 +1801,8 @@ namespace DocFileFormat
|
||||
// Checks if the CHPX is special
|
||||
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
|
||||
{
|
||||
/*
|
||||
for (list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
|
||||
{
|
||||
short value = FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
int c = 0;
|
||||
}
|
||||
*/
|
||||
if (!chpx) return false;
|
||||
if (!chpx->grpprl) return false;
|
||||
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
|
||||
{
|
||||
@ -1807,6 +1872,11 @@ namespace DocFileFormat
|
||||
{
|
||||
SectionPropertyExceptions* ret = NULL;
|
||||
|
||||
if (!m_document->AllSepx)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ret = m_document->AllSepx->operator [](cp);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -87,7 +87,7 @@ namespace DocFileFormat
|
||||
bool isSectionEnd ( int cp );
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
int writeParagraph( int cp );
|
||||
int writeParagraph( int cp, int cpEnd );
|
||||
// Writes a Paragraph that starts at the given cpStart and
|
||||
// ends at the given cpEnd
|
||||
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
|
||||
@ -110,15 +110,15 @@ namespace DocFileFormat
|
||||
// Writes the table starts at the given cp value
|
||||
int writeTable ( int initialCp, unsigned int nestingLevel );
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write );
|
||||
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid);
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, unsigned int nestingLevel );
|
||||
// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int writeTableRow ( int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel );
|
||||
int writeTableRow ( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
|
||||
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
|
||||
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int findCellEndCp ( int initialCp, unsigned int nestingLevel );
|
||||
|
||||
bool writeBookmarks ( int cp );
|
||||
@ -135,6 +135,8 @@ namespace DocFileFormat
|
||||
// Searches the given vector for the next FieldEnd character.
|
||||
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
|
||||
Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
|
||||
|
||||
void AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries);
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
bool m_bInternalXmlWriter;
|
||||
|
||||
@ -154,11 +156,19 @@ namespace DocFileFormat
|
||||
int _commentNr;
|
||||
bool _isTextBoxContent;
|
||||
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues
|
||||
bool _writeInstrText;
|
||||
bool _writeWebHidden;
|
||||
unsigned int _fldCharCounter;
|
||||
std::wstring _writeAfterRun;
|
||||
std::wstring _lastOLEObject;
|
||||
int _cacheListNum;
|
||||
|
||||
struct fieldLevels
|
||||
{
|
||||
bool bBegin = false;
|
||||
bool bSeparate = false;
|
||||
//bool bInstrText = false;
|
||||
bool bEnd = false;
|
||||
};
|
||||
std::vector<fieldLevels> _fieldLevels;
|
||||
bool _bContentWrite;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -48,22 +48,89 @@ namespace DocFileFormat
|
||||
{
|
||||
Initialize();
|
||||
|
||||
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_bOlderVersion);
|
||||
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_nWordVersion);
|
||||
|
||||
//setDefaultCompatibilityOptions( fib->m_FibBase.nFib );
|
||||
|
||||
unsigned int size = fib->m_FibWord97.lcbDop;
|
||||
unsigned char* bytes = tStream.ReadBytes( size, true );
|
||||
unsigned int size = fib->m_FibWord97.lcbDop;
|
||||
unsigned char* bytes = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
if ( size > 0 )
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
unsigned char* Temp = tStream.ReadBytes(size, true);
|
||||
tStream.Seek(fib->m_FibWord97.fcDop, 0);
|
||||
delete []Temp;
|
||||
|
||||
unsigned char flags1 = tStream.ReadByte();
|
||||
|
||||
fFacingPages = GETBIT(flags1, 0);
|
||||
fWindowControl = GETBIT(flags1, 1);
|
||||
Fpc = GETBITS(flags1, 5, 6);
|
||||
bool fWide = GETBIT(flags1, 7);
|
||||
|
||||
grpfIhdt = tStream.ReadByte();
|
||||
|
||||
unsigned short flags2 = tStream.ReadUInt16();
|
||||
rncFtn = GETBIT(flags2, 0);
|
||||
nFtn = GETBITS(flags2, 1, 15);
|
||||
|
||||
unsigned char irmBar = tStream.ReadByte();
|
||||
|
||||
unsigned char flags3 = tStream.ReadByte();
|
||||
unsigned char irmProps = GETBITS(flags3, 0, 6);
|
||||
fRevMarking = GETBIT(flags3, 7);
|
||||
|
||||
unsigned short flags4 = tStream.ReadUInt16();
|
||||
fBackup = GETBIT(flags4, 0);
|
||||
fExactWords = GETBIT(flags4, 1);
|
||||
fPagHidden = GETBIT(flags4, 2);
|
||||
fPagResults = GETBIT(flags4, 3);
|
||||
fLockAtn = GETBIT(flags4, 4);
|
||||
fMirrorMargins = GETBIT(flags4, 5);
|
||||
bool fKeepFileFormat = GETBIT(flags4, 6);
|
||||
fDflttrueType = GETBIT(flags4, 7);
|
||||
|
||||
fPagSuppressTopSpacing = GETBIT(flags4, 8);
|
||||
fMaybeRTLTables = GETBIT(flags4, 9);
|
||||
|
||||
bool fSpares = tStream.ReadUInt16();
|
||||
dxaTab = tStream.ReadUInt16();
|
||||
|
||||
wSpare = tStream.ReadUInt16();//ftcDefaultBi
|
||||
dxaHotZ = tStream.ReadUInt16();
|
||||
|
||||
wSpare2 = tStream.ReadUInt16();
|
||||
wSpare3 = tStream.ReadUInt16();
|
||||
|
||||
dttmCreated = DateAndTime( tStream.ReadUInt32() );
|
||||
dttmRevised = DateAndTime( tStream.ReadUInt32() );
|
||||
dttmLastPrint = DateAndTime( tStream.ReadUInt32() );
|
||||
|
||||
nRevision = tStream.ReadUInt16();
|
||||
tmEdited = tStream.ReadUInt32();
|
||||
|
||||
cWords = tStream.ReadUInt32();
|
||||
cCh = tStream.ReadUInt32();
|
||||
cPg = tStream.ReadUInt16();
|
||||
|
||||
unsigned short rgwSpareDocSum[2];
|
||||
rgwSpareDocSum[0] = tStream.ReadUInt16();
|
||||
rgwSpareDocSum[1] = tStream.ReadUInt16();
|
||||
|
||||
}
|
||||
else if ( size > 0 )
|
||||
{
|
||||
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
|
||||
bytes = tStream.ReadBytes( size, true );
|
||||
|
||||
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
|
||||
fWindowControl = FormatUtils::GetBitFromBytes( bytes, 2, 1 );
|
||||
fPMHMainDoc = FormatUtils::GetBitFromBytes( bytes, 2, 2 );
|
||||
grfSuppression = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 3, 2 );
|
||||
Fpc = (short)(short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
|
||||
Fpc = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
|
||||
|
||||
grpfIhdt = FormatUtils::BytesToUChar( bytes, 1, size );
|
||||
|
||||
rncFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 0, 2 );
|
||||
nFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 2, 14 );
|
||||
@ -545,6 +612,7 @@ namespace DocFileFormat
|
||||
fSwapBordersFacingPgs = false;
|
||||
dxaTab = 0;
|
||||
wSpare = 0;
|
||||
wSpare3 = 0;
|
||||
dxaHotZ = 0;
|
||||
cConsecHypLim = 0;
|
||||
wSpare2 = 0;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -177,7 +177,8 @@ namespace DocFileFormat
|
||||
unsigned short cConsecHypLim;
|
||||
// Reserved
|
||||
unsigned short wSpare2;
|
||||
// Date and time document was created
|
||||
unsigned short wSpare3;
|
||||
// Date and time document was created
|
||||
DateAndTime dttmCreated;
|
||||
// Date and time document was last revised
|
||||
DateAndTime dttmRevised;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -37,9 +37,9 @@ namespace DocFileFormat
|
||||
{
|
||||
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream ) : bStandard(false), bXOR(false), bAES(false)
|
||||
{
|
||||
VirtualStreamReader tStream( tableStream, 0, fib->m_bOlderVersion);
|
||||
VirtualStreamReader tStream( tableStream, 0, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibBase.fObfuscation || fib->m_bOlderVersion)
|
||||
if (fib->m_FibBase.fObfuscation || fib->m_nWordVersion > 0)
|
||||
{
|
||||
bXOR = true;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -79,7 +79,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -69,14 +69,22 @@ namespace DocFileFormat
|
||||
newObject->prq = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x03 );
|
||||
newObject->fTrueType = FormatUtils::BitmaskToBool ( ffid, 0x04 );
|
||||
newObject->ff = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x70 );
|
||||
newObject->wWeight = reader->ReadInt16();
|
||||
newObject->chs = reader->ReadByte();
|
||||
|
||||
//int sz_fonts = 150; //.. нужно генерить уникальное todooo
|
||||
int szAlt = 0;
|
||||
if (reader->nWordVersion == 2)
|
||||
{
|
||||
newObject->wWeight = reader->ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
newObject->wWeight = reader->ReadInt16();
|
||||
newObject->chs = reader->ReadByte();
|
||||
|
||||
int szAlt = reader->ReadByte();
|
||||
szAlt = reader->ReadByte();
|
||||
}
|
||||
|
||||
if (!reader->olderVersion)
|
||||
if (reader->nWordVersion == 0)
|
||||
{
|
||||
//read the 10 bytes panose
|
||||
newObject->panoseSize = 10;
|
||||
@ -97,7 +105,7 @@ namespace DocFileFormat
|
||||
|
||||
unsigned char *bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszFtn), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250 );
|
||||
}
|
||||
@ -131,7 +139,7 @@ namespace DocFileFormat
|
||||
|
||||
bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszAlt), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
@ -151,7 +159,7 @@ namespace DocFileFormat
|
||||
{
|
||||
long strStart = reader->GetPosition();
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{//ansi string only
|
||||
while ( reader->ReadByte() != 0 )
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -71,7 +71,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -89,7 +89,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -81,7 +81,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -93,7 +93,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
|
||||
cp++;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -98,7 +98,7 @@ void FormFieldData::_FFData::read(VirtualStreamReader *reader)
|
||||
xstzEntryMcr = readXstz(reader);
|
||||
xstzExitMcr = readXstz(reader);
|
||||
}
|
||||
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion_ )
|
||||
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion )
|
||||
{
|
||||
binary_data_size = 0;
|
||||
|
||||
@ -139,7 +139,7 @@ FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx,
|
||||
|
||||
if (fc >= 0 && bNilPICFAndBinData)
|
||||
{
|
||||
VirtualStreamReader reader(stream, fc, bOlderVersion_);
|
||||
VirtualStreamReader reader(stream, fc, nWordVersion);
|
||||
|
||||
int sz_stream = reader.GetSize();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -108,7 +108,7 @@ namespace DocFileFormat
|
||||
//STTB hsttbDropList;
|
||||
void read(VirtualStreamReader* reader);
|
||||
};
|
||||
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion );
|
||||
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion );
|
||||
virtual ~FormFieldData() {}
|
||||
private:
|
||||
friend class FormFieldDataMapping;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -52,8 +52,8 @@ namespace DocFileFormat
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion ):
|
||||
FormattedDiskPage(), rgb(NULL), grpchpxSize(NULL), grpchpx(NULL)
|
||||
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion ):
|
||||
FormattedDiskPage(), rgb(NULL), grpchpxSize(0), grpchpx(NULL)
|
||||
{
|
||||
Type = Character;
|
||||
WordStream = wordStream;
|
||||
@ -80,7 +80,6 @@ namespace DocFileFormat
|
||||
j += 4;
|
||||
}
|
||||
|
||||
//create arrays
|
||||
grpchpxSize = crun;
|
||||
rgb = new unsigned char[crun];
|
||||
grpchpx = new CharacterPropertyExceptions*[grpchpxSize];
|
||||
@ -104,11 +103,10 @@ namespace DocFileFormat
|
||||
|
||||
//read the bytes of chpx
|
||||
chpx = new unsigned char[cb];
|
||||
//Array.Copy(bytes, (wordOffset * 2) + 1, chpx, 0, chpx.Length);
|
||||
memcpy( chpx, ( bytes + (wordOffset * 2) + 1 ), cb );
|
||||
|
||||
//parse CHPX and fill grpchpx
|
||||
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, oldVersion);
|
||||
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, nWordVersion);
|
||||
|
||||
RELEASEARRAYOBJECTS( chpx );
|
||||
}
|
||||
@ -139,7 +137,7 @@ namespace DocFileFormat
|
||||
}
|
||||
//there are n offsets and n-1 fkp's in the bin table
|
||||
|
||||
if (fib->m_bOlderVersion)
|
||||
if (fib->m_nWordVersion > 0)
|
||||
{
|
||||
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBteChpx - 8 ) / 6 ) + 1;
|
||||
|
||||
@ -162,7 +160,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -178,7 +176,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -50,7 +50,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
virtual ~FormattedDiskPageCHPX();
|
||||
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion );
|
||||
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion );
|
||||
/// Parses the 0Table (or 1Table) for FKP _entries containing CHPX
|
||||
static std::list<FormattedDiskPageCHPX*>* GetAllCHPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream );
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -52,59 +52,53 @@ namespace DocFileFormat
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex):
|
||||
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex):
|
||||
FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL)
|
||||
{
|
||||
Type = Paragraph;
|
||||
WordStream = wordStream;
|
||||
{
|
||||
Type = Paragraph;
|
||||
WordStream = wordStream;
|
||||
|
||||
//read the 512 bytes (FKP)
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[512];
|
||||
|
||||
WordStream->seek( offset);
|
||||
WordStream->read( bytes, 512);
|
||||
//read the 512 bytes (FKP)
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[512];
|
||||
|
||||
//get the count
|
||||
crun = bytes[511];
|
||||
WordStream->seek( offset);
|
||||
WordStream->read( bytes, 512);
|
||||
|
||||
//create and fill the array with the adresses
|
||||
rgfcSize = crun + 1;
|
||||
rgfc = new int[rgfcSize];
|
||||
//get the count
|
||||
crun = bytes[511];
|
||||
|
||||
int j = 0;
|
||||
//create and fill the array with the adresses
|
||||
rgfcSize = crun + 1;
|
||||
rgfc = new int[rgfcSize];
|
||||
|
||||
int j = 0;
|
||||
|
||||
for ( unsigned int i = 0; i < rgfcSize; i++ )
|
||||
{
|
||||
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
|
||||
j += 4;
|
||||
}
|
||||
for ( unsigned int i = 0; i < rgfcSize; i++ )
|
||||
{
|
||||
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
|
||||
j += 4;
|
||||
}
|
||||
rgbx = new BX[crun];
|
||||
grppapxSize = crun;
|
||||
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
|
||||
|
||||
//create arrays
|
||||
rgbx = new BX[crun];
|
||||
grppapxSize = crun;
|
||||
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
|
||||
for ( unsigned int i = 0; i < grppapxSize; i++ )
|
||||
{
|
||||
grppapx[i] = NULL;
|
||||
}
|
||||
|
||||
for ( unsigned int i = 0; i < grppapxSize; i++ )
|
||||
{
|
||||
grppapx[i] = NULL;
|
||||
}
|
||||
j = 4 * ( crun + 1 );
|
||||
|
||||
j = 4 * ( crun + 1 );
|
||||
|
||||
//read the 12 for PHE
|
||||
unsigned char* phe = NULL;
|
||||
phe = new unsigned char[12];
|
||||
|
||||
unsigned char* papx = NULL;
|
||||
unsigned char phe[12];
|
||||
|
||||
for ( int i = 0; i < crun; i++ )
|
||||
for ( unsigned char i = 0; i < crun; i++ )
|
||||
{
|
||||
BX bx;
|
||||
bx.wordOffset = bytes[j];
|
||||
j++;
|
||||
|
||||
if (fComplex || !oldVersion)
|
||||
if (fComplex || nWordVersion == 0)
|
||||
{
|
||||
memcpy( phe, ( bytes + j), 12 );
|
||||
|
||||
@ -113,6 +107,13 @@ namespace DocFileFormat
|
||||
|
||||
j += 12;
|
||||
}
|
||||
else if (nWordVersion == 2)
|
||||
{
|
||||
memcpy( phe, ( bytes + bx.wordOffset * 2 + j + 1), 6);
|
||||
|
||||
//fill the rgbx array
|
||||
bx.phe = ParagraphHeight( phe, 6, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( phe, ( bytes + j), 6);
|
||||
@ -126,29 +127,27 @@ namespace DocFileFormat
|
||||
|
||||
if ( bx.wordOffset != 0 )
|
||||
{
|
||||
//read first unsigned char of PAPX
|
||||
//PAPX is stored in a FKP; so the first unsigned char is a count of words
|
||||
unsigned char padbyte = 0;
|
||||
unsigned char cw = bytes[bx.wordOffset * 2];
|
||||
|
||||
//if that unsigned char is zero, it's a pad unsigned char, and the word count is the following unsigned char
|
||||
if ( cw == 0 )
|
||||
{
|
||||
padbyte = 1;
|
||||
cw = bytes[bx.wordOffset * 2 + 1];
|
||||
}
|
||||
|
||||
if ( cw != 0 )
|
||||
{
|
||||
int sz = cw * 2;
|
||||
//read the bytes for papx
|
||||
papx = new unsigned char[cw * 2];
|
||||
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), ( cw * 2 ) );
|
||||
unsigned char* papx = new unsigned char[sz];
|
||||
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), sz );
|
||||
|
||||
//parse PAPX and fill grppapx
|
||||
grppapx[i] = new ParagraphPropertyExceptions( papx, ( cw * 2 ), dataStream, oldVersion );
|
||||
grppapx[i] = new ParagraphPropertyExceptions( papx, sz, dataStream, nWordVersion );
|
||||
|
||||
RELEASEARRAYOBJECTS( papx );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -157,7 +156,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS( phe );
|
||||
RELEASEARRAYOBJECTS( bytes );
|
||||
}
|
||||
|
||||
@ -179,7 +177,7 @@ namespace DocFileFormat
|
||||
|
||||
//there are n offsets and n-1 fkp's in the bin table
|
||||
|
||||
if (fib->m_bOlderVersion && fib->m_FibBase.fComplex == false)
|
||||
if (fib->m_nWordVersion > 0 && fib->m_FibBase.fComplex == false)
|
||||
{
|
||||
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBtePapx - 8 ) / 6 ) + 1;
|
||||
|
||||
@ -202,7 +200,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
|
||||
}
|
||||
|
||||
//if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last)
|
||||
@ -226,7 +224,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -63,7 +63,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
virtual ~FormattedDiskPagePAPX();
|
||||
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex);
|
||||
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex);
|
||||
/// Parses the 0Table (or 1Table) for FKP _entries containing PAPX
|
||||
static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream);
|
||||
/// Returns a list of all PAPX FCs between they given boundaries.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -38,10 +38,30 @@ namespace Global
|
||||
static const wchar_t ColorIdentifier[17][12] =
|
||||
{
|
||||
L"auto",
|
||||
L"000000",//L"black",
|
||||
L"0000FF",//L"blue",
|
||||
L"00FFFF",//L"cyan",
|
||||
L"00FF00",// L"green",
|
||||
L"FF00FF",//L"magenta",
|
||||
L"FF0000",//L"red",
|
||||
L"FFFF00",//L"yellow",
|
||||
L"FFFFFF",//L"white",
|
||||
L"darkBlue",
|
||||
L"darkCyan",
|
||||
L"darkGreen",
|
||||
L"darkMagenta",
|
||||
L"darkRed",
|
||||
L"darkYellow",
|
||||
L"darkGray",
|
||||
L"lightGray"
|
||||
};
|
||||
static const wchar_t ColorNameIdentifier[17][12] =
|
||||
{
|
||||
L"auto",
|
||||
L"black",
|
||||
L"blue",
|
||||
L"cyan",
|
||||
L"green",
|
||||
L"green",
|
||||
L"magenta",
|
||||
L"red",
|
||||
L"yellow",
|
||||
@ -55,7 +75,6 @@ namespace Global
|
||||
L"darkGray",
|
||||
L"lightGray"
|
||||
};
|
||||
|
||||
static const wchar_t UnderlineCode[56][16] =
|
||||
{
|
||||
L"none",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -38,110 +38,83 @@ namespace DocFileFormat
|
||||
{
|
||||
HeaderAndFooterTable::HeaderAndFooterTable (FileInformationBlock* fib, POLE::Stream* pTableStream)
|
||||
{
|
||||
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_bOlderVersion);
|
||||
m_nCurrentIndex = 0;
|
||||
|
||||
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlcfHdd > tableReader.GetSize()) return;
|
||||
|
||||
unsigned int tableSize = fib->m_FibWord97.lcbPlcfHdd / 4;//in bytes
|
||||
|
||||
if ( ( tableSize > 0 ) && ( fib->m_RgLw97.ccpHdr > 0 ) )
|
||||
if ( tableSize < 1 || fib->m_RgLw97.ccpHdr <1 )
|
||||
return;
|
||||
|
||||
int* table = new int[tableSize];
|
||||
|
||||
for (unsigned int i = 0; i < tableSize; ++i)
|
||||
{
|
||||
int* table = new int[tableSize];
|
||||
|
||||
for (unsigned int i = 0; i < tableSize; ++i)
|
||||
{
|
||||
table[i] = tableReader.ReadInt32();
|
||||
}
|
||||
|
||||
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
|
||||
|
||||
|
||||
//the first 6 _entries are about footnote and endnote formatting
|
||||
//so skip these _entries
|
||||
int pos = (fib->m_FibBase.fComplex || !fib->m_bOlderVersion) ? 6 : 0;
|
||||
|
||||
int count = ( tableSize - pos - 2) / 6;
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
//Even Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arEvenHeaders.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arEvenHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Odd Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arOddHeaders.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arOddHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Even Footer
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arEvenFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arEvenFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Odd Footer
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arOddFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arOddFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//First Page Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arFirstHeaders.push_back (NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arFirstHeaders.push_back (new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ));
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
if (pos >= tableSize)
|
||||
break;
|
||||
|
||||
//First Page Footers
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arFirstFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arFirstFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(table);
|
||||
table[i] = tableReader.ReadInt32();
|
||||
}
|
||||
|
||||
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
|
||||
|
||||
int count = 0;
|
||||
int pos = (fib->m_FibBase.fComplex || fib->m_nWordVersion == 0) ? 6 : 0;
|
||||
//the first 6 _entries are about footnote and endnote formatting -Word97 so skip these
|
||||
|
||||
std::vector<std::vector<CharacterRange*>*> arHeadersFooters;
|
||||
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
count = ( tableSize - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
count = ( tableSize - pos - 1) / 6;
|
||||
|
||||
arHeadersFooters.push_back(&m_arEvenHeaders);
|
||||
arHeadersFooters.push_back(&m_arOddHeaders);
|
||||
arHeadersFooters.push_back(&m_arEvenFooters);
|
||||
arHeadersFooters.push_back(&m_arOddFooters);
|
||||
arHeadersFooters.push_back(&m_arFirstHeaders);
|
||||
arHeadersFooters.push_back(&m_arFirstFooters);
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
//Even Header
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arCommonHeadersFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arCommonHeadersFooters.push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t j = 0; j < 6; j++)
|
||||
{
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
arHeadersFooters[j]->push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
arHeadersFooters[j]->push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
|
||||
}
|
||||
pos++;
|
||||
|
||||
if (pos >= tableSize) break;
|
||||
}
|
||||
}
|
||||
if (pos >= tableSize) break;
|
||||
}
|
||||
RELEASEARRAYOBJECTS(table);
|
||||
}
|
||||
|
||||
HeaderAndFooterTable::~HeaderAndFooterTable()
|
||||
@ -152,5 +125,7 @@ namespace DocFileFormat
|
||||
for_each (m_arFirstHeaders.begin(), m_arFirstHeaders.end(), DeleteDynamicObject());
|
||||
for_each (m_arOddFooters.begin(), m_arOddFooters.end(), DeleteDynamicObject());
|
||||
for_each (m_arOddHeaders.begin(), m_arOddHeaders.end(), DeleteDynamicObject());
|
||||
|
||||
for_each (m_arCommonHeadersFooters.begin(), m_arCommonHeadersFooters.end(), DeleteDynamicObject());
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -34,10 +34,12 @@
|
||||
#include "CharacterRange.h"
|
||||
#include "FileInformationBlock.h"
|
||||
|
||||
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex) {\
|
||||
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex)\
|
||||
{\
|
||||
if (m_ar##NAME.empty()) return NULL; \
|
||||
if (nIndex < (int)m_ar##NAME.size()) return m_ar##NAME[nIndex];\
|
||||
return NULL; } \
|
||||
return NULL; \
|
||||
}\
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -54,8 +56,17 @@ namespace DocFileFormat
|
||||
GET_CHARS_RANGE (EvenFooters);
|
||||
GET_CHARS_RANGE (OddFooters);
|
||||
|
||||
inline CharacterRange* GetNextHeaderFooter()
|
||||
{
|
||||
if (m_nCurrentIndex < m_arCommonHeadersFooters.size())
|
||||
return m_arCommonHeadersFooters[m_nCurrentIndex++];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
private:
|
||||
|
||||
size_t m_nCurrentIndex;
|
||||
std::vector<CharacterRange*> m_arCommonHeadersFooters;
|
||||
|
||||
std::vector<CharacterRange*> m_arFirstHeaders;
|
||||
std::vector<CharacterRange*> m_arEvenHeaders;
|
||||
std::vector<CharacterRange*> m_arOddHeaders;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -71,7 +71,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -152,37 +152,53 @@ namespace DocFileFormat
|
||||
}
|
||||
OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
|
||||
{
|
||||
int pos = 0;
|
||||
if (length < 212)
|
||||
{
|
||||
//int sz = FormatUtils::BytesToUChar(data, 0, length);
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, length - pos);
|
||||
pos += 16;
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, 1);
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
|
||||
short strLen = length - pos;
|
||||
|
||||
while (strLen > 0)
|
||||
{
|
||||
if (data[strLen + 20 - 1] != 0)
|
||||
break;
|
||||
strLen--;
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, length - pos);
|
||||
pos += 16;
|
||||
}
|
||||
|
||||
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
|
||||
short strLen = length - pos;
|
||||
|
||||
while (strLen > 0)
|
||||
{
|
||||
if (data[strLen + 20 - 1] != 0)
|
||||
break;
|
||||
strLen--;
|
||||
}
|
||||
if (strLen > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
}
|
||||
if (strLen > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
}
|
||||
|
||||
ByteStructure* OutlineListDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
unsigned char *data = reader->ReadBytes(212, true);
|
||||
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, 212);
|
||||
int sz = GetSize(reader->nWordVersion);
|
||||
|
||||
unsigned char *data = reader->ReadBytes(sz, true);
|
||||
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, sz);
|
||||
|
||||
delete []data;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -143,8 +143,13 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring xst; //64 chars ansi
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 212;
|
||||
static const int STRUCTURE_SIZE_OLD = 10;
|
||||
public:
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return (nWordVersion == 2) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
virtual ~OutlineListDescriptor();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -49,7 +49,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( fib->m_FibWord97.lcbPlfLfo > 0 )
|
||||
{
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlfLfo > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -77,7 +77,7 @@ namespace DocFileFormat
|
||||
//this papx has no istd, so use PX to parse it
|
||||
unsigned char *bytes = reader->ReadBytes( cbGrpprlPapx, true );
|
||||
|
||||
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->olderVersion);
|
||||
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->nWordVersion);
|
||||
grpprlPapx = new ParagraphPropertyExceptions( *(px->grpprl) );
|
||||
|
||||
RELEASEOBJECT( px );
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
|
||||
//read the group of chpx sprms
|
||||
bytes = reader->ReadBytes( cbGrpprlChpx, true );
|
||||
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->olderVersion );
|
||||
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->nWordVersion );
|
||||
RELEASEARRAYOBJECTS( bytes );
|
||||
|
||||
//read the number text
|
||||
@ -116,6 +116,10 @@ namespace DocFileFormat
|
||||
|
||||
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
|
||||
{
|
||||
if (length < 16)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bEnabled = true;
|
||||
|
||||
nfc = FormatUtils::BytesToUChar(data, 0, length);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -45,7 +45,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( fib->m_FibWord97.lcbPlfLst > 0 )
|
||||
{
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlfLst > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -110,7 +110,7 @@ namespace DocFileFormat
|
||||
int countText = m_document->FIB->m_RgLw97.ccpText;
|
||||
int countTextRel = m_document->FIB->m_RgLw97.ccpText - 1;
|
||||
|
||||
while (cp < countText)
|
||||
while (cp < countText && cp >= 0)
|
||||
{
|
||||
fc = m_document->FindFileCharPos(cp);
|
||||
|
||||
@ -120,7 +120,7 @@ namespace DocFileFormat
|
||||
|
||||
if (papx)
|
||||
{
|
||||
TableInfo tai(papx);
|
||||
TableInfo tai(papx, m_document->nWordVersion);
|
||||
if (tai.fInTable)
|
||||
{
|
||||
int cpStart = cp;
|
||||
@ -135,7 +135,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph(cp);
|
||||
cp = writeParagraph(cp, countTextRel);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -124,7 +124,7 @@ public:
|
||||
|
||||
if (m_Data)
|
||||
{
|
||||
rdByte = m_Data[m_Position];
|
||||
rdByte = (m_Position < m_Size) ? m_Data[m_Position] : 0;
|
||||
m_Position += sizeof(rdByte);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -338,9 +338,9 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
|
||||
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, bool bOlderVersion)
|
||||
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, int nWordVersion)
|
||||
{
|
||||
if (bOlderVersion && nfc > 5)
|
||||
if (nWordVersion > 0 && nfc > 5)
|
||||
{
|
||||
if (nfc == 0xff) return std::wstring( L"bullet");
|
||||
else return std::wstring( L"none");
|
||||
@ -633,7 +633,7 @@ namespace DocFileFormat
|
||||
|
||||
if ((chpxs != NULL) && (!chpxs->empty()))
|
||||
{
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->FIB->m_bOlderVersion);
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->nWordVersion);
|
||||
|
||||
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
|
||||
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
|
||||
/// Converts the number format code of the binary format.
|
||||
static std::wstring GetNumberFormatWideString(int nfc, bool bOlderVersion = false);
|
||||
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
|
||||
|
||||
virtual ~NumberingMapping();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -60,7 +60,7 @@ namespace DocFileFormat
|
||||
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
|
||||
{
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_bOlderVersion);
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
|
||||
|
||||
if (pFIB->m_FibWord97.fcDggInfo > oStearmReader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user